mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
39 lines
1008 B
TypeScript
39 lines
1008 B
TypeScript
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';
|
|
import JNFrameTween, { JTween } from '../../extensions/ngame/assets/ngame/sync/frame/game/tween/JNFrameTween';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('Main')
|
|
export class Main extends Component {
|
|
|
|
@property(Prefab)
|
|
UIPrefab: Prefab = null;
|
|
|
|
@property(Prefab)
|
|
WorldPrefab: Prefab = null;
|
|
|
|
async onLoad(){
|
|
|
|
JTween().start();
|
|
|
|
//加载 APP
|
|
await JNGame.Init(app,[
|
|
{path:"proto/GDemo"}
|
|
]);
|
|
|
|
//发生帧同步开始
|
|
app.socket.Send(JNSyncAction.NSyncFrameStart);
|
|
|
|
// 创建UI
|
|
director.getScene().addChild(instantiate(this.UIPrefab));
|
|
// 创建世界
|
|
director.getScene().addChild(instantiate(this.WorldPrefab));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|