示例#1
0
    void ProcEquipEffectAtt(CEquipment pEquip, bool bEquip)
    {
        if (pEquip != null)
        {
            tagEquipProto pProto = pEquip.m_pEquipProto;
            if (pProto == null)
            {
                return;
            }

            // weapon
            int nFactor = 1;
            if (!bEquip)
            {
                nFactor = -1;
            }

            if (pProto.eEquipPos == EEquipPos.EEP_Weapon)
            {
                if (bEquip)
                {
                    ModBaseAttValue(ERoleAttribute.ERA_WeaponDmgMin, pProto.nMinDmg);
                    ModBaseAttValue(ERoleAttribute.ERA_WeaponDmgMax, pProto.nMaxDmg);
                }
                else
                {
                    ModBaseAttValue(ERoleAttribute.ERA_WeaponDmgMin, -pProto.nMinDmg);
                    ModBaseAttValue(ERoleAttribute.ERA_WeaponDmgMax, -pProto.nMaxDmg);
                }
            }

            // cale weapon base att
            ChangeHeroAtt(pEquip.m_equipex.EquipBaseAtt, 3, nFactor);
        }
    }
示例#2
0
    void ShowRewardItem(GameObject item, uint dwTypeID, int nNum)
    {
        if (ItemCreator.MIsEquipment(dwTypeID))
        {
            tagEquipProto pEquipProto = null;
            CProtoManager.inst.m_mapEquip.TryGetValue(dwTypeID, out pEquipProto);
            if (pEquipProto != null)
            {
                Transform pIcon = item.transform.Find("Icon");
                if (pIcon != null)
                {
                    UIAtlas tu = Resources.Load("GameIcon", typeof(UIAtlas)) as UIAtlas;
                    UnityEngine.GameObject ctrl = pIcon.gameObject;
                    ctrl.GetComponent <UISprite>().atlas      = tu;
                    ctrl.GetComponent <UISprite>().spriteName = pEquipProto.strIcon;
                }

                Transform pNum = item.transform.Find("num");
                if (pNum != null)
                {
                    UnityEngine.GameObject ctrl = pNum.gameObject;
                    ctrl.GetComponent <UILabel>().text = nNum.ToString();
                }
            }
        }
        else
        {
            tagItemProto pProto = null;
            CProtoManager.inst.m_mapItem.TryGetValue(dwTypeID, out pProto);
            if (pProto != null)
            {
                Transform pIcon = item.transform.Find("Icon");
                if (pIcon != null)
                {
                    UIAtlas tu = Resources.Load("GameIcon", typeof(UIAtlas)) as UIAtlas;
                    UnityEngine.GameObject ctrl = pIcon.gameObject;
                    ctrl.GetComponent <UISprite>().atlas      = tu;
                    ctrl.GetComponent <UISprite>().spriteName = pProto.strIcon;
                }

                Transform pNum = item.transform.Find("num");
                if (pNum != null)
                {
                    UnityEngine.GameObject ctrl = pNum.gameObject;
                    ctrl.GetComponent <UILabel>().text = nNum.ToString();
                }
            }
        }
    }
示例#3
0
    public void LoadEquipConfig( )
    {
        CXmlContainer xml      = new CXmlContainer();
        List <string> herolist = new List <string> ();

        if (xml.LoadXML("data/equip_proto", "id", herolist))
        {
            for (int i = 0; i < herolist.Count; i++)
            {
                tagEquipProto item = new tagEquipProto();
                item.dwTypeID = xml.GetDword("id", herolist[i]);

                item.eType      = (EItemType)xml.GetDword("type", herolist[i]);
                item.byLevel    = xml.GetInt("level", herolist[i], 1);
                item.byQuality  = (byte)xml.GetInt("quality", herolist[i], 0);
                item.nBasePrice = xml.GetInt("Price", herolist[i], 1);

                item.dwSuitID     = xml.GetDword("SuitID", herolist[i]);
                item.eEquipPos    = (EEquipPos)xml.GetInt("EquipPos", herolist[i], 0);
                item.nMinDmg      = xml.GetInt("WeaponMinDmg", herolist[i], 1);
                item.nMaxDmg      = xml.GetInt("WeaponMaxDmg", herolist[i], 1);
                item.nRepairPrice = xml.GetInt("RepairPrice", herolist[i], 1);
                item.nHolePrice   = xml.GetInt("HolePrice", herolist[i], 1);

                item.dwFormulaID   = xml.GetDword("FormulaID", herolist[i]);
                item.dwDeFoemulaID = xml.GetDword("DeFoemulaID", herolist[i]);

                item.BaseEffect[0].eRoleAtt = (ERoleAttribute)xml.GetDword("AttType1", herolist[i]);
                item.BaseEffect[0].nValue   = xml.GetInt("AttValue1", herolist[i], 1);
                item.BaseEffect[1].eRoleAtt = (ERoleAttribute)xml.GetDword("AttType2", herolist[i]);
                item.BaseEffect[1].nValue   = xml.GetInt("AttValue2", herolist[i], 1);
                item.BaseEffect[2].eRoleAtt = (ERoleAttribute)xml.GetDword("AttType3", herolist[i]);
                item.BaseEffect[2].nValue   = xml.GetInt("AttValue3", herolist[i], 1);

                item.strIcon = xml.GetString("icon", herolist[i], "");
                item.strName = xml.GetString("name", herolist[i], "");
                item.strdesc = xml.GetString("desc", herolist[i], "");
                m_mapEquip.Add(item.dwTypeID, item);
            }
        }
    }
示例#4
0
    //----------------------------------------------------------------------
    int CalSpaceUsed(uint dwTypeID, Int16 nNum)
    {
        tagItemProto pProto = null;

        if (ItemCreator.MIsEquipment(dwTypeID))
        {
            tagEquipProto pEquipProto = null;
            CProtoManager.inst.m_mapEquip.TryGetValue(dwTypeID, out pEquipProto);
            pProto = (tagItemProto)pEquipProto;
        }
        else
        {
            CProtoManager.inst.m_mapItem.TryGetValue(dwTypeID, out pProto);
        }

        if (pProto == null)
        {
            return(-1);
        }

        int nUseSpace = 0;

        if (nNum < pProto.nMaxLapNum)
        {
            nUseSpace = 1;
        }
        else
        {
            if (pProto.nMaxLapNum <= 0)
            {
                pProto.nMaxLapNum = 1;
            }
            nUseSpace = (1 == pProto.nMaxLapNum ? nNum : (nNum - 1) / pProto.nMaxLapNum);
        }

        return(nUseSpace);
    }