public void Execute(GameCmd.stForceStopUserMoveUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = ClientGlobal.Instance().MainPlayer; if (player == null) { return; } Vector3 pos = new Vector3(cmd.stop_pos_x * 0.01f, 0, -cmd.stop_pos_y * 0.01f); Engine.Utility.Log.LogGroup("ZDY", "stop move ==============================!"); player.SendMessage(EntityMessage.EntityCommand_ForceStopMove, pos); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false); // 请求服务器同步时间 GameCmd.stTimeTickMoveUserCmd_C cmd_send = new GameCmd.stTimeTickMoveUserCmd_C { client_time = (uint)(Time.realtimeSinceStartup * 1000) }; if (cmd_send != null && ClientGlobal.Instance().netService != null) { ClientGlobal.Instance().netService.SendCheckTime(cmd_send); } // 同步下服务器时间 EntitySystem.EntityConfig.m_bForceMove = true; //EntitySystem.EntityConfig.serverTime = cmd.server_time; //Engine.Utility.Log.LogGroup("XXF", "ForceStop {0}", EntitySystem.EntityConfig.serverTime); }
public void Execute(GameCmd.stFirstMainUserPosMapScreenUserCmd_S cmd) { //UserData.SetMsgTypeToEnterScene(); // 加载地图时,阻塞消息 //resetSceneData(); Action <UIPanelBase> loadingAction = (panelBase) => { UserData.MapID = cmd.mapid; // UserData.CurrentCountryID = cmd.countryid; UserData.Pos = new MapVector2(cmd.x, cmd.y); IMapSystem mapSystem = ClientGlobal.Instance().GetMapSystem(); if (mapSystem != null) { // 统一处理地图ID if (DataManager.Manager <MapDataManager>().CurLineNum != cmd.line && mapSystem.GetMapID() == cmd.mapid) { IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { es.Clear(); } GameCmd.stTimeTickMoveUserCmd_C cmdinfo = new GameCmd.stTimeTickMoveUserCmd_C { client_time = (uint)(Time.realtimeSinceStartup * 1000) }; NetService.Instance.SendCheckTime(cmdinfo); } //uint uSceneID = (cmd.countryid << 8) | cmd.mapid; mapSystem.EnterMap(cmd.mapid, new Vector3(cmd.x, 0, -cmd.y)); Log.Info("进入场景后的第一个消息 id={0}", cmd.mapid); } UserData.MapID = cmd.mapid; //UserData.CurrentCountryID = cmd.countryid; UserData.Pos = new MapVector2(cmd.x, cmd.y); Engine.Utility.Log.Error("EnterMap:({0},{1})", cmd.x, -cmd.y); MapDataManager mgr = DataManager.Manager <MapDataManager>(); if (mgr.CurLineNum != cmd.line) { if (!mgr.IsDefalultLine) { string mapName = mapSystem.GetMapName(); TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Copy_Commond_changeline, mapName, cmd.line); } DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ChangeLinePanel); // stRequestLineInfoMapScreenUserCmd_C changeLine = new stRequestLineInfoMapScreenUserCmd_C(); // NetService.Instance.Send(changeLine); } mgr.CurLineNum = cmd.line; }; if (UserData.MapID != cmd.mapid) { DataManager.Manager <UIPanelManager>().ShowLoading(progress: 0); } //else //{ // loadingAction.Invoke(null); //} loadingAction.Invoke(null); }