赞 | 1 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 18571 |
最后登录 | 2019-4-20 |
在线时间 | 376 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 112
- 在线时间
- 376 小时
- 注册时间
- 2015-1-26
- 帖子
- 203
|
本帖最后由 raketenfaust02 于 2017-6-10 22:31 编辑
- Window_ChoiceList.prototype.textWidthEx = function(text) {
- text = languageControl(text); //多语种对应
- return this.drawTextEx(text, 0, this.contents.height);
- };
- Window_Command.prototype.addCommand = function(name, symbol, enabled, ext) {
- if (enabled === undefined) {
- enabled = true;
- }
- if (ext === undefined) {
- ext = null;
- }
- text = languageControl(name); //多语种检测
- this._list.push({ name: text, symbol: symbol, enabled: enabled, ext: ext});
- };
- Bitmap.prototype.drawText = function(text, x, y, maxWidth, lineHeight, align) {
- // Note: Firefox has a bug with textBaseline: Bug 737852
- // So we use 'alphabetic' here.
- if (text !== undefined) {
- var tx = x;
- var ty = y + lineHeight - (lineHeight - this.fontSize * 0.7) / 2;
- var context = this._context;
- var alpha = context.globalAlpha;
- maxWidth = maxWidth || 0xffffffff;
- text = languageControl(text); //多语种检测
- if (align === 'center') {
- tx += maxWidth / 2;
- }
- if (align === 'right') {
- tx += maxWidth;
- }
- context.save();
- context.font = this._makeFontNameText();
- context.textAlign = align;
- context.textBaseline = 'alphabetic';
- context.globalAlpha = 1;
- this._drawTextOutline(text, tx, ty, maxWidth);
- context.globalAlpha = alpha;
- this._drawTextBody(text, tx, ty, maxWidth);
- context.restore();
- this._setDirty();
- }
- };
- Game_Message.prototype.add = function(text) {
- text = languageControl(text); //多语种检测
- this._texts.push(text);
- };
- //检测语种
- languageControl = function(text){
- language = $gameVariables.value(1); //用游戏变量1决定当前语言
- string = text;
- switch(language)
- {
- //1号语言
- case 1:
- Table = StringTable_EN;
- break;
- //2号语言
- case 2:
- Table = StringTable_CNS;
- break;
- //3号语言
- case 3:
- Table = StringTable_JP;
- break;
- //如需扩展更多语言在此处添加case
- //case 4:
- //Table = StringTable_CNT;
- //break;
- //默认语言
- default:
- Table = StringTable_EN
- }
- if (Table[string] != null){ //未找到语言包时直接显示原有字符串
- text = Table[string];
- }
- return text;
- };
- //翻译文件索引
- StringTable_EN = {
- "NEW GAME" : "New Game",
- "LOAD GAME" : "Load Game",
- "EXIT GAME" : "Exit Game",
- "Continue" : "Continue",
- "Options" : "Options",
- "Status" : "Status",
- "Item" : "Item",
- "Skill" : "Skill",
- "Equip" : "Equip",
- "Save" : "Save",
- "Formation" : "Formation",
- "Game End" : "Game End",
- "TEST" : "English",
- "当前语言设定为" : "Current language is set to English.",
- "Language00" : "English",
- "Language01" : "简体中文",
- "Language02" : "日本語",
- "是" : "YES",
- "否" : "NO",
- };
- StringTable_CNS = {
- "NEW GAME" : "新游戏",
- "LOAD GAME" : "读取进度",
- "EXIT GAME" : "退出游戏",
- "Continue" : "继续游戏",
- "Options" : "系统",
- "Status" : "状态",
- "Item" : "道具",
- "Skill" : "技能",
- "Equip" : "装备",
- "Save" : "存档",
- "Formation" : "队形",
- "Game End" : "结束",
- "TEST" : "简体中文",
- "当前语言设定为" : "当前语言设定为简体中文。",
- "Language00" : "English",
- "Language01" : "简体中文",
- "Language02" : "日本語",
- "是" : "是",
- "否" : "否",
- };
- StringTable_JP = {
- "NEW GAME" : "はじめから",
- "LOAD GAME" : "つづきから",
- "EXIT GAME" : "終了",
- "Options" : "オプション",
- "Status" : "ステータス",
- "Item" : "アイテム",
- "Skill" : "スキル",
- "Equip" : "装備",
- "Save" : "セーフ",
- "Formation" : "編成",
- "Game End" : "終了",
- "TEST" : "日本語",
- "T" : "エラー",
- "当前语言设定为" : "現在の言語を日本語に設定されています。",
- "Language00" : "English",
- "Language01" : "简体中文",
- "Language02" : "日本語",
- "是" : "はい",
- "否" : "いいえ",
- };
复制代码
自家用语言包插件,用游戏变量1(可以在代码里改成其他ID)控制当前语言。
默认1=英语,2=简体中文,3=日语
|
|