diff --git a/assets/Script/example.meta b/assets/Script/example.meta index dbd0cbe..6f62518 100644 --- a/assets/Script/example.meta +++ b/assets/Script/example.meta @@ -1,7 +1,12 @@ { - "ver": "1.0.1", - "uuid": "dbb441af-a09d-46e3-8941-73a234e9ccb4", - "isSubpackage": false, - "subpackageName": "", - "subMetas": {} -} \ No newline at end of file + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "87e0627a-a537-4158-b9e3-6ef310a36de7", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Script/example/EmptyScene.ts b/assets/Script/example/EmptyScene.ts index 3c259c5..bcf61c2 100644 --- a/assets/Script/example/EmptyScene.ts +++ b/assets/Script/example/EmptyScene.ts @@ -1,11 +1,14 @@ -const { ccclass, property } = cc._decorator; -@ccclass -export default class EmptyScene extends cc.Component { - @property(cc.Label) - label: cc.Label = null; - - start() { - let ccloader: any = cc.loader; - this.label.string = `Current Scene Asset Count ${Object.keys(ccloader._cache).length}`; - } -} +import { _decorator, Component, Label, assetManager } from 'cc'; +const { ccclass, property } = _decorator; + +@ccclass +export default class EmptyScene extends Component { + @property(Label) + label: Label | null = null; + + update() { + if (this.label) { + this.label.string = `Current Scene Asset Count ${assetManager.assets.count}`; + } + } +} diff --git a/assets/Script/example/EmptyScene.ts.meta b/assets/Script/example/EmptyScene.ts.meta index b813b88..4db6016 100644 --- a/assets/Script/example/EmptyScene.ts.meta +++ b/assets/Script/example/EmptyScene.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "2d3e3e9a-b673-4d88-b784-aaeb04610066", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/NetExample.ts b/assets/Script/example/NetExample.ts index f2ee02e..412d6d4 100644 --- a/assets/Script/example/NetExample.ts +++ b/assets/Script/example/NetExample.ts @@ -1,89 +1,92 @@ -import { WebSock } from "../network/WebSock"; -import { NetManager } from "../network/NetManager"; -import { NetNode } from "../network/NetNode"; -import { DefStringProtocol, NetData, INetworkTips } from "../network/NetInterface"; - - - -const { ccclass, property } = cc._decorator; - -class NetTips implements INetworkTips { - private getLabel(): cc.Label { - let label = null; - let node = cc.director.getScene().getChildByName("@net_tip_label"); - if (node) { - label = node.getComponent(cc.Label); - } else { - node = new cc.Node("@net_tip_label"); - label = node.addComponent(cc.Label); - node.setPosition(cc.winSize.width / 2, cc.winSize.height / 2); - } - return label; - } - - connectTips(isShow: boolean): void { - if (isShow) { - this.getLabel().string = "Connecting"; - this.getLabel().node.active = true; - } else { - this.getLabel().node.active = false; - } - } - - reconnectTips(isShow: boolean): void { - if (isShow) { - this.getLabel().string = "Reconnecting"; - this.getLabel().node.active = true; - } else { - this.getLabel().node.active = false; - } - } - - requestTips(isShow: boolean): void { - if (isShow) { - this.getLabel().string = "Requesting"; - this.getLabel().node.active = true; - } else { - this.getLabel().node.active = false; - } - } -} - -@ccclass -export default class NetExample extends cc.Component { - @property(cc.Label) - textLabel: cc.Label = null; - @property(cc.Label) - urlLabel: cc.Label = null; - @property(cc.RichText) - msgLabel: cc.RichText = null; - private lineCount: number = 0; - - onLoad() { - let Node = new NetNode(); - Node.init(new WebSock(), new DefStringProtocol(), new NetTips()); - Node.setResponeHandler(0, (cmd: number, data: NetData) => { - if (this.lineCount > 5) { - let idx = this.msgLabel.string.search("\n"); - this.msgLabel.string = this.msgLabel.string.substr(idx + 1); - } - this.msgLabel.string += `${data}\n`; - ++this.lineCount; - }); - NetManager.getInstance().setNetNode(Node); - } - - onConnectClick() { - NetManager.getInstance().connect({ url: this.urlLabel.string }); - } - - onSendClick() { - NetManager.getInstance().send(this.textLabel.string); - } - - onDisconnectClick() { - NetManager.getInstance().close(); - } - - // update (dt) {} -} +import { WebSock } from "../network/WebSock"; +import { NetManager } from "../network/NetManager"; +import { NetNode } from "../network/NetNode"; +import { DefStringProtocol, NetData, INetworkTips } from "../network/NetInterface"; +import { Component, Label, _decorator, view, director, Node, RichText } from "cc"; + +const { ccclass, property } = _decorator; + +class NetTips implements INetworkTips { + private getLabel(): Label { + let label = null; + let winSize = view.getCanvasSize(); + let scene = director.getScene(); + if (scene) { + let node = scene.getChildByName("@net_tip_label"); + if (node) { + label = node.getComponent(Label); + } else { + let node = new Node("@net_tip_label"); + label = node.addComponent(Label); + node.setPosition(winSize.width / 2, winSize.height / 2); + } + } + return label!; + } + + connectTips(isShow: boolean): void { + if (isShow) { + this.getLabel().string = "Connecting"; + this.getLabel().node.active = true; + } else { + this.getLabel().node.active = false; + } + } + + reconnectTips(isShow: boolean): void { + if (isShow) { + this.getLabel().string = "Reconnecting"; + this.getLabel().node.active = true; + } else { + this.getLabel().node.active = false; + } + } + + requestTips(isShow: boolean): void { + if (isShow) { + this.getLabel().string = "Requesting"; + this.getLabel().node.active = true; + } else { + this.getLabel().node.active = false; + } + } +} + +@ccclass +export default class NetExample extends Component { + @property(Label) + textLabel: Label = null!; + @property(Label) + urlLabel: Label = null!; + @property(RichText) + msgLabel: RichText = null!; + private lineCount: number = 0; + + onLoad() { + let Node = new NetNode(); + Node.init(new WebSock(), new DefStringProtocol(), new NetTips()); + Node.setResponeHandler(0, (cmd: number, data: NetData) => { + if (this.lineCount > 5) { + let idx = this.msgLabel.string.search("\n"); + this.msgLabel.string = this.msgLabel.string.substr(idx + 1); + } + this.msgLabel.string += `${data}\n`; + ++this.lineCount; + }); + NetManager.getInstance().setNetNode(Node); + } + + onConnectClick() { + NetManager.getInstance().connect({ url: this.urlLabel.string }); + } + + onSendClick() { + NetManager.getInstance().send(this.textLabel.string); + } + + onDisconnectClick() { + NetManager.getInstance().close(); + } + + // update (dt) {} +} diff --git a/assets/Script/example/NetExample.ts.meta b/assets/Script/example/NetExample.ts.meta index 138497b..97a9d11 100644 --- a/assets/Script/example/NetExample.ts.meta +++ b/assets/Script/example/NetExample.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "55d2374d-6bd2-4345-a7dc-085a9e5c5547", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/ResExample.ts b/assets/Script/example/ResExample.ts index ec79a9f..aec832f 100644 --- a/assets/Script/example/ResExample.ts +++ b/assets/Script/example/ResExample.ts @@ -1,72 +1,79 @@ +import { assetManager } from "cc"; +import { Sprite } from "cc"; +import { SpriteFrame } from "cc"; +import { Component, Node, Label, Asset, Prefab, _decorator, instantiate, resources } from "cc"; import ResLoader, { resLoader } from "../res/ResLoader"; -const { ccclass, property } = cc._decorator; +const { ccclass, property } = _decorator; @ccclass -export default class NetExample extends cc.Component { - @property(cc.Node) - attachNode: cc.Node = null; - @property(cc.Label) - dumpLabel: cc.Label = null; - ress: cc.Asset[] = null; - remoteRes: cc.Asset = null; +export default class NetExample extends Component { + @property(Node) + attachNode: Node | null = null; + @property(Label) + dumpLabel: Label | null = null; + ress: Asset[] | null = null; + remoteRes: Asset | null = null; start() { } onLoadRes() { - cc.loader.loadRes("prefabDir/HelloWorld", cc.Prefab, (error: Error, prefab: cc.Prefab) => { - if (!error) { - cc.instantiate(prefab).parent = this.attachNode; - } - }); + // 动态加载资源 + resources.load("prefabDir/HelloWorld", Prefab, + (error, prefab) => { + if (!error) { + instantiate(prefab).parent = this.attachNode; + } + }); } onUnloadRes() { - this.attachNode.removeAllChildren(true); - cc.loader.releaseRes("prefabDir/HelloWorld"); + // 释放动态加载的资源 + this.attachNode!.removeAllChildren(); + resources.release("prefabDir/HelloWorld"); } onMyLoadRes() { - ResLoader.loadDir("prefabDir", cc.Prefab, (error: Error, prefabs: cc.Prefab[]) => { + resLoader.loadDir("prefabDir", Prefab, (error, prefabs) => { if (!error) { this.ress = prefabs; for (let i = 0; i < prefabs.length; ++i) { - cc.instantiate(prefabs[i]).parent = this.attachNode; + instantiate(prefabs[i]).parent = this.attachNode; } } }); } onMyUnloadRes() { - this.attachNode.removeAllChildren(true); + this.attachNode!.removeAllChildren(); if (this.ress) { - for(let item of this.ress) { - ResLoader.release(item); + for (let item of this.ress) { + item.decRef(true); } this.ress = null; } } onLoadRemote() { - ResLoader.load("http://tools.itharbors.com/christmas/res/tree.png", (err, res) => { + resLoader.load("http://tools.itharbors.com/christmas/res/tree.png", (err, res) => { if (err || !res) return; this.remoteRes = res; - let spriteFrame = new cc.SpriteFrame(res); - let node = new cc.Node("tmp"); - let sprite = node.addComponent(cc.Sprite); + let spriteFrame = new SpriteFrame(); + spriteFrame.texture = res; + let node = new Node("tmp"); + let sprite = node.addComponent(Sprite); sprite.spriteFrame = spriteFrame; node.parent = this.attachNode; }) } onUnloadRemote() { - this.attachNode.removeAllChildren(true); - this.remoteRes.decRef(); + this.attachNode!.removeAllChildren(); + this.remoteRes!.decRef(); } onDump() { - let Loader:any = cc.loader; - this.dumpLabel.string = `当前资源总数:${Object.keys(Loader._cache).length}`; + this.dumpLabel!.string = `当前资源总数:${assetManager.assets.count}`; } } diff --git a/assets/Script/example/ResExample.ts.meta b/assets/Script/example/ResExample.ts.meta index 3409e56..289d032 100644 --- a/assets/Script/example/ResExample.ts.meta +++ b/assets/Script/example/ResExample.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "35e3e9e5-c4f5-4d9d-b71d-14f429549015", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/ResKeeperExample.ts b/assets/Script/example/ResKeeperExample.ts index 719878f..5988470 100644 --- a/assets/Script/example/ResKeeperExample.ts +++ b/assets/Script/example/ResKeeperExample.ts @@ -1,17 +1,21 @@ +import { assetManager } from "cc"; +import { SpriteFrame } from "cc"; +import { Sprite } from "cc"; +import { director, _decorator, Component, Label, Node, Prefab } from "cc"; import { ResLeakChecker } from "../res/ResLeakChecker"; -import ResLoader, { resLoader } from "../res/ResLoader"; +import { resLoader } from "../res/ResLoader"; import { ResUtil } from "../res/ResUtil"; -const { ccclass, property } = cc._decorator; +const { ccclass, property } = _decorator; @ccclass -export default class NetExample extends cc.Component { - @property(cc.Boolean) +export default class NetExample extends Component { + @property(Boolean) resUtilMode = true; - @property(cc.Node) - attachNode: cc.Node = null; - @property(cc.Label) - dumpLabel: cc.Label = null; + @property(Node) + attachNode: Node | null = null; + @property(Label) + dumpLabel: Label | null = null; checker = new ResLeakChecker(); start() { @@ -19,49 +23,46 @@ export default class NetExample extends cc.Component { } onAdd() { - ResLoader.load("prefabDir/HelloWorld", cc.Prefab, (error: Error, prefab: cc.Prefab) => { + resLoader.load("prefabDir/HelloWorld", Prefab, (error, prefab) => { if (!error) { let myNode = ResUtil.instantiate(prefab); myNode.parent = this.attachNode; myNode.setPosition((Math.random() * 500) - 250, myNode.position.y); console.log(myNode.position); - prefab.decRef(); } }); } onSub() { - if (this.attachNode.childrenCount > 0) { - this.attachNode.children[this.attachNode.childrenCount - 1].destroy(); + if (this.attachNode!.children.length > 0) { + this.attachNode!.children[this.attachNode!.children.length - 1].destroy(); } } onAssign() { - ResLoader.load("images/test", cc.SpriteFrame, (error: Error, sp: cc.SpriteFrame) => { + resLoader.load("images/test/spriteFrame", SpriteFrame, (error, sp) => { this.checker.traceAsset(sp); - if (this.attachNode.childrenCount > 0) { - let targetNode = this.attachNode.children[this.attachNode.childrenCount - 1]; - targetNode.getComponent(cc.Sprite).spriteFrame = ResUtil.assignWith(sp, targetNode, true); + if (this.attachNode!.children.length > 0) { + let targetNode = this.attachNode!.children[this.attachNode!.children.length - 1]; + targetNode.getComponent(Sprite)!.spriteFrame = ResUtil.assignWith(sp, targetNode, true); } - sp.decRef(); }); } onClean() { - this.attachNode.destroyAllChildren(); + this.attachNode!.destroyAllChildren(); } onDump() { this.checker.dump(); - let Loader: any = cc.loader; - this.dumpLabel.string = `当前资源总数:${Object.keys(Loader._cache).length}`; + this.dumpLabel!.string = `当前资源总数:${assetManager.assets.count}`; } onLoadClick() { - cc.director.loadScene("example_empty"); + this.checker.reset(); + director.loadScene("example_empty"); } onPreloadClick() { - cc.director.preloadScene("example_empty"); - } + director.preloadScene("example_empty"); } } diff --git a/assets/Script/example/ResKeeperExample.ts.meta b/assets/Script/example/ResKeeperExample.ts.meta index cdb978f..b7ce735 100644 --- a/assets/Script/example/ResKeeperExample.ts.meta +++ b/assets/Script/example/ResKeeperExample.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "44dffeac-521c-4e2b-9107-cbac1e6ce1ea", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/UIExample.ts b/assets/Script/example/UIExample.ts index b2c3b48..f66f012 100644 --- a/assets/Script/example/UIExample.ts +++ b/assets/Script/example/UIExample.ts @@ -1,39 +1,40 @@ -import { UIConf, uiManager } from "../ui/UIManager"; -import { resLoader } from "../res/ResLoader"; - -// Learn TypeScript: -// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html -// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html -// Learn Attribute: -// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html -// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html -// Learn life-cycle callbacks: -// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html -// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html - -const { ccclass, property } = cc._decorator; - -export enum UIID { - UILogin, - UIHall, - UINotice, - UIBag, -} - -export let UICF: { [key: number]: UIConf } = { - [UIID.UILogin]: { prefab: "Prefab/Login" }, - [UIID.UIHall]: { prefab: "Prefab/Hall" }, - [UIID.UINotice]: { prefab: "Prefab/Notice" }, - [UIID.UIBag]: { prefab: "Prefab/Bag", preventTouch: true }, -} - -@ccclass -export default class UIExample extends cc.Component { - - start() { - uiManager.initUIConf(UICF); - uiManager.open(UIID.UILogin); - } - - // update (dt) {} -} +import { UIConf, uiManager } from "../ui/UIManager"; +import { resLoader } from "../res/ResLoader"; +import { Component, _decorator } from "cc"; + +// Learn TypeScript: +// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html +// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html +// Learn Attribute: +// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html +// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html +// Learn life-cycle callbacks: +// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html +// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html + +const { ccclass, property } = _decorator; + +export enum UIID { + UILogin, + UIHall, + UINotice, + UIBag, +} + +export let UICF: { [key: number]: UIConf } = { + [UIID.UILogin]: { prefab: "Prefab/Login" }, + [UIID.UIHall]: { prefab: "Prefab/Hall" }, + [UIID.UINotice]: { prefab: "Prefab/Notice" }, + [UIID.UIBag]: { prefab: "Prefab/Bag", preventTouch: true }, +} + +@ccclass +export default class UIExample extends Component { + + start() { + uiManager.initUIConf(UICF); + uiManager.open(UIID.UILogin); + } + + // update (dt) {} +} diff --git a/assets/Script/example/UIExample.ts.meta b/assets/Script/example/UIExample.ts.meta index 5d22281..8672e59 100644 --- a/assets/Script/example/UIExample.ts.meta +++ b/assets/Script/example/UIExample.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "1ac134aa-f1cc-4b29-9b50-7b5842828af4", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/uiviews.meta b/assets/Script/example/uiviews.meta index f7bf95d..82d96a0 100644 --- a/assets/Script/example/uiviews.meta +++ b/assets/Script/example/uiviews.meta @@ -1,7 +1,12 @@ { - "ver": "1.0.1", - "uuid": "617085ba-564f-4bee-8dcd-8b6f47e9e5c0", - "isSubpackage": false, - "subpackageName": "", - "subMetas": {} -} \ No newline at end of file + "ver": "1.1.0", + "importer": "directory", + "imported": true, + "uuid": "95e5a5dc-080c-4717-af98-0a49efab7201", + "files": [], + "subMetas": {}, + "userData": { + "compressionType": {}, + "isRemoteBundle": {} + } +} diff --git a/assets/Script/example/uiviews/UIBag.ts b/assets/Script/example/uiviews/UIBag.ts index 997e427..7cd9e70 100644 --- a/assets/Script/example/uiviews/UIBag.ts +++ b/assets/Script/example/uiviews/UIBag.ts @@ -1,45 +1,48 @@ -import { UIView } from "../../ui/UIView"; -import { uiManager } from "../../ui/UIManager"; - -// Learn TypeScript: -// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html -// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html -// Learn Attribute: -// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html -// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html -// Learn life-cycle callbacks: -// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html -// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html - -const {ccclass, property} = cc._decorator; - -@ccclass -export default class UIBag extends UIView { - private selectItem: cc.SpriteFrame = null; - private selectNode: cc.Node = null; - - public init() { - - } - - public onClick(event) { - if (this.selectNode) { - this.selectNode.setScale(1); - } - - let node : cc.Node = event.target; - this.selectNode = node; - this.selectNode.setScale(1.5); - - let sprite = node.getComponent(cc.Sprite); - this.selectItem = sprite.spriteFrame; - } - - public onOkClick() { - uiManager.close(); - } - - public onClose(): any { - return this.selectItem; - } -} +import { UIView } from "../../ui/UIView"; +import { uiManager } from "../../ui/UIManager"; +import { _decorator } from "cc"; +import { SpriteFrame } from "cc"; +import { Sprite, Node } from "cc"; + +// Learn TypeScript: +// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html +// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html +// Learn Attribute: +// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html +// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html +// Learn life-cycle callbacks: +// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html +// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html + +const {ccclass, property} = _decorator; + +@ccclass +export default class UIBag extends UIView { + private selectItem: SpriteFrame | null= null; + private selectNode: Node | null = null; + + public init() { + + } + + public onClick(event : any) { + if (this.selectNode) { + this.selectNode.setScale(1, 1, 1); + } + + let node : Node = event.target; + this.selectNode = node; + this.selectNode.setScale(1.5, 1.5, 1.5); + + let sprite = node.getComponent(Sprite); + this.selectItem = sprite!.spriteFrame; + } + + public onOkClick() { + uiManager.close(); + } + + public onClose(): any { + return this.selectItem; + } +} diff --git a/assets/Script/example/uiviews/UIBag.ts.meta b/assets/Script/example/uiviews/UIBag.ts.meta index df15d41..3063fcf 100644 --- a/assets/Script/example/uiviews/UIBag.ts.meta +++ b/assets/Script/example/uiviews/UIBag.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "fca32edd-d4a8-4b8a-aea7-cc894b82d0a3", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/uiviews/UIHall.ts b/assets/Script/example/uiviews/UIHall.ts index 5b78229..c9f6462 100644 --- a/assets/Script/example/uiviews/UIHall.ts +++ b/assets/Script/example/uiviews/UIHall.ts @@ -1,24 +1,26 @@ -import { UIView } from "../../ui/UIView"; -import { uiManager } from "../../ui/UIManager"; -import { UIID } from "../UIExample"; - -const {ccclass, property} = cc._decorator; - -@ccclass -export default class UIHall extends UIView { - - @property({type : cc.Sprite}) - weapon: cc.Sprite = null; - - public onBag() { - uiManager.open(UIID.UIBag); - } - - public onNotice() { - uiManager.open(UIID.UINotice); - } - - public onTop(preID: number, item: cc.SpriteFrame) { - this.weapon.spriteFrame = item; - } -} +import { UIView } from "../../ui/UIView"; +import { uiManager } from "../../ui/UIManager"; +import { UIID } from "../UIExample"; +import { Sprite, _decorator } from "cc"; +import { SpriteFrame } from "cc"; + +const {ccclass, property} = _decorator; + +@ccclass +export default class UIHall extends UIView { + + @property({type : Sprite}) + weapon: Sprite | null = null; + + public onBag() { + uiManager.open(UIID.UIBag); + } + + public onNotice() { + uiManager.open(UIID.UINotice); + } + + public onTop(preID: number, item: SpriteFrame) { + this.weapon!.spriteFrame = item; + } +} diff --git a/assets/Script/example/uiviews/UIHall.ts.meta b/assets/Script/example/uiviews/UIHall.ts.meta index 5d91b1f..de35cd9 100644 --- a/assets/Script/example/uiviews/UIHall.ts.meta +++ b/assets/Script/example/uiviews/UIHall.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "f33533b6-6dcf-44b1-b345-90d71f0f9fcc", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/uiviews/UILogin.ts b/assets/Script/example/uiviews/UILogin.ts index fe75a4d..ec7480b 100644 --- a/assets/Script/example/uiviews/UILogin.ts +++ b/assets/Script/example/uiviews/UILogin.ts @@ -1,15 +1,16 @@ -import { UIView } from "../../ui/UIView"; -import { uiManager } from "../../ui/UIManager"; -import { UIID } from "../UIExample"; - -const {ccclass, property} = cc._decorator; - -@ccclass -export default class UILogin extends UIView { - - public onLogin() { - // 连续打开2个界面 - uiManager.replace(UIID.UIHall); - uiManager.open(UIID.UINotice); - } -} +import { UIView } from "../../ui/UIView"; +import { uiManager } from "../../ui/UIManager"; +import { UIID } from "../UIExample"; +import { _decorator } from "cc"; + +const {ccclass} = _decorator; + +@ccclass +export default class UILogin extends UIView { + + public onLogin() { + // 连续打开2个界面 + uiManager.replace(UIID.UIHall); + uiManager.open(UIID.UINotice); + } +} diff --git a/assets/Script/example/uiviews/UILogin.ts.meta b/assets/Script/example/uiviews/UILogin.ts.meta index fa752c2..cabd7b6 100644 --- a/assets/Script/example/uiviews/UILogin.ts.meta +++ b/assets/Script/example/uiviews/UILogin.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "969accd6-77d9-473a-95f7-c28bb820df79", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Script/example/uiviews/UINotice.ts b/assets/Script/example/uiviews/UINotice.ts index 2fc5173..e782364 100644 --- a/assets/Script/example/uiviews/UINotice.ts +++ b/assets/Script/example/uiviews/UINotice.ts @@ -1,11 +1,12 @@ -import { UIView } from "../../ui/UIView"; - -const {ccclass, property} = cc._decorator; - -@ccclass -export default class UINotice extends UIView { - - public init() { - - } -} +import { _decorator } from "cc"; +import { UIView } from "../../ui/UIView"; + +const {ccclass} = _decorator; + +@ccclass +export default class UINotice extends UIView { + + public init() { + + } +} diff --git a/assets/Script/example/uiviews/UINotice.ts.meta b/assets/Script/example/uiviews/UINotice.ts.meta index edfad92..84d16a4 100644 --- a/assets/Script/example/uiviews/UINotice.ts.meta +++ b/assets/Script/example/uiviews/UINotice.ts.meta @@ -1,9 +1,9 @@ { - "ver": "1.0.8", + "ver": "4.0.21", + "importer": "typescript", + "imported": true, "uuid": "db8814dd-4cb8-4cd1-9fce-d9743f13d99c", - "isPlugin": false, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file + "files": [], + "subMetas": {}, + "userData": {} +}