void SetBufData(GComponent obj, Protomsg.BuffDatas data) { //图标 var clientskill = ExcelManager.Instance.GetBuffIM().GetBIByID(data.TypeID); if (clientskill != null) { if (clientskill.IconPath.Length > 0) { obj.GetChild("icon").asLoader.url = clientskill.IconPath; } if (clientskill.IconTimeEnable == 0) { obj.GetChild("pro").asProgress.value = 100; } else { obj.GetChild("pro").asProgress.value = (data.RemainTime / data.Time) * 100; } } if (data.TagNum >= 2) { obj.GetChild("count").asTextField.text = "" + data.TagNum; } else { obj.GetChild("count").asTextField.text = ""; } }
public BuffEffect m_ControlBuffEffect;//控制特效 //根据buffid 创建单位特效 public void CreateBuffSpecial(Protomsg.BuffDatas buffdata) { //Debug.Log("------- CreateBuffSpecial :" + buffdata.TypeID+ " "+ Tool.GetTime()); BuffEffect buffeffect = BuffEffect.CreateBuffEffect(buffdata, this); if (buffeffect != null) { m_BuffEffects[buffdata.TypeID] = buffeffect; } else { //Debug.Log("------- CreateBuffSpecial : faild" + buffdata.TypeID + " " + m_BuffEffects); } //switch (typeid) //{ // case 4: // m_Mode.GetComponent<UnityEntitySpecial>().AddWhite(); // break; //} }
//public public BuffEffect(Protomsg.BuffDatas buffdata, UnityEntity parent) { Data = buffdata; TypeID = buffdata.TypeID; BIdata = ExcelManager.Instance.GetBuffIM().GetBIByID(buffdata.TypeID); ParentEntity = parent; Init(); }
public static BuffEffect CreateBuffEffect(Protomsg.BuffDatas buffdata, UnityEntity parent) { var data = ExcelManager.Instance.GetBuffIM().GetBIByID(buffdata.TypeID); if (data == null || parent == null || parent.Mode == null) { return(null); } return(new BuffEffect(buffdata, parent)); }
public void FreshBuffSpecial(Protomsg.BuffDatas buffdata) { if (m_BuffEffects.ContainsKey(buffdata.TypeID) == false) { return; } var be = m_BuffEffects[buffdata.TypeID]; be.FreshData(buffdata); }
void AddBuf(Protomsg.BuffDatas data) { var clientskill = ExcelManager.Instance.GetBuffIM().GetBIByID(data.TypeID); if (clientskill == null || clientskill.IconPath.Length <= 0) { return; } GComponent view = UIPackage.CreateObject("GameUI", "buf_icon").asCom; view.scale = new Vector2(0.7f, 0.7f); Bufs.AddChild(view); BufsRes[data.TypeID] = view; SetBufData(view, data); }
public void FreshData(Protomsg.BuffDatas buffdata) { Data = buffdata; UpdateData(); }
//刷新buff public void FreshBuff(Google.Protobuf.Collections.RepeatedField <global::Protomsg.BuffDatas> buffdata) { //buff数据 叠加计算出正确数据 foreach (var item in buffdata) { bool isfind = false;//如果在以前的BuffDatas中没找到 则为新增buff if (BuffDatas != null) { for (var i = 0; i < BuffDatas.Length; i++) { if (item.TypeID == BuffDatas[i].TypeID) { item.RemainTime += BuffDatas[i].RemainTime; item.Time += BuffDatas[i].Time; item.TagNum += BuffDatas[i].TagNum; item.ConnectionType += BuffDatas[i].ConnectionType; item.ConnectionX += BuffDatas[i].ConnectionX; item.ConnectionY += BuffDatas[i].ConnectionY; item.ConnectionZ += BuffDatas[i].ConnectionZ; isfind = true; FreshBuffSpecial(item); } } } if (isfind == false) { //新增buff 创建特效 CreateBuffSpecial(item); } } //找出删除的buff if (BuffDatas != null) { for (var i = 0; i < BuffDatas.Length; i++) { bool isfind = false;//如果在当前前的buffdata中没找到 则为删除buff foreach (var item in buffdata) { if (item.TypeID == BuffDatas[i].TypeID) { isfind = true; } } if (isfind == false) { //删除buff 删除特效 RemoveBuffSpecial(BuffDatas[i].TypeID); } } } //buff数据赋值 if (buffdata.Count > 0) { BuffDatas = new Protomsg.BuffDatas[buffdata.Count]; int index = 0; foreach (var item in buffdata) { BuffDatas[index++] = item; } } else { BuffDatas = null; } }