first commit
This commit is contained in:
9
assets/res-native/setting/LabLanguage.ts
Normal file
9
assets/res-native/setting/LabLanguage.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
interface LabelConfigType {
|
||||
[key: string]: string[];
|
||||
}
|
||||
|
||||
export const LabelConfig : LabelConfigType = {
|
||||
"自动游戏B": ["自动游戏", "AUTO PLAY"],
|
||||
"剩余次数B:": ["剩余次数:", "REMAINING TIMES:"],
|
||||
"数据错误": ["数据错误", "Data error"],
|
||||
}
|
||||
9
assets/res-native/setting/LabLanguage.ts.meta
Normal file
9
assets/res-native/setting/LabLanguage.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "2ef0d99e-c12a-4894-a23f-cb0267a1ad5c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
20
assets/res-native/setting/LangSet.ts
Normal file
20
assets/res-native/setting/LangSet.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export enum LangType {
|
||||
ZH = 0,
|
||||
EN = 1,
|
||||
}
|
||||
|
||||
export const LANG_STRING = {
|
||||
"zh" : LangType.ZH,
|
||||
"en" : LangType.EN
|
||||
};
|
||||
|
||||
export const LANG_ENUM = {
|
||||
0 : "zh",
|
||||
1 : "en"
|
||||
};
|
||||
|
||||
export class LangSet {
|
||||
public langIndex : LangType = LangType.EN;
|
||||
}
|
||||
|
||||
export const LANG_SET = new LangSet();
|
||||
9
assets/res-native/setting/LangSet.ts.meta
Normal file
9
assets/res-native/setting/LangSet.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "d950b1eb-aff9-4280-822f-fcce09077313",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
34
assets/res-native/setting/ServerConfig.ts
Normal file
34
assets/res-native/setting/ServerConfig.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/** 服务区域 */
|
||||
export const enum SERVER_EREA {
|
||||
// 一级棒横版
|
||||
ZP = 0,
|
||||
}
|
||||
/** 当前服务区域配置(根据打包修改) */
|
||||
export const NOW_SERVER_EREA : SERVER_EREA = SERVER_EREA.ZP;
|
||||
|
||||
// 默认地址
|
||||
const DEFAULT_URL = "https://dice-api.yuliao666.top"
|
||||
/** 通用版本 */
|
||||
const DEFAULT_VERSION = "1.0.5"
|
||||
/** 测试服版本号 */
|
||||
const DEFAULT_TEST_VERSION = "1.0.0"
|
||||
|
||||
/** 区域打包配置文件 */
|
||||
const SERVER_CONFIG = {
|
||||
// 横版一级棒
|
||||
[0] : {
|
||||
"server" : DEFAULT_URL,
|
||||
"site_id" : "ba5ea4dc-75bb-438d-8a3a-b8031ef89426",
|
||||
"ver" : DEFAULT_TEST_VERSION,
|
||||
"area" : "86",
|
||||
}
|
||||
}
|
||||
|
||||
/** 服务器地址 */
|
||||
export const SERVER_LIST = SERVER_CONFIG[NOW_SERVER_EREA]["server"];
|
||||
/** Site ID */
|
||||
export const HTTP_SITE_ID = SERVER_CONFIG[NOW_SERVER_EREA]["site_id"];
|
||||
/** 当前版本号 */
|
||||
export const GAME_VER = SERVER_CONFIG[NOW_SERVER_EREA]["ver"];
|
||||
/** 国家电话区号 */
|
||||
export const COUNTRY_CODE = SERVER_CONFIG[NOW_SERVER_EREA]["area"];
|
||||
9
assets/res-native/setting/ServerConfig.ts.meta
Normal file
9
assets/res-native/setting/ServerConfig.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "29ef329c-fd90-4d8a-a91a-95ab0b17eace",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
34
assets/res-native/setting/SwitchLang.ts
Normal file
34
assets/res-native/setting/SwitchLang.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { _decorator, Component, Label, Sprite, SpriteFrame } from "cc";
|
||||
import { app } from "../../app/app";
|
||||
import { Tools } from "../tools/Tools";
|
||||
import { LANG_SET } from "./LangSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
@ccclass('SwitchLang')
|
||||
|
||||
export class SwitchLang extends Component {
|
||||
@property(String) lab_lang: string = "";
|
||||
|
||||
@property(SpriteFrame) spr_lang : SpriteFrame[] = [];
|
||||
|
||||
protected onLoad(): void {
|
||||
this.updateLab();
|
||||
app.manager.event.on("LangChanged", this.updateLab, this);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
app?.manager.event?.off("LangChanged", this.updateLab, this);
|
||||
}
|
||||
|
||||
updateLab(){
|
||||
let lab = this.getComponent(Label)
|
||||
if (lab != null) {
|
||||
this.getComponent(Label).string = Tools.GetLocalized(this.lab_lang)
|
||||
};
|
||||
|
||||
let sprite = this.getComponent(Sprite)
|
||||
if (sprite != null) {
|
||||
if (this.spr_lang && this.spr_lang[LANG_SET.langIndex])
|
||||
this.getComponent(Sprite).spriteFrame = this.spr_lang[LANG_SET.langIndex]
|
||||
};
|
||||
}
|
||||
}
|
||||
9
assets/res-native/setting/SwitchLang.ts.meta
Normal file
9
assets/res-native/setting/SwitchLang.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "62eb7e15-ddf5-4380-98b5-f9ab11085deb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user