2023-10-23 18:56:01 +08:00
|
|
|
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';
|
2023-10-26 03:06:44 +08:00
|
|
|
import { TableGRole } from '../resources/config/ts/TableGRole';
|
2023-10-23 18:56:01 +08:00
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
|
|
@ccclass('Main')
|
|
|
|
export class Main extends Component {
|
|
|
|
|
|
|
|
@property(Prefab)
|
|
|
|
UIPrefab: Prefab = null;
|
|
|
|
|
|
|
|
@property(Prefab)
|
|
|
|
WorldPrefab: Prefab = null;
|
|
|
|
|
|
|
|
async onLoad(){
|
|
|
|
|
|
|
|
//加载 APP
|
2023-10-24 19:12:25 +08:00
|
|
|
await JNGame.Init(app,[
|
|
|
|
{path:"proto/GDemo"}
|
|
|
|
]);
|
2023-10-23 18:56:01 +08:00
|
|
|
|
2023-10-26 03:06:44 +08:00
|
|
|
console.log("TableGRole",TableGRole.getAllConfig())
|
|
|
|
|
2023-10-23 18:56:01 +08:00
|
|
|
//发生帧同步开始
|
|
|
|
app.socket.Send(JNSyncAction.NSyncFrameStart);
|
|
|
|
|
|
|
|
// 创建UI
|
|
|
|
director.getScene().addChild(instantiate(this.UIPrefab));
|
|
|
|
// 创建世界
|
|
|
|
director.getScene().addChild(instantiate(this.WorldPrefab));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|