Titlescreen: Add language selection menu

This commit is contained in:
LoveEevee 2019-01-21 18:47:22 +03:00
parent 016bfaf2c1
commit 59baa9f06f
12 changed files with 463 additions and 91 deletions

View File

@ -17,7 +17,6 @@ body{
background-color: #000; background-color: #000;
background-position: top center; background-position: top center;
background-size: 30vh; background-size: 30vh;
font-family: TnT, Meiryo, sans-serif;
} }
#screen.pattern-bg{ #screen.pattern-bg{
background-color: #fe7839; background-color: #fe7839;

View File

@ -41,5 +41,25 @@
.click-to-continue::before{ .click-to-continue::before{
-webkit-text-stroke: 0.25em #f00; -webkit-text-stroke: 0.25em #f00;
filter: blur(0.3vmin); filter: blur(0.3vmin);
left: auto; }
#lang{
font-size: 3vmin;
position: absolute;
bottom: 0;
left: 0;
background-repeat: no-repeat;
background-size: auto 70%;
background-position: center;
width: 4em;
height: 4em;
}
#lang:focus-within{
outline: #4d90fe auto 5px;
}
#lang-dropdown{
font-size: 1.7em;
font-family: Microsoft YaHei, sans-serif;
opacity: 0;
width: 100%;
height: 100%;
} }

View File

