= [];
8 | private numsLen: number = 0;
9 | private numSum: number = 0;
10 |
11 | /**
12 | * 构造函数
13 | * @param $maxNum 参与计算的最大值
14 | */
15 | public constructor($maxNum: number = 10) {
16 | this.maxNum = $maxNum;
17 | }
18 |
19 | /**
20 | * 加入一个值
21 | * @param value
22 | */
23 | public push(value: number): void {
24 | if (this.numsLen > this.maxNum) {
25 | this.numsLen--;
26 | this.numSum -= this.nums.shift();
27 | }
28 | this.nums.push(value);
29 | this.numSum += value;
30 | this.numsLen++;
31 | }
32 |
33 | /**
34 | * 获取平均值
35 | * @returns {number}
36 | */
37 | public getValue(): number {
38 | return this.numSum / this.numsLen;
39 | }
40 |
41 | /**
42 | * 清空
43 | */
44 | public clear(): void {
45 | this.nums.splice(0);
46 | this.numsLen = 0;
47 | this.numSum = 0;
48 | }
49 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/AverageUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "774b4a36-ad3c-44d4-9b21-3ee6bfff2292",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/DateUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "c360d5af-018b-4200-84b1-fde0f267e739",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/DebugUtils.ts:
--------------------------------------------------------------------------------
1 | import BaseClass from "../base/BaseClass";
2 |
3 | /**
4 | * Debug调试工具
5 | */
6 | export default class DebugUtils extends BaseClass {
7 |
8 | private _isOpen: boolean;
9 | private _startTimes: any;
10 | private _threshold: number = 3;
11 |
12 | public constructor() {
13 | super();
14 | this._startTimes = {};
15 | }
16 |
17 | /**
18 | * 设置调试是否开启
19 | * @param flag
20 | */
21 | public isOpen(flag: boolean): void {
22 | this._isOpen = flag;
23 | }
24 |
25 | /**
26 | * 是否是调试模式
27 | * @returns {boolean}
28 | */
29 | public get isDebug(): boolean {
30 | return this._isOpen;
31 | }
32 |
33 | /**
34 | * 开始
35 | * @param key 标识
36 | * @param minTime 最小时间
37 | */
38 | public start(key: string): void {
39 | if (!this._isOpen) {
40 | return;
41 | }
42 | // this._startTimes[key] = egret.getTimer();
43 | }
44 |
45 | /**
46 | * 停止
47 | */
48 | public stop(key): number {
49 | if (!this._isOpen) {
50 | return 0;
51 | }
52 |
53 | if (!this._startTimes[key]) {
54 | return 0;
55 | }
56 |
57 | // var cha: number = egret.getTimer() - this._startTimes[key];
58 | // if (cha > this._threshold) {
59 | // Log.trace(key + ": " + cha);
60 | // }
61 | // return cha;
62 | }
63 |
64 | /**
65 | * 设置时间间隔阈值
66 | * @param value
67 | */
68 | public setThreshold(value: number): void {
69 | this._threshold = value;
70 | }
71 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/DebugUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "0f498c33-9cb1-4c3a-8fa3-efcf954f5cfa",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/DeviceUtils.ts:
--------------------------------------------------------------------------------
1 | import BaseClass from "../base/BaseClass";
2 |
3 | export default class DeviceUtils extends BaseClass {
4 |
5 | /**
6 | * 构造函数
7 | */
8 | public constructor() {
9 | super();
10 | }
11 |
12 | /**
13 | * 当前是否Html5版本
14 | * @returns {boolean}
15 | * @constructor
16 | */
17 | public get IsHtml5(): boolean {
18 | return cc.sys.isBrowser;
19 | }
20 |
21 | /**
22 | * 当前是否是Native版本
23 | * @returns {boolean}
24 | * @constructor
25 | */
26 | public get IsNative(): boolean {
27 | return cc.sys.isNative;
28 | }
29 |
30 | /**
31 | * 当前是否是微信小游戏版本
32 | * @returns {boolean}
33 | * @constructor
34 | */
35 | public get IsWxGame(): boolean {
36 | return cc.sys.platform == cc.sys.WECHAT_GAME;
37 | }
38 |
39 | /**
40 | * 当前是否是微端版本
41 | */
42 | public get IsMicroClient(): boolean {
43 | return true;
44 | }
45 |
46 | /**
47 | * 当前是否是微端WebView
48 | */
49 | public get IsMicroClientWebView(): boolean {
50 | return this.IsMicroClient && this.IsHtml5;
51 | }
52 |
53 | /**
54 | * 当前是否是微端Runtime
55 | */
56 | public get IsMicroClientRuntime(): boolean {
57 | return this.IsMicroClient && !this.IsHtml5;
58 | }
59 |
60 | /**
61 | * 是否是在手机上
62 | * @returns {boolean}
63 | * @constructor
64 | */
65 | public get IsMobile(): boolean {
66 | return cc.sys.isMobile;
67 | }
68 |
69 | /**
70 | * 是否是在PC上
71 | * @returns {boolean}
72 | * @constructor
73 | */
74 | public get IsPC(): boolean {
75 | return !cc.sys.isMobile;
76 | }
77 |
78 | /**
79 | * 是否是QQ浏览器
80 | * @returns {boolean}
81 | * @constructor
82 | */
83 | public get IsQQBrowser(): boolean {
84 | return this.IsHtml5 && navigator.userAgent.indexOf('MQQBrowser') != -1;
85 | }
86 |
87 | /**
88 | * 是否是IE浏览器
89 | * @returns {boolean}
90 | * @constructor
91 | */
92 | public get IsIEBrowser(): boolean {
93 | return this.IsHtml5 && navigator.userAgent.indexOf("MSIE") != -1;
94 | }
95 |
96 | /**
97 | * 是否是Firefox浏览器
98 | * @returns {boolean}
99 | * @constructor
100 | */
101 | public get IsFirefoxBrowser(): boolean {
102 | return this.IsHtml5 && navigator.userAgent.indexOf("Firefox") != -1;
103 | }
104 |
105 | /**
106 | * 是否是Chrome浏览器
107 | * @returns {boolean}
108 | * @constructor
109 | */
110 | public get IsChromeBrowser(): boolean {
111 | return this.IsHtml5 && navigator.userAgent.indexOf("Chrome") != -1;
112 | }
113 |
114 | /**
115 | * 是否是Safari浏览器
116 | * @returns {boolean}
117 | * @constructor
118 | */
119 | public get IsSafariBrowser(): boolean {
120 | return this.IsHtml5 && navigator.userAgent.indexOf("Safari") != -1;
121 | }
122 |
123 | /**
124 | * 是否是Opera浏览器
125 | * @returns {boolean}
126 | * @constructor
127 | */
128 | public get IsOperaBrowser(): boolean {
129 | return this.IsHtml5 && navigator.userAgent.indexOf("Opera") != -1;
130 | }
131 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/DeviceUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "ab54462e-4025-4a4f-a964-35d183a7f543",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/Dictionary.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "9e1272a2-448c-41aa-ac1f-c0214d2683c7",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/GlobalDefine.ts:
--------------------------------------------------------------------------------
1 | export function isNull(obj: any) {
2 | return obj == undefined || obj == null;
3 | }
4 |
5 | /**
6 | * Mixin,组合可重用组件来创建类
7 | */
8 | export function applyMixins(derivedCtor: any, baseCtors: any[]) {
9 | baseCtors.forEach(baseCtor => {
10 | Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
11 | derivedCtor.prototype[name] = baseCtor.prototype[name];
12 | })
13 | });
14 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/GlobalDefine.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "b011926b-f4a9-43c2-80df-c4726380242d",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/JsNativeBridge.ts:
--------------------------------------------------------------------------------
1 | import Log from "./Log";
2 | import App from "../App";
3 |
4 | /**
5 | *
6 | */
7 | export default class JsNativeBridge {
8 |
9 | /**
10 | * 反射调用原生静态方法
11 | * @param className 安卓是全路径类名,iOS是类名即可
12 | * @param methodName iOS需要是完整的方法名 callNativeUIWithTitle:andContent:
13 | * @param parameters 0个或任意多个参数
14 | * @param methodSignature 方法签名正是用来帮助区分这些相同名字的方法(重载方法)
15 | * ()V,它表示一个没有参数没有返回值的方法
16 | * (I)V 表示参数为一个int,没有返回值的方法
17 | * (Ljava/lang/String;)I 表示参数为一个string,返回值为int的方法
18 | * (IF)Z 表示参数为一个int和一个float,返回值为boolean的方法
19 | */
20 | static callStaticMethod(className: string, methodName: string, parameters:any, methodSignature?: string) {
21 | if (!App.DeviceUtils.IsNative) {
22 | return -1;
23 | }
24 | Log.info(" JsNativeBridge callStaticMethod = ", methodName, " parameters = ", parameters);
25 | if (cc.sys.os == cc.sys.OS_IOS) {
26 | let result = jsb.reflection.callStaticMethod(className, methodName, parameters);
27 | if (result) {
28 | Log.info("callStaticMethod ios result = ", result);
29 | }
30 | } else {
31 | let result = jsb.reflection.callStaticMethod(className, methodName, methodSignature, parameters)
32 | if (result) {
33 | Log.info("callStaticMethod android result = ", result);
34 | return result;
35 | }
36 | }
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/JsNativeBridge.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "4a19505d-78d1-4ad8-9021-8b68c6b4119b",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/LocalStorageUtils.ts:
--------------------------------------------------------------------------------
1 | export default class LocalStorageUtils {
2 |
3 | private static hashID: string;
4 |
5 | public static setHashID(openid: string): void {
6 | LocalStorageUtils.hashID = openid;
7 | LocalStorageUtils.setItem('hashID', openid, true);
8 | }
9 |
10 | public static getHashID(): string {
11 | return LocalStorageUtils.getItem('hashID', true);
12 | }
13 |
14 | public static setItem(key: string, value: string, isGlobal: boolean = false): void {
15 | if (isGlobal) {
16 | cc.sys.localStorage.setItem(key, value);
17 | } else {
18 | cc.sys.localStorage.setItem(`${LocalStorageUtils.hashID}_${key}`, value);
19 | }
20 | }
21 |
22 | public static getItem(key: string, isGlobal: boolean = false): string {
23 | if (isGlobal) {
24 | return cc.sys.localStorage.getItem(key);
25 | } else {
26 | return cc.sys.localStorage.getItem(`${LocalStorageUtils.hashID}_${key}`);
27 | }
28 | }
29 |
30 | public static removeItem(key: string, isGlobal: boolean = false): void {
31 | if (isGlobal) {
32 | cc.sys.localStorage.removeItem(key);
33 | } else {
34 | cc.sys.localStorage.removeItem(`${LocalStorageUtils.hashID}_${key}`);
35 | }
36 | }
37 |
38 | public static clearAll(): void {
39 | cc.sys.localStorage.clear();
40 | }
41 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/LocalStorageUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "7384a566-45e6-4db6-9bba-db1f988317b7",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/Log.ts:
--------------------------------------------------------------------------------
1 | import App from "../App";
2 |
3 | export default class Log {
4 |
5 | private static getDateString(): string {
6 | let d = new Date();
7 | let str = d.getHours().toString();
8 | let timeStr = "";
9 | timeStr += (str.length == 1 ? "0" + str : str) + ":";
10 | str = d.getMinutes().toString();
11 | timeStr += (str.length == 1 ? "0" + str : str) + ":";
12 | str = d.getSeconds().toString();
13 | timeStr += (str.length == 1 ? "0" + str : str) + ":";
14 | str = d.getMilliseconds().toString();
15 | if (str.length == 1) str = "00" + str;
16 | if (str.length == 2) str = "0" + str;
17 | timeStr += str;
18 |
19 | timeStr = "[" + timeStr + "]";
20 | return timeStr;
21 | }
22 |
23 | private static stack(index): string {
24 | var e = new Error();
25 | var lines = e.stack.split("\n");
26 | lines.shift();
27 | var result = [];
28 | lines.forEach(function (line) {
29 | line = line.substring(7);
30 | var lineBreak = line.split(" ");
31 | if (lineBreak.length < 2) {
32 | result.push(lineBreak[0]);
33 | } else {
34 | result.push({[lineBreak[0]]: lineBreak[1]});
35 | }
36 | });
37 |
38 | var list = [];
39 | if (index < result.length - 1) {
40 | for (var a in result[index]) {
41 | list.push(a);
42 | }
43 | }
44 |
45 | var splitList = list[0].split(".");
46 | if(splitList[0] == "Function")
47 | {
48 | return (splitList[1] + "." + splitList[2] + ": ");
49 | }
50 | else
51 | {
52 | return (splitList[0] + "." + splitList[1] + ": ");
53 | }
54 | }
55 |
56 | /**
57 | * 打印
58 | * @param args 内容
59 | */
60 | public static info(...args): void {
61 | if (App.DebugUtils.isDebug) {
62 | var backLog = console.log || cc.log;
63 | backLog.call(this, Log.getDateString(), Log.stack(2), cc.js.formatStr.apply(cc, arguments));
64 | }
65 | }
66 |
67 | /**
68 | * 警告
69 | * @param args 内容
70 | */
71 | public static warn(...args) {
72 | if (App.DebugUtils.isDebug) {
73 | var backLog = console.log || cc.log;
74 | backLog.call(this, "[WARN]", Log.getDateString(), Log.stack(2), cc.js.formatStr.apply(cc, arguments));
75 | }
76 | }
77 |
78 | /**
79 | * 错误
80 | * @param args 内容
81 | */
82 | public static error(...args) {
83 | if (App.DebugUtils.isDebug) {
84 | var backLog = console.log || cc.log;
85 | backLog.call(this, "[ERROR]", Log.getDateString(), Log.stack(2), cc.js.formatStr.apply(cc, arguments));
86 | }
87 | }
88 |
89 | /**
90 | * 打印堆栈
91 | * @param args 内容
92 | */
93 | public static trace(...args): void {
94 | if (App.DebugUtils.isDebug) {
95 | var backLog = console.log || cc.log;
96 | var e = new Error();
97 | var lines = e.stack.split("\n");
98 | lines.shift();
99 | var result = [];
100 | lines.forEach(function (line) {
101 | backLog.call(this, line);
102 | });
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/Log.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "e00bfaba-ec7b-4737-811c-db45dade2573",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/MathUtils.ts:
--------------------------------------------------------------------------------
1 | import BaseClass from "../base/BaseClass";
2 |
3 | /**
4 | * 数学计算工具类
5 | */
6 | export default class MathUtils extends BaseClass {
7 |
8 | /**
9 | * 弧度制转换为角度值
10 | * @param radian 弧度制
11 | * @returns {number}
12 | */
13 | public getAngle(radian: number): number {
14 | return 180 * radian / Math.PI;
15 | }
16 |
17 | /**
18 | * 角度值转换为弧度制
19 | * @param angle
20 | */
21 | public getRadian(angle: number): number {
22 | return angle / 180 * Math.PI;
23 | }
24 |
25 | /**
26 | * 获取两点间弧度
27 | * @param p1X
28 | * @param p1Y
29 | * @param p2X
30 | * @param p2Y
31 | * @returns {number}
32 | */
33 | public getRadian2(p1X: number, p1Y: number, p2X: number, p2Y: number): number {
34 | var xdis: number = p2X - p1X;
35 | var ydis: number = p2Y - p1Y;
36 | return Math.atan2(ydis, xdis);
37 | }
38 |
39 | /**
40 | * 获取两点间距离
41 | * @param p1X
42 | * @param p1Y
43 | * @param p2X
44 | * @param p2Y
45 | * @returns {number}
46 | */
47 | public getDistance(p1X: number, p1Y: number, p2X: number, p2Y: number): number {
48 | var disX: number = p2X - p1X;
49 | var disY: number = p2Y - p1Y;
50 | var disQ: number = disX * disX + disY * disY;
51 | return Math.sqrt(disQ);
52 | }
53 |
54 | /**
55 | * 获取区间随机数
56 | * @param min 最小值
57 | * @param max 最大值
58 | * @returns {number} 随机数
59 | */
60 | public get_random_interval(min: number, max: number) {
61 | return Math.floor(Math.random() * (max - min + 1) + min);
62 | }
63 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/MathUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "e687880a-5060-4c0f-b570-4031354412ae",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/MessageCenter.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "297798ba-8eab-4832-80be-39a37b7e3492",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/ObjectPool.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "a0495392-f65f-4ebb-b97b-65c03e54203c",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/PathUtils.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 路径相关的实用函数。
3 | */
4 | import BaseClass from "../base/BaseClass";
5 |
6 | export default class PathUtils extends BaseClass {
7 |
8 | /**
9 | * 获取规范的路径。
10 | */
11 | public getRegularPath(path: string): string {
12 | if (path == null) {
13 | return null;
14 | }
15 | return path.replace('\\', '/');
16 | }
17 |
18 | /**
19 | * 获取连接后的路径。
20 | */
21 | public getCombinePath(...path: string[]): string {
22 | if (path == null || path.length < 1) {
23 | return null;
24 | }
25 |
26 | var combinePath: string = path[0];
27 | for (var i = 1; i < path.length; i++) {
28 | combinePath = combinePath + "/" + path[i];
29 | }
30 | return this.getRegularPath(combinePath);
31 | }
32 |
33 | /**
34 | * 获取远程格式的路径(带有file:// 或 http:// 前缀)。
35 | */
36 | public getRemotePath(...path: string[]): string {
37 | var combinePath = this.getCombinePath(...path);
38 | if (combinePath == null) {
39 | return null;
40 | }
41 |
42 | var remotePath: string;
43 | if (combinePath.indexOf("://") != -1) {
44 | return combinePath;
45 | } else {
46 | return ("https:///" + combinePath).replace("https:////", "https:///");
47 | }
48 | }
49 |
50 | /**
51 | * 根据文件路径获取文件的完整名称
52 | */
53 | public getFileNameInPath(path: string): string {
54 | var inde: number = path.lastIndexOf("/")
55 | if (inde != -1) {
56 | return path.substr(inde + 1, path.length);
57 | }
58 | return path;
59 | }
60 |
61 | /**
62 | * 根据文件路径获取文件的后缀名
63 | */
64 | public getExtensionByFilePath(filePath: string): string {
65 | if (filePath.lastIndexOf('.') == -1)
66 | return null;
67 |
68 | return filePath.substr(filePath.lastIndexOf('.') + 1, filePath.length);
69 | }
70 |
71 | /**
72 | * 从带后缀名的文件名中提取出文件名
73 | */
74 | public getFileNameWithoutExtension(fileName: string) {
75 | if (fileName.lastIndexOf('.') == -1)
76 | return fileName;
77 |
78 | return fileName.substr(0, fileName.lastIndexOf('.'));
79 | }
80 |
81 | /**
82 | * 通过路径获得最后一个文件夹的父路径
83 | */
84 | public getParentPathOfLastFoulder(path: string): string {
85 | for (var n = path.length - 1; 0 <= n; n--) {
86 | if (path[n] == '/' || path[n] == '\\')
87 | if (n != path.length - 1)
88 | return path.substr(0, n);
89 | }
90 | return "";
91 | }
92 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/PathUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "f39195e1-505f-40d6-98a6-ebfe37244119",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/StageUtils.ts:
--------------------------------------------------------------------------------
1 | import BaseClass from "../base/BaseClass";
2 |
3 | export default class StageUtils extends BaseClass{
4 | /** UIStage单例 */
5 | private static _uiStage: cc.Node;
6 |
7 | private static _stage:cc.Node;
8 |
9 | /**
10 | * 构造函数
11 | */
12 | public constructor() {
13 | super();
14 |
15 | let canvas = cc.find("Canvas");
16 |
17 | if (StageUtils._stage == null) {
18 | StageUtils._stage = new cc.Node();
19 | StageUtils._stage.name = "Stage";
20 | canvas.addChild(StageUtils._stage);
21 | }
22 |
23 | if (StageUtils._uiStage == null) {
24 | StageUtils._uiStage = new cc.Node();
25 | StageUtils._uiStage.name = "UIStage";
26 | canvas.addChild(StageUtils._uiStage);
27 | }
28 | }
29 |
30 | public getStage():cc.Node
31 | {
32 | return StageUtils._stage;
33 | }
34 |
35 | public getCCUIStage():cc.Node
36 | {
37 | return StageUtils._uiStage;
38 | }
39 |
40 | public clear():void
41 | {
42 | StageUtils._uiStage.cleanup();
43 | StageUtils._uiStage = null;
44 | StageUtils._stage.cleanup();
45 | StageUtils._stage = null;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/StageUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "7a94b2be-37b2-48ed-be87-92278216311c",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/StringUtils.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * 字符串操作工具类
3 | */
4 | import BaseClass from "../base/BaseClass";
5 |
6 | export default class StringUtils extends BaseClass {
7 |
8 | /**
9 | * 去掉前后空格
10 | * @param str
11 | * @returns {string}
12 | */
13 | public trimSpace(str: string): string {
14 | return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
15 | }
16 |
17 | /**
18 | * 获取字符串长度,中文为2
19 | * @param str
20 | */
21 | public getStringLength(str: string): number {
22 | var strArr = str.split("");
23 | var length = 0;
24 | for (var i = 0; i < strArr.length; i++) {
25 | var s = strArr[i];
26 | if (this.isChinese(s)) {
27 | length += 2;
28 | } else {
29 | length += 1;
30 | }
31 | }
32 | return length;
33 | }
34 |
35 | /**
36 | * 判断一个字符串是否包含中文
37 | * @param str
38 | * @returns {boolean}
39 | */
40 | public isChinese(str: string): boolean {
41 | var reg = /^.*[\u4E00-\u9FA5]+.*$/;
42 | return reg.test(str);
43 | }
44 |
45 | public Format(str: string, ...val: string[]): string {
46 | for (let index = 0; index < val.length; index++) {
47 | str = str.replace(`{${index}}`, val[index]);
48 | }
49 | return str;
50 | }
51 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/StringUtils.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "5ee891f2-9e96-4525-a7e7-056d7ba61177",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_framework/utils/TimerManager.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "dc352bd5-2045-4b9f-af17-2da8e6b826f5",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "c091bc41-0477-4e0b-9442-87abbec3fc51",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "20226816-7922-42c2-a361-ab949d3927fa",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/ControllerConst.ts:
--------------------------------------------------------------------------------
1 | export enum ControllerConst {
2 | Loading = 10000,
3 | Login,
4 | Home,
5 | Friend,
6 | Shop,
7 | Warehouse,
8 | Factory,
9 | Task,
10 | Mail,
11 | Game,
12 | RpgGame,
13 | Gold_Select,
14 | Settlement,
15 | Friend_Room_Enter,
16 | Chat,
17 | /** 签到 */
18 | Sign_In,
19 | /** 福利 */
20 | Welfare,
21 | /** 设置 */
22 | Set,
23 | Recharge,
24 | /** 公告 */
25 | Proclamation,
26 | PersonalInfo
27 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/ControllerConst.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "fe890650-7954-463b-a9b4-b6c4dea8d1c3",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/LocalStorageConst.ts:
--------------------------------------------------------------------------------
1 | export default class LocalStorageConst {
2 |
3 | public static local_res_version: string = "local_res_version";
4 | public static cached_default_res_json_url: string = "cached_default_res_json_url";
5 | public static cached_game_areaId = "cur_areaId";// 存储当前游戏areaid
6 | public static cached_cur_serverId = "cur_serverId";// 存储当前serverId
7 | /** 音乐开关状态 */
8 | public static music_switch_status: string = "music_switch_status";
9 | /** 音效开关状态 */
10 | public static sound_switch_status: string = "sound_switch_status";
11 | /** 震动开关状态 */
12 | public static shock_switch_status: string = "shock_switch_status";
13 | /** 方言开关状态 */
14 | public static dialect_switch_status: string = "dialect_switch_status";
15 | /** 单击出牌开关状态 */
16 | public static click_out_switch_status: string = "click_out_switch_status";
17 | /** 放大出牌开关状态 */
18 | public static enlarge_switch_status: string = "enlarge_switch_status";
19 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/LocalStorageConst.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "22d5b800-efb0-471b-926a-dcc504a7931b",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/SceneConsts.ts:
--------------------------------------------------------------------------------
1 | export enum SceneConsts {
2 | /**
3 | * Game场景
4 | * @type {number}
5 | */
6 | Game = 1,
7 |
8 | /**
9 | * 登录场景
10 | * @type {number}
11 | */
12 | Login,
13 |
14 | /**
15 | * 游戏场景
16 | * @type {number}
17 | */
18 | UI,
19 |
20 | /**
21 | * Loading场景
22 | * @type {number}
23 | */
24 | LOADING,
25 |
26 | /**
27 | * RpgGame场景
28 | * @type {number}
29 | */
30 | RpgGame,
31 | }
32 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/SceneConsts.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "1c322531-5e9c-419c-9a66-a5eee79d3ed1",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/ViewConst.ts:
--------------------------------------------------------------------------------
1 | export enum ViewConst {
2 | Loading = 10000,
3 | Login,
4 | Home,
5 | Friend,
6 | Shop,
7 | ShopDetal,
8 | Warehouse,
9 | Factory,
10 | Task,
11 | Daily,
12 | Mail,
13 | Gold_Select,
14 | Settlement,
15 | Create_Friend_Room,
16 | Join_Friend_Room,
17 | Chat,
18 | /** 福利 */
19 | Welfare,
20 | /** 签到 */
21 | SignIn,
22 | /** 救济金 */
23 | Relief,
24 | Set,
25 | Proclamation,
26 | TotalSettlement,
27 | DisMissRoom,
28 | PersonalInfo,
29 | Rule,
30 | Game = 20000,
31 | GameUI,
32 | RpgGame,
33 | }
34 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/consts/ViewConst.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "015e1fcf-27d9-409c-8e7f-0076b99cccf6",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/misc.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "b409d315-e593-479a-8180-874e3718ef88",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/misc/FairyGUIUtil.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "e6878e4a-4ddc-4df2-8934-e70aa538e942",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "ae6d1ca4-6aa6-43b8-b1ba-a229cb879576",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "9f3769f1-bff9-4bea-9b42-b5639347a1ca",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/LoginConst.ts:
--------------------------------------------------------------------------------
1 | export default class LoginConst {
2 | public static LOGIN_ACCOUNT_C2S: number = 10001;
3 | public static LOGIN_SDK_C2S: number = 10002;
4 | public static LOGIN_RES_S2C: number = 10003;
5 | public static REFRESH_PLAY_COUNT: number = 10004;
6 |
7 | public static LOGIN_UI_PKG = {
8 | "name":"MainMenu",
9 | "path":"ui/MainMenu"
10 | }
11 | }
12 |
13 | enum LoginBgClickStatus {
14 | /**不可触摸*/
15 | UNTOUCHABLE = 0,
16 |
17 | /**请求GlobalInfo信息*/
18 | REQUEST_GLOBAL_INFO,
19 |
20 | /**请求资源版本信息*/
21 | REQUEST_RESOURCE_VERSION,
22 |
23 | /**请求SDK登录*/
24 | REQUEST_SDK_LOGIN,
25 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/LoginConst.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "b064697d-a57f-4eec-bd09-a0a6420e3abd",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/controller.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "254a880d-2d61-45a6-bb0c-464557cdf630",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/controller/LoginController.ts:
--------------------------------------------------------------------------------
1 | import BaseController from "../../../../game_framework/mvc/controller/BaseController";
2 | import LayerManager from "../../../../game_framework/layer/LayerManager";
3 | import App from "../../../../game_framework/App";
4 | import LoginView from "../view/LoginView";
5 | import LoginModel from "../model/LoginModel";
6 | import LoginProxy from "../proxy/LoginProxy";
7 | import Log from "../../../../game_framework/utils/Log";
8 | import LoginConst from "../LoginConst";
9 | import {ViewConst} from "../../../consts/ViewConst";
10 |
11 | export default class LoginController extends BaseController {
12 | /** 本模块的数据存储 */
13 | private loginModel: LoginModel;
14 |
15 | /** 本模块的所有UI */
16 | private loginView: LoginView;
17 |
18 | /** 本模块的Proxy */
19 | private loginProxy: LoginProxy;
20 |
21 | public constructor() {
22 | super();
23 |
24 | this.loginModel = new LoginModel(this); // 初始化Model
25 |
26 | this.loginView = new LoginView(this, LayerManager.UI_Main); // 初始化UI
27 | App.ViewManager.register(ViewConst.Login, this.loginView);
28 |
29 | this.loginProxy = new LoginProxy(this); // 初始化Proxy
30 |
31 | // 注册模块间、模块内部事件监听
32 | this.registerFunc(LoginConst.LOGIN_ACCOUNT_C2S, this.login_controller, this); // 注册账号登录
33 | this.registerFunc(LoginConst.LOGIN_SDK_C2S, this.login_sdk_controller, this); // 注册SDK登录
34 | Log.info("LoginController初始化成功");
35 | }
36 |
37 | /**
38 | * 请求账号密码登陆
39 | * @param userName
40 | * @param pwd
41 | */
42 | private login_controller(userName: string, pwd: string): void {
43 | this.loginProxy.login_proxy(userName, pwd);
44 | }
45 |
46 | /**
47 | * 请求SDK登录
48 | */
49 | private async login_sdk_controller() {
50 |
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/controller/LoginController.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "af6fbb8b-8bda-4b67-bc0b-5a6ee75416c3",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/model.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "795fcf63-a678-4344-a76d-b0560b62cbd0",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/model/LoginModel.ts:
--------------------------------------------------------------------------------
1 | import BaseModel from "../../../../game_framework/mvc/model/BaseModel";
2 | import BaseController from "../../../../game_framework/mvc/controller/BaseController";
3 |
4 | export default class LoginModel extends BaseModel {
5 |
6 |
7 | /**
8 | * 构造函数
9 | * @param $controller 所属模块
10 | */
11 | public constructor($controller: BaseController) {
12 | super($controller);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/model/LoginModel.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "4639d8af-51a7-4aeb-b067-0ce55794564c",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/proxy.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "d0d45659-2747-4244-bdd2-ff5d20dbca91",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/proxy/LoginProxy.ts:
--------------------------------------------------------------------------------
1 | import BaseController from "../../../../game_framework/mvc/controller/BaseController";
2 | import BaseProxy from "../../../../game_framework/mvc/proxy/BaseProxy";
3 |
4 | export default class LoginProxy extends BaseProxy {
5 | public constructor($controller: BaseController) {
6 | super($controller);
7 | // 注册从服务器返回消息的监听
8 |
9 | }
10 |
11 | /**
12 | * 账号密码登陆
13 | * @param accounts
14 | * @param pwd
15 | */
16 | public login_proxy(accounts: string, pwd: string): void {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/proxy/LoginProxy.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "c7b9ac18-bb57-4f5a-9e7b-8f8bf040f00a",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/view.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "e36b5d17-ed26-4ce0-a688-ef3119daef65",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/view/CCLoginView.ts:
--------------------------------------------------------------------------------
1 | import BaseController from "../../../../game_framework/mvc/controller/BaseController";
2 | import App from "../../../../game_framework/App";
3 | import BaseCCUIView from "../../../../game_framework/mvc/view/BaseCCUIView";
4 | import BaseCCUILayer from "../../../../game_framework/layer/BaseCCUILayer";
5 |
6 | export default class CCLoginView extends BaseCCUIView {
7 |
8 | public constructor($controller: BaseController, $parent: BaseCCUILayer) {
9 | super($controller, $parent);
10 | }
11 |
12 | /**
13 | * 面板开启执行函数,用于子类继承
14 | * @param param 参数
15 | */
16 | public open(...param: any[]): void {
17 | super.open(param);
18 | App.ResManager.loadRes("prefabs/CCUI",cc.Prefab,function(err, res){
19 | var asset = App.ResManager.getRes("prefabs/CCUI", cc.Prefab);
20 | var ccuiNode = cc.instantiate(asset);
21 | this.displayObject.addChild(ccuiNode);
22 | }.bind(this));
23 | }
24 |
25 | /**
26 | * 面板关闭执行函数,用于子类继承
27 | * @param param 参数
28 | */
29 | public close(...param: any[]): void {
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/view/CCLoginView.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "8ad90fd3-e46e-4556-a038-a25daf03af74",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/view/LoginBgView.ts:
--------------------------------------------------------------------------------
1 | import BaseSpriteView from "../../../../game_framework/mvc/view/BaseSpriteView";
2 | import BaseController from "../../../../game_framework/mvc/controller/BaseController";
3 | import BaseSpriteLayer from "../../../../game_framework/layer/BaseSpriteLayer";
4 | import App from "../../../../game_framework/App";
5 |
6 | export default class LoginBgView extends BaseSpriteView {
7 |
8 | public constructor($controller: BaseController, $parent: BaseSpriteLayer) {
9 | super($controller, $parent);
10 | }
11 |
12 | /**
13 | * 面板开启执行函数,用于子类继承
14 | * @param param 参数
15 | */
16 | public open(...param: any[]): void {
17 | super.open(param);
18 | App.ResManager.loadRes("prefabs/Bg",cc.Prefab,function(err, res){
19 | var asset = App.ResManager.getRes("prefabs/Bg", cc.Prefab);
20 | var bgNode = cc.instantiate(asset);
21 | this.displayObject.addChild(bgNode);
22 | }.bind(this));
23 | }
24 |
25 | /**
26 | * 面板关闭执行函数,用于子类继承
27 | * @param param 参数
28 | */
29 | public close(...param: any[]): void {
30 |
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/view/LoginBgView.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "de42ed39-1bd3-4793-8b1c-a56e31c6da5c",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/module/login/view/LoginView.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "09f5f159-657d-4cbb-92aa-aeb087ba7881",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "49b64800-f26d-481f-b749-e432e8d5b963",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/ByteArrayMsgByProtobuf.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "68090173-d232-45e2-bb43-543c9569857f",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultCSPacket.ts:
--------------------------------------------------------------------------------
1 | import CSPacket from "../../game_framework/net/socket/packet/CSPacket";
2 | import DefaultCSPacketHead from "./DefaultCSPacketHead";
3 |
4 | export default class DefaultCSPacket extends CSPacket {
5 |
6 | public PacketHead: DefaultCSPacketHead;
7 |
8 | public constructor() {
9 | super();
10 | this.PacketHead = new DefaultCSPacketHead(0);
11 | }
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultCSPacket.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "3155c7f6-231f-40fc-88aa-28d2c0f8b791",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultCSPacketHead.ts:
--------------------------------------------------------------------------------
1 | import CSPacketHead from "../../game_framework/net/socket/packet/CSPacketHead";
2 |
3 | export default class DefaultCSPacketHead extends CSPacketHead {
4 |
5 | public m_PacketHeadSize:number;
6 | public m_PacketSize: number;
7 | public m_ProtocolID: number;
8 | public m_ErrorCode: number;
9 |
10 | public constructor(_packetId: number) {
11 | super(_packetId);
12 | this.m_PacketHeadSize = 12;
13 | }
14 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultCSPacketHead.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "5c71e412-ecf6-4205-b16b-f70c4d6c89b1",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultNetChannel.ts:
--------------------------------------------------------------------------------
1 | export enum DefaultNetChannel {
2 | NetChannel_Hall,
3 | NetChannel_Room,
4 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultNetChannel.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "74c52598-b5f1-4ae8-accd-08dc5bd9e3ac",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultSCPacket.ts:
--------------------------------------------------------------------------------
1 | import SCPacket from "../../game_framework/net/socket/packet/SCPacket";
2 | import DefaultSCPacketHead from "./DefaultSCPacketHead";
3 |
4 | export default class DefaultSCPacket extends SCPacket {
5 |
6 | public PacketHead: DefaultSCPacketHead;
7 |
8 | public constructor() {
9 | super();
10 | this.PacketHead = new DefaultSCPacketHead(0);
11 | }
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultSCPacket.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "58e77ded-ca85-4bc9-b013-964369d9126d",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultSCPacketHead.ts:
--------------------------------------------------------------------------------
1 | import SCPacketHead from "../../game_framework/net/socket/packet/SCPacketHead";
2 |
3 | export default class DefaultSCPacketHead extends SCPacketHead {
4 |
5 | public m_PacketHeadSize:number;
6 | public m_PacketSize: number;
7 | public m_ProtocolID: number;
8 | public m_ErrorCode: number;
9 |
10 | public constructor(_packetId: number) {
11 | super(_packetId);
12 | this.m_PacketHeadSize = 12;
13 | }
14 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/net/DefaultSCPacketHead.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "6539ae2c-8b3c-4ccb-b5b7-e6c8bc1d6891",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "ebf666a6-c31f-48e4-9d91-15a12c998868",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure/ProcedureCheckVersion.ts:
--------------------------------------------------------------------------------
1 | import ProcedureBase from "../../game_framework/fsm/ProcedureBase";
2 | import App from "../../game_framework/App";
3 | import Log from "../../game_framework/utils/Log";
4 | import ProcedureMain from "./ProcedureMain";
5 |
6 | export default class ProcedureCheckVersion extends ProcedureBase {
7 | constructor(owner: Object) {
8 | super(owner);
9 | }
10 |
11 | public onEnter(obj: Object = null): void {
12 | super.onEnter(obj);
13 | Log.info("可在这个流程做资源版本检测");
14 | App.Procedure.changeState(cc.js.getClassName(ProcedureMain));
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure/ProcedureCheckVersion.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "d9a1b4e2-9419-4008-85ec-bca7b1d319c2",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure/ProcedureLaunch.ts:
--------------------------------------------------------------------------------
1 | import ProcedureBase from "../../game_framework/fsm/ProcedureBase";
2 | import Log from "../../game_framework/utils/Log";
3 | import App from "../../game_framework/App";
4 | import LoginScene from "../scene/LoginScene";
5 | import {SceneConsts} from "../consts/SceneConsts";
6 | import GlobalInfo from "../../game_framework/consts/GlobalInfo";
7 | import ResourceItem from "../../game_framework/resource/ResourceItem";
8 | import {isNull} from "../../game_framework/utils/GlobalDefine";
9 | import LayerManager from "../../game_framework/layer/LayerManager";
10 | import ProcedureCheckVersion from "./ProcedureCheckVersion";
11 |
12 | export default class ProcedureLaunch extends ProcedureBase {
13 | constructor(owner: Object) {
14 | super(owner);
15 | }
16 |
17 | public onInit(...args: any[]): void {
18 | super.onInit(args);
19 | }
20 |
21 | public onEnter(obj: Object = null): void {
22 | super.onEnter(obj);
23 | App.UrlParameters = this.urlParse();
24 | App.ResManager.loadRes("config/build_info", cc.JsonAsset, this.onBuildInfoConfigLoadComplete.bind(this));
25 | }
26 |
27 | private onBuildInfoConfigLoadComplete(err: string, res: ResourceItem): void {
28 | if (isNull(err)) {
29 | App.BuildInfo = res.getRes().json;
30 | console.log("App.BuildInfo = ", App.BuildInfo);
31 | console.log("App.UrlParameters = ",App.UrlParameters);
32 | App.init();
33 | App.GlobalInfo = new GlobalInfo();
34 | App.GlobalInfo.GateServerIp = "121.40.165.18";
35 | App.GlobalInfo.GateServerPort = 8800;
36 | fgui.addLoadHandler();
37 | fgui.GRoot.create();
38 | LayerManager.init();
39 | this.initScene();
40 | App.Procedure.changeState(cc.js.getClassName(ProcedureCheckVersion));
41 | } else {
42 | console.log(err);
43 | }
44 | }
45 |
46 | public onUpdate(): void {
47 | super.onUpdate();
48 | }
49 |
50 | public onLeave(preKey: string): void {
51 | super.onLeave(preKey);
52 | }
53 |
54 | private urlParse(): Object {
55 | var params = {};
56 | if (window.location == null) {
57 | return params;
58 | }
59 | var str = window.location.href; //取得整个地址栏
60 | params = App.Http.decode(str);
61 | return params;
62 | }
63 |
64 | /**
65 | * 初始化所有场景
66 | */
67 | private initScene(): void {
68 | App.SceneManager.register(SceneConsts.Login, new LoginScene());
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure/ProcedureLaunch.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "ee69bbd0-ebea-49ab-a5b9-dac5fea3bdb5",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure/ProcedureMain.ts:
--------------------------------------------------------------------------------
1 | import ProcedureBase from "../../game_framework/fsm/ProcedureBase";
2 | import App from "../../game_framework/App";
3 | import {SceneConsts} from "../consts/SceneConsts";
4 | import {ViewConst} from "../consts/ViewConst";
5 |
6 | export default class ProcedureMain extends ProcedureBase {
7 | constructor(owner: Object) {
8 | super(owner);
9 | }
10 |
11 | public onEnter(obj: Object = null): void {
12 | super.onEnter(obj);
13 |
14 | App.SceneManager.runScene(SceneConsts.Login);
15 | App.ViewManager.open(ViewConst.Login);
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/procedure/ProcedureMain.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "67a03fcf-05d8-412b-b3d7-2210b3049984",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/scene.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "1798bf67-bac8-47fd-a960-9161d1237c54",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/scene/LoginScene.ts:
--------------------------------------------------------------------------------
1 | import BaseScene from "../../game_framework/scene/base/BaseScene";
2 | import LayerManager from "../../game_framework/layer/LayerManager";
3 | import App from "../../game_framework/App";
4 | import LoginController from "../module/login/controller/LoginController";
5 | import {ControllerConst} from "../consts/ControllerConst";
6 | import Log from "../../game_framework/utils/Log";
7 |
8 | export default class LoginScene extends BaseScene {
9 |
10 | /**
11 | * 构造函数
12 | */
13 | public constructor() {
14 | super();
15 | }
16 |
17 | /**
18 | * 进入Scene调用
19 | */
20 | public onEnter(): void {
21 | super.onEnter();
22 |
23 | // 添加该Scene使用的层级
24 | this.addLayer(LayerManager.UI_Main);
25 | this.addLayer(LayerManager.UI_Popup);
26 | this.addLayer(LayerManager.UI_Message);
27 | this.addLayer(LayerManager.UI_Tips);
28 | this.addLayer(LayerManager.UI_Loading);
29 | // 初始化该scene的所有视图控制器
30 | this.initViewController();
31 | }
32 |
33 | /**
34 | * 退出Scene调用
35 | */
36 | public onExit(): void {
37 | super.onExit();
38 | }
39 |
40 | private initViewController(): void {
41 | App.ControllerManager.register(ControllerConst.Login, LoginController);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/scene/LoginScene.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "30110698-0a2f-477a-87d1-f8dd8d7cffc3",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "77b8c316-113a-43b6-9cff-96533f1663a7",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/ChannelID.ts:
--------------------------------------------------------------------------------
1 | export default class ChannelID {
2 | static DEFAULT: number = 0;
3 | static WX: number = 1;//微信
4 | }
5 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/ChannelID.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "fac318c7-1237-461d-8086-a16d58c107e2",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/default.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.1.2",
3 | "uuid": "7815c8f4-3913-417b-bee5-986af2dd6f59",
4 | "isBundle": false,
5 | "bundleName": "",
6 | "priority": 1,
7 | "compressionType": {},
8 | "optimizeHotUpdate": {},
9 | "inlineSpriteFrames": {},
10 | "isRemoteBundle": {},
11 | "subMetas": {}
12 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/default/DefaultChannel.ts:
--------------------------------------------------------------------------------
1 | import DefaultLogin from "./DefaultLogin";
2 | import BaseChannel from "../../../game_framework/sdk/base/BaseChannel";
3 | export default class DefaultChannel extends BaseChannel{
4 |
5 | constructor(id:number){
6 | super(id)
7 | this.loginMgr = new DefaultLogin();
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/default/DefaultChannel.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "fa7dd559-ed8b-40fd-b71e-d38d15633e61",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/default/DefaultLogin.ts:
--------------------------------------------------------------------------------
1 | import LoginInterface from "../../../game_framework/sdk/base/LoginInterface";
2 | import Log from "../../../game_framework/utils/Log";
3 | import {LoginCallback, LogoutCallback} from "../../../game_framework/sdk/SDKCallback";
4 |
5 | export default class DefaultLogin implements LoginInterface {
6 |
7 | login(account, func: LoginCallback) {
8 | Log.info("登录 account");
9 | this.loginCallback = func;
10 | }
11 |
12 | logout(func: LogoutCallback) {
13 | this.logoutCallback = func;
14 | }
15 |
16 | loginCallback:LoginCallback;
17 | logoutCallback:LogoutCallback;
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/assets/scripts/game_main/sdk/default/DefaultLogin.ts.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.8",
3 | "uuid": "0a0e32fd-0690-47b4-94e1-1110b3d3a7e5",
4 | "isPlugin": false,
5 | "loadPluginInWeb": true,
6 | "loadPluginInNative": true,
7 | "loadPluginInEditor": false,
8 | "subMetas": {}
9 | }
--------------------------------------------------------------------------------
/assets/scripts/scripts.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/assets/scripts/scripts.iml.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.1",
3 | "uuid": "c062bb7b-1027-4aec-93f8-8e4a711e14e3",
4 | "subMetas": {}
5 | }
--------------------------------------------------------------------------------
/build-templates.meta:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.0.1",
3 | "uuid": "0c01b29d-5934-4561-8283-fbd2fa3c9d24",
4 | "isSubpackage": false,
5 | "subpackageName": "",
6 | "subMetas": {}
7 | }
--------------------------------------------------------------------------------
/packages/hot_update/comp-inspectors/custom-comp.js:
--------------------------------------------------------------------------------
1 | Vue.component('custom-comp-inspector', {
2 | template: `
3 |
4 |
5 |
6 |
7 | `,
8 |
9 | props: {
10 | target: {
11 | twoWay: true,
12 | type: Object,
13 | },
14 | },
15 | });
16 |
--------------------------------------------------------------------------------
/packages/hot_update/core/CfgUtil.js:
--------------------------------------------------------------------------------
1 | let fs = require("fire-fs"), path = require("fire-path"), electron = require("electron"),
2 | FileUtil = Editor.require("packages://hot_update/core/FileUtil"), self = module.exports = {
3 | cfgData: {
4 | version: "",
5 | serverRootDir: "",
6 | resourceRootDir: "",
7 | genManifestDir: "",
8 | localServerPath: "",
9 | hotAddressArray: [],
10 | buildTime: null,
11 | genTime: null,
12 | genVersion: null
13 | }, updateBuildTimeByMain(e) {
14 | let t = this._getAppCfgPath();
15 | if (fs.existsSync(t)) {
16 | let i = fs.readFileSync(t, "utf-8"), r = JSON.parse(i);
17 | r.buildTime = e, r.genTime = e, fs.writeFileSync(t, JSON.stringify(r))
18 | } else Editor.log("热更新配置文件不存在: " + t)
19 | }, updateBuildTime(e) {
20 | this.cfgData.buildTime = e, this.cfgData.genTime = e, this._save()
21 | }, updateGenTime(e, t) {
22 | this.cfgData.genTime = e, this.cfgData.genVersion = t, this._save()
23 | }, getBuildTimeGenTime() {
24 | let e = {buildTime: null, genTime: null}, t = this._getAppCfgPath();
25 | if (fs.existsSync(t)) {
26 | let i = fs.readFileSync(t, "utf-8"), r = JSON.parse(i);
27 | e.buildTime = r.buildTime, e.genTime = r.genTime, this.cfgData.buildTime = r.buildTime, this.cfgData.genTime = r.genTime
28 | }
29 | return e
30 | }, saveConfig(e) {
31 | this.cfgData.version = e.version, this.cfgData.serverRootDir = e.serverRootDir, this.cfgData.resourceRootDir = e.resourceRootDir, this.cfgData.localServerPath = e.localServerPath, this.cfgData.hotAddressArray = e.hotAddressArray, this._save()
32 | }, _save() {
33 | let e = self._getAppCfgPath();
34 | fs.writeFileSync(e, JSON.stringify(this.cfgData))
35 | }, cleanConfig() {
36 | fs.unlink(this._getAppCfgPath())
37 | }, getMainFestDir() {
38 | let e = electron.remote.app.getPath("userData");
39 | return path.join(e, "hot-update-tools-manifestOutPut")
40 | }, getPackZipDir() {
41 | electron.remote.app.getPath("userData");
42 | return path.join(this._getAppRootPath(), "packVersion")
43 | }, _getAppRootPath() {
44 | let e = Editor.libraryPath;
45 | return e.substring(0, e.length - 7)
46 | }, _getAppCfgPath() {
47 | let e = null;
48 | e = electron.remote ? electron.remote.app.getPath("userData") : electron.app.getPath("userData");
49 | let t = Editor.libraryPath;
50 | return t = (t = (t = t.replace(/\\/g, "-")).replace(/:/g, "-")).replace(/\//g, "-"), path.join(e, "hot-update-tools-cfg-" + t + ".json")
51 | }, initCfg(e) {
52 | let t = this._getAppCfgPath();
53 | FileUtil.isFileExit(t) ? fs.readFile(t, "utf-8", function (t, i) {
54 | if (!t) {
55 | let t = JSON.parse(i.toString());
56 | self.cfgData = t, e && e(t)
57 | }
58 | }.bind(self)) : e && e(null)
59 | }
60 | };
--------------------------------------------------------------------------------
/packages/hot_update/core/FileUtil.js:
--------------------------------------------------------------------------------
1 | let fs = require("fire-fs"), path = require("fire-path"), self = module.exports = {
2 | getDirAllFiles(e, t) {
3 | fs.readdirSync(e).forEach((l, i) => {
4 | let r = path.join(e, l), n = fs.statSync(r);
5 | n.isDirectory() ? this.getDirAllFiles(r, t) : n.isFile() && t.push(r)
6 | })
7 | },
8 | getFileString(e, t) {
9 | let l = 0, i = e.length, r = {};
10 | for (let n in e) {
11 | let s = e[n];
12 | this._isFileExit(s) ? fs.readFile(s, "utf-8", function (e, n) {
13 | e || self._collectString(n, r), self._onCollectStep(s, ++l, i, r, t)
14 | }) : self._onCollectStep(s, ++l, i, r, t)
15 | }
16 | }, _onCollectStep(e, t, l, i, r) {
17 | r && r.stepCb && r.stepCb(e, t, l), t >= l && self._onCollectOver(i, r)
18 | }, _onCollectOver(e, t) {
19 | let l = [], i = "";
20 | for (let t in e) i += t, l.push(t);
21 | t && t.compCb && t.compCb(i)
22 | },
23 | mkDir(e) {
24 | try {
25 | fs.mkdirSync(e)
26 | } catch (e) {
27 | if ("EEXIST" !== e.code) throw e
28 | }
29 | },
30 | isFileExit(e) {
31 | try {
32 | fs.accessSync(e, fs.F_OK)
33 | } catch (e) {
34 | return !1
35 | }
36 | return !0
37 | }, _collectString(e, t) {
38 | for (let l in e) {
39 | let i = e.charAt(l);
40 | t[i] ? t[i]++ : t[i] = 1
41 | }
42 | },
43 | emptyDir(e) {
44 | let t = function (e) {
45 | let l = fs.readdirSync(e);
46 | for (let i in l) {
47 | let r = path.join(e, l[i]);
48 | fs.statSync(r).isDirectory() ? t(r) : fs.unlinkSync(r)
49 | }
50 | }, l = function (t) {
51 | let i = fs.readdirSync(t);
52 | if (i.length > 0) {
53 | for (let e in i) {
54 | let r = path.join(t, i[e]);
55 | l(r)
56 | }
57 | t !== e && fs.rmdirSync(t)
58 | } else t !== e && fs.rmdirSync(t)
59 | };
60 | t(e), l(e)
61 | },
62 | is_fileType(e, t) {
63 | t = t.split(",");
64 | let l = ".(";
65 | for (let e = 0; e < t.length; e++) 0 !== e && (l += "|"), l += t[e].trim();
66 | return l += ")$", new RegExp(l, "i").test(e)
67 | },
68 | createDirectory(_path) {
69 | if (fs.existsSync(_path))
70 | return;
71 |
72 | if (fs.existsSync(self._getParentDirectoryPath(_path))) {
73 | fs.mkdirSync(_path);
74 | } else {
75 | this.createDirectory(self._getParentDirectoryPath(_path));
76 | fs.mkdirSync(_path);
77 | }
78 | }, _getParentDirectoryPath(_path) {
79 | var tempPath = _path;
80 | for (var n = tempPath.length - 1; 0 <= n; n--) {
81 | if (tempPath[n] == '/' || tempPath[n] == '\\')
82 | if (n != tempPath.length - 1)
83 | return tempPath.substr(0, n);
84 | }
85 | return "";
86 | }
87 | };
--------------------------------------------------------------------------------
/packages/hot_update/core/HttpService.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var http = require("http"), https = require("https"), qs = require("querystring"), HttpService = function () {
3 | }, pro = HttpService.prototype;
4 | pro.sendHttpGetReq = function (t, n, e, r, o) {
5 | var i = qs.stringify(r), s = {hostname: t, port: n, path: e + "?" + i, method: "GET"},
6 | u = http.request(s, function (t) {
7 | t.setEncoding("utf8"), t.on("data", function (t) {
8 | o(null, JSON.parse(t))
9 | })
10 | });
11 | u.on("error", function (t) {
12 | o(new Error("err"), null)
13 | }), u.end()
14 | }, pro.sendHttpsGetReq = function (t, n, e, r, o) {
15 | var i = qs.stringify(r);
16 | https.get(t + ":" + n + e + "?" + i, function (t) {
17 | t.on("data", function (t) {
18 | o(null, JSON.parse(t.toString()))
19 | })
20 | }).on("error", function (t) {
21 | o(t)
22 | })
23 | }, pro.sendHttpPostReq = function (t, n, e, r, o) {
24 | var i = qs.stringify(r), s = {
25 | hostname: t,
26 | port: n,
27 | path: e,
28 | method: "POST",
29 | headers: {"Content-Type": "application/x-www-form-urlencoded", "Content-Length": i.length}
30 | }, u = http.request(s, function (t) {
31 | if (200 == t.statusCode) {
32 | t.setEncoding("utf8");
33 | var n = "";
34 | t.on("data", function (t) {
35 | n += t
36 | }), t.on("end", function () {
37 | o(null, JSON.parse(n))
38 | })
39 | } else t.send(500, "error"), o(new Error("err"), null)
40 | });
41 | u.on("error", function (t) {
42 | o(new Error("err"), null)
43 | }), u.write(i), u.end()
44 | }, pro.sendHttpsPostReq = function (t, n, e, r, o) {
45 | e = e + "?" + qs.stringify(r);
46 | var i = {hostname: t, port: n || 443, path: e || "/", method: "POST"};
47 | https.request(i, function (t) {
48 | t.on("data", function (t) {
49 | o(null, JSON.parse(t.toString()))
50 | })
51 | }).on("error", function (t) {
52 | o(t)
53 | })
54 | }, module.exports = new HttpService;
--------------------------------------------------------------------------------
/packages/hot_update/i18n/en.js:
--------------------------------------------------------------------------------
1 | module.exports={title:"hotUpdateTools"};
--------------------------------------------------------------------------------
/packages/hot_update/i18n/zh.js:
--------------------------------------------------------------------------------
1 | module.exports={title:"热更新工具"};
--------------------------------------------------------------------------------
/packages/hot_update/main.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | load () {
5 | },
6 |
7 | unload () {
8 | },
9 |
10 | messages: {
11 | open() {
12 | Editor.Panel.open('hot_update');
13 | },
14 | },
15 | };
16 |
--------------------------------------------------------------------------------
/packages/hot_update/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hot_update",
3 | "main": "main.js",
4 | "main-menu": {
5 | "自定义工具/热更配置生成": {
6 | "message": "hot_update:open"
7 | }
8 | },
9 | "panel": {
10 | "main" : "panel/index.js",
11 | "type" : "dockable",
12 | "title" : "热更配置生成",
13 | "width" : 400,
14 | "height": 300
15 | }
16 | }
--------------------------------------------------------------------------------
/packages/hot_update/panel/index.css:
--------------------------------------------------------------------------------
1 | /*@import url(theme://globals/fontello.css);*/ @import url('app://bower_components/fontawesome/css/font-awesome.min.css'); h2 { color: #11ff00; } .greenColor{ color: #11ff00; } :host { display: flex; flex-direction: column; } h3 { margin-top: 0; margin-bottom: 10px; } .toolbar { display: flex; flex-direction: row; align-items: center; padding: 10px; } #view { flex: 1; padding: 10px; padding-top: 0px; overflow-y: auto; overflow-x: hidden; } div.section { border-bottom: 1px solid #666; padding-bottom: 10px; margin-bottom: 10px; } div.section:last-child { border-bottom: 0px; } div.group { min-width: 420px; margin-bottom: 5px; display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; } span { margin-right: 0.25em; }
--------------------------------------------------------------------------------
/packages/tools/main.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = {
4 | load () {
5 | // 当 package 被正确加载的时候执行
6 | Editor.log('打开Tools面板');
7 | },
8 |
9 | unload () {
10 | // 当 package 被正确卸载的时候执行
11 | Editor.log('关闭Tools面板');
12 | },
13 |
14 | messages: {
15 | 'openPanel' () {
16 | Editor.Panel.open('tools');
17 | }
18 | },
19 | };
20 |
--------------------------------------------------------------------------------
/packages/tools/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tools",
3 | "version": "0.0.1",
4 | "description": "编辑器功能扩展",
5 | "author": "CCGameFramework",
6 | "main": "main.js",
7 | "main-menu": {
8 | "自定义工具/Tools": {
9 | "message": "tools:openPanel"
10 | }
11 | },
12 | "panel": {
13 | "main": "panel/index.js",
14 | "type": "dockable",
15 | "title": "编辑器功能扩展",
16 | "width": 400,
17 | "height": 300
18 | },
19 | "scene-script": "scene-walker.js"
20 | }
21 |
--------------------------------------------------------------------------------
/packages/tools/panel/index.js:
--------------------------------------------------------------------------------
1 | // panel/index.js
2 | Editor.Panel.extend({
3 | style: `
4 | :host {
5 | margin: 10px;
6 | }
7 | `,
8 |
9 | template: `
10 | A Simple Vue Panel
11 |
12 |
13 | Input Value = {{message}}
14 | `,
15 |
16 | ready () {
17 | new window.Vue({
18 | el: this.shadowRoot,
19 | data: {
20 | message: 'Hello World',
21 | },
22 | });
23 | },
24 | });
--------------------------------------------------------------------------------
/packages/tools/scene-walker.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | 'get-canvas-children': function (event) {
3 | var canvas = cc.find('Canvas');
4 | Editor.log('children length : ' + canvas.children.length);
5 |
6 | if (event.reply) {
7 | event.reply(null, canvas.children.length);
8 | }
9 | }
10 | };
--------------------------------------------------------------------------------
/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "engine": "cocos-creator-js",
3 | "packages": "packages",
4 | "version": "2.1.4",
5 | "id": "d1780d53-cd48-4b1b-aa65-92dba063832f"
6 | }
--------------------------------------------------------------------------------
/settings/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "start-scene": "current",
3 | "group-list": [
4 | "default"
5 | ],
6 | "collision-matrix": [
7 | [
8 | true
9 | ]
10 | ],
11 | "excluded-modules": [],
12 | "last-module-event-record-time": 0,
13 | "design-resolution-width": 960,
14 | "design-resolution-height": 640,
15 | "fit-width": false,
16 | "fit-height": true,
17 | "use-project-simulator-setting": false,
18 | "simulator-orientation": false,
19 | "use-customize-simulator": false,
20 | "simulator-resolution": {
21 | "width": 960,
22 | "height": 640
23 | },
24 | "assets-sort-type": "name",
25 | "facebook": {
26 | "enable": false,
27 | "appID": "",
28 | "live": {
29 | "enable": false
30 | },
31 | "audience": {
32 | "enable": false
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/settings/services.json:
--------------------------------------------------------------------------------
1 | {
2 | "game": {
3 | "name": "未知游戏",
4 | "appid": "UNKNOW"
5 | }
6 | }
--------------------------------------------------------------------------------