bool VoteCallBack(int nEventID, object param) { if (!m_ClientGlobal.IsMainPlayer(m_Master)) { return(true); } // uint state = GetBuffEffectType(); //if ( nEventID == (int)GameVoteEventID.SKILL_CANUSE ) //{ // if((state&(uint)BuffEffectType.CANOT_USESKILL) == (uint)BuffEffectType.CANOT_USESKILL) // { // return false; // } // if ( ( state & (uint)BuffEffectType.CANNOT_USEATTACKANDSKILL ) == (uint)BuffEffectType.CANNOT_USEATTACKANDSKILL ) // { // return false; // } //} //else if ( nEventID == (int)GameVoteEventID.ENTITYSYSTEM_VOTE_ENTITYMOVE ) //{ // stVoteEntityMove move = (stVoteEntityMove)param; // if (m_Master.GetUID() == move.uid) // { // if ((state & (uint)BuffEffectType.CANNOT_MOVE) == (uint)BuffEffectType.CANNOT_MOVE) // { // return false; // } // } //} return(true); }
public void OnContrllerEvent(int nEventID, object param) { if (m_Host == null) { Engine.Utility.Log.Error("MoveController.OnContrllerEvent: host is null"); return; } if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE) { Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param; if (m_bJoystick && stopEntity.uid == m_Host.GetUID() && !stopEntity.bExternal) // 自行移动停止才需要继续向前预测 { // 继续向前预测 MoveByDir(m_fCalcRotate); } } else if (nEventID == (int)Client.GameEventID.SKLL_LONGPRESS) { stSkillLongPress st = (stSkillLongPress)param; m_bSkillLongPress = st.bLongPress; } else if (nEventID == (int)Client.GameEventID.ENTITYSYSTEM_ENTITYDEAD) { stEntityDead ed = (stEntityDead)param; if (m_ClientGlobal.IsMainPlayer(ed.uid)) { m_bJoystick = false; m_Host.SendMessage(EntityMessage.EntityCommand_StopMove, m_ClientGlobal.MainPlayer.GetPos()); } } else if (nEventID == (int)Client.GameEventID.SKILL_FORBIDDENJOYSTICK) { Client.stForbiddenJoystick info = (Client.stForbiddenJoystick)param; Client.IPlayer player = m_ClientGlobal.MainPlayer; if (player == null) { return; } if (info.playerID == player.GetUID()) { //bForbiddenJoystick = info.bFobidden; //if(bForbiddenJoystick) //{ // // Log.LogGroup( "ZDY" , "摇杆禁用" ); //} //else //{ // // Log.LogGroup( "ZDY" , "摇杆回复" ); //} } } }
private void OnEvent(int nEventID, object param) { // 地表没有创建成功的时候,就已经收到了角色和NPC的创建 这里重新设置位置和地表做碰撞 if (nEventID == (int)GameEventID.SYSTEM_LOADSCENECOMPELETE) { //List<IPlayer> lstPlayer; FindAllEntity <IPlayer>(ref lstPlayer); for (int i = 0; i < lstPlayer.Count; ++i) { Vector3 pos = lstPlayer[i].GetPos(); lstPlayer[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstPlayer.Clear(); //List<INPC> lstNPC; FindAllEntity <INPC>(ref lstNPC); for (int i = 0; i < lstNPC.Count; ++i) { Vector3 pos = lstNPC[i].GetPos(); lstNPC[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstNPC.Clear(); //List<IBox> lstBox; FindAllEntity <IBox>(ref lstBox); for (int i = 0; i < lstBox.Count; ++i) { Vector3 pos = lstBox[i].GetPos(); pos.y += 0.2f; lstBox[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstBox.Clear(); //List<IRobot> lstRobot; FindAllEntity <IRobot>(ref lstRobot); for (int i = 0; i < lstRobot.Count; ++i) { Vector3 pos = lstRobot[i].GetPos(); lstRobot[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstRobot.Clear(); // 请求同步移动时间 ReqMoveServerTime(); } else if (nEventID == (int)GameEventID.RECONNECT_SUCESS) // 重新连接成功 { stReconnectSucess st = (stReconnectSucess)param; if (st.isLogin) { Clear(false); // 不清理除主角 // 请求同步移动时间 ReqMoveServerTime(); } else {//强制同步 GameCmd.stUserMoveMoveUserCmd_C cmd = new GameCmd.stUserMoveMoveUserCmd_C(); cmd.client_time = 0; List <GameCmd.Pos> list = new List <GameCmd.Pos>(); GameCmd.Pos pp = new GameCmd.Pos(); pp.x = 0; pp.y = 0; list.Add(pp); cmd.poslist.AddRange(list); m_ClientGlobal.netService.Send(cmd); } } else if (nEventID == (int)GameEventID.NETWORK_CONNECTE_CLOSE)// 网络断开 { if (m_ClientGlobal.MainPlayer != null) { m_ClientGlobal.MainPlayer.SendMessage(EntityMessage.EntityCommand_RemoveLinkAllEffect); } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) // 实体死亡 { stEntityDead ed = (stEntityDead)param; if (m_ClientGlobal.IsMainPlayer(ed.uid)) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rs.EnableGray(true); } } IEntity en = FindEntity(ed.uid); if (en != null) { AddEffectOnEntity(en, false); } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_RELIVE) { stEntityRelive ed = (stEntityRelive)param; if (m_ClientGlobal.IsMainPlayer(ed.uid)) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rs.EnableGray(false); } } IEntity en = FindEntity(ed.uid); if (en != null) { AddEffectOnEntity(en, true); } } else if (nEventID == (int)GameEventID.PLAYER_LOGIN_SUCCESS) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rs.EnableGray(false); } // 请求同步移动时间 ReqMoveServerTime(); } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_LEAVEMAP) // 离开地图 { // 清理地图上所有对象 Clear(false); // 切地图时让主角停止移动 IPlayer mainPlayer = EntitySystem.m_ClientGlobal.MainPlayer; if (mainPlayer != null) { bool ismoving = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (ismoving) { mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_StopMove, mainPlayer.GetPos()); } } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_CHANGEAREA) // 区域变化 动作处理 { stEntityChangeArea changeArea = (stEntityChangeArea)param; IEntity en = FindEntity(changeArea.uid); if (en != null && en.GetEntityType() == EntityType.EntityType_Player) { string strCurAni = (string)en.SendMessage(EntityMessage.EntityCommand_GetCurAni, null); bool bChangeArea = false; if (changeArea.eType == MapAreaType.Safe || changeArea.eType == MapAreaType.Fish) { if (strCurAni == EntityAction.Stand_Combat) { strCurAni = EntityAction.Stand; bChangeArea = true; } if (strCurAni == EntityAction.Run_Combat) { strCurAni = EntityAction.Run; bChangeArea = true; } } else { if (strCurAni == EntityAction.Stand) { strCurAni = EntityAction.Stand_Combat; bChangeArea = true; } if (strCurAni == EntityAction.Run) { strCurAni = EntityAction.Run_Combat; bChangeArea = true; } } if (bChangeArea) { PlayAni anim_param = new PlayAni(); anim_param.strAcionName = strCurAni; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.1f; en.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_CREATEENTITY) { stCreateEntity create = (stCreateEntity)param; IEntity en = FindEntity(create.uid); if (en != null) { EntityManager.Instance().OnCreateEntity(en); } } }