接入ResLogin.otherPlayers
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { find } from "cc";
|
||||
import { BaseState } from "../../Framework/FSM/BaseState";
|
||||
import { UIMgr } from "../../Framework/UI/UIMgr";
|
||||
import { PlayerInfo } from "../../Shared/protocols/MsgResLogin";
|
||||
import { MsgResLogin, PlayerInfo } from "../../Shared/protocols/MsgResLogin";
|
||||
import { UIGame } from "../Game/UIGame";
|
||||
import { World } from "../Game/World";
|
||||
|
||||
@@ -14,6 +14,7 @@ import { World } from "../Game/World";
|
||||
* - 游戏主循环
|
||||
*/
|
||||
export class AppStatusGame extends BaseState {
|
||||
private _cmd: MsgResLogin
|
||||
private _player: PlayerInfo = null;
|
||||
private _isNewPlayer: boolean = false;
|
||||
private _uiGame: UIGame = null;
|
||||
@@ -25,10 +26,11 @@ export class AppStatusGame extends BaseState {
|
||||
/**
|
||||
* 进入游戏状态
|
||||
*/
|
||||
async onEnter(params?: any): Promise<void> {
|
||||
async onEnter(params?: MsgResLogin): Promise<void> {
|
||||
super.onEnter(params);
|
||||
|
||||
console.log("[AppStatusGame] 进入游戏世界");
|
||||
console.log("[AppStatusGame] 进入游戏世界", params);
|
||||
this._cmd = params
|
||||
|
||||
// 保存玩家信息
|
||||
if (params) {
|
||||
@@ -87,7 +89,7 @@ export class AppStatusGame extends BaseState {
|
||||
}
|
||||
|
||||
// 初始化世界,传入本地玩家信息
|
||||
await World.getInstance().init(worldRoot, this._player);
|
||||
await World.getInstance().init(worldRoot, this._player, this._cmd.otherPlayers);
|
||||
|
||||
console.log("[AppStatusGame] 游戏初始化完成");
|
||||
}
|
||||
@@ -117,7 +119,10 @@ export class AppStatusGame extends BaseState {
|
||||
* 更新游戏状态(每帧调用)
|
||||
*/
|
||||
onUpdate(dt: number): void {
|
||||
// TODO: 游戏主循环逻辑
|
||||
// 更新世界状态,包括玩家信息显示
|
||||
World.getInstance().update(dt);
|
||||
|
||||
// TODO: 其他游戏主循环逻辑
|
||||
// - 更新角色位置
|
||||
// - 检测碰撞
|
||||
// - 更新敌人AI
|
||||
|
||||
Reference in New Issue
Block a user