//------------------------------------------------------------------------------------------------------- /** * @brief 获取buff列表 * @param */ public void GetBuffList(out List <Client.stAddBuff> lstBuff) { lstBuff = new List <stAddBuff>(); if (m_Master == null) { return; } Dictionary <uint, stBuffData> .Enumerator iter = buffDic.GetEnumerator(); while (iter.MoveNext()) { stStateValue curBuff = null; Dictionary <uint, stStateValue> .Enumerator itBuff = iter.Current.Value.buffDataDic.GetEnumerator(); while (itBuff.MoveNext()) { curBuff = itBuff.Current.Value; } if (curBuff != null) { stAddBuff addBuff = new stAddBuff(); addBuff.buffid = curBuff.baseid; addBuff.level = curBuff.level; addBuff.lTime = curBuff.ltime; addBuff.uid = m_Master.GetUID(); lstBuff.Add(addBuff); } } }
public void ReceiveBuffList(List <stStateValue> list) { IEntity en = m_Master; for (int i = 0; i < list.Count; i++) { var state = list[i]; ChangeCreatureByBuff(en, state.baseid, true); //客户端使用毫秒的精度 state.ltime = state.ltime * 1000; stBuffData buffData; if (buffDic.TryGetValue(state.thisid, out buffData)) { if (buffData.buffDataDic.ContainsKey(state.thisid)) { buffData.buffDataDic[state.thisid] = state; } else { buffData.buffDataDic.Add(state.thisid, state); } // Buff Update // 更新时间 } else { buffData = new stBuffData(); buffData.buffid = state.thisid; buffData.buffDataDic = new Dictionary <uint, stStateValue>(); buffData.buffDataDic.Add(state.thisid, state); buffDic.Add(state.thisid, buffData); AddBuffEffect(state.baseid, state.thisid); if (en != null) { stAddBuff addBuff = new stAddBuff(); addBuff.buffid = state.baseid; addBuff.uid = en.GetUID(); addBuff.level = state.level; addBuff.lTime = state.ltime; addBuff.buffThisID = state.thisid; EventEngine.Instance().DispatchEvent((int)GameEventID.BUFF_ADDTOTARGETBUFF, addBuff); } } } if (list.Count > 0) { int len = list.Count; stStateValue state = list[len - 1]; BuffDataBase bdb = GameTableManager.Instance.GetTableItem <BuffDataBase>(state.baseid); if (bdb != null) { string str = bdb.buffColor; Color c = SkillSystem.GetColorByStr(str); if (c == null) { return; } if (en != null) { m_buffColorEntity = en; en.SendMessage(EntityMessage.EntityCommond_SetColor, c); if (TimerAxis.Instance().IsExist(m_ucolorCountDownTimerID, this)) { TimerAxis.Instance().KillTimer(m_ucolorCountDownTimerID, this); } TimerAxis.Instance().SetTimer(m_ucolorCountDownTimerID, state.ltime, this, 1); } } } }
//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); } }