From c069ccd74e691fca2f9a5c604f330d847f087831 Mon Sep 17 00:00:00 2001 From: JianMiau Date: Tue, 28 Dec 2021 23:37:22 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E6=B8=85=E9=99=A4=E6=9A=AB=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scene/helloworld.fire | 29 +++-- assets/Script/Manager.ts | 20 +++ .../{webview.ts.meta => Manager.ts.meta} | 0 assets/Script/webview.ts | 9 -- tslint.json | 115 ++++++++++++++++++ 5 files changed, 151 insertions(+), 22 deletions(-) create mode 100644 assets/Script/Manager.ts rename assets/Script/{webview.ts.meta => Manager.ts.meta} (100%) delete mode 100644 assets/Script/webview.ts create mode 100644 tslint.json diff --git a/assets/Scene/helloworld.fire b/assets/Scene/helloworld.fire index bf6d9ab..4f44f10 100644 --- a/assets/Scene/helloworld.fire +++ b/assets/Scene/helloworld.fire @@ -77,6 +77,9 @@ ], "_active": true, "_components": [ + { + "__id__": 7 + }, { "__id__": 8 }, @@ -242,9 +245,6 @@ "_components": [ { "__id__": 6 - }, - { - "__id__": 7 } ], "_prefab": null, @@ -307,16 +307,6 @@ "webviewEvents": [], "_id": "0dhyrwc5lM/oEUOjnLH8Wx" }, - { - "__type__": "e1b90/rohdEk4SdmmEZANaD", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 5 - }, - "_enabled": true, - "_id": "darFjTzH1B452j05U2ywfj" - }, { "__type__": "cc.Canvas", "_name": "", @@ -360,5 +350,18 @@ "_originalWidth": 0, "_originalHeight": 0, "_id": "56i7y6VTBNEZCKvOCJzojM" + }, + { + "__type__": "e1b90/rohdEk4SdmmEZANaD", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "webview": { + "__id__": 6 + }, + "_id": "b3AScs1lVP7ruEGNmMEKXU" } ] \ No newline at end of file diff --git a/assets/Script/Manager.ts b/assets/Script/Manager.ts new file mode 100644 index 0000000..39ecbc6 --- /dev/null +++ b/assets/Script/Manager.ts @@ -0,0 +1,20 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class Manager extends cc.Component { + //#region 外調參數 + + @property({ type: cc.WebView }) + public webview: cc.WebView = null + + //#endregion + + //#region Lifecycle + + protected onLoad(): void { + this.webview.url = `https://karolchang.github.io/jm-expense-vue-ts/?ignore=${Date.now()}`; + this.webview.node.active = true + } + + //#endregion +} diff --git a/assets/Script/webview.ts.meta b/assets/Script/Manager.ts.meta similarity index 100% rename from assets/Script/webview.ts.meta rename to assets/Script/Manager.ts.meta diff --git a/assets/Script/webview.ts b/assets/Script/webview.ts deleted file mode 100644 index cbe8a87..0000000 --- a/assets/Script/webview.ts +++ /dev/null @@ -1,9 +0,0 @@ -const { ccclass, property } = cc._decorator; - -@ccclass -export default class webview extends cc.Component { - protected onLoad(): void { - this.node.getComponent(cc.WebView).url = `https://karolchang.github.io/jm-expense-vue-ts/?ignore=${Date.now()}`; - this.node.active = true; - } -} diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..dd18020 --- /dev/null +++ b/tslint.json @@ -0,0 +1,115 @@ +{ + "rules": { + "ban": [ + true, + [ + "_", + "extend" + ], + [ + "_", + "isNull" + ], + [ + "_", + "isDefined" + ] + ], + "class-name": false, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "eofline": false, + "forin": false, + "indent": [ + true, + 4 + ], + "interface-name": [ + true, + "never-prefix" + ], + "jsdoc-format": true, + "label-position": true, + "label-undefined": true, + "max-line-length": [ + false, + 140 + ], + "no-arg": true, + "no-bitwise": false, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-key": true, + "no-duplicate-variable": true, + "no-empty": true, + // "no-eval": true, + "no-string-literal": false, + "no-trailing-comma": true, + "no-trailing-whitespace": true, + "no-unused-expression": false, + "no-unused-variable": true, + "no-unreachable": true, + "no-use-before-declare": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "quotemark": [ + true, + "double" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef": [ + true, + "call-signature", + "parameter", + "property-declaration", + "variable-declaration" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace" + }, + { + "index-signature": "space" + } + ], + "use-strict": [ + true, + "check-module", + "check-function" + ], + "variable-name": false, + "whitespace": [ + false, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ] + } +} \ No newline at end of file