public void UpdateBelong(Client.INPC npc, uint owernuserid, uint owernteamid, uint ownerclanid, string ownerName) { bool preBelong = npc.BelongOther; bool nowBelong = IsBelongOther(owernuserid, owernteamid, ownerclanid); npc.TeamID = owernteamid; npc.OwnerID = owernuserid; if (preBelong != nowBelong) { Client.stEntityChangename e = new Client.stEntityChangename(); e.uid = npc.GetUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME, e); } stRefreshNPCBelongParam param = new stRefreshNPCBelongParam() { npcid = npc.GetUID(), teamid = owernteamid, ownerid = owernuserid, clanid = ownerclanid, ownerName = ownerName, }; OnBelongChanged(param); DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eRefreshNpcBelong, param); }
// public stRefreshNPCBelongParam NpcBelongData // { // get // { // return npcBelongData; // } // } public void OnBelongChanged(stRefreshNPCBelongParam param) { if (m_dic_NpcBelongData.Count >= 300) { m_dic_NpcBelongData.Clear(); } if (m_dic_NpcBelongData.ContainsKey(param.npcid)) { m_dic_NpcBelongData[param.npcid] = param; } else { m_dic_NpcBelongData.Add(param.npcid, param); } }
[Execute]//Npc归属人列表返回信息 public void Execute(GameCmd.stNpcBelongListMapScreenUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } INPC npc = es.FindNPC(cmd.npcid); if (npc != null) { npc.OwnerID = cmd.userid; npc.TeamID = cmd.teamid; bool belongOther = false; if (cmd.userid != 0) { if (cmd.userid != ClientGlobal.Instance().MainPlayer.GetID()) { belongOther = true; } else { npc.BelongMe = true; } } if (!belongOther && (cmd.teamid != 0 || cmd.clanid != 0)) { if (DataManager.Manager <TeamDataManager>().IsJoinTeam == true) { if (DataManager.Manager <TeamDataManager>().TeamId != cmd.teamid) { belongOther = true; } } else if (DataManager.Manager <ClanManger>().IsJoinClan == true) { if (DataManager.Manager <ClanManger>().ClanId != cmd.clanid) { belongOther = true; } } else { belongOther = true; } } npc.BelongOther = belongOther; stEntityChangename e = new stEntityChangename(); e.uid = npc.GetUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME, e); stRefreshNPCBelongParam param = new stRefreshNPCBelongParam() { npcid = npc.GetUID(), teamid = cmd.teamid, ownerid = cmd.userid, clanid = cmd.clanid, ownerName = cmd.ownername, }; NpcAscription.Instance.OnBelongChanged(param); DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eRefreshNpcBelong, param); } }
//StringBuilder targetName = new StringBuilder(20); private void OnTargetChange(object param) { stTargetChange tc = (stTargetChange)param; if (tc.target == null) { m_trans_target.gameObject.SetActive(false); } else { IEntity entity = tc.target; string name = entity.GetName(); string lvstr = entity.GetProp((int)CreatureProp.Level).ToString(); m_label_MonsterLevel_Label.text = lvstr; bool showPackeage = false; if (entity.GetEntityType() == EntityType.EntityType_NPC) { INPC npc = entity as INPC; showPackeage = npc.IsBoss(); NpcDataBase ndb = GameTableManager.Instance.GetTableItem <NpcDataBase>((uint)npc.GetProp((int)EntityProp.BaseID)); if (ndb != null) { if (ndb.dwMonsterType == 1) { InitTargetUIInMonster(); m_widget_player.gameObject.SetActive(false); m_widget_monster.gameObject.SetActive(true); m_lableTargetLevel.text = entity.GetProp((int)CreatureProp.Level).ToString(); } else { InitTargetUI(); string iconName = UIManager.GetIconName(ndb.npcIcon, npc.IsPet()); UIManager.GetTextureAsyn(iconName, ref m_curTargetIconAsynSeed, () => { if (null != m_spriteTargetIcon) { m_spriteTargetIcon.mainTexture = null; } }, m_spriteTargetIcon, false); m_widget_player.gameObject.SetActive(true); m_widget_monster.gameObject.SetActive(false); } } if (npc.IsMonster() == false) { bool bVisit = true; if (npc.IsSummon() || npc.IsPet()) { bVisit = false; } CopyTypeTable ct = DataManager.Manager <ComBatCopyDataManager>().GetCurCopyType(); if (ct != CopyTypeTable.Arena) { if (bVisit) { Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().VisiteNPC(npc.GetUID()); } } } else { //请 if (m_nLastNpcId != entity.GetUID()) { BShowEnemyList = false; m_transHateList.gameObject.SetActive(false); } } m_nLastNpcId = entity.GetUID(); if (m_nLastNpcId != 0) { stRefreshNPCBelongParam npcbelongdata = NpcAscription.Instance.GetNpcBelongByNpcID(m_nLastNpcId); UpdateTargetStatus(npcbelongdata.npcid, npcbelongdata.teamid, npcbelongdata.ownerid, npcbelongdata.clanid, npcbelongdata.ownerName); } } else { InitTargetUI(); m_widget_player.gameObject.SetActive(true); m_widget_monster.gameObject.SetActive(false); IPlayer player = entity as IPlayer; if (player != null) { int job = player.GetProp((int)PlayerProp.Job); int sex = player.GetProp((int)PlayerProp.Sex); SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex)sex); if (sdb != null) { UIManager.GetTextureAsyn(sdb.strprofessionIcon, ref m_curTargetIconAsynSeed, () => { if (null != m_spriteTargetIcon) { m_spriteTargetIcon.mainTexture = null; } }, m_spriteTargetIcon, false); } m_transHateList.gameObject.SetActive(false); //目标选择 OnSetSelectTargetGrid(player.GetID()); } } m_toggle_packageState.gameObject.SetActive(showPackeage); m_lableTargetName.text = name; //m_lableTargetLevel.text = entity.GetProp((int)CreatureProp.Level).ToString(); UpdateTargetHp(entity); BuffManager.TargetBuffList.Clear(); if (entity != null) { List <Client.stAddBuff> lstBuff; IBuffPart part = entity.GetPart(EntityPart.Buff) as IBuffPart; if (part != null) { part.GetBuffList(out lstBuff); for (int i = 0; i < lstBuff.Count; ++i) { stAddBuff buff = lstBuff[i]; table.BuffDataBase db = GameTableManager.Instance.GetTableItem <table.BuffDataBase>(buff.buffid); if (db != null) { if (db.dwShield == 1) {//不显示的直接跳过 continue; } } BuffManager.TargetBuffList.Add(lstBuff[i]); } } else { Engine.Utility.Log.Error("获取{0}Buff部件失败!", entity.GetName()); } } m_trans_target.gameObject.SetActive(true); RefreshBuffIcon(m_trans_TargetBUffContainer, BuffManager.TargetBuffList); } }
void OnVoiceEvent(int nEventId, object param) { if (nEventId == (int)Client.GameEventID.TEAM_JOIN) { Client.stTeamJoin tj = (Client.stTeamJoin)param; } else if (nEventId == (int)Client.GameEventID.TEAM_LEAVE) { //当玩家退出队伍时,如果玩家当前在队伍聊天室,则会自动退出队伍聊天室。 if (GVoiceManger.Instance.JoinRoomType == JoinRoomEnum.Team) { GVoiceManger.Instance.QuitRoom(GVoiceManger.Instance.JoinRoomName); } } else if (nEventId == (int)Client.GameEventID.CLANQUIT) { Client.stClanQuit cq = (Client.stClanQuit)param; if (Client.ClientGlobal.Instance().IsMainPlayer(cq.uid)) { if (GVoiceManger.Instance.JoinRoomType == JoinRoomEnum.Nation) { GVoiceManger.Instance.QuitRoom(GVoiceManger.Instance.JoinRoomName); } } } else if (nEventId == (int)Client.GameEventID.CHAT_LEVELROOM) { SetMuteBtn(true); } else if (nEventId == (int)Client.GameEventID.CHAT_JOINROOM) { Client.stVoiceJoinRoom jr = (Client.stVoiceJoinRoom)param; SetMuteBtn(!jr.succ); if (jr.succ) { if (GVoiceManger.Instance.JoinRoomType == JoinRoomEnum.Team) { TipsManager.Instance.ShowTips(LocalTextType.Talk_ActualTime_jinruduiwuliaotianshi); //打开扬声器 收听语音 GVoiceManger.Instance.OpenSpeaker(); GVoiceManger.Instance.CloseMicInRoom(); SetSettingBtnStatus(1); SetSpeek("队伍频道"); } else if (GVoiceManger.Instance.JoinRoomType == JoinRoomEnum.Nation) { SetSpeek("氏族频道"); TipsManager.Instance.ShowTips(LocalTextType.Talk_ActualTime_jinrushizuliaotianshi); //氏族聊天 所有人都打开喇叭 管理员打开麦克风 GVoiceManger.Instance.OpenSpeaker(); bool manager = false; if (DataManager.Manager <ClanManger>().ClanInfo == null) { SetSettingBtnStatus(1); return; } GameCmd.stClanMemberInfo clanInfo = DataManager.Manager <ClanManger>().ClanInfo.GetMemberInfo((uint)MainPlayerHelper.GetPlayerID()); if (clanInfo != null && clanInfo.duty != GameCmd.enumClanDuty.CD_Member) { //管理员打开麦克风 GVoiceManger.Instance.OpenMicInRoom(); SetSettingBtnStatus(3); } else { GVoiceManger.Instance.CloseMicInRoom(); SetSettingBtnStatus(1); } } } } else if (nEventId == (int)Client.GameEventID.CHAT_SPEEKERNOW) { string name = (string)param; SetSpeek(name); StartPlayAnimation(); } else if (nEventId == (int)Client.GameEventID.CHAT_MICKSTATE) { bool state = (bool)param; if (GVoiceManger.Instance.JoinRoomType == JoinRoomEnum.Team) { SetSettingBtnStatus(state ? 2 : 1); } else if (GVoiceManger.Instance.JoinRoomType == JoinRoomEnum.Nation) { if (DataManager.Manager <ClanManger>().ClanInfo == null) { SetSettingBtnStatus(0); return; } GameCmd.stClanMemberInfo clanInfo = DataManager.Manager <ClanManger>().ClanInfo.GetMemberInfo((uint)MainPlayerHelper.GetPlayerID()); if (clanInfo != null) { if (clanInfo.duty == GameCmd.enumClanDuty.CD_Member) { SetSettingBtnStatus(state ? 2 : 1); } else { SetSettingBtnStatus(3); } } } } else if (nEventId == (int)Client.GameEventID.CHAT_SETMICBTN) { bool show = (bool)param; if (show) { if (DataManager.Manager <ClanManger>().ClanInfo != null) { GameCmd.stClanMemberInfo clanInfo = DataManager.Manager <ClanManger>().ClanInfo.GetMemberInfo((uint)MainPlayerHelper.GetPlayerID()); if (clanInfo != null) { if (clanInfo.duty == GameCmd.enumClanDuty.CD_Member) { SetSettingBtnStatus(1); } else { SetSettingBtnStatus(3); } } } } else { GVoiceManger.Instance.CloseMic(); if (DataManager.Manager <ClanManger>().ClanInfo != null) { GameCmd.stClanMemberInfo clanInfo = DataManager.Manager <ClanManger>().ClanInfo.GetMemberInfo((uint)MainPlayerHelper.GetPlayerID()); if (clanInfo != null) { if (clanInfo.duty == GameCmd.enumClanDuty.CD_Member) { SetSettingBtnStatus(0); } else { SetSettingBtnStatus(3); } } } } } switch (nEventId) { case (int)Client.GameEventID.TEAM_JOIN: case (int)Client.GameEventID.TEAM_LEAVE: case (int)Client.GameEventID.CLANJOIN: case (int)Client.GameEventID.CLANQUIT: if (m_nLastNpcId != 0) { stRefreshNPCBelongParam npcbelongdata = NpcAscription.Instance.GetNpcBelongByNpcID(m_nLastNpcId); UpdateTargetStatus(npcbelongdata.npcid, npcbelongdata.teamid, npcbelongdata.ownerid, npcbelongdata.clanid, npcbelongdata.ownerName); } break; } }
public override bool OnMsg(UIMsgID msgid, object param) { if (msgid == UIMsgID.eSetRoleProperty)//添加主角的时候刷新界面 { // Client.IEntity entity = (Client.IEntity)param; Client.IEntity entity = param as Client.IEntity; if (entity != null) { //SetRoleHp(entity); //SetRoleMp(entity); //SetRoleExp(entity); //SetRolePkModel(entity); //if (m_label_lablePower != null) //{ // m_label_lablePower.text = entity.GetProp((int)FightCreatureProp.Power).ToString(); //} SetRoleHpMpExpPkPower(entity); } } else if (msgid == UIMsgID.stShowBuff) { stShowBuffInfo info = (stShowBuffInfo)param; if (info.IsMainRole) { ArrayList list = DataManager.Manager <BuffDataManager>().MainRoleBuffList; RefreshBuffIcon(m_trans_MainRoleBUffContainer, list); ShowBuffInfo(m_trans_MainRoleBUffContainer, true); } else { ArrayList list = DataManager.Manager <BuffDataManager>().TargetBuffList; RefreshBuffIcon(m_trans_TargetBUffContainer, list); ShowBuffInfo(m_trans_TargetBUffContainer, false); } } else if (msgid == UIMsgID.eRefreshEnemyList) { GameCmd.stEnmityDataUserCmd_S cmd = (GameCmd.stEnmityDataUserCmd_S)param; OnEnemyList(cmd); } else if (msgid == UIMsgID.eShowCopyInfo) { stCopyInfo info = (stCopyInfo)param; ShowFBWidgetUI(info.bShow, info.bShowBattleInfoBtn); } else if (msgid == UIMsgID.eSkillBtnRefresh) {//走新手引导 OnUIEvent SetSkillIcon(); } else if (msgid == UIMsgID.eSkillChangeState) { LearnSkillDataManager data = DataManager.Manager <LearnSkillDataManager>(); if (m_widget_SkillBtns != null) { Quaternion rotation = m_widget_SkillBtns.transform.localRotation; if (data.CurState == SkillSettingState.StateTwo) { m_widget_SkillBtns.transform.DORotate(new Vector3(0, 0, 125), rotTime); } else { m_widget_SkillBtns.transform.DORotate(new Vector3(0, 0, 0), rotTime); } SetPlayerSkillIcon(); uint stateSkill = data.GetCurStateSkillIDByJob(); ExecutePublicCD(stateSkill); } data.SetCurStateSkillList(); } else if (msgid == UIMsgID.eSkillShowPetSkill) { if (m_lstSkillBtns.Count > 9) { m_lstSkillBtns[9].Refresh(); } } else if (msgid == UIMsgID.eShortcutList) { InitShortcutGrid();//快捷使用道具 } else if (msgid == UIMsgID.eShortcutRect) { Vector3 pos = (Vector3)param; PointInRectEvent(pos); } else if (msgid == UIMsgID.eShortcutRect) { Vector3 pos = (Vector3)param; PointInRectEvent(pos); } else if (msgid == UIMsgID.eRefreshNpcBelong) { stRefreshNPCBelongParam data = (stRefreshNPCBelongParam)param; UpdateTargetStatus(data.npcid, data.teamid, data.ownerid, data.clanid, data.ownerName); } else if (msgid == UIMsgID.eAnswerState) { InitAnswerUI(); } return(true); }