public void Execute(stSetPKModePropertyUserCmd_CS cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IEntity en = es.FindPlayer(cmd.userid); if (en != null) { en.SetProp((int)PlayerProp.PkMode, (int)cmd.pkmode); stPropUpdate prop = new stPropUpdate(); prop.uid = en.GetUID(); prop.nPropIndex = (int)PlayerProp.PkMode; prop.oldValue = en.GetProp((int)PlayerProp.PkMode); prop.newValue = (int)cmd.pkmode; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop); //切换模式后刷新一下场景内的的血条 RoleStateBarManager.RefreshAllRoleBarHeadStatus(HeadStatusType.Hp); } else { Engine.Utility.Log.Error("找不到player :{0}", cmd.userid); } }
public void Execute(stSetPKValuePropertyUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IEntity en = es.FindPlayer(cmd.userid); if (en != null) { en.SetProp((int)PlayerProp.PKValue, (int)cmd.pkvalue); stPropUpdate prop = new stPropUpdate(); prop.uid = en.GetUID(); prop.nPropIndex = (int)PlayerProp.PKValue; prop.oldValue = en.GetProp((int)PlayerProp.PKValue); prop.newValue = (int)cmd.pkvalue; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop); } else { Engine.Utility.Log.Error("找不到player :{0}", cmd.userid); } }
public void Execute(stMainUserDataUserCmd_S cmd) { //MainRole.Instance.MainData = cmd.data; // TODO: 后面再来处理 IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } EntityCreateData data = new EntityCreateData(); data.PropList = new EntityAttr[(int)PlayerProp.End - (int)EntityProp.Begin]; data.ID = cmd.data.dwUserID; RoleUtil.BuildPlayerPropList(cmd.data, ref data.PropList); IPlayer player = es.FindPlayer(cmd.data.dwUserID); if (player != null) { player.UpdateProp(data); DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSetRoleProperty, player); } }
public void Excute(GameCmd.stMainUserRelivePropertyUserCmd_S cmd) { // GameCmd.stReliveColdMagicUserCmd Engine.Utility.Log.Info("复活玩家 id: " + cmd.dwUserTempID); IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(cmd.dwUserTempID); if (player == null) { return; } // MapVector2 mapPos = MapVector2.FromCoordinate(cmd.x, cmd.y); Vector3 pos = new Vector3(cmd.x, 0, -cmd.y); // 服务器到客户端坐标转换 player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); player.ChangeState(CreatureState.Normal); stEntityRelive stRelive = new stEntityRelive(); stRelive.uid = player.GetUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_RELIVE, stRelive); }
public void Execute(GameCmd.stUserStopMoveUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(cmd.charid); if (player == null) { return; } if (ClientGlobal.Instance().IsMainPlayer(player)) { 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); }
public void Execute(GameCmd.stBatchRemoveUserMapScreenUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } for (int i = 0; i < cmd.id.Count; ++i) { EntityCreator.Instance().RemovePlayer(cmd.id[i]); IPlayer player = es.FindPlayer(cmd.id[i]); if (player != null) { if (!ClientGlobal.Instance().IsMainPlayer(player)) { Client.stRemoveEntity removeEntiy = new Client.stRemoveEntity(); removeEntiy.uid = player.GetUID(); Engine.Utility.Log.Info("remove :" + cmd.id[i]); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_REMOVEENTITY, removeEntiy); es.RemoveEntity(player); } } } }
public void RebackWeaponSuitAndCleanData(uint uid) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } IPlayer player = es.FindPlayer(uid); if (player == null) { return; } uint suitId; if (m_playerSuitDic.TryGetValue(player.GetID(), out suitId)) { SendChangeBody(2, suitId, player); SendChangeRenderObj(suitId, 2, player.GetID()); m_playerSuitDic.Remove(player.GetID()); m_playerFishingDic.Remove(player.GetID()); } }
void OnClickMsg(GameObject o) { // 发送事件 //显示切换目标 es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { IPlayer m_curTarget = es.FindPlayer(this.teamMemberInfo.id); if (m_curTarget != null) { Client.stTargetChange targetChange = new Client.stTargetChange(); targetChange.target = m_curTarget; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_TARGETCHANGE, targetChange); } } //左侧最远操作界面 if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MissionAndTeamPanel)) { stTeamMemberBtn teamMemberBtn = new stTeamMemberBtn(); teamMemberBtn.id = this.teamMemberInfo.id; teamMemberBtn.name = this.teamMemberInfo.name; teamMemberBtn.pos_y = this.transform.position.y; DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MissionAndTeamPanel, UIMsgID.eTeamMemberBtn, teamMemberBtn); } }
public override bool OnTogglePanel(int tabType, int pageid) { if (pageid == (int)PropPanelPageEnum.Page_Prop) { SetPanelMode(PropPanelMode.Prop, true); uint showUID = ClientGlobal.Instance().MainPlayer.GetID(); IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return(false); } IPlayer player = es.FindPlayer(showUID); if (player == null) { return(false); } m_currShowUID = showUID; ShowByPlayer(player); m_label_fight.gameObject.SetActive(true); } else if (pageid == (int)PropPanelPageEnum.Page_Title) { SetPanelMode(PropPanelMode.Title, true); } else if (pageid == (int)PropPanelPageEnum.Page_Fashion) { SetPanelMode(PropPanelMode.Fashion, true); m_label_fight.gameObject.SetActive(false); } // 页签红点提示 UpdateRedPoint(); return(base.OnTogglePanel(tabType, pageid)); }
public void Execute(stSendGoodNessDataUserCmd cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IEntity en = es.FindPlayer(cmd.userid); if (en != null) { //// 时间(分钟) 大于0表示恶,否则表示善 暂时没用 en.SetProp((int)PlayerProp.GoodNess, (int)cmd.goodstate);//GameCmd.enumGoodNess.GoodNess_Badman: stPropUpdate prop = new stPropUpdate(); prop.uid = en.GetUID(); prop.nPropIndex = (int)PlayerProp.GoodNess; prop.oldValue = en.GetProp((int)PlayerProp.GoodNess); prop.newValue = (int)cmd.goodstate; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop); } else { Engine.Utility.Log.Error("找不到player :{0}", cmd.userid); } }
public void PlayAni(uint uid, string entityAction, int loop) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } IPlayer player = es.FindPlayer(uid); if (player == null) { return; } //处理 PlayAni anim_param = new PlayAni(); anim_param.strAcionName = entityAction; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = loop; anim_param.fBlendTime = 0.2f; player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); }
public void Execute(GameCmd.stNotifyUninterruptMagicUserCmd_S cmd) { if (cmd.actiontype == UninterruptActionType.UninterruptActionType_SkillCJ) { ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.userid, EntityType.EntityType_Player); if (skillPart == null) { Engine.Utility.Log.Error("获取主角技能部件失败!"); return; } Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSBREAK, new stGuildBreak() { action = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ, uid = cmd.userid, skillid = skillPart.GetCurSkillDataBase().wdID }); TimerAxis.Instance().KillTimer(m_uReadSliderTimerID, this); skillPart.OnInterruptSkill(cmd.userid, cmd.time, cmd.type, (uint)cmd.actiontype); } else if (cmd.actiontype == UninterruptActionType.UninterruptActionType_GOHOME) { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, cmd.userid); IEntitySystem pEntitySystem = ClientGlobal.Instance().GetEntitySystem(); if (pEntitySystem != null) { IPlayer pPlayer = pEntitySystem.FindPlayer((uint)id); if (pPlayer != null) { if (pPlayer.IsMainPlayer()) { Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.time; param.type = cmd.actiontype; param.uid = id; param.npcId = cmd.npcid; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); } else { } } } } else { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, cmd.userid); Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.time; param.type = cmd.actiontype; param.uid = id; param.npcId = cmd.npcid; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); } }
public override void SetGridData(object data) { base.SetGridData(data); this.m_playerId = (uint)data; IEntitySystem entitySystem = ClientGlobal.Instance().GetEntitySystem(); IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer; if (entitySystem == null) { return; } if (mainPlayer == null) { return; } IPlayer player = entitySystem.FindPlayer(this.m_playerId); if (player == null) { //锁定玩家太远 取不到九屏数据 不显示距离 m_lblDistance.gameObject.SetActive(false); return; } //name SetName(player.GetName()); //icon int job = player.GetProp((int)PlayerProp.Job); SetIcon((uint)job); //lv int lv = player.GetProp((int)CreatureProp.Level); SetLv(lv); //hp float hp = (float)player.GetProp((int)CreatureProp.Hp); int maxHp = player.GetProp((int)CreatureProp.MaxHp); if (maxHp > 0) { SetHp(hp / maxHp); } //distance float distace = Vector3.Distance(mainPlayer.GetPos(), player.GetPos()); SetDistance(distace); }
/// <summary> /// 9屏同步钓鱼动作 /// </summary> /// <param name="cmd"></param> public void OnFishingAniToNine(stFishToNinePropertyUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } IPlayer player = es.FindPlayer(cmd.uid); if (player == null) { return; } //不是钓鱼的装备 换成钓鱼的装备 if (false == DataManager.Manager <SuitDataManager>().IsFishingSuit(cmd.uid)) { //调整人物朝向 AdjustPlayerFoward(player); //武器换成鱼竿 DataManager.Manager <SuitDataManager>().OnFishingRodSuit(player); } // 1 :为抛竿 3 :为收杆 if (cmd.type == 1) { PlayStartFishingAni(cmd.uid); //鱼竿动画 PlayFishingRodAni(cmd.uid, "Angling_Start"); //关闭画鱼线 CloseFishingLine(cmd.uid); Engine.CorotinueInstance.Instance.StartCoroutine(DrawFishingLine(cmd.uid)); } else if (cmd.type == 3) { PlayAnimation(cmd.uid, EntityAction.FishingEnd, 1); //鱼竿动画 PlayFishingRodAni(cmd.uid, "Angling_End"); //关闭画鱼线 CloseFishingLine(cmd.uid); //收杆动作完成后 回收鱼竿 播放idle Engine.CorotinueInstance.Instance.StartCoroutine(DelayToFishngStand(cmd.uid)); } }
public void ShowByUID(uint id) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(id); if (player == null) { return; } int level = player.GetProp((int)CreatureProp.Level); #region 基础经验显示 for (int i = 1; i < 5; i++) { uint treeID = uint.Parse("50" + i); if (treeID == null) { return; } table.WishingTreeDataBase data = GameTableManager.Instance.GetTableItem <table.WishingTreeDataBase>(treeID); uint level_min2 = data.level_min2; GameObject tree = m_widget_tree.transform.Find("tree_" + i).gameObject; UILabel exp = tree.transform.Find("exp").GetComponent <UILabel>(); if (level < level_min2) { exp.text = (level * data.master_exp_mul1).ToString(); } else { exp.text = (level * data.master_exp_mul2).ToString(); } Transform status = tree.transform.Find("status").GetComponent <Transform>(); UISprite btn = status.transform.Find("btn_buy_" + i).GetComponent <UISprite>(); UILabel price = btn.GetComponentInChildren <UILabel>(); price.text = data.price.ToString(); } #region 元宝显示 #endregion #endregion }
/// <summary> /// 切换目标 /// </summary> /// <param name="id"></param> void SelectTargetChange(uint id) { //切换目标 IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { IPlayer m_curTarget = es.FindPlayer(id); if (m_curTarget != null) { //检测视野(策划要求不做视野检测) //if (es.CheckEntityVisible(m_curTarget)) //检测搜索范围 if (es.CheckSearchRange(m_curTarget)) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { //如果在挂机先停止(清任务目标),再开始,打指定目标 if (cs.GetCombatRobot().Status == CombatRobotStatus.RUNNING) { cs.GetCombatRobot().Stop(); cs.GetCombatRobot().Start(); } } Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().UpdateTarget(m_curTarget); Client.stTargetChange targetChange = new Client.stTargetChange(); targetChange.target = m_curTarget; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSYTEM_TAB, targetChange); // Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_TARGETCHANGE, targetChange); } else { TipsManager.Instance.ShowTips("目标不在附近"); } } else { TipsManager.Instance.ShowTips("目标不在附近"); } } }
/// <summary> /// 队长是否在9屏内 /// </summary> /// <returns></returns> bool IsIn9Screen() { uint leaderId = DataManager.Manager <TeamDataManager>().LeaderId; IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es != null) { IPlayer leaderPlaer = es.FindPlayer(leaderId); return(leaderPlaer != null); //在9屏 返回true, 否则 false } else { Engine.Utility.Log.Error("IEntitySystem 为 null !!!"); return(false); } }
IEntity GetEntity(uint id, EntityType type) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return(null); } IEntity entity = null; switch (type) { case EntityType.EntityType_Item: entity = es.FindItem(id); break; case EntityType.EntityType_Monster: entity = es.FindMonster(id); break; case EntityType.EntityType_NPC: { entity = es.FindNPC(id); if (entity == null) { entity = es.FindRobot(id); } } break; case EntityType.EntityType_Player: entity = es.FindPlayer(id); break; case EntityType.EntityType_Puppet: entity = es.FindPuppet(id); break; default: break; } return(entity); }
public void RefrushServerPos(GameCmd.stSendUserCurPosMoveUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(cmd.char_id); if (player == null) { return; } player.RefrushServerPos(new Vector3(cmd.pos_info.x * 0.01f, 0, -cmd.pos_info.y * 0.01f)); }
public void Execute(GameCmd.stUserMoveMoveUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(cmd.charid); if (player == null) { return; } if (ClientGlobal.Instance().IsMainPlayer(player)) { return; } Move move = new Move(); move.m_speed = player.GetProp((int)WorldObjProp.MoveSpeed) * EntityConst.MOVE_SPEED_RATE; // 速度为测试速度 move.strRunAct = Client.EntityAction.Run; move.path = new List <Vector3>(); // 添加起点 move.path.Add(new Vector3(cmd.begin_pos_x * 0.01f, 0, -cmd.begin_pos_y * 0.01f)); for (int i = 0; i < cmd.poslist.Count; ++i) { //if (i > 0) //{ // move.path.Add(new Vector3(cmd.poslist[i].x, 0, -cmd.poslist[i].y)); //} //else { move.path.Add(new Vector3(cmd.poslist[i].x * 0.01f, 0, -cmd.poslist[i].y * 0.01f)); } } player.SendMessage(EntityMessage.EntityCommand_MovePath, (object)move); }
public void Execute(stReturnUserNameRequestUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); foreach (var item in cmd.data) { IPlayer player = es.FindPlayer(item.id); if (player != null) { player.SendMessage(EntityMessage.EntityCommond_SetName, item.name); //玩家自己 if (Client.ClientGlobal.Instance().IsMainPlayer(player)) { stNewName name = new stNewName(); name.newName = item.name; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_NEWNAME, name); } } } }
/// <summary> /// 第四 /// </summary> /// <param name="data"></param> protected override void OnShow(object data) { base.OnShow(data); // Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, EventCallBack); Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.TITLE_TIMEOUT, EventCallBack); Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.TITLE_WEAR, EventCallBack); Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.TITLE_ACTIVATE, EventCallBack); Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.TITLE_NEWTITLE, EventCallBack); Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.TITLE_USETIMES, EventCallBack); Engine.Utility.EventEngine.Instance().AddEventListener((int)GameEventID.ENTITYSYSTEM_CHANGERENDEROBJ, SuitEventCallBack); uint showUID = ClientGlobal.Instance().MainPlayer.GetID(); if (data != null && data is uint) { showUID = (uint)data; } IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(showUID); if (player == null) { return; } m_currShowUID = showUID; ShowByPlayer(player); // 页签红点提示 UpdateRedPoint(); }
public void Execute(GameCmd.stChangeMoveSpeedDataUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } switch (cmd.type) { case (uint)SceneEntryType.SceneEntry_NPC: { INPC npc = es.FindNPC(cmd.id); if (npc != null) { npc.SetProp((int)WorldObjProp.MoveSpeed, (int)cmd.mvspd); npc.SendMessage(EntityMessage.EntityCommand_SetAniSpeed, (object)1.0f); } } break; case (uint)SceneEntryType.SceneEntry_Player: { IPlayer player = es.FindPlayer(cmd.id); if (player != null) { player.SetProp((int)WorldObjProp.MoveSpeed, (int)cmd.mvspd); player.SendMessage(EntityMessage.EntityCommand_SetAniSpeed, (object)1.0f); } } break; default: break; } }
/// <summary> /// 9屏同步钓鱼状态 /// </summary> /// <param name="cmd"></param> public void OnFishingStateToNine(stFishStateToNinePropertyUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } IPlayer player = es.FindPlayer(cmd.uid); if (player == null) { return; } // 1 :进入钓鱼 2 :退出钓鱼 if (cmd.type == 1) { //调整人物朝向 AdjustPlayerFoward(player); //武器换成鱼竿 DataManager.Manager <SuitDataManager>().OnFishingRodSuit(player); } else if (cmd.type == 2) { //鱼竿换回武器 DataManager.Manager <SuitDataManager>().RebackWeaponSuitAndCleanData(player.GetID()); //播放站立动作 PlayAnimation(cmd.uid, EntityAction.Stand, -1); //关闭画鱼线 CloseFishingLine(cmd.uid); } }
public void AddPlayer(t_MapUserData data, Vector3 pos, uint dir, List <GameCmd.Pos> lstPos, bool bHavePos = false) { if (data == null) { return; } IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = null; if (es.FindPlayer(data.userdata.dwUserID) != null) // 更新数据 { player = CreatePlayer(data); if (player != null && bHavePos) { player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); //Vector3 rot = GameUtil.S2CDirection(dir); //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); } return; } // 主角立即创建 if (UserData.IsMainRoleID(data.userdata.dwUserID)) { player = CreatePlayer(data); if (player != null && bHavePos) { player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); //Vector3 rot = GameUtil.S2CDirection(dir); //player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); } return; } player = CreatePlayer(data); if (player != null && bHavePos) { player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); Vector3 rot = GameUtil.S2CDirection(dir); player.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot); //m_UserDataPool.Free(iter.Current.Value); // m_dicUserData.Remove(iter.Current.Value.data.userdata.dwUserID); // break; if (lstPos != null) { Move move = new Move(); move.m_speed = player.GetProp((int)WorldObjProp.MoveSpeed) * EntityConst.MOVE_SPEED_RATE; // 速度为测试速度 move.strRunAct = Client.EntityAction.Run; move.path = new List <Vector3>(); // 添加起点 //move.path.Add(new Vector3(cmd.begin_pos_x * 0.01f, 0, -cmd.begin_pos_y * 0.01f)); for (int i = 0; i < lstPos.Count; ++i) { //if (i > 0) //{ // move.path.Add(new Vector3(cmd.poslist[i].x, 0, -cmd.poslist[i].y)); //} //else { move.path.Add(new Vector3(lstPos[i].x * 0.01f, 0, -lstPos[i].y * 0.01f)); } } player.SendMessage(EntityMessage.EntityCommand_MovePath, (object)move); } } }
/// <summary> /// 跟新队友属性 /// </summary> void UpdateTeamMemberProp() { if (es == null) { return; } IPlayer player = es.FindPlayer(this.teamMemberInfo.id); //在九屏 if (player != null) { if (false == player.IsDead()) { //死亡标识 SetDeadMark(false); //地图标识 SetMapName(false); //血量 float hpValue = (player.GetProp((int)CreatureProp.Hp) + 0.0f) / (player.GetProp((int)CreatureProp.MaxHp)); SetHp(true, hpValue); } else { SetDeadMark(true); SetHp(true, 0); } //等级 SetLv((uint)player.GetProp((int)CreatureProp.Level));//同步等级 //在线标识 SetOfflineMark(false); } //不在九屏 else { SetDeadMark(false); SetHp(false); //设置地图名(分线) SetMapName(true, this.teamMemberInfo.lineId); SetLv(this.teamMemberInfo.lv); //在线标识 SetOfflineMark(!this.teamMemberInfo.onLine); } //队长标识 bool isLeader = DataManager.Manager <TeamDataManager>().IsLeader(this.teamMemberInfo.id); SetLeaderMark(isLeader); //跟随标识 SetFollowMark(this.teamMemberInfo.isFollow); }
////////////////////////////////////////////////////////////////////////////////////////////////////////// private Client.IPlayer CreatePlayer(GameCmd.t_MapUserData userData) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return(null); } EntityCreateData data = RoleUtil.BuildCreateEntityData(EntityType.EntityType_Player, userData); IPlayer player = es.FindPlayer(userData.userdata.dwUserID); if (player != null) { uint clanIdLow = (uint)player.GetProp((int)CreatureProp.ClanIdLow); uint clanIdHigh = (uint)player.GetProp((int)CreatureProp.ClanIdHigh); uint clanid = (clanIdHigh << 16) | clanIdLow; // //uint clanid = (uint)player.GetProp((int)CreatureProp.ClanId); //玩家死亡 服务器会通过这里刷新 所以这里更新下玩家血条 if (userData.userdata.curhp <= 0) { stPropUpdate prop = new stPropUpdate(); prop.uid = player.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; prop.oldValue = player.GetProp((int)CreatureProp.Hp); player.UpdateProp(data); prop.newValue = player.GetProp((int)CreatureProp.Hp); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); } else { stPropUpdate prop = new stPropUpdate(); prop.uid = player.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; prop.oldValue = player.GetProp((int)CreatureProp.Hp); player.UpdateProp(data); prop.newValue = player.GetProp((int)CreatureProp.Hp); if (prop.oldValue < prop.newValue) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); } } if (userData.userdata.clan_id != clanid) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CLANREFRESHID, new Client.stClanUpdate() { uid = player.GetUID(), clanId = userData.userdata.clan_id }); } } else { if (UserData.IsMainRoleID(userData.userdata.dwUserID)) { data.nLayer = LayerMask.NameToLayer("MainPlayer"); data.bMainPlayer = true; // 设置主角标识 player = es.CreateEntity(EntityType.EntityType_Player, data, true) as IPlayer; if (player == null) { Engine.Utility.Log.Error("CreatePlayer:创建角色失败!"); return(null); } Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE, new Client.stCreateEntity() { uid = userData.userdata.dwUserID }); // 设置控制对象 Client.IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetActiveCtrl().SetHost(player); } // 补丁 服务器没有金钱没有放在角色属性上 { player.SetProp((int)PlayerProp.Money, (int)UserData.Money); player.SetProp((int)PlayerProp.Coupon, (int)UserData.Coupon); player.SetProp((int)PlayerProp.Cold, (int)UserData.Cold); player.SetProp((int)PlayerProp.Reputation, (int)UserData.Reputation); player.SetProp((int)PlayerProp.Score, (int)UserData.Score); player.SetProp((int)PlayerProp.CampCoin, (int)UserData.CampCoin); player.SetProp((int)PlayerProp.AchievePoint, (int)UserData.AchievePoint); player.SetProp((int)PlayerProp.ShouLieScore, (int)UserData.ShouLieScore); player.SetProp((int)PlayerProp.FishingMoney, (int)UserData.FishingMoney); player.SetProp((int)PlayerProp.YinLiang, (int)UserData.YinLiang); } // 设置主像机参数 SetupMainCamera(player); //玩家成功登陆回调 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.PLAYER_LOGIN_SUCCESS, null); //Client.stCreateEntity createEntity = new Client.stCreateEntity(); //createEntity.uid = player.GetUID(); //Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity); //set hp DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSetRoleProperty, player); //预加载资源 // PreLoadResource(player.GetProp((int)PlayerProp.Job)); } else { //Profiler.BeginSample("CreatePlayer"); player = es.CreateEntity(EntityType.EntityType_Player, data, !m_bDelayLoad) as IPlayer; //Profiler.EndSample(); Protocol.Instance.RequestName(userData.userdata.dwUserID); } if (player != null) { PlayAni anim_param = new PlayAni(); anim_param.strAcionName = EntityAction.Stand; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.2f; player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } IBuffPart buffpart = player.GetPart(EntityPart.Buff) as IBuffPart; if (buffpart != null) { buffpart.ReceiveBuffList(userData.statelist.data); } return(player); }