mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-10-13 02:26:07 +00:00
update
This commit is contained in:
33
JisolGameCocos/assets/script/Main.ts
Normal file
33
JisolGameCocos/assets/script/Main.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { _decorator, Component, director, instantiate, Node, Prefab } from 'cc';
|
||||
import { app } from './App';
|
||||
import { JNGame } from '../../extensions/ngame/assets/ngame/JNGame';
|
||||
import { JNSyncAction } from '../../extensions/ngame/assets/ngame/sync/JNSyncAction';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('Main')
|
||||
export class Main extends Component {
|
||||
|
||||
@property(Prefab)
|
||||
UIPrefab: Prefab = null;
|
||||
|
||||
@property(Prefab)
|
||||
WorldPrefab: Prefab = null;
|
||||
|
||||
async onLoad(){
|
||||
|
||||
//加载 APP
|
||||
await JNGame.Init(app);
|
||||
|
||||
//发生帧同步开始
|
||||
app.socket.Send(JNSyncAction.NSyncFrameStart);
|
||||
|
||||
// 创建UI
|
||||
director.getScene().addChild(instantiate(this.UIPrefab));
|
||||
// 创建世界
|
||||
director.getScene().addChild(instantiate(this.WorldPrefab));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user