@ -82,7 +82,8 @@ var assets = {
"mimizu.png", "mimizu.png",
"results_flowers.png", "results_flowers.png",
"results_mikoshi.png", "results_mikoshi.png",
"results_tetsuohana.png" "results_tetsuohana.png",
"globe.svg"
], ],
"audioSfx": [ "audioSfx": [
"don.wav", "don.wav",

View File

@ -285,6 +285,7 @@
inputText = inputText.slice(0, matches.index) inputText = inputText.slice(0, matches.index)
ura = matches[0] ura = matches[0]
} }
var bold = this.bold(config.fontFamily)
var string = inputText.split("") var string = inputText.split("")
var drawn = [] var drawn = []
@ -296,30 +297,54 @@
drawn.push({text: symbol, x: 0, y: 0, h: 18}) drawn.push({text: symbol, x: 0, y: 0, h: 18})
}else if(symbol === "ー"){ }else if(symbol === "ー"){
// Long-vowel mark // Long-vowel mark
if(bold){
drawn.push({text: symbol, x: -1, y: -1, h: 33, rotate: true})
}else{
drawn.push({realText: symbol, svg: this.longVowelMark, x: -4, y: 5, h: 33, scale: [mul, mul]}) drawn.push({realText: symbol, svg: this.longVowelMark, x: -4, y: 5, h: 33, scale: [mul, mul]})
}
}else if(symbol === "∀"){ }else if(symbol === "∀"){
drawn.push({text: symbol, x: 0, y: 0, h: 39, rotate: true}) drawn.push({text: symbol, x: 0, y: 0, h: 39, rotate: true})
}else if(symbol === "↓"){ }else if(symbol === "↓"){
drawn.push({text: symbol, x: 0, y: 12, h: 45}) drawn.push({text: symbol, x: 0, y: 12, h: 45})
}else if(symbol === ""){ }else if(symbol === ""){
if(bold){
drawn.push({realText: symbol, text: ".", x: 13, y: -15, h: 15})
}else{
drawn.push({realText: symbol, text: ".", x: 13, y: -7, h: 15, scale: [1.2, 0.7]}) drawn.push({realText: symbol, text: ".", x: 13, y: -7, h: 15, scale: [1.2, 0.7]})
}
}else if(symbol === "…"){ }else if(symbol === "…"){
drawn.push({text: symbol, x: 0, y: 5, h: 25, rotate: true}) drawn.push({text: symbol, x: bold ? 9 : 0, y: 5, h: 25, rotate: true})
}else if(r.comma.test(symbol)){ }else if(r.comma.test(symbol)){
// Comma, full stop // Comma, full stop
if(bold){
drawn.push({text: symbol, x: 13, y: -15, h: 15})
}else{
drawn.push({text: symbol, x: 13, y: -7, h: 15, scale: [1.2, 0.7]}) drawn.push({text: symbol, x: 13, y: -7, h: 15, scale: [1.2, 0.7]})
}
}else if(r.ideographicComma.test(symbol)){ }else if(r.ideographicComma.test(symbol)){
// Ideographic comma, full stop // Ideographic comma, full stop
drawn.push({text: symbol, x: 16, y: -16, h: 18}) drawn.push({text: symbol, x: 16, y: -16, h: 18})
}else if(r.apostrophe.test(symbol)){ }else if(r.apostrophe.test(symbol)){
// Apostrophe // Apostrophe
if(bold){
drawn.push({text: symbol, x: 20, y: -25, h: 0})
}else{
drawn.push({realText: symbol, text: ",", x: 20, y: -39, h: 0, scale: [1.2, 0.7]}) drawn.push({realText: symbol, text: ",", x: 20, y: -39, h: 0, scale: [1.2, 0.7]})
}
}else if(r.degree.test(symbol)){ }else if(r.degree.test(symbol)){
// Degree // Degree
if(bold){
drawn.push({text: symbol, x: 16, y: 9, h: 25})
}else{
drawn.push({text: symbol, x: 16, y: 3, h: 18}) drawn.push({text: symbol, x: 16, y: 3, h: 18})
}
}else if(r.brackets.test(symbol)){ }else if(r.brackets.test(symbol)){
// Rotated brackets // Rotated brackets
if(bold){
drawn.push({text: symbol, x: 0, y: 0, h: 35, rotate: true})
}else{
drawn.push({text: symbol, x: 0, y: -5, h: 25, rotate: true}) drawn.push({text: symbol, x: 0, y: -5, h: 25, rotate: true})
}
}else if(r.tilde.test(symbol)){ }else if(r.tilde.test(symbol)){
// Rotated hyphen, tilde // Rotated hyphen, tilde
drawn.push({realText: symbol, text: symbol === "~" ? "" : symbol, x: 0, y: 2, h: 35, rotate: true}) drawn.push({realText: symbol, text: symbol === "~" ? "" : symbol, x: 0, y: 2, h: 35, rotate: true})
@ -448,7 +473,7 @@
actions.push("selectable") actions.push("selectable")
} }
for(let action of actions){ for(let action of actions){
ctx.font = config.fontSize + "px " + config.fontFamily ctx.font = bold + config.fontSize + "px " + config.fontFamily
ctx.textBaseline = "top" ctx.textBaseline = "top"
if(action === "stroke"){ if(action === "stroke"){
ctx.strokeStyle = config.outline ctx.strokeStyle = config.outline
@ -571,6 +596,7 @@
inputText = inputText.slice(0, matches.index) inputText = inputText.slice(0, matches.index)
ura = matches[0] ura = matches[0]
} }
var bold = this.bold(config.fontFamily)
var string = inputText.split("") var string = inputText.split("")
var drawn = [] var drawn = []
@ -587,12 +613,20 @@
}else if(symbol === "'"){ }else if(symbol === "'"){
drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]}) drawn.push({text: ",", x: 0, y: -15, w: 7, scale: [1, 0.7]})
}else if(symbol === "∀"){ }else if(symbol === "∀"){
if(bold){
drawn.push({text: symbol, x: 0, y: 0, w: 40})
}else{
drawn.push({text: symbol, x: -3, y: 0, w: 55}) drawn.push({text: symbol, x: -3, y: 0, w: 55})
}
}else if(symbol === ""){ }else if(symbol === ""){
drawn.push({text: symbol, x: -9, y: 0, w: 37}) drawn.push({text: symbol, x: -9, y: 0, w: 37})
}else if(r.comma.test(symbol)){ }else if(r.comma.test(symbol)){
// Comma, full stop // Comma, full stop
if(bold){
drawn.push({text: symbol, x: -3, y: 0, w: 13})
}else{
drawn.push({text: symbol, x: -3, y: 13, w: 13, scale: [1.2, 0.7]}) drawn.push({text: symbol, x: -3, y: 13, w: 13, scale: [1.2, 0.7]})
}
}else if(r.en.test(symbol)){ }else if(r.en.test(symbol)){
// n-width // n-width
drawn.push({text: symbol, x: 0, y: 0, w: 28}) drawn.push({text: symbol, x: 0, y: 0, w: 28})
@ -614,7 +648,11 @@
drawn.push({text: number, x: 0, y: 0, w: 32}) drawn.push({text: number, x: 0, y: 0, w: 32})
}else if(r.degree.test(symbol)){ }else if(r.degree.test(symbol)){
// Degree // Degree
if(bold){
drawn.push({text: symbol, x: 0, y: 0, w: 20})
}else{
drawn.push({text: symbol, x: 5, y: 0, w: 0}) drawn.push({text: symbol, x: 5, y: 0, w: 0})
}
}else if(r.uppercase.test(symbol)){ }else if(r.uppercase.test(symbol)){
// Latin script uppercase // Latin script uppercase
drawn.push({text: symbol, x: 0, y: 0, w: 32}) drawn.push({text: symbol, x: 0, y: 0, w: 32})
@ -668,7 +706,7 @@
drawn.reverse() drawn.reverse()
} }
ctx.font = config.fontSize + "px " + config.fontFamily ctx.font = bold + config.fontSize + "px " + config.fontFamily
ctx.textBaseline = config.baseline || "top" ctx.textBaseline = config.baseline || "top"
ctx.textAlign = "center" ctx.textAlign = "center"
@ -1252,6 +1290,10 @@
} }
} }
bold(font){
return font === "Microsoft YaHei, sans-serif" ? "bold " : ""
}
getMS(){ getMS(){
return Date.now() return Date.now()
} }

View File

@ -80,9 +80,10 @@ var perf = {
allImg: 0, allImg: 0,
load: 0 load: 0
} }
var strings
pageEvents.add(root, ["touchstart", "touchmove", "touchend"], event => { pageEvents.add(root, ["touchstart", "touchmove", "touchend"], event => {
if(event.cancelable && cancelTouch){ if(event.cancelable && cancelTouch && event.target.tagName !== "SELECT"){
event.preventDefault() event.preventDefault()
} }
}) })

View File

@ -319,10 +319,10 @@ class ParseOsu{
if(hitSound & this.osu.FINISH){ if(hitSound & this.osu.FINISH){
if(hitSound & this.osu.WHISTLE || hitSound & this.osu.CLAP){ if(hitSound & this.osu.WHISTLE || hitSound & this.osu.CLAP){
type = "daiKa" type = "daiKa"
txt = "カッ(大)" txt = strings.note.daiKa
}else if(hitSound & this.osu.NORMAL || hitSound === this.osu.FINISH){ }else if(hitSound & this.osu.NORMAL || hitSound === this.osu.FINISH){
type = "daiDon" type = "daiDon"
txt = "ドン(大)" txt = strings.note.daiDon
}else{ }else{
emptyValue = true emptyValue = true
} }

View File

@ -16,7 +16,7 @@ class Scoresheet{
this.fadeScreen.id = "fade-screen" this.fadeScreen.id = "fade-screen"
this.game.appendChild(this.fadeScreen) this.game.appendChild(this.fadeScreen)
this.font = "TnT, Meiryo, sans-serif" this.font = strings.font
this.state = { this.state = {
screen: "fadeIn", screen: "fadeIn",
screenMS: this.getMS(), screenMS: this.getMS(),

View File

@ -90,14 +90,15 @@ class SongSelect{
outline: "#656565" outline: "#656565"
} }
} }
this.font = "TnT, Meiryo, sans-serif" this.font = strings.font
this.songs = [] this.songs = []
for(let song of assets.songs){ for(let song of assets.songs){
var en = strings.id === "en"
this.songs.push({ this.songs.push({
id: song.id, id: song.id,
title: song.title, title: en ? song.title_en : song.title,
subtitle: song.subtitle, subtitle: en ? song.subtitle_en : song.subtitle,
skin: song.category in this.songSkin ? this.songSkin[song.category] : this.songSkin.default, skin: song.category in this.songSkin ? this.songSkin[song.category] : this.songSkin.default,
stars: song.stars, stars: song.stars,
category: song.category, category: song.category,
@ -886,6 +887,7 @@ class SongSelect{
fontFamily: this.font, fontFamily: this.font,
x: 53, x: 53,
y: 30, y: 30,
width: 280,
letterSpacing: 2, letterSpacing: 2,
forceShadow: true forceShadow: true
}, [ }, [
@ -1089,8 +1091,7 @@ class SongSelect{
highlight = 0 highlight = 0
} }
if(this.currentSongId !== currentSong.id || this.currentSongTitle !== currentSong.title){ if(this.currentSongTitle !== currentSong.title){
this.currentSongId = currentSong.id
this.currentSongTitle = currentSong.title this.currentSongTitle = currentSong.title
this.currentSongCache.clear() this.currentSongCache.clear()
} }
@ -1279,15 +1280,16 @@ class SongSelect{
h: (songSel ? 88 : 135) + 10, h: (songSel ? 88 : 135) + 10,
id: this.difficulty[currentUra ? 4 : i] + (songSel ? "1" : "0") id: this.difficulty[currentUra ? 4 : i] + (songSel ? "1" : "0")
}, ctx => { }, ctx => {
var ja = strings.id === "ja"
this.draw.verticalText({ this.draw.verticalText({
ctx: ctx, ctx: ctx,
text: this.difficulty[i], text: this.difficulty[i],
x: offset, x: offset,
y: 0, y: 0,
width: songSel ? 44 : 56, width: songSel ? 44 : 56,
height: songSel ? (i === 1 ? 66 : 88) : (i === 0 ? 130 : (i === 1 ? 110 : 135)), height: songSel ? (i === 1 && ja ? 66 : 88) : (ja ? 130 : (i === 1 && ja ? 110 : 135)),
fill: currentUra ? "#fff" : "#000", fill: currentUra ? "#fff" : "#000",
fontSize: songSel ? 25 : (i === 2 ? 45 : 40), fontSize: songSel ? 25 : (i === 2 && ja ? 45 : 40),
fontFamily: this.font, fontFamily: this.font,
outline: currentUra ? "#003C52" : false, outline: currentUra ? "#003C52" : false,
outlineSize: currentUra ? this.songAsset.letterBorder : 0 outlineSize: currentUra ? this.songAsset.letterBorder : 0

View File

@ -1,6 +1,10 @@
class StringsJa{ function StringsJa(){
constructor(){ this.id = "ja"
this.titleProceed = "Click or Press Enter!" this.name = "日本語"
this.regex = /^ja$/
this.font = "TnT, Meiryo, sans-serif"
this.titleProceed = "クリックするかEnterを押す"
this.categories = { this.categories = {
"J-POP": "J-POP", "J-POP": "J-POP",
"アニメ": "アニメ", "アニメ": "アニメ",
@ -29,8 +33,8 @@
this.oni = "おに" this.oni = "おに"
this.sessionStart = "オンラインセッションを開始する!" this.sessionStart = "オンラインセッションを開始する!"
this.sessionEnd = "オンラインセッションを終了する" this.sessionEnd = "オンラインセッションを終了する"
this.loading = "Loading..." this.loading = "ロード中..."
this.cancel = "Cancel" this.cancel = "キャンセル"
this.note = { this.note = {
don: "ドン", don: "ドン",
ka: "カッ", ka: "カッ",
@ -40,6 +44,7 @@
daiDrumroll: "連打(大)ーっ!!", daiDrumroll: "連打(大)ーっ!!",
balloon: "ふうせん" balloon: "ふうせん"
} }
this.combo = "コンボ"
this.clear = "クリア" this.clear = "クリア"
this.pauseOptions = [ this.pauseOptions = [
"演奏をつづける", "演奏をつづける",
@ -50,6 +55,243 @@
this.points = "点" this.points = "点"
this.maxCombo = "最大コンボ数" this.maxCombo = "最大コンボ数"
this.drumroll = "連打数" this.drumroll = "連打数"
}
} }
var strings = new StringsJa() function StringsEn(){
this.id = "en"
this.name = "English"
this.regex = /^en$|^en-/
this.font = "TnT, Meiryo, sans-serif"
this.titleProceed = "Click or Press Enter!"
this.categories = {
"J-POP": "Pop",
"アニメ": "Anime",
"ボーカロイド™曲": "VOCALOID™ Music",
"バラエティ": "Variety",
"クラシック": "Classical",
"ゲームミュージック": "Game Music",
"ナムコオリジナル": "NAMCO Original"
}
this.selectSong = "Select Song"
this.selectDifficulty = "Select Difficulty"
this.back = "Back"
this.random = "Random"
this.randomSong = "Random Song"
this.tutorial = "How to Play"
this.aboutSimulator = "About Simulator"
this.browse = "Browse…"
this.defaultSongList = "Default Song List"
this.songOptions = "Song Options"
this.none = "None"
this.auto = "Auto"
this.netplay = "Netplay"
this.easy = "Easy"
this.normal = "Normal"
this.hard = "Hard"
this.oni = "Extreme"
this.sessionStart = "Begin an Online Session!"
this.sessionEnd = "End Online Session"
this.loading = "Loading..."
this.cancel = "Cancel"
this.note = {
don: "Don",
ka: "Ka",
daiDon: "DON",
daiKa: "KA",
drumroll: "Drum rollー!!",
daiDrumroll: "DRUM ROLLー!!",
balloon: "Balloon"
}
this.combo = "Combo"
this.clear = "Clear"
this.pauseOptions = [
"Continue",
"Retry",
"Back to Select Song"
]
this.results = "Results"
this.points = "pts"
this.maxCombo = "MAX Combo"
this.drumroll = "Drumroll"
}
function StringsCn(){
this.id = "cn"
this.name = "中文简体"
this.regex = /^zh$|^zh-CN$/
this.font = "Microsoft YaHei, sans-serif"
this.titleProceed = "点击或按回车!"
this.categories = {
"J-POP": "流行音乐",
"アニメ": "卡通动画音乐",
"ボーカロイド™曲": "VOCALOID™ Music",
"バラエティ": "综合音乐",
"クラシック": "古典音乐",
"ゲームミュージック": "游戏音乐",
"ナムコオリジナル": "NAMCO原创音乐"
}
this.selectSong = "选择乐曲"
this.selectDifficulty = "选择难度"
this.back = "返回"
this.random = "随机"
this.randomSong = "随机选曲"
this.tutorial = "操作说明"
this.aboutSimulator = "游戏信息"
this.browse = "浏览…"
this.defaultSongList = "默认歌曲列表"
this.songOptions = "选项"
this.none = "无"
this.auto = "自动"
this.netplay = "网络对战"
this.easy = "简单"
this.normal = "普通"
this.hard = "困难"
this.oni = "魔王"
this.sessionStart = "开始在线会议!"
this.sessionEnd = "结束在线会话"
this.loading = "读取中..."
this.cancel = "取消"
this.note = {
don: "咚",
ka: "咔",
daiDon: "咚(大)",
daiKa: "咔(大)",
drumroll: "连打ー!!",
daiDrumroll: "连打(大)ー!!",
balloon: "气球"
}
this.combo = "连段"
this.clear = "通关"
this.pauseOptions = [
"继续演奏",
"从头开始",
"返回「选择乐曲」"
]
this.results = "发表成绩"
this.points = "点"
this.maxCombo = "最多连段数"
this.drumroll = "连打数"
}
function StringsTw(){
this.id = "tw"
this.name = "中文繁體"
this.regex = /^zh-HK$|^zh-TW$/
this.font = "Microsoft YaHei, sans-serif"
this.titleProceed = "點擊或按回車!"
this.categories = {
"J-POP": "流行音樂",
"アニメ": "卡通動畫音樂",
"ボーカロイド™曲": "VOCALOID™ Music",
"バラエティ": "綜合音樂",
"クラシック": "古典音樂",
"ゲームミュージック": "遊戲音樂",
"ナムコオリジナル": "NAMCO原創音樂"
}
this.selectSong = "選擇樂曲"
this.selectDifficulty = "選擇難度"
this.back = "返回"
this.random = "隨機"
this.randomSong = "隨機選曲"
this.tutorial = "操作说明"
this.aboutSimulator = "游戏信息"
this.browse = "浏览…"
this.defaultSongList = "默认歌曲列表"
this.songOptions = "選項"
this.none = "無"
this.auto = "自動"
this.netplay = "网络对战"
this.easy = "簡單"
this.normal = "普通"
this.hard = "困難"
this.oni = "魔王"
this.sessionStart = "開始在線會議!"
this.sessionEnd = "結束在線會話"
this.loading = "讀取中..."
this.cancel = "取消"
this.note = {
don: "咚",
ka: "咔",
daiDon: "咚(大)",
daiKa: "咔(大)",
drumroll: "連打ー!!",
daiDrumroll: "連打(大)ー!!",
balloon: "氣球"
}
this.combo = "連段"
this.clear = "通關"
this.pauseOptions = [
"繼續演奏",
"從頭開始",
"返回「選擇樂曲」"
]
this.results = "發表成績"
this.points = "點"
this.maxCombo = "最多連段數"
this.drumroll = "連打數"
}
function StringsKo(){
this.id = "ko"
this.name = "한국어"
this.regex = /^ko$/
this.font = "Microsoft YaHei, sans-serif"
this.titleProceed = "클릭하거나 Enter를 누릅니다!"
this.categories = {
"J-POP": "POP",
"アニメ": "애니메이션",
"ボーカロイド™曲": "VOCALOID™ Music",
"バラエティ": "버라이어티",
"クラシック": "클래식",
"ゲームミュージック": "게임",
"ナムコオリジナル": "남코 오리지널"
}
this.selectSong = "곡 선택"
this.selectDifficulty = "난이도 선택"
this.back = "돌아간다"
this.random = "랜덤"
this.randomSong = "랜덤"
this.tutorial = "지도 시간"
this.aboutSimulator = "게임 정보"
this.browse = "찾아보기…"
this.defaultSongList = "기본 노래 목록"
this.songOptions = "옵션"
this.none = "없음"
this.auto = "오토"
this.netplay = "넷 플레이"
this.easy = "쉬움"
this.normal = "보통"
this.hard = "어려움"
this.oni = "귀신"
this.sessionStart = "온라인 세션 시작!"
this.sessionEnd = "온라인 세션 끝내기"
this.loading = "로딩 중..."
this.cancel = "취소"
this.note = {
don: "쿵",
ka: "딱",
daiDon: "쿵(대)",
daiKa: "딱(대)",
drumroll: "연타ー!!",
daiDrumroll: "연타(대)ー!!",
balloon: "풍선"
}
this.combo = "콤보"
this.clear = "클리어"
this.pauseOptions = [
"연주 계속하기",
"처음부터 다시",
"「곡 선택」으로"
]
this.results = "성적 발표"
this.points = "점"
this.maxCombo = "최대 콤보 수"
this.drumroll = "연타 횟수"
}
var allStrings = {
"ja": new StringsJa(),
"en": new StringsEn(),
"cn": new StringsCn(),
"tw": new StringsTw(),
"ko": new StringsKo()
}

View File

@ -1,13 +1,19 @@
class Titlescreen{ class Titlescreen{
constructor(){ constructor(){
loader.changePage("titlescreen", false) loader.changePage("titlescreen", false)
this.titleScreen = document.getElementById("title-screen") this.titleScreen = document.getElementById("title-screen")
var proceed = document.getElementById("title-proceed") this.proceed = document.getElementById("title-proceed")
proceed.appendChild(document.createTextNode(strings.titleProceed)) this.langDropdown = document.getElementById("lang-dropdown")
proceed.setAttribute("alt", strings.titleProceed)
this.lang = this.getLang()
this.setLang(allStrings[this.lang])
this.addLangs()
pageEvents.keyAdd(this, "all", "down", this.keyDown.bind(this)) pageEvents.keyAdd(this, "all", "down", this.keyDown.bind(this))
pageEvents.add(this.titleScreen, ["mousedown", "touchstart"], this.onPressed.bind(this)) pageEvents.add(this.titleScreen, ["mousedown", "touchstart"], this.onPressed.bind(this))
pageEvents.add(this.langDropdown, "change", this.langChange.bind(this))
assets.sounds["title"].play() assets.sounds["title"].play()
this.gamepad = new Gamepad({ this.gamepad = new Gamepad({
"13": ["a", "b", "x", "y", "start", "ls", "rs"] "13": ["a", "b", "x", "y", "start", "ls", "rs"]
@ -24,7 +30,11 @@ class Titlescreen{
}) })
} }
} }
keyDown(event, code){ keyDown(event, code){
if(event && event.target === this.langDropdown){
return
}
if(!code){ if(!code){
code = event.keyCode code = event.keyCode
} }
@ -61,11 +71,56 @@ class Titlescreen{
}, 500) }, 500)
} }
} }
getLang(){
if(localStorage.lang && localStorage.lang in allStrings){
return localStorage.lang
}
if("languages" in navigator){
var userLang = navigator.languages.slice()
userLang.unshift(navigator.language)
for(var i in userLang){
for(var j in allStrings){
if(allStrings[j].regex.test(userLang[i])){
return j
}
}
}
}
return "ja"
}
setLang(lang){
strings = lang
this.proceed.innerText = strings.titleProceed
this.proceed.setAttribute("alt", strings.titleProceed)
loader.screen.style.fontFamily = strings.font
loader.screen.style.fontWeight = strings.font === "Microsoft YaHei, sans-serif" ? "bold" : ""
}
addLangs(){
for(var i in allStrings){
var option = document.createElement("option")
option.value = i
if(i === this.lang){
option.selected = true
}
option.appendChild(document.createTextNode(allStrings[i].name))
this.langDropdown.appendChild(option)
}
}
langChange(){
this.lang = this.langDropdown.value
localStorage.lang = this.lang
this.setLang(allStrings[this.lang])
}
clean(){ clean(){
this.gamepad.clean() this.gamepad.clean()
assets.sounds["title"].stop() assets.sounds["title"].stop()
pageEvents.keyRemove(this, "all") pageEvents.keyRemove(this, "all")
pageEvents.remove(this.titleScreen, ["mousedown", "touchstart"]) pageEvents.remove(this.titleScreen, ["mousedown", "touchstart"])
pageEvents.remove(this.langDropdown, "change")
delete this.titleScreen delete this.titleScreen
delete this.proceed
delete this.langDropdown
} }
} }

View File

@ -69,7 +69,7 @@
this.drumroll = [] this.drumroll = []
this.beatInterval = this.controller.parsedSongData.beatInfo.beatInterval this.beatInterval = this.controller.parsedSongData.beatInfo.beatInterval
this.font = "TnT, Meiryo, sans-serif" this.font = strings.font
this.draw = new CanvasDraw() this.draw = new CanvasDraw()
this.assets = new ViewAssets(this) this.assets = new ViewAssets(this)
@ -260,9 +260,14 @@
}) })
ctx.fill() ctx.fill()
if(selectedSong.category in strings.categories){
var categoryName = strings.categories[selectedSong.category]
}else{
var categoryName = selectedSong.category
}
this.draw.layeredText({ this.draw.layeredText({
ctx: ctx, ctx: ctx,
text: selectedSong.category, text: categoryName,
fontSize: 15, fontSize: 15,
fontFamily: this.font, fontFamily: this.font,
align: "center", align: "center",
@ -629,7 +634,7 @@
// Score // Score
ctx.save() ctx.save()
ctx.font = "30px " + this.font ctx.font = "30px TnT, Meiryo, sans-serif"
ctx.fillStyle = "#fff" ctx.fillStyle = "#fff"
ctx.strokeStyle = "#fff" ctx.strokeStyle = "#fff"
ctx.lineWidth = 0.3 ctx.lineWidth = 0.3
@ -763,11 +768,13 @@
}else{ }else{
ctx.fillStyle = "#fff" ctx.fillStyle = "#fff"
} }
ctx.font = fontSize + "px " + this.font ctx.font = this.draw.bold(this.font) + fontSize + "px " + this.font
ctx.lineWidth = 7 * mul ctx.lineWidth = 7 * mul
ctx.textAlign = "center" ctx.textAlign = "center"
ctx.strokeText("コンボ", comboX, comboTextY) ctx.miterLimit = 1
ctx.fillText("コンボ", comboX, comboTextY) ctx.strokeText(strings.combo, comboX, comboTextY)
ctx.miterLimit = 10
ctx.fillText(strings.combo, comboX, comboTextY)
} }
// Slot // Slot
@ -931,7 +938,7 @@
x: _w / 2, x: _w / 2,
y: 18, y: 18,
width: _w, width: _w,
height: _h, height: _h - 54,
fontSize: 40, fontSize: 40,
fontFamily: this.font, fontFamily: this.font,
letterSpacing: -1 letterSpacing: -1
@ -1292,7 +1299,7 @@
var text = circle.getText() var text = circle.getText()
var textX = circlePos.x var textX = circlePos.x
var textY = circlePos.y + 83 * mul var textY = circlePos.y + 83 * mul
ctx.font = lyricsSize + "px Kozuka" ctx.font = lyricsSize + "px Kozuka, Microsoft YaHei, sans-serif"
ctx.textBaseline = "middle" ctx.textBaseline = "middle"
ctx.textAlign = "center" ctx.textAlign = "center"
@ -1373,7 +1380,7 @@
ctx: ctx, ctx: ctx,
text: i.toString(), text: i.toString(),
fontSize: fontSize, fontSize: fontSize,
fontFamily: this.font, fontFamily: "TnT, Meiryo, sans-serif",
x: textX, x: textX,
y: textY y: textY
}, [ }, [

View File

@ -2,3 +2,6 @@
<div class="logo-big">太鼓の達人ウェブ</div> <div class="logo-big">太鼓の達人ウェブ</div>
<div class="click-to-continue stroke-sub" id="title-proceed"></div> <div class="click-to-continue stroke-sub" id="title-proceed"></div>
</div> </div>
<div id="lang">
<select id="lang-dropdown"></select>
</div>