[add] EventBus使用
This commit is contained in:
		
							
								
								
									
										12
									
								
								Project/assets/Scene.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Project/assets/Scene.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.1.2",
 | 
			
		||||
  "uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
 | 
			
		||||
  "isBundle": false,
 | 
			
		||||
  "bundleName": "",
 | 
			
		||||
  "priority": 1,
 | 
			
		||||
  "compressionType": {},
 | 
			
		||||
  "optimizeHotUpdate": {},
 | 
			
		||||
  "inlineSpriteFrames": {},
 | 
			
		||||
  "isRemoteBundle": {},
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1010
									
								
								Project/assets/Scene/helloworld.fire
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1010
									
								
								Project/assets/Scene/helloworld.fire
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										7
									
								
								Project/assets/Scene/helloworld.fire.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Project/assets/Scene/helloworld.fire.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.2.9",
 | 
			
		||||
  "uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
 | 
			
		||||
  "asyncLoadAssets": false,
 | 
			
		||||
  "autoReleaseAssets": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								Project/assets/Script.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Project/assets/Script.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.1.2",
 | 
			
		||||
  "uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
 | 
			
		||||
  "isBundle": false,
 | 
			
		||||
  "bundleName": "",
 | 
			
		||||
  "priority": 1,
 | 
			
		||||
  "compressionType": {},
 | 
			
		||||
  "optimizeHotUpdate": {},
 | 
			
		||||
  "inlineSpriteFrames": {},
 | 
			
		||||
  "isRemoteBundle": {},
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										41
									
								
								Project/assets/Script/HelloWorld.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								Project/assets/Script/HelloWorld.ts
									
									
									
									
									
										Normal 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();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								Project/assets/Script/HelloWorld.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Project/assets/Script/HelloWorld.ts.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.0.8",
 | 
			
		||||
  "uuid": "fdc7a7f1-b81c-4e03-b45f-06e57e3529a6",
 | 
			
		||||
  "isPlugin": false,
 | 
			
		||||
  "loadPluginInWeb": true,
 | 
			
		||||
  "loadPluginInNative": true,
 | 
			
		||||
  "loadPluginInEditor": false,
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								Project/assets/Texture.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Project/assets/Texture.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "1.1.2",
 | 
			
		||||
  "uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
 | 
			
		||||
  "isBundle": false,
 | 
			
		||||
  "bundleName": "",
 | 
			
		||||
  "priority": 1,
 | 
			
		||||
  "compressionType": {},
 | 
			
		||||
  "optimizeHotUpdate": {},
 | 
			
		||||
  "inlineSpriteFrames": {},
 | 
			
		||||
  "isRemoteBundle": {},
 | 
			
		||||
  "subMetas": {}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Project/assets/Texture/HelloWorld.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Project/assets/Texture/HelloWorld.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 37 KiB  | 
							
								
								
									
										36
									
								
								Project/assets/Texture/HelloWorld.png.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Project/assets/Texture/HelloWorld.png.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.3.5",
 | 
			
		||||
  "uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
 | 
			
		||||
  "type": "sprite",
 | 
			
		||||
  "wrapMode": "clamp",
 | 
			
		||||
  "filterMode": "bilinear",
 | 
			
		||||
  "premultiplyAlpha": false,
 | 
			
		||||
  "genMipmaps": false,
 | 
			
		||||
  "packable": true,
 | 
			
		||||
  "width": 195,
 | 
			
		||||
  "height": 270,
 | 
			
		||||
  "platformSettings": {},
 | 
			
		||||
  "subMetas": {
 | 
			
		||||
    "HelloWorld": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc",
 | 
			
		||||
      "rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": 0,
 | 
			
		||||
      "offsetY": 0,
 | 
			
		||||
      "trimX": 0,
 | 
			
		||||
      "trimY": 0,
 | 
			
		||||
      "width": 195,
 | 
			
		||||
      "height": 270,
 | 
			
		||||
      "rawWidth": 195,
 | 
			
		||||
      "rawHeight": 270,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Project/assets/Texture/singleColor.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Project/assets/Texture/singleColor.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 82 B  | 
							
								
								
									
										36
									
								
								Project/assets/Texture/singleColor.png.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Project/assets/Texture/singleColor.png.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{
 | 
			
		||||
  "ver": "2.3.5",
 | 
			
		||||
  "uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
 | 
			
		||||
  "type": "sprite",
 | 
			
		||||
  "wrapMode": "clamp",
 | 
			
		||||
  "filterMode": "bilinear",
 | 
			
		||||
  "premultiplyAlpha": false,
 | 
			
		||||
  "genMipmaps": false,
 | 
			
		||||
  "packable": true,
 | 
			
		||||
  "width": 2,
 | 
			
		||||
  "height": 2,
 | 
			
		||||
  "platformSettings": {},
 | 
			
		||||
  "subMetas": {
 | 
			
		||||
    "singleColor": {
 | 
			
		||||
      "ver": "1.0.4",
 | 
			
		||||
      "uuid": "410fb916-8721-4663-bab8-34397391ace7",
 | 
			
		||||
      "rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
 | 
			
		||||
      "trimType": "auto",
 | 
			
		||||
      "trimThreshold": 1,
 | 
			
		||||
      "rotated": false,
 | 
			
		||||
      "offsetX": 0,
 | 
			
		||||
      "offsetY": 0,
 | 
			
		||||
      "trimX": 0,
 | 
			
		||||
      "trimY": 0,
 | 
			
		||||
      "width": 2,
 | 
			
		||||
      "height": 2,
 | 
			
		||||
      "rawWidth": 2,
 | 
			
		||||
      "rawHeight": 2,
 | 
			
		||||
      "borderTop": 0,
 | 
			
		||||
      "borderBottom": 0,
 | 
			
		||||
      "borderLeft": 0,
 | 
			
		||||
      "borderRight": 0,
 | 
			
		||||
      "subMetas": {}
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user