Example #1
0
    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 = "";
        }
    }
Example #2
0
    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;

        //}
    }
Example #3
0
 //public
 public BuffEffect(Protomsg.BuffDatas buffdata, UnityEntity parent)
 {
     Data         = buffdata;
     TypeID       = buffdata.TypeID;
     BIdata       = ExcelManager.Instance.GetBuffIM().GetBIByID(buffdata.TypeID);
     ParentEntity = parent;
     Init();
 }
Example #4
0
    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));
    }
Example #5
0
    public void FreshBuffSpecial(Protomsg.BuffDatas buffdata)
    {
        if (m_BuffEffects.ContainsKey(buffdata.TypeID) == false)
        {
            return;
        }
        var be = m_BuffEffects[buffdata.TypeID];

        be.FreshData(buffdata);
    }
Example #6
0
    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);
    }
Example #7
0
 public void FreshData(Protomsg.BuffDatas buffdata)
 {
     Data = buffdata;
     UpdateData();
 }
Example #8
0
    //刷新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;
        }
    }