[add] EventBus使用

This commit is contained in:
2022-08-01 14:23:29 +08:00
parent 17b9af484e
commit cf95786b9c
34 changed files with 34622 additions and 635 deletions

View File

@@ -0,0 +1,41 @@
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class HelloWorld extends cc.Component {
@property(cc.Label)
public Label: cc.Label = null;
@property
public Text: string = 'hello';
@property(cc.Button)
public Btn: cc.Button = null;
// LIFE-CYCLE CALLBACKS:
// protected onLoad() {}
public onClickBtn() {
let url: string = window.location.search;
let URLscheme: any[] = [];
if (url.indexOf("?") !== -1) {
let str = url.substring(1);
let strs = str.split("&");
for (let i = 0; i < strs.length; i++) {
URLscheme[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
}
}
if (URLscheme["host"]) {
opener?.window.parent.postMessage({ data: "hello" }, URLscheme["host"]);
window.close();
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "fdc7a7f1-b81c-4e03-b45f-06e57e3529a6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}