Beispiel #1
0
    sdBuff FindBuffByCastActor(int id, sdActorInterface castActor)
    {
        sdBuff buff = null;

        for (int i = 0; i < buffs.Count; i++)
        {
            buff = buffs[i];
            if (buff.GetTemplateID() == id)
            {
                if (castActor == buff.m_CasterActor || castActor == null)
                {
                    return(buff);
                }
            }
        }
        for (int i = 0; i < HideBuffs.Count; i++)
        {
            buff = HideBuffs[i];
            if (buff.GetTemplateID() == id)
            {
                if (castActor == buff.m_CasterActor || castActor == null)
                {
                    return(buff);
                }
            }
        }
        return(null);
    }
Beispiel #2
0
    public bool RemoveBuff(int id)
    {
        bool bRet = false;

        for (int i = 0; i < HideBuffs.Count; i++)
        {
            sdBuff buff = HideBuffs[i];
            if (buff.GetTemplateID() == id)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                HideBuffs.RemoveAt(i);
                bRet = true;
            }
        }
        bool buffchanged = false;

        for (int i = 0; i < buffs.Count; i++)
        {
            sdBuff buff = buffs[i];
            if (buff.GetTemplateID() == id)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_HAND);
                buffs.RemoveAt(i);
                buffchanged = true;
                bRet        = true;
            }
        }
        if (buffchanged)
        {
            BuffChange(buffs);
        }
        return(bRet);
    }
Beispiel #3
0
    sdBuff  FindBuff(int id)
    {
        sdBuff buff = null;

        for (int i = 0; i < buffs.Count; i++)
        {
            buff = buffs[i];
            if (buff.GetTemplateID() == id)
            {
                return(buff);
            }
        }
        for (int i = 0; i < HideBuffs.Count; i++)
        {
            buff = HideBuffs[i];
            if (buff.GetTemplateID() == id)
            {
                return(buff);
            }
        }
        return(null);
    }
    // Update is called once per frame
    void Update()
    {
        if (actor != null)
        {
            foreach (DictionaryEntry e in actor.Property)
            {
                sdConfDataMgr.SetMemberValue(this, e.Key as string, e.Value);
            }
        }

        {
            List <sdBuff> lstBuff = actor.GetBuffs();
            if (lstBuff.Count > 0)
            {
                Hashtable table = (Hashtable)sdConfDataMgr.Instance().GetTable("buff");
                if (buff == null)
                {
                    buff = new string[lstBuff.Count];
                }
                if (buff.Length != lstBuff.Count)
                {
                    buff = new string[lstBuff.Count];
                }
                for (int i = 0; i < lstBuff.Count; i++)
                {
                    sdBuff    sbuff = lstBuff[i];
                    int       id    = sbuff.GetTemplateID();
                    Hashtable prop  = table[id.ToString()] as Hashtable;

                    buff[i] = id.ToString() + "_" +
                              prop["szName[ROLE_NAME_LEN]"] as string + "_" +
                              prop["szDescription[DESCRIPTION_LEN]"] as string;
                }
            }
            else
            {
                buff = null;
            }
        }

        STAY        = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STAY);
        HOLD        = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_HOLD);
        STUN        = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_STUN);
        LIMIT_SKILL = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_LIMIT_SKILL);
        UNBEAT      = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_UNBEAT);
        KNOCKBACK   = actor.CheckDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_KNOCKBACK);
    }
Beispiel #5
0
    public void SetBuffId(sdBuff buff)
    {
        if (buff == null)
        {
            gameObject.GetComponent <UISprite>().spriteName = "";
            if (icon != null)
            {
                icon.GetComponent <UISprite>().spriteName = "";
            }

            lastTime = -1;
            if (mask != null)
            {
                mask.GetComponent <UISprite>().fillAmount = 0;
            }

            return;
        }

        gameObject.GetComponent <UISprite>().spriteName = "FightingSystem_Img_Buff";
        buffid = buff.GetTemplateID();
        Hashtable buffTable = sdConfDataMgr.Instance().GetTable("buff");
        Hashtable item      = buffTable[buffid.ToString()] as Hashtable;

        if (item != null)
        {
            if (icon != null)
            {
                icon.GetComponent <UISprite>().spriteName = item["icon"].ToString();
                if (sdConfDataMgr.Instance().BuffAtlas != null)
                {
                    icon.GetComponent <UISprite>().atlas = sdConfDataMgr.Instance().BuffAtlas;
                }
                else if (!isLoadAtlas)
                {
                    LoadBuffIcon();
                    isLoadAtlas = true;
                }
            }
            lastTime = float.Parse(item["nTotalTime"].ToString()) / 1000 - buff.GetLifeTime();
            if (mask != null)
            {
                mask.GetComponent <UISprite>().fillAmount = lastTime / (float.Parse(item["nTotalTime"].ToString()) / 1000);
            }
        }
    }
Beispiel #6
0
    public virtual bool RemoveBuffbyID(int templataID)
    {
        bool bRet = false;

        for (int index = 0; index < HideBuffs.Count;)
        {
            sdBuff buff = HideBuffs[index];
            if (buff.GetTemplateID() == templataID)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
                HideBuffs.RemoveAt(index);
                bRet = true;
                continue;
            }
            else
            {
                ++index;
            }
        }
        for (int index = 0; index < buffs.Count;)
        {
            sdBuff buff = buffs[index];
            if (buff.GetTemplateID() == templataID)
            {
                buff.Stop(HeaderProto.EBuffEndType.BUFF_END_DEAD);
                buffs.RemoveAt(index);
                bRet = true;
                continue;
            }
            else
            {
                ++index;
            }
        }
        return(bRet);
    }
Beispiel #7
0
    public bool    CheckBuff(int type, int data)
    {
        //sdBuff[] allbuff	=	null;//m_BuffSys.
        if (type == (int)HeaderProto.ECheckBuffType.CHECK_BUFF_NONE)
        {
            return(true);
        }
        switch (type)
        {
        case (int)HeaderProto.ECheckBuffType.CHECK_BUFF_CLASS: {
            for (int i = 0; i < buffs.Count; i++)
            {
                sdBuff buff = buffs[i];
                if ((int)buff.GetProperty()["byClass"] == data)
                {
                    return(true);
                }
            }
        } break;

        case (int)HeaderProto.ECheckBuffType.CHECK_BUFF_SUB_CLASS: {
            for (int i = 0; i < buffs.Count; i++)
            {
                sdBuff buff      = buffs[i];
                int    iClass    = data / 10000;
                int    iSubClass = data % 10000;
                if ((int)buff.GetProperty()["bySubClass"] == iSubClass &&
                    (int)buff.GetProperty()["byClass"] == iClass
                    )
                {
                    return(true);
                }
            }
        } break;

        case (int)HeaderProto.ECheckBuffType.CHECK_BUFF_CLASS_ID: {
            for (int i = 0; i < buffs.Count; i++)
            {
                sdBuff buff = buffs[i];
                if ((int)buff.GetProperty()["dwClassID"] == data)
                {
                    return(true);
                }
            }
        } break;

        case (int)HeaderProto.ECheckBuffType.CHECK_BUFF_TEMPLATE_ID: {
            for (int i = 0; i < buffs.Count; i++)
            {
                sdBuff buff = buffs[i];
                if (buff.GetTemplateID() == data)
                {
                    return(true);
                }
            }
        } break;

        case (int)HeaderProto.ECheckBuffType.CHECK_BUFF_DAMAGE_PRO: {
            for (int i = 0; i < buffs.Count; i++)
            {
                sdBuff buff = buffs[i];
                if ((int)buff.GetProperty()["byProperty"] == data)
                {
                    return(true);
                }
            }
        } break;
        }
        return(false);
    }