drgame-cc 1.0.45 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/drres/focus/focus_1/gesture.atlas +34 -0
- package/drres/focus/focus_1/gesture.atlas.meta +6 -0
- package/drres/focus/focus_1/gesture.json +1 -0
- package/drres/focus/focus_1/gesture.json.meta +10 -0
- package/drres/focus/focus_1/gesture.png +0 -0
- package/drres/{icons/pointer-yellow-60.png.meta → focus/focus_1/gesture.png.meta} +14 -14
- package/drres/focus/focus_1.meta +13 -0
- package/drres/focus/focus_2/gesture.atlas +41 -0
- package/drres/focus/focus_2/gesture.atlas.meta +6 -0
- package/drres/focus/focus_2/gesture.json +1 -0
- package/drres/focus/focus_2/gesture.json.meta +10 -0
- package/drres/focus/focus_2/gesture.png +0 -0
- package/drres/{icons/pointer-blue-60.png.meta → focus/focus_2/gesture.png.meta} +13 -13
- package/drres/focus/focus_2.meta +13 -0
- package/drres/focus/focus_3/gesture.atlas +34 -0
- package/drres/focus/focus_3/gesture.atlas.meta +6 -0
- package/drres/focus/focus_3/gesture.json +1 -0
- package/drres/focus/focus_3/gesture.json.meta +10 -0
- package/drres/focus/focus_3/gesture.png +0 -0
- package/drres/{icons/pointer-pink-60.png.meta → focus/focus_3/gesture.png.meta} +12 -12
- package/drres/focus/focus_3.meta +13 -0
- package/drres/focus/focus_4/gesture.atlas +20 -0
- package/drres/focus/focus_4/gesture.atlas.meta +6 -0
- package/drres/focus/focus_4/gesture.json +1 -0
- package/drres/focus/focus_4/gesture.json.meta +10 -0
- package/drres/focus/focus_4/gesture.png +0 -0
- package/drres/focus/focus_4/gesture.png.meta +38 -0
- package/drres/focus/focus_4.meta +13 -0
- package/drres/focus.meta +13 -0
- package/drres/prefab/ExitWin.prefab +2 -2
- package/drres/prefab/Toast.prefab +378 -378
- package/drscript/{ad/AdManager.ts.meta → BtnExtra.ts.meta} +1 -1
- package/drscript/Define.ts +17 -2
- package/drscript/{ad/AdSlot.ts.meta → Define.ts.meta} +1 -1
- package/drscript/{ad/AggregateAdProvider.ts.meta → ExitWin.ts.meta} +1 -1
- package/drscript/GameAnalytics.ts +37 -118
- package/drscript/{ad/IAdProvider.ts.meta → GameAnalytics.ts.meta} +1 -1
- package/drscript/HelperWin.ts.meta +10 -0
- package/drscript/Info.ts.meta +10 -0
- package/drscript/InternalUitl.ts.meta +10 -0
- package/drscript/KeyAdapter.ts +133 -0
- package/drscript/KeyAdapter.ts.meta +10 -0
- package/drscript/Loader.ts.meta +10 -0
- package/drscript/PlatformAdapter.ts +178 -192
- package/drscript/PlatformAdapter.ts.meta +10 -0
- package/drscript/README.md +91 -805
- package/drscript/README.md.meta +6 -0
- package/drscript/UIAdapter.ts +324 -0
- package/drscript/UIAdapter.ts.meta +10 -0
- package/drscript/WebBridge.ts +1 -1
- package/drscript/WebBridge.ts.meta +10 -0
- package/drscript/ad-sdk/reporters/superset-lewo.js +6 -0
- package/drscript/ad-sdk/types/enums.d.ts +1 -0
- package/drscript/ad-sdk.meta +13 -0
- package/drscript/ad.meta +13 -0
- package/drscript/component/AlertTip.ts +25 -0
- package/drscript/component/AlertTip.ts.meta +10 -0
- package/drscript/component/BtnExtra.ts +17 -0
- package/drscript/component/BtnExtra.ts.meta +10 -0
- package/drscript/{ExitWin.ts → component/ExitWin.ts} +6 -8
- package/drscript/component/ExitWin.ts.meta +10 -0
- package/drscript/{HelperWin.ts → component/HelperWin.ts} +5 -19
- package/drscript/component/HelperWin.ts.meta +10 -0
- package/drscript/component.meta +13 -0
- package/drscript/config.meta +13 -0
- package/drscript/core.meta +13 -0
- package/drscript/focus/FocusItem.ts +1 -19
- package/drscript/focus/FocusManager.ts +132 -170
- package/drscript/focus/FocusVisualLayer.ts +74 -163
- package/drscript/focus.meta +13 -0
- package/drscript/input/KeyboardMove.ts +40 -11
- package/drscript/input/KeyboardMove.ts.meta +10 -0
- package/drscript/input.meta +13 -0
- package/drscript/interface.meta +13 -0
- package/drscript/pinyin.meta +13 -0
- package/drscript/toast.meta +13 -0
- package/drscript/virtualgamepad.meta +13 -0
- package/package.json +1 -1
- package/drres/config/default.json +0 -108
- package/drres/config/default.json.meta +0 -6
- package/drres/icons/pointer-blue-60.png +0 -0
- package/drres/icons/pointer-pink-60.png +0 -0
- package/drres/icons/pointer-white-60.png +0 -0
- package/drres/icons/pointer-yellow-60.png +0 -0
- package/drscript/Info.ts +0 -78
- package/drscript/InternalUitl.ts +0 -65
- package/drscript/ad/AdManager.ts +0 -174
- package/drscript/ad/AdSlot.ts +0 -44
- package/drscript/ad/AggregateAdProvider.ts +0 -149
- package/drscript/ad/IAdProvider.ts +0 -39
- package/drscript/ad/MockAdProvider.ts +0 -36
- package/drscript/ad/MockAdProvider.ts.meta +0 -10
- package/drscript/ad/SelfAdProvider.ts +0 -41
- package/drscript/ad/SelfAdProvider.ts.meta +0 -10
- package/drscript/config/TvUiConfig.ts +0 -155
- package/drscript/config/TvUiConfig.ts.meta +0 -10
- package/drscript/config/TvUiConfigManager.ts +0 -133
- package/drscript/config/TvUiConfigManager.ts.meta +0 -10
- package/drscript/core/BackManager.ts +0 -38
- package/drscript/core/BackManager.ts.meta +0 -10
- package/drscript/core/NativeBridge.ts +0 -137
- package/drscript/core/NativeBridge.ts.meta +0 -10
- package/drscript/core/TvUi.ts +0 -69
- package/drscript/core/TvUi.ts.meta +0 -10
- package/drscript/core/TvUiRoot.ts +0 -137
- package/drscript/core/TvUiRoot.ts.meta +0 -10
- package/drscript/icon/IconConfig.ts +0 -7
- package/drscript/icon/IconConfig.ts.meta +0 -10
- package/drscript/icon/IconManager.ts +0 -97
- package/drscript/icon/IconManager.ts.meta +0 -10
- package/drscript/input/KeyCodeAdapter.ts +0 -23
- package/drscript/input/RemoteInputManager.ts +0 -105
- package/drscript/interface/ILobbyBridge.ts +0 -5
- package/drscript/toast/ToastComponent.ts +0 -35
- package/drscript/toast/ToastComponent.ts.meta +0 -10
- package/drscript/toast/ToastManager.ts +0 -66
- package/drscript/toast/ToastManager.ts.meta +0 -10
- package/drscript/toast/TvExitConfirmDialog.ts +0 -334
- package/drscript/toast/TvExitConfirmDialog.ts.meta +0 -10
- package/drscript/toast/UIFunctions.ts +0 -150
- package/drscript/toast/UIFunctions.ts.meta +0 -10
package/drscript/Info.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import TvUi from "./core/TvUi";
|
|
2
|
-
import { AnalyticsAction, AnalyticsEvent } from "./GameAnalytics";
|
|
3
|
-
import { PlatformAdapter } from "./PlatformAdapter";
|
|
4
|
-
import ToastManager from "./toast/ToastManager";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function getRuntimeTvUi(): any {
|
|
8
|
-
let root: any = typeof window != "undefined" ? window : null;
|
|
9
|
-
return TvUi || (root && (root.TvUi || root.drres)) || null;
|
|
10
|
-
}
|
|
11
|
-
export interface RewardVideoHooks {
|
|
12
|
-
onClose?: Function;
|
|
13
|
-
onFail?: Function;
|
|
14
|
-
onFinish?: Function;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 请求广告
|
|
18
|
-
// await AdSdk.requestAd({
|
|
19
|
-
// reward_type: 'extra_life', // CP 自定义类型
|
|
20
|
-
// trigger_scene: 'game_over', // CP 自定义场景
|
|
21
|
-
// });
|
|
22
|
-
|
|
23
|
-
// 要求如下定义 trigger_scene:
|
|
24
|
-
// 使用道具 use_prop
|
|
25
|
-
// 开始游戏 start_game
|
|
26
|
-
// 复活弹窗 revive_pop
|
|
27
|
-
// 购买皮肤 buy_skin
|
|
28
|
-
// 购买道具 buy_prop
|
|
29
|
-
// 游戏结束 game_over
|
|
30
|
-
// 关卡通过 level_complete
|
|
31
|
-
// 商店/道具 shop
|
|
32
|
-
// 每日奖励 daily_reward
|
|
33
|
-
// 加速 boost
|
|
34
|
-
// ...增加请提出
|
|
35
|
-
// ```
|
|
36
|
-
export function showRewardVideo(scene: string, rewardType: string, callback: Function, target?: any, hooks?: RewardVideoHooks) {
|
|
37
|
-
let finishFired = false;
|
|
38
|
-
let fireFinish = () => {
|
|
39
|
-
if (finishFired) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
finishFired = true;
|
|
43
|
-
hooks && hooks.onFinish && hooks.onFinish.call(target);
|
|
44
|
-
};
|
|
45
|
-
let onSuccess = () => {
|
|
46
|
-
try {
|
|
47
|
-
PlatformAdapter.report(AnalyticsEvent.RewardVideoAd, AnalyticsAction.Exposure);
|
|
48
|
-
callback && callback.call(target);
|
|
49
|
-
}
|
|
50
|
-
finally {
|
|
51
|
-
fireFinish();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
let onClose = () => {
|
|
55
|
-
ToastManager.Inst.make("必须看完视频,才能获取奖励");
|
|
56
|
-
hooks && hooks.onClose && hooks.onClose.call(target);
|
|
57
|
-
fireFinish();
|
|
58
|
-
};
|
|
59
|
-
let onFail = () => {
|
|
60
|
-
ToastManager.Inst.make("广告暂不可用,请稍后再试");
|
|
61
|
-
hooks && hooks.onFail && hooks.onFail.call(target);
|
|
62
|
-
fireFinish();
|
|
63
|
-
};
|
|
64
|
-
let tvUi: any = getRuntimeTvUi();
|
|
65
|
-
if (tvUi && tvUi.ads && tvUi.ads.showReward && tvUi.api && tvUi.api.hasBridge && tvUi.api.hasBridge()) {
|
|
66
|
-
tvUi.ads.showReward({
|
|
67
|
-
scene: scene,
|
|
68
|
-
rewardType: rewardType,
|
|
69
|
-
onSuccess: onSuccess,
|
|
70
|
-
onClose: onClose,
|
|
71
|
-
onFail: onFail,
|
|
72
|
-
onFinish: fireFinish
|
|
73
|
-
});
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
callback && callback.call(target);
|
|
77
|
-
return;
|
|
78
|
-
}
|
package/drscript/InternalUitl.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const pinyinMap: { [key: string]: string } = {
|
|
4
|
-
"啊": "a", "阿": "a", "吖": "a", "嗄": "a", "腌": "a", "锕": "a",
|
|
5
|
-
"边": "b", "八": "b", "巴": "b", "拔": "b", "跋": "b", "罴": "b", "魃": "b", "白": "b", "百": "b", "摆": "b", "败": "b", "拜": "b", "柏": "b", "邦": "b", "棒": "b", "宝": "b", "保": "b", "报": "b", "暴": "b", "豹": "b", "卑": "b", "悲": "b", "北": "b", "背": "b", "贝": "b", "倍": "b", "被": "b", "奔": "b", "本": "b", "苯": "b", "绷": "b", "甭": "b", "泵": "b", "蹦": "b", "比": "b", "笔": "b", "必": "b", "毕": "b", "闭": "b", "毙": "b", "碧": "b", "蔽": "b", "弊": "b", "避": "b", "泌": "b", "鼻": "b", "卞": "b", "变": "b", "辨": "b", "辩": "b", "遍": "b", "标": "b", "彪": "b", "膘": "b", "表": "b", "别": "b", "宾": "b", "彬": "b", "濒": "b", "滨": "b", "冰": "b", "柄": "b", "饼": "b", "并": "b", "病": "b", "波": "b", "拨": "b", "博": "b", "搏": "b", "薄": "b", "播": "b", "伯": "b", "帛": "b", "泊": "b", "勃": "b", "舶": "b", "渤": "b", "补": "b", "不": "b", "布": "b", "步": "b", "部": "b", "簿": "b",
|
|
6
|
-
"擦": "c", "猜": "c", "才": "c", "材": "c", "财": "c", "裁": "c", "采": "c", "彩": "c", "菜": "c", "蔡": "c", "参": "c", "餐": "c", "残": "c", "惭": "c", "蚕": "c", "惨": "c", "灿": "c", "仓": "c", "苍": "c", "沧": "c", "操": "c", "曹": "c", "草": "c", "册": "c", "侧": "c", "测": "c", "层": "c", "曾": "c", "查": "c", "茶": "c", "搽": "c", "察": "c", "叉": "c", "差": "c", "拆": "c", "钗": "c", "柴": "c", "豺": "c", "掺": "c", "搀": "c", "蝉": "c", "馋": "c", "缠": "c", "产": "c", "阐": "c", "颤": "c", "铲": "c", "长": "c", "场": "c", "常": "c", "唱": "c", "厂": "c", "敞": "c", "超": "c", "朝": "c", "潮": "c", "吵": "c", "炒": "c", "车": "c", "扯": "c", "撤": "c", "掣": "c", "彻": "c", "辰": "c", "晨": "c", "沉": "c", "陈": "c", "衬": "c", "趁": "c", "称": "c", "城": "c", "成": "c", "呈": "c", "承": "c", "诚": "c", "乘": "c", "惩": "c", "程": "c", "吃": "c", "持": "c", "池": "c", "迟": "c", "驰": "c", "耻": "c", "齿": "c", "赤": "c", "翅": "c", "炽": "c", "冲": "c", "虫": "c", "崇": "c", "抽": "c", "仇": "c", "绸": "c", "稠": "c", "愁": "c", "筹": "c", "丑": "c", "臭": "c", "出": "c", "初": "c", "除": "c", "厨": "c", "础": "c", "储": "c", "楚": "c", "处": "c", "川": "c", "穿": "c", "传": "c", "船": "c", "串": "c", "闯": "c", "创": "c", "疮": "c", "窗": "c", "床": "c", "吹": "c", "垂": "c", "炊": "c", "捶": "c", "锤": "c", "春": "c", "纯": "c", "唇": "c", "淳": "c", "蠢": "c", "戳": "c", "绰": "c", "茨": "c", "磁": "c", "雌": "c", "辞": "c", "慈": "c", "此": "c", "次": "c", "刺": "c", "赐": "c", "从": "c", "丛": "c", "聪": "c", "匆": "c", "葱": "c", "囱": "c", "凑": "c", "粗": "c", "促": "c", "醋": "c", "簇": "c", "窜": "c", "摧": "c", "崔": "c", "催": "c", "脆": "c", "瘁": "c", "粹": "c", "翠": "c", "村": "c", "存": "c", "寸": "c", "措": "c",
|
|
7
|
-
"搭": "d", "答": "d", "达": "d", "打": "d", "大": "d", "呆": "d", "待": "d", "怠": "d", "袋": "d", "代": "d", "带": "d", "贷": "d", "单": "d", "担": "d", "丹": "d", "但": "d", "淡": "d", "蛋": "d", "氮": "d", "当": "d", "挡": "d", "党": "d", "刀": "d", "导": "d", "倒": "d", "到": "d", "稻": "d", "道": "d", "得": "d", "德": "d", "的": "d", "灯": "d", "登": "d", "等": "d", "低": "d", "滴": "d", "敌": "d", "笛": "d", "狄": "d", "涤": "d", "迪": "d", "底": "d", "地": "d", "弟": "d", "递": "d", "帝": "d", "蒂": "d", "第": "d", "典": "d", "点": "d", "碘": "d", "电": "d", "店": "d", "垫": "d", "殿": "d", "靛": "d", "雕": "d", "吊": "d", "调": "d", "跌": "d", "爹": "d", "碟": "d", "叠": "d", "丁": "d", "盯": "d", "叮": "d", "钉": "d", "顶": "d", "订": "d", "定": "d", "丢": "d", "东": "d", "冬": "d", "动": "d", "冻": "d", "洞": "d", "都": "d", "斗": "d", "豆": "d", "逗": "d", "督": "d", "毒": "d", "读": "d", "犊": "d", "独": "d", "堵": "d", "赌": "d", "杜": "d", "镀": "d", "肚": "d", "度": "d", "短": "d", "段": "d", "断": "d", "缎": "d", "堆": "d", "队": "d", "对": "d", "敦": "d", "墩": "d", "蹲": "d", "盾": "d", "顿": "d", "钝": "d", "多": "d", "夺": "d", "朵": "d", "躲": "d", "du": "d", "duo": "d",
|
|
8
|
-
"额": "e", "俄": "e", "峨": "e", "鹅": "e", "恶": "e", "饿": "e", "鳄": "e", "遏": "e", "恩": "e", "儿": "e", "而": "e", "尔": "e", "耳": "e", "二": "e", "贰": "e",
|
|
9
|
-
"发": "f", "罚": "f", "乏": "f", "阀": "f", "法": "f", "番": "f", "翻": "f", "凡": "f", "烦": "f", "樊": "f", "繁": "f", "反": "f", "返": "f", "犯": "f", "泛": "f", "饭": "f", "范": "f", "贩": "f", "方": "f", "坊": "f", "芳": "f", "防": "f", "肥": "f", "非": "f", "啡": "f", "飞": "f", "匪": "f", "诽": "f", "吠": "f", "肺": "f", "废": "f", "沸": "f", "费": "f", "分": "f", "份": "f", "纷": "f", "酚": "f", "氛": "f", "粉": "f", "奋": "f", "愤": "f", "粪": "f", "风": "f", "枫": "f", "疯": "f", "峰": "f", "锋": "f", "蜂": "f", "冯": "f", "凤": "f", "佛": "f", "否": "f", "夫": "f", "孵": "f", "敷": "f", "弗": "f", "伏": "f", "扶": "f", "服": "f", "浮": "f", "符": "f", "幅": "f", "福": "f", "辐": "f", "抚": "f", "俯": "f", "釜": "f", "辅": "f", "腑": "f", "腐": "f", "父": "f", "付": "f", "妇": "f", "负": "f", "附": "f", "复": "f", "赴": "f", "副": "f", "覆": "f", "赋": "f", "傅": "f", "富": "f",
|
|
10
|
-
"嘎": "g", "噶": "g", "旮": "g", "伽": "g", "钆": "g", "该": "g", "改": "g", "盖": "g", "概": "g", "干": "g", "甘": "g", "杆": "g", "肝": "g", "赶": "g", "感": "g", "敢": "g", "赣": "g", "刚": "g", "岗": "g", "纲": "g", "钢": "g", "港": "g", "高": "g", "膏": "g", "篙": "g", "糕": "g", "告": "g", "歌": "g", "搁": "g", "戈": "g", "鸽": "g", "割": "g", "革": "g", "葛": "g", "格": "g", "蛤": "g", "隔": "g", "个": "g", "各": "g", "给": "g", "根": "g", "跟": "g", "更": "g", "耕": "g", "工": "g", "功": "g", "攻": "g", "供": "g", "公": "g", "宫": "g", "恭": "g", "龚": "g", "拱": "g", "共": "g", "钩": "g", "购": "g", "构": "g", "古": "g", "谷": "g", "股": "g", "骨": "g", "鼓": "g", "固": "g", "故": "g", "顾": "g", "雇": "g", "瓜": "g", "刮": "g", "挂": "g", "怪": "g", "关": "g", "观": "g", "官": "g", "馆": "g", "管": "g", "惯": "g", "罐": "g", "光": "g", "广": "g", "逛": "g", "规": "g", "硅": "g", "归": "g", "龟": "g", "鬼": "g", "轨": "g", "诡": "g", "桂": "g", "柜": "g", "贵": "g", "滚": "g", "棍": "g", "锅": "g", "国": "g", "果": "g", "过": "g",
|
|
11
|
-
"哈": "h", "还": "h", "孩": "h", "海": "h", "氦": "h", "害": "h", "韩": "h", "含": "h", "函": "h", "寒": "h", "罕": "h", "喊": "h", "汉": "h", "汗": "h", "杭": "h", "航": "h", "毫": "h", "号": "h", "好": "h", "浩": "h", "耗": "h", "喝": "h", "合": "h", "何": "h", "和": "h", "河": "h", "核": "h", "荷": "h", "盒": "h", "禾": "h", "贺": "h", "黑": "h", "很": "h", "狠": "h", "恨": "h", "哼": "h", "横": "h", "衡": "h", "恒": "h", "红": "h", "洪": "h", "宏": "h", "虹": "h", "鸿": "h", "侯": "h", "后": "h", "厚": "h", "候": "h", "乎": "h", "呼": "h", "忽": "h", "胡": "h", "壶": "h", "湖": "h", "虎": "h", "互": "h", "户": "h", "沪": "h", "护": "h", "花": "h", "华": "h", "哗": "h", "滑": "h", "化": "h", "话": "h", "画": "h", "划": "h", "槐": "h", "坏": "h", "欢": "h", "环": "h", "缓": "h", "환": "h", "换": "h", "唤": "h", "患": "h", "幻": "h", "黄": "h", "慌": "h", "荒": "h", "皇": "h", "蝗": "h", "簧": "h", "幌": "h", "灰": "h", "挥": "h", "辉": "h", "回": "h", "毁": "h", "悔": "h", "会": "h", "汇": "h", "讳": "h", "绘": "h", "荤": "h", "昏": "h", "婚": "h", "混": "h", "魂": "h", "活": "h", "火": "h", "伙": "h", "或": "h", "货": "h", "祸": "h", "惑": "h",
|
|
12
|
-
"击": "j", "基": "j", "机": "j", "畸": "j", "积": "j", "激": "j", "及": "j", "级": "j", "即": "j", "极": "j", "急": "j", "疾": "j", "集": "j", "几": "j", "己": "j", "挤": "j", "脊": "j", "记": "j", "计": "j", "纪": "j", "技": "j", "系": "j", "季": "j", "剂": "j", "济": "j", "继": "j", "既": "j", "家": "j", "加": "j", "夹": "j", "佳": "j", "嘉": "j", "镓": "j", "甲": "j", "钾": "j", "假": "j", "价": "j", "架": "j", "嫁": "j", "驾": "j", "尖": "j", "奸": "j", "间": "j", "肩": "j", "艰": "j", "监": "j", "兼": "j", "煎": "j", "束": "j", "俭": "j", "检": "j", "碱": "j", "捡": "j", "减": "j", "简": "j", "舰": "j", "见": "j", "件": "j", "建": "j", "剑": "j", "健": "j", "键": "j", "渐": "j", "溅": "j", "江": "j", "疆": "j", "蒋": "j", "奖": "j", "讲": "j", "匠": "j", "酱": "j", "降": "j", "郊": "j", "娇": "j", "浇": "j", "骄": "j", "焦": "j", "胶": "j", "教": "j", "角": "j", "脚": "j", "搅": "j", "缴": "j", "叫": "j", "轿": "j", "较": "j", "接": "j", "街": "j", "节": "j", "劫": "j", "结": "j", "截": "j", "姐": "j", "解": "j", "介": "j", "戒": "j", "届": "j", "界": "j", "借": "j", "巾": "j", "筋": "j", "金": "j", "今": "j", "津": "j", "紧": "j", "锦": "j", "仅": "j", "尽": "j", "进": "j", "近": "j", "浸": "j", "晋": "j", "禁": "j", "京": "j", "经": "j", "精": "j", "惊": "j", "晶": "j", "鲸": "j", "井": "j", "警": "j", "景": "j", "颈": "j", "静": "j", "镜": "j", "竞": "j", "竟": "j", "敬": "j", "境": "j", "纠": "j", "究": "j", "九": "j", "久": "j", "酒": "j", "救": "j", "旧": "j", "就": "j", "舅": "j", "咎": "j", "鞠": "j", "居": "j", "拘": "j", "菊": "j", "局": "j", "矩": "j", "举": "j", "聚": "j", "据": "j", "巨": "j", "具": "j", "剧": "j", "距": "j", "惧": "j", "锯": "j", "俱": "j", "句": "j", "卷": "j", "绢": "j", "撅": "j", "决": "j", "绝": "j", "觉": "j", "桷": "j",
|
|
13
|
-
"卡": "k", "开": "k", "揩": "k", "楷": "k", "看": "k", "坎": "k", "砍": "k", "康": "k", "慷": "k", "抗": "k", "亢": "k", "考": "k", "烤": "k", "靠": "k", "棵": "k", "颗": "k", "科": "k", "可": "k", "渴": "k", "克": "k", "客": "k", "课": "k", "肯": "k", "恳": "k", "坑": "k", "空": "k", "孔": "k", "恐": "k", "控": "k", "抠": "k", "口": "k", "扣": "k", "寇": "k", "哭": "k", "库": "k", "裤": "k", "酷": "k", "夸": "k", "垮": "k", "跨": "k", "挎": "k", "块": "k", "快": "k", "宽": "k", "款": "k", "狂": "k", "框": "k", "矿": "k", "亏": "k", "葵": "k", "魁": "k", "馈": "k", "愧": "k", "溃": "k", "坤": "k", "昆": "k", "困": "k",
|
|
14
|
-
"垃": "l", "拉": "l", "啦": "l", "辣": "l", "来": "l", "莱": "l", "赖": "l", "蓝": "l", "栏": "l", "拦": "l", "篮": "l", "阑": "l", "兰": "l", "澜": "l", "谰": "l", "揽": "l", "缆": "l", "懒": "l", "烂": "l", "滥": "l", "琅": "l", "郎": "l", "狼": "l", "廊": "l", "朗": "l", "浪": "l", "捞": "l", "劳": "l", "牢": "l", "老": "l", "乐": "l", "勒": "l", "雷": "l", "镭": "l", "累": "l", "泪": "l", "类": "l", "冷": "l", "愣": "l", "厘": "l", "梨": "l", "黎": "l", "篱": "l", "狸": "l", "离": "l", "理": "l", "李": "l", "里": "l", "鲤": "l", "礼": "l", "莉": "l", "荔": "l", "吏": "l", "丽": "l", "利": "l", "励": "l", "例": "l", "隶": "l", "力": "l", "历": "l", "连": "l", "帘": "l", "莲": "l", "联": "l", "廉": "l", "镰": "l", "怜": "l", "涟": "l", "恋": "l", "链": "l", "练": "l", "粮": "l", "梁": "l", "良": "l", "凉": "l", "两": "l", "辆": "l", "量": "l", "晾": "l", "聊": "l", "疗": "l", "辽": "l", "潦": "l", "了": "l", "撂": "l", "廖": "l", "料": "l", "列": "l", "烈": "l", "猎": "l", "裂": "l", "劣": "l", "林": "l", "临": "l", "邻": "l", "鳞": "l", "凛": "l", "吝": "l", "拎": "l", "伶": "l", "灵": "l", "岭": "l", "领": "l", "另": "l", "令": "l", "溜": "l", "刘": "l", "流": "l", "留": "l", "瘤": "l", "硫": "l", "柳": "l", "六": "l", "龙": "l", "聋": "l", "隆": "l", "笼": "l", "陇": "l", "楼": "l", "娄": "l", "搂": "l", "篓": "l", "漏": "l", "露": "l", "卢": "l", "庐": "l", "芦": "l", "炉": "l", "颅": "l", "卤": "l", "虏": "l", "鲁": "l", "路": "l", "鹿": "l", "潞": "l", "禄": "l", "录": "l", "陆": "l", "驴": "l", "吕": "l", "铝": "l", "侣": "l", "旅": "l", "履": "l", "屡": "l", "缕": "l", "律": "l", "虑": "l", "氯": "l", "绿": "l", "峦": "l", "挛": "l", "滦": "l", "卵": "l", "乱": "l", "掠": "l", "略": "l", "伦": "l", "沦": "l", "轮": "l", "论": "l", "罗": "l", "萝": "l", "逻": "l", "箩": "l", "洛": "l", "落": "l", "骆": "l",
|
|
15
|
-
"妈": "m", "麻": "m", "抹": "m", "吗": "m", "马": "m", "码": "m", "骂": "m", "埋": "m", "买": "m", "卖": "m", "麦": "m", "迈": "m", "脉": "m", "蛮": "m", "满": "m", "曼": "m", "漫": "m", "慢": "m", "忙": "m", "芒": "m", "盲": "m", "茫": "m", "猫": "m", "毛": "m", "矛": "m", "铆": "m", "茂": "m", "冒": "m", "帽": "m", "贸": "m", "么": "m", "没": "m", "枚": "m", "梅": "m", "媒": "m", "镁": "m", "每": "m", "美": "m", "妹": "m", "门": "m", "闷": "m", "们": "m", "萌": "m", "盟": "m", "檬": "m", "猛": "m", "蒙": "m", "锰": "m", "梦": "m", "弥": "m", "迷": "m", "谜": "m", "米": "m", "秘": "m", "密": "m", "幂": "m", "面": "m", "苗": "m", "描": "m", "秒": "m", "妙": "m", "庙": "m", "灭": "m", "民": "m", "敏": "m", "闽": "m", "明": "m", "鸣": "m", "名": "m", "命": "m", "摸": "m", "摹": "m", "模": "m", "膜": "m", "磨": "m", "末": "m", "墨": "m", "默": "m", "莫": "m", "漠": "m", "陌": "m", "谋": "m", "某": "m", "母": "m", "墓": "m", "幕": "m", "慕": "m", "木": "m", "目": "m", "牧": "m", "穆": "m",
|
|
16
|
-
"拿": "n", "纳": "n", "娜": "n", "钠": "n", "那": "n", "南": "n", "男": "n", "难": "n", "囊": "n", "挠": "n", "脑": "n", "恼": "n", "闹": "n", "嫩": "n", "能": "n", "妮": "n", "霓": "n", "泥": "n", "你": "n", "拟": "n", "逆": "n", "匿": "n", "腻": "n", "年": "n", "念": "n", "娘": "n", "酿": "n", "鸟": "n", "尿": "n", "捏": "n", "聂": "n", "孽": "n", "您": "n", "宁": "n", "凝": "n", "拧": "n", "泞": "n", "牛": "n", "扭": "n", "钮": "n", "脓": "n", "农": "n", "浓": "n", "弄": "n", "奴": "n", "努": "n", "怒": "n", "女": "n", "暖": "n", "疟": "n", "挪": "n", "诺": "n", "儒": "r",
|
|
17
|
-
"哦": "o", "噢": "o",
|
|
18
|
-
"趴": "p", "爬": "p", "帕": "p", "怕": "p", "拍": "p", "排": "p", "牌": "p", "派": "p", "攀": "p", "潘": "p", "盘": "p", "判": "p", "叛": "p", "盼": "p", "庞": "p", "旁": "p", "胖": "p", "抛": "p", "炮": "p", "跑": "p", "泡": "p", "培": "p", "赔": "p", "配": "p", "喷": "p", "盆": "p", "朋": "p", "棚": "p", "蓬": "p", "硼": "p", "鹏": "p", "碰": "p", "批": "p", "披": "p", "劈": "p", "皮": "p", "疲": "p", "匹": "p", "痞": "p", "屁": "p", "篇": "p", "偏": "p", "片": "p", "骗": "p", "飘": "p", "漂": "p", "票": "p", "撇": "p", "拼": "p", "贫": "p", "频": "p", "品": "p", "聘": "p", "平": "p", "评": "p", "屏": "p", "乒": "p", "泼": "p", "颇": "p", "破": "p", "迫": "p", "魄": "p", "剖": "p", "扑": "p", "铺": "p", "葡": "p", "蒲": "p", "朴": "p", "浦": "p", "普": "p", "谱": "p",
|
|
19
|
-
"七": "q", "期": "q", "欺": "q", "戚": "q", "妻": "q", "凄": "q", "染": "q", "栖": "q", "齐": "q", "旗": "q", "祈": "q", "其": "q", "奇": "q", "歧": "q", "畦": "q", "崎": "q", "脐": "q", "棋": "q", "企": "q", "启": "q", "起": "q", "气": "q", "弃": "q", "汽": "q", "契": "q", "砌": "q", "器": "q", "恰": "q", "洽": "q", "千": "q", "迁": "q", "签": "q", "牵": "q", "钎": "q", "铅": "q", "前": "q", "钱": "q", "潜": "q", "浅": "q", "遣": "q", "欠": "q", "枪": "q", "腔": "q", "墙": "q", "蔷": "q", "抢": "q", "强": "q", "羟": "q", "桥": "q", "乔": "q", "侨": "q", "巧": "q", "鞘": "q", "撬": "q", "峭": "q", "俏": "q", "窍": "q", "切": "q", "茄": "q", "且": "q", "窃": "q", "侵": "q", "秦": "q", "琴": "q", "勤": "q", "芹": "q", "擒": "q", "寝": "q", "青": "q", "轻": "q", "氢": "q", "倾": "q", "清": "q", "情": "q", "晴": "q", "请": "q", "庆": "q", "琼": "q", "穷": "q", "秋": "q", "求": "q", "球": "q", "区": "q", "曲": "q", "躯": "q", "屈": "q", "驱": "q", "渠": "q", "取": "q", "娶": "q", "龋": "q", "去": "q", "趣": "q", "圈": "q", "全": "q", "权": "q", "泉": "q", "拳": "q", "劝": "q", "券": "q", "缺": "q", "却": "q", "雀": "q", "确": "q", "鹊": "q", "裙": "q", "群": "q",
|
|
20
|
-
"然": "r", "燃": "r", "冉": "r", "绕": "r", "饶": "r", "热": "r", "惹": "r", "人": "r", "仁": "r", "忍": "r", "认": "r", "任": "r", "日": "r", "刃": "r", "仍": "r", "荣": "r", "绒": "r", "融": "r", "如": "r", "乳": "r", "入": "r", "软": "r", "锐": "r", "瑞": "r", "若": "r", "弱": "r",
|
|
21
|
-
"撒": "s", "洒": "s", "萨": "s", "塞": "s", "三": "s", "伞": "s", "散": "s", "桑": "s", "嗓": "s", "丧": "s", "扫": "s", "嫂": "s", "色": "s", "涩": "s", "森": "s", "僧": "s", "沙": "s", "杀": "s", "啥": "s", "傻": "s", "筛": "s", "晒": "s", "山": "s", "删": "s", "煽": "s", "衫": "s", "闪": "s", "陕": "s", "擅": "s", "膳": "s", "汕": "s", "扇": "s", "伤": "s", "商": "s", "赏": "s", "上": "s", "尚": "s", "梢": "s", "烧": "s", "稍": "s", "勺": "s", "少": "s", "绍": "s", "哨": "s", "奢": "s", "赊": "s", "蛇": "s", "舌": "s", "舍": "s", "设": "s", "社": "s", "射": "s", "涉": "s", "摄": "s", "谁": "s", "身": "s", "深": "s", "神": "s", "审": "s", "婶": "s", "肾": "s", "甚": "s", "渗": "s", "慎": "s", "声": "s", "生": "s", "升": "s", "胜": "s", "盛": "s", "省": "s", "师": "s", "失": "s", "狮": "s", "施": "s", "湿": "s", "诗": "s", "石": "s", "时": "s", "识": "s", "实": "s", "食": "s", "史": "s", "矢": "s", "使": "s", "始": "s", "驶": "s", "士": "s", "氏": "s", "市": "s", "示": "s", "世": "s", "仕": "s", "式": "s", "事": "s", "势": "s", "是": "s", "适": "s", "室": "s", "逝": "s", "释": "s", "饰": "s", "誓": "s", "收": "s", "手": "s", "守": "s", "首": "s", "受": "s", "兽": "s", "授": "s", "售": "s", "书": "s", "叔": "s", "枢": "s", "梳": "s", "淑": "s", "舒": "s", "疏": "s", "输": "s", "蔬": "s", "孰": "s", "赎": "s", "暑": "s", "黍": "s", "鼠": "s", "属": "s", "术": "s", "树": "s", "竖": "s", "数": "s", "耍": "s", "摔": "s", "帅": "s", "率": "s", "双": "s", "霜": "s", "爽": "s", "水": "s", "税": "s", "睡": "s", "顺": "s", "瞬": "s", "说": "s", "朔": "s", "烁": "s", "硕": "s", "思": "s", "司": "s", "私": "s", "死": "s", "四": "s", "寺": "s", "饲": "s", "巳": "s", "松": "s", "耸": "s", "送": "s", "宋": "s", "讼": "s", "诵": "s", "搜": "s", "艘": "s", "苏": "s", "诉": "s", "肃": "s", "素": "s", "速": "s", "粟": "s", "塑": "s", "酸": "s", "蒜": "s", "算": "s", "虽": "s", "随": "s", "碎": "s", "岁": "s", "穗": "s", "孙": "s", "损": "s", "笋": "s", "梭": "s", "唆": "s", "缩": "s", "所": "s", "索": "s", "锁": "s",
|
|
22
|
-
"他": "t", "它": "t", "她": "t", "塔": "t", "獭": "t", "挞": "t", "踏": "t", "胎": "t", "苔": "t", "抬": "t", "台": "t", "太": "t", "态": "t", "泰": "t", "坍": "t", "摊": "t", "贪": "t", "瘫": "t", "坛": "t", "谈": "t", "痰": "t", "坦": "t", "毯": "t", "炭": "t", "探": "t", "叹": "t", "汤": "t", "唐": "t", "堂": "t", "棠": "t", "塘": "t", "糖": "t", "烫": "t", "掏": "t", "涛": "t", "滔": "t", "逃": "t", "桃": "t", "陶": "t", "讨": "t", "套": "t", "特": "t", "藤": "t", "腾": "t", "疼": "t", "踢": "t", "剔": "t", "梯": "t", "提": "t", "题": "t", "蹄": "t", "体": "t", "替": "t", "天": "t", "添": "t", "甜": "t", "填": "t", "田": "t", "舔": "t", "挑": "t", "条": "t", "跳": "t", "贴": "t", "铁": "t", "厅": "t", "听": "t", "烃": "t", "停": "t", "庭": "t", "蜓": "t", "艇": "t", "通": "t", "同": "t", "铜": "t", "童": "t", "统": "t", "痛": "t", "偷": "t", "头": "t", "投": "t", "透": "t", "突": "t", "图": "t", "徒": "t", "途": "t", "土": "t", "吐": "t", "兔": "t", "团": "t", "推": "t", "腿": "t", "退": "t", "吞": "t", "屯": "t", "臀": "t", "拖": "t", "托": "t", "脱": "t", "陀": "t", "驼": "t", "椭": "t", "拓": "t",
|
|
23
|
-
"挖": "w", "哇": "w", "蛙": "w", "瓦": "w", "歪": "w", "外": "w", "弯": "w", "湾": "w", "玩": "w", "完": "w", "碗": "w", "晚": "w", "万": "w", "亡": "w", "王": "w", "往": "w", "忘": "w", "望": "w", "危": "w", "威": "w", "微": "w", "韦": "w", "为": "w", "围": "w", "唯": "w", "惟": "w", "维": "w", "伟": "w", "伪": "w", "尾": "w", "纬": "w", "委": "w", "卫": "w", "未": "w", "位": "w", "味": "w", "畏": "w", "胃": "w", "喂": "w", "文": "w", "闻": "w", "蚊": "w", "稳": "w", "问": "w", "翁": "w", "我": "w", "沃": "w", "卧": "w", "握": "w", "乌": "w", "污": "w", "屋": "w", "无": "w", "吴": "w", "五": "w", "伍": "w", "午": "w", "武": "w", "舞": "w", "务": "w", "物": "w", "误": "w",
|
|
24
|
-
"夕": "x", "西": "x", "吸": "x", "希": "x", "昔": "x", "析": "x", "矽": "x", "息": "x", "熄": "x", "悉": "x", "惜": "x", "稀": "x", "溪": "x", "锡": "x", "熙": "x", "嘻": "x", "膝": "x", "习": "x", "喜": "x", "洗": "x", "戏": "x", "细": "x", "虾": "x", "瞎": "x", "峡": "x", "侠": "x", "狭": "x", "下": "x", "夏": "x", "吓": "x", "仙": "x", "先": "x", "纤": "x", "氐": "x", "咸": "x", "贤": "x", "弦": "x", "闲": "x", "显": "x", "险": "x", "献": "x", "县": "x", "现": "x", "线": "x", "限": "x", "陷": "x", "宪": "x", "相": "x", "香": "x", "箱": "x", "镶": "x", "想": "x", "响": "x", "享": "x", "项": "x", "巷": "x", "象": "x", "像": "x", "橡": "x", "削": "x", "消": "x", "萧": "x", "硝": "x", "销": "x", "小": "x", "孝": "x", "校": "x", "笑": "x", "效": "x", "些": "x", "歇": "x", "协": "x", "邪": "x", "胁": "x", "斜": "x", "写": "x", "血": "x", "卸": "x", "蟹": "x", "泻": "x", "械": "x", "谢": "x", "新": "x", "心": "x", "信": "x", "兴": "x", "星": "x", "腥": "x", "猩": "x", "刑": "x", "形": "x", "型": "x", "醒": "x", "姓": "x", "凶": "x", "胸": "x", "雄": "x", "熊": "x", "休": "x", "修": "x", "羞": "x", "朽": "x", "秀": "x", "绣": "x", "袖": "x", "须": "x", "需": "x", "许": "x", "续": "x", "絮": "x", "婿": "x", "轩": "x", "宣": "x", "喧": "x", "旋": "x", "悬": "x", "选": "x", "薛": "x", "学": "x", "雪": "x", "寻": "x", "训": "x", "讯": "x", "迅": "x", "压": "y", "牙": "y", "芽": "y", "呀": "y", "哑": "y", "雅": "y", "亚": "y", "烟": "y", "淹": "y", "焉": "y", "阉": "y", "盐": "y", "严": "y", "研": "y", "蜒": "y", "岩": "y", "延": "y", "言": "y", "颜": "y", "阎": "y", "炎": "y", "沿": "y", "掩": "y", "眼": "y", "演": "y", "艳": "y", "宴": "y", "验": "y", "央": "y", "秧": "y", "扬": "y", "羊": "y", "阳": "y", "氧": "y", "仰": "y", "养": "y", "样": "y", "邀": "y", "腰": "y", "姚": "y", "摇": "y", "遥": "y", "窑": "y", "谣": "y", "咬": "y", "舀": "y", "药": "y", "要": "y", "耀": "y", "椰": "y", "爷": "y", "也": "y", "冶": "y", "野": "y", "业": "y", "叶": "y", "页": "y", "夜": "y", "液": "y", "一": "y", "伊": "y", "衣": "y", "医": "y", "依": "y", "仪": "y", "宜": "y", "姨": "y", "移": "y", "遗": "y", "疑": "y", "乙": "y", "已": "y", "以": "y", "艺": "y", "亿": "y", "义": "y", "亦": "y", "役": "y", "译": "y", "易": "y", "疫": "y", "益": "y", "谊": "y", "意": "y", "毅": "y", "翼": "y", "因": "y", "阴": "y", "音": "y", "银": "y", "引": "y", "印": "y", "应": "y", "英": "y", "婴": "y", "樱": "y", "鹰": "y", "迎": "y", "盈": "y", "营": "y", "映": "y", "硬": "y", "哟": "y", "用": "y", "优": "y", "忧": "y", "尤": "y", "由": "y", "邮": "y", "犹": "y", "游": "y", "有": "y", "友": "y", "右": "y", "幼": "y", "于": "y", "予": "y", "余": "y", "鱼": "y", "娱": "y", "渔": "y", "宇": "y", "羽": "y", "雨": "y", "与": "y", "玉": "y", "域": "y", "欲": "y", "狱": "y", "喻": "y", "寓": "y", "御": "y", "愈": "y", "誉": "y", "冤": "y", "元": "y", "园": "y", "原": "y", "圆": "y", "援": "y", "源": "y", "袁": "y", "怨": "y", "院": "y", "愿": "y", "月": "y", "岳": "y", "悦": "y", "阅": "y", "跃": "y", "越": "y", "云": "y", "匀": "y", "允": "y", "孕": "y", "运": "y", "韵": "y", "匝": "z", "杂": "z", "砸": "z", "灾": "z", "栽": "z", "宰": "z", "再": "z", "在": "z", "咱": "z", "暂": "z", "赞": "z", "脏": "z", "葬": "z", "遭": "z", "糟": "z", "早": "z", "枣": "z", "藻": "z", "蚤": "z", "澡": "z", "皂": "z", "灶": "z", "责": "z", "则": "z", "泽": "z", "贼": "z", "怎": "z", "增": "z", "扎": "z", "渣": "z", "闸": "z", "铡": "z", "眨": "z", "栅": "z", "榨": "z", "乍": "z", "炸": "z", "诈": "z", "摘": "z", "宅": "z", "窄": "z", "债": "z", "寨": "z", "瞻": "z", "展": "z", "盏": "z", "崭": "z", "占": "z", "战": "z", "站": "z", "张": "z", "章": "z", "彰": "z", "漳": "z", "掌": "z", "丈": "z", "涨": "z", "杖": "z", "账": "z", "照": "z", "罩": "z", "赵": "z", "遮": "z", "折": "z", "哲": "z", "者": "z", "这": "z", "浙": "z", "珍": "z", "真": "z", "甄": "z", "砧": "z", "贞": "z", "针": "z", "侦": "z", "诊": "z", "镇": "z", "震": "z", "振": "z", "帧": "z", "证": "z", "郑": "z", "政": "z", "之": "z", "支": "z", "汁": "z", "芝": "z", "枝": "z", "知": "z", "织": "z", "肢": "z", "脂": "z", "职": "z", "直": "z", "植": "z", "执": "z", "值": "z", "止": "z", "址": "z", "只": "z", "旨": "z", "指": "z", "至": "z", "志": "z", "治": "z", "致": "z", "置": "z", "中": "z", "忠": "z", "钟": "z", "衷": "z", "终": "z", "种": "z", "肿": "z", "重": "z", "仲": "z", "众": "z", "州": "z", "洲": "z", "诌": "z", "周": "z", "粥": "z", "轴": "z", "肘": "z", "帚": "z", "咒": "z", "皱": "z", "骤": "z", "珠": "z", "株": "z", "蛛": "z", "朱": "z", "猪": "z", "诸": "z", "逐": "z", "竹": "z", "烛": "z", "主": "z", "拄": "z", "煮": "z", "嘱": "z", "住": "z", "注": "z", "助": "z", "贮": "z", "柱": "z", "祝": "z", "驻": "z", "抓": "z", "爪": "z", "拽": "z", "专": "z", "砖": "z", "转": "z", "撰": "z", "赚": "z", "篆": "z", "妆": "z", "庄": "z", "装": "z", "撞": "z", "壮": "z", "状": "z", "锥": "z", "追": "z", "缀": "z", "坠": "z", "赘": "z", "准": "z", "捉": "z", "拙": "z", "卓": "z", "桌": "z", "灼": "z", "茁": "z", "浊": "z", "酌": "z", "啄": "z", "着": "z", "咨": "z", "资": "z", "姿": "z", "滋": "z", "仔": "z", "子": "z", "紫": "z", "自": "z", "渍": "z", "字": "z", "宗": "z", "综": "z", "棕": "z", "踪": "z", "总": "z", "纵": "z", "走": "z", "奏": "z", "租": "z", "足": "z", "族": "z", "阻": "z", "组": "z", "钻": "z", "最": "z", "罪": "z", "嘴": "z", "尊": "z", "遵": "z", "昨": "z", "左": "z", "佐": "z", "坐": "z", "座": "z", "做": "z"
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const firstCharMap: { [key: string]: string } = {};
|
|
28
|
-
for (const key in pinyinMap) {
|
|
29
|
-
const pinyin = pinyinMap[key];
|
|
30
|
-
if (pinyin && pinyin.length > 0) {
|
|
31
|
-
firstCharMap[key] = pinyin.charAt(0);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class InternalUitl {
|
|
36
|
-
public static getChineseInitials(str: string): string {
|
|
37
|
-
const result = this.pinyin(str, {
|
|
38
|
-
pattern: 'first',
|
|
39
|
-
toneType: 'none',
|
|
40
|
-
type: 'array'
|
|
41
|
-
});
|
|
42
|
-
if (Array.isArray(result)) {
|
|
43
|
-
return result.join('').toLowerCase();
|
|
44
|
-
}
|
|
45
|
-
return str;
|
|
46
|
-
}
|
|
47
|
-
private static pinyin(word: string, options?: any): any {
|
|
48
|
-
if (!word) return [];
|
|
49
|
-
const result: string[] = [];
|
|
50
|
-
for (let i = 0; i < word.length; i++) {
|
|
51
|
-
const char = word.charAt(i);
|
|
52
|
-
const py = pinyinMap[char];
|
|
53
|
-
if (py) {
|
|
54
|
-
if (options && options.pattern === 'first') {
|
|
55
|
-
result.push(py.charAt(0));
|
|
56
|
-
} else {
|
|
57
|
-
result.push(py);
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
result.push(char);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
}
|
package/drscript/ad/AdManager.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import TvUiConfigManager from "../config/TvUiConfigManager";
|
|
2
|
-
import { TvUiAdChannelConfig, TvUiAdSlotConfig } from "../config/TvUiConfig";
|
|
3
|
-
import IAdProvider, { AdRuntimeData, AdShowOptions, AdShowResult } from "./IAdProvider";
|
|
4
|
-
import AggregateAdProvider from "./AggregateAdProvider";
|
|
5
|
-
import SelfAdProvider from "./SelfAdProvider";
|
|
6
|
-
import MockAdProvider from "./MockAdProvider";
|
|
7
|
-
|
|
8
|
-
export default class AdManager {
|
|
9
|
-
private static providers: { [type: string]: IAdProvider } = {};
|
|
10
|
-
|
|
11
|
-
public static init() {
|
|
12
|
-
this.providers = {};
|
|
13
|
-
this.registerProvider(new AggregateAdProvider());
|
|
14
|
-
this.registerProvider(new SelfAdProvider());
|
|
15
|
-
this.registerProvider(new MockAdProvider());
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static registerProvider(provider: IAdProvider) {
|
|
19
|
-
if (!provider || !provider.type) return;
|
|
20
|
-
this.providers[provider.type] = provider;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public static showSlot(slotId: string, options: AdShowOptions = {}): Promise<boolean> {
|
|
24
|
-
let slotConfig = this.getSlotConfig(slotId);
|
|
25
|
-
if (!slotConfig || slotConfig.enabled === false) {
|
|
26
|
-
if (options.onFail) options.onFail({ message: "ad slot disabled", slotId: slotId });
|
|
27
|
-
return Promise.resolve(false);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let channels = this.getSortedChannels(slotConfig);
|
|
31
|
-
return this.showByChannels(slotId, slotConfig, options, channels, 0, null).then((result: AdShowResult) => {
|
|
32
|
-
if (result && (result.status == "success" || result.status == "loaded")) return true;
|
|
33
|
-
if (result && result.status == "closed") return false;
|
|
34
|
-
if (options.onFail) {
|
|
35
|
-
options.onFail((result && result.error) || { message: "all ad channels failed", slotId: slotId });
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public static hideSlot(slotId: string) {
|
|
42
|
-
let slotConfig = this.getSlotConfig(slotId);
|
|
43
|
-
let channels = slotConfig ? this.getSortedChannels(slotConfig) : [];
|
|
44
|
-
if (channels.length > 0) {
|
|
45
|
-
for (let i = 0; i < channels.length; i++) {
|
|
46
|
-
let channel = channels[i];
|
|
47
|
-
let provider = channel && this.providers[channel.type];
|
|
48
|
-
if (provider) provider.hide(slotId, channel);
|
|
49
|
-
}
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
for (let type in this.providers) {
|
|
53
|
-
if (this.providers.hasOwnProperty(type)) this.providers[type].hide(slotId);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public static refreshSlot(slotId: string, options: AdShowOptions = {}) {
|
|
58
|
-
this.hideSlot(slotId);
|
|
59
|
-
return this.showSlot(slotId, options);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public static showReward(options: AdShowOptions): Promise<boolean> {
|
|
63
|
-
options = this.mergeOptions(options, { mode: "reward" });
|
|
64
|
-
return this.showSlot((options && options.slotId) || "reward", options);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public static showPopup(options: AdShowOptions): Promise<boolean> {
|
|
68
|
-
options = this.mergeOptions(options, { mode: "popup" });
|
|
69
|
-
return this.showSlot((options && options.slotId) || (options && options.scene) || "popup", options);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public static hidePopup(scene?: string) {
|
|
73
|
-
this.hideSlot(scene || "popup");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
private static getSlotConfig(slotId: string): TvUiAdSlotConfig {
|
|
77
|
-
let config = TvUiConfigManager.getConfig();
|
|
78
|
-
let ads = config.ads || {};
|
|
79
|
-
return ads[slotId] || ads["popup"] || null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private static showByChannels(
|
|
83
|
-
slotId: string,
|
|
84
|
-
slotConfig: TvUiAdSlotConfig,
|
|
85
|
-
options: AdShowOptions,
|
|
86
|
-
channels: TvUiAdChannelConfig[],
|
|
87
|
-
index: number,
|
|
88
|
-
lastError: any
|
|
89
|
-
): Promise<AdShowResult> {
|
|
90
|
-
if (index >= channels.length) {
|
|
91
|
-
return Promise.resolve({ status: "failed", error: lastError || { message: "ad channels empty", slotId: slotId } });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let channel = channels[index];
|
|
95
|
-
if (!channel || channel.enabled === false) {
|
|
96
|
-
return this.showByChannels(slotId, slotConfig, options, channels, index + 1, lastError);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
let provider = this.providers[channel.type];
|
|
100
|
-
if (!provider) {
|
|
101
|
-
return this.showByChannels(slotId, slotConfig, options, channels, index + 1, { message: "ad provider missing", channel: channel.type });
|
|
102
|
-
}
|
|
103
|
-
if (!provider.isAvailable()) {
|
|
104
|
-
return this.showByChannels(slotId, slotConfig, options, channels, index + 1, { message: "ad provider unavailable", channel: channel.type });
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
let data: AdRuntimeData = {
|
|
108
|
-
slotId: slotId,
|
|
109
|
-
slotConfig: slotConfig,
|
|
110
|
-
channel: channel,
|
|
111
|
-
options: options
|
|
112
|
-
};
|
|
113
|
-
return provider.load(data).then((runtimeData: AdRuntimeData) => {
|
|
114
|
-
return provider.show(runtimeData);
|
|
115
|
-
}).then((result: AdShowResult) => {
|
|
116
|
-
if (!result || result.status == "failed") {
|
|
117
|
-
if (options && options.mode == "reward") return result || <AdShowResult>{ status: "failed", error: lastError };
|
|
118
|
-
return this.showByChannels(slotId, slotConfig, options, channels, index + 1, result && (result.error || result.data));
|
|
119
|
-
}
|
|
120
|
-
return result;
|
|
121
|
-
}).catch((error: any) => {
|
|
122
|
-
if (options && options.mode == "reward") return <AdShowResult>{ status: "failed", error: error };
|
|
123
|
-
return this.showByChannels(slotId, slotConfig, options, channels, index + 1, error);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
private static getSortedChannels(slotConfig: TvUiAdSlotConfig): TvUiAdChannelConfig[] {
|
|
128
|
-
let channels: TvUiAdChannelConfig[] = [];
|
|
129
|
-
let configured = (slotConfig && slotConfig.channels) || [];
|
|
130
|
-
for (let i = 0; i < configured.length; i++) {
|
|
131
|
-
if (configured[i]) channels.push(configured[i]);
|
|
132
|
-
}
|
|
133
|
-
if (slotConfig && slotConfig.fallback) {
|
|
134
|
-
channels.push(this.normalizeFallback(slotConfig.fallback));
|
|
135
|
-
}
|
|
136
|
-
if (!this.hasChannelType(channels, "mock")) {
|
|
137
|
-
channels.push({ type: "mock", priority: 100 });
|
|
138
|
-
}
|
|
139
|
-
channels.sort((a: TvUiAdChannelConfig, b: TvUiAdChannelConfig) => {
|
|
140
|
-
return this.getPriority(a) - this.getPriority(b);
|
|
141
|
-
});
|
|
142
|
-
return channels;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
private static normalizeFallback(fallback: TvUiAdChannelConfig): TvUiAdChannelConfig {
|
|
146
|
-
if (fallback.type) return fallback;
|
|
147
|
-
let result: any = this.mergeOptions(<any>fallback, {});
|
|
148
|
-
result.type = (fallback.imagePath || fallback.imageUrl) ? "self" : "mock";
|
|
149
|
-
if (result.priority === undefined) result.priority = 90;
|
|
150
|
-
return result;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
private static hasChannelType(channels: TvUiAdChannelConfig[], type: string): boolean {
|
|
154
|
-
for (let i = 0; i < channels.length; i++) {
|
|
155
|
-
if (channels[i] && channels[i].type == type) return true;
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
private static getPriority(channel: TvUiAdChannelConfig): number {
|
|
161
|
-
if (!channel || channel.priority === undefined) return 999;
|
|
162
|
-
return channel.priority;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
private static mergeOptions(base: AdShowOptions, extra: AdShowOptions): AdShowOptions {
|
|
166
|
-
let result: any = {};
|
|
167
|
-
let key: string;
|
|
168
|
-
base = base || {};
|
|
169
|
-
extra = extra || {};
|
|
170
|
-
for (key in base) result[key] = (<any>base)[key];
|
|
171
|
-
for (key in extra) result[key] = (<any>extra)[key];
|
|
172
|
-
return result;
|
|
173
|
-
}
|
|
174
|
-
}
|
package/drscript/ad/AdSlot.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import AdManager from "./AdManager";
|
|
2
|
-
|
|
3
|
-
const { ccclass, property } = cc._decorator;
|
|
4
|
-
|
|
5
|
-
@ccclass
|
|
6
|
-
export default class AdSlot extends cc.Component {
|
|
7
|
-
@property
|
|
8
|
-
slotId: string = "popup";
|
|
9
|
-
|
|
10
|
-
@property
|
|
11
|
-
showOnLoad: boolean = false;
|
|
12
|
-
|
|
13
|
-
onEnable() {
|
|
14
|
-
if (this.showOnLoad) this.show();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
onDisable() {
|
|
18
|
-
this.hide();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public show() {
|
|
22
|
-
AdManager.showSlot(this.slotId, { container: this.node });
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public hide() {
|
|
26
|
-
AdManager.hideSlot(this.slotId);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public refresh() {
|
|
30
|
-
AdManager.refreshSlot(this.slotId, { container: this.node });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public static show(slotId: string) {
|
|
34
|
-
return AdManager.showSlot(slotId);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public static hide(slotId: string) {
|
|
38
|
-
AdManager.hideSlot(slotId);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public static refresh(slotId: string) {
|
|
42
|
-
return AdManager.refreshSlot(slotId);
|
|
43
|
-
}
|
|
44
|
-
}
|