예제 #1
0
    public OneEquipVision EquipVision(EquipPosition pos, bool isSecondJewelry = false)
    {
        switch (pos)
        {
        case EquipPosition.Head:
            return(helmetD);

        case EquipPosition.Breast:
            return(breastplateD);

        case EquipPosition.Arm:
            return(gardebrasD);

        case EquipPosition.Leg:
            return(leggingD);

        case EquipPosition.Finger:
            if (!isSecondJewelry)
            {
                return(jewelry0D);
            }
            else
            {
                return(jewelry1D);
            }

        case EquipPosition.Hand:
            return(weaponD);

        default: return(helmetD);
        }
    }
예제 #2
0
    public void initEquip(GDEEquipmentData equip)
    {
        SetSelfAsBg(false);
        EquipItem item = SDDataManager.Instance.GetEquipItemById(equip.id);

        equipPos = (EquipPosition)SDDataManager.Instance.getEquipPosById(equip.id);
        itemId   = equip.id;
        //
        itemImg.sprite = SDDataManager.Instance.GetEquipIconById(itemId);
        int rarity = item.LEVEL;

        frameImg.sprite  = SDDataManager.Instance.baseFrameSpriteByRarity(rarity);
        itemBgImg.sprite = SDDataManager.Instance.baseBgSpriteByRarity(rarity);
        //
        itemHashcode = equip.hashcode;
        itemUpLv     = equip.lv;
        if (starVision)
        {
            starVision.gameObject.SetActive(false);
        }
        if (downText)
        {
            downText.text = SDGameManager.T(item.NAME);
        }
        if (upText)
        {
            upText.gameObject.SetActive(true);
            upText.text = SDDataManager.Instance.rarityString(item.LEVEL);
        }
    }
예제 #3
0
    public bool Use__equip_reap(string equipReapItem_id, out string equipId)
    {
        equipId = string.Empty;
        if (SDDataManager.Instance.getConsumableNum(equipReapItem_id) <= 0)
        {
            return(false);
        }
        bool flag = SDDataManager.Instance.checkIfHaveOpKey(SDConstants.MaterialType.equip_reap
                                                            , out string keyId);

        if (!flag)
        {
            return(false);
        }
        consumableItem item = SDDataManager.Instance.getConsumableById(equipReapItem_id);

        if (!item)
        {
            return(false);
        }
        string str = item.SpecialStr;

        string[]      strings = str.Split('_');
        EquipPosition pos     = ROHelp.EQUIP_POS(strings[0]);
        int           rank    = GetArmorRank(strings[1]);

        equipId = ReapNormalEquip(pos, rank);
        SDDataManager.Instance.consumeConsumable(keyId, out int r);
        return(true);
    }
예제 #4
0
    public void equipBtnTapped(EquipPosition pos, bool isSecondJewelry = false)
    {
        if (isClicking)
        {
            return;
        }
        else
        {
            isClicking = true;
        }
        bool flag;

        if (CurrentSearchingPos != pos)
        {
            flag = true;
        }
        else
        {
            if (pos == EquipPosition.Finger && isSecondPos != isSecondJewelry)
            {
                flag = true;
            }
            else
            {
                flag = false;
            }
        }
        if (flag)
        {
            CurrentSearchingPos = pos;
            isSecondPos         = isSecondJewelry;
            if (HDP.CurrentRDSubType != HeroDetailPanel.RoleDetailSubType.heroEquip)
            {
                HDP.CurrentRDSubType = HeroDetailPanel.RoleDetailSubType.heroEquip;
                HDP.historyAdd(HDP.CurrentRDSubType);
            }
            ES.initPosEquipSelectPanel(pos, isSecondPos);
            UIEffectManager.Instance.showAnimFadeIn(ES.transform);
        }
        else
        {
            /*
             * UIEffectManager.Instance.hideAnimFadeOut(ES.transform);
             * CurrentSearchingPos = EquipPosition.End;
             * //
             * if(HDP.CurrentRDSubType == HeroDetailPanel.RoleDetailSubType.heroEquip)
             *  HDP.commonBackAction();
             */
        }
        Invoke("BtnTappedEnd", 0.25f);
    }
예제 #5
0
    public void AddEquips()
    {
        List <GDEEquipmentData> _gdes = SDDataManager.Instance.getAllOwnedEquips();

        if (_gdes.Count < 4)
        {
            List <EquipItem> all = SDDataManager.Instance.AllEquipList;
            all = all.FindAll(x => x.IconFromAtlas != null &&
                              x.WeaponRace != null &&
                              x.WeaponRace.WeaponClass == SDConstants.WeaponClass.Claymore);
            List <int> enables = RandomIntger.NumListReturn(5, all.Count);
            for (int i = 0; i < all.Count; i++)
            {
                if (enables.Contains(i))
                {
                    SDDataManager.Instance.addEquip(all[i].ID);
                }
            }
            List <EquipItem> allcs = all.FindAll(x =>
                                                 x.WeaponRace.WeaponClass == SDConstants.WeaponClass.Claymore);
            EquipItem _item = allcs[Random.Range(0, allcs.Count)];
            SDDataManager.Instance.addEquip(_item.ID);

            List <GDEEquipmentData> gdes = SDDataManager.Instance.getAllOwnedEquips();
            int[] posLists = new int[(int)EquipPosition.End];
            for (int i = 0; i < gdes.Count; i++)
            {
                string        id   = gdes[i].id;
                EquipItem     item = SDDataManager.Instance.GetEquipItemById(id);
                EquipPosition pos  = item.EquipPos;
                posLists[(int)pos]++;
            }
            string S = "";
            for (int i = 0; i < posLists.Length; i++)
            {
                S += ((EquipPosition)i).ToString().ToUpper() + ": " + posLists[i] + "/ ";
            }
            Debug.Log(S);
        }


        if (!_gdes.Exists(x => MustHave.Exists(y => y.ID == x.id)))
        {
            for (int i = 0; i < MustHave.Count; i++)
            {
                SDDataManager.Instance.addEquip(MustHave[i].ID);
            }
        }
    }
예제 #6
0
    RoleAttributeList getRALFromEquip(EquipPosition UsePos, BattleRoleData source, BattleRoleData target)
    {
        RoleAttributeList _ral = RoleAttributeList.zero;
        SDArmor           SDA  = null;

        if (UsePos == EquipPosition.Head)
        {
            SDA = target.HeroProperty._helmet;
        }
        else if (UsePos == EquipPosition.Breast)
        {
            SDA = target.HeroProperty._breastplate;
        }
        else if (UsePos == EquipPosition.Arm)
        {
            SDA = target.HeroProperty._gardebras;
        }
        else if (UsePos == EquipPosition.Leg)
        {
            SDA = target.HeroProperty._legging;
        }
        else if (UsePos == EquipPosition.Hand)
        {
            SDA = target.HeroProperty._weapon;
        }
        if (SDA != null)
        {
            _ral = SDA.RoleBasicRA.Clone;
        }
        if (UsePos == EquipPosition.Finger)
        {
            RoleAttributeList r0 = RoleAttributeList.zero;
            if (target.HeroProperty._jewelry0 != null)
            {
                r0 = target.HeroProperty._jewelry0.RoleBasicRA.Clone;
            }
            RoleAttributeList r1 = RoleAttributeList.zero;
            if (target.HeroProperty._jewelry1 != null)
            {
                r1 = target.HeroProperty._jewelry1.RoleBasicRA.Clone;
            }
            _ral = r0 + r1;
        }
        return(_ral);
    }
예제 #7
0
    public void showOnePosEquipsOwned(EquipPosition pos)
    {
        ResetPageWithoutDestroy();
        //ResetPage();
        List <GDEEquipmentData> allEquips;

        if (currentHeroHashcode > 0 && SDDataManager.Instance.getHeroIdByHashcode
                (currentHeroHashcode) != null)
        {
            string id = SDDataManager.Instance.getHeroIdByHashcode(currentHeroHashcode);
            allEquips = SDDataManager.Instance.GetPosOwnedEquipsByCareer
                            (pos, id, true);
        }
        else
        {
            allEquips = SDDataManager.Instance.getOwnedEquipsByPos(pos, true);
        }

        itemCount = allEquips.Count;
        if (itemCount <= 0)
        {
            foreach (SingleItem s in AllItemSlots)
            {
                s.SetSelfAsBg();
            }
        }
        int endNumInVolume = Mathf.Max(0, itemCount - PerPageMaxVolume * pageIndex);
        int startIndex     = PerPageMaxVolume * pageIndex;

        for (int i = 0; i < PerPageMaxVolume; i++)
        {
            if (i >= endNumInVolume)
            {
                AllItemSlots[i].SetSelfAsBg();
                continue;
            }
            else
            {
                SingleItem _s = AllItemSlots[i];
                _s.sourceController = this;
                _s.initEquip(allEquips[i + startIndex]);
                items.Add(_s);
            }
        }
    }
예제 #8
0
    public void initPosEquipSelectPanel(EquipPosition Pos, bool isSecondJPos = false)
    {
        if (heroDetail == null)
        {
            heroDetail = FindObjectOfType <SDHeroDetail>();
        }
        careerType = heroDetail.careerIndex;
        equipPos   = Pos;
        Debug.Log(pageController);

        pageController.currentHeroHashcode  = heroDetail.Hashcode;
        SDGameManager.Instance.stockUseType = SDConstants.StockUseType.work;
        if (Pos == EquipPosition.Head)
        {
            initHelmetSelectPanel();
        }
        else if (Pos == EquipPosition.Breast)
        {
            initBreastplateSelectPanel();
        }
        else if (Pos == EquipPosition.Arm)
        {
            initGardebrasSelectPanel();
        }
        else if (Pos == EquipPosition.Leg)
        {
            initLeggingSelectPanel();
        }
        else if (Pos == EquipPosition.Finger)
        {
            isSecondJewelryPos = isSecondJPos;
            initJewelrySelectPanel();
        }
        else if (Pos == EquipPosition.Hand)
        {
            initWeaponSelectPanel();
        }
    }
예제 #9
0
    public override void whenOpenThisPanel()
    {
        base.whenOpenThisPanel();
        //initAllEquipsOwned();
        initEquipsOwnedByPos(EquipPosition.Hand);
        EDP.whenOpenThisPanel();
        AllPosBtns = PosBtnContent.GetComponentsInChildren <Button>();
        //
        List <EquipPosition> list = new List <EquipPosition>()
        {
            EquipPosition.Hand
            ,
            EquipPosition.Finger
            ,
            EquipPosition.Leg
            ,
            EquipPosition.Breast
            ,
            EquipPosition.Head
        };

        for (int i = 0; i < AllPosBtns.Length; i++)
        {
            EquipPosition pos = list[i];
            AllPosBtns[i].GetComponentInChildren <Text>().text
                = pos.ToString().ToUpper();
            Image img = AllPosBtns[i].transform.GetChild(0).GetComponent <Image>();
            img.sprite
                = SDDataManager.Instance.equipPosIcon(pos);
            img.SetNativeSize();
            AllPosBtns[i].onClick.AddListener(delegate()
            {
                this.BtnToChangePos(pos);
            });
        }
        EDP.gameObject.SetActive(false);
    }
예제 #10
0
    /// <summary>
    /// 被封印类道具生效后结果
    /// </summary>
    /// <param name="pos"></param>
    /// <param name="type"></param>
    /// <param name="Num"></param>
    /// <returns></returns>
    public string ReapNormalEquip(EquipPosition pos, int type)
    {
        List <EquipItem> equips = SDDataManager.Instance.AllEquipList;
        List <EquipItem> all    = equips.FindAll(x => x.EquipPos == pos);

        if (pos == EquipPosition.End)
        {
            all = equips;
        }

        if (type > 0)
        {
            all = all.FindAll(x => x.ArmorRank.Index == type);
        }

        float[] r     = new float[] { 6, 3.5f, 0.46f, 0.04f };
        int     level = RandomIntger.Choose(r);

        all = all.FindAll(x => x.LEVEL == level);
        int       randomNum = UnityEngine.Random.Range(0, all.Count);
        EquipItem result    = all[randomNum];

        return(result.ID);
    }
예제 #11
0
 public void BtnToChangePos(EquipPosition pos)
 {
     //Debug.Log(go.name);
     Debug.Log("切换位置为" + pos.ToString());
     CurrentPos = pos;
 }
예제 #12
0
 void initEquipsOwnedByPos(EquipPosition pos)
 {
     SDGameManager.Instance.stockUseType = SDConstants.StockUseType.detail;
     PAGE.ItemsInit(SDConstants.ItemType.Equip, pos);
 }
예제 #13
0
 public void ItemsInit(SDConstants.ItemType type, EquipPosition pos)
 {
     EquipPos = pos;
     ItemsInit(type);
 }
예제 #14
0
    private static void CreateArmorConfig()
    {
        List <Dictionary <string, string> > xxListResult;


        #region BasicHeros
        xxListResult = ReadVSC("hero");
        HeroRace[]      heroRaces   = Resources.LoadAll <HeroRace>("");
        RoleCareer[]    careers     = Resources.LoadAll <RoleCareer>("");
        List <HeroInfo> AlreadyHave = Resources.LoadAll <HeroInfo>("").ToList();
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];

            if (AlreadyHave.Exists(x => x.ID == Dic["id"]))
            {
                continue;
            }
            //
            HeroInfo     mi  = ScriptableObject.CreateInstance <HeroInfo>();
            CharacterSex sex = (CharacterSex)(StringToInteger(Dic["gender"]));
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], sex, "");
            int Race = StringToInteger(Dic["race"]);
            foreach (HeroRace race in heroRaces)
            {
                if (race.Index == Race)
                {
                    mi.Race = race; break;
                }
            }
            int career = StringToInteger(Dic["career"]);
            foreach (RoleCareer c in careers)
            {
                if (c.Index == career)
                {
                    mi.Career = c; break;
                }
            }
            mi.InitRAL(RALByDictionary(Dic));
            mi.WeaponRaceList = GetWeaponTypeList(Dic["weaponClass"]);
            mi.SpecialStr     = Dic["specialStr"];
            mi.AddSkillData(
                getSkillsByString(Dic["skill0"])
                , getSkillsByString(Dic["skill1"])
                , getSkillsByString(Dic["skillOmega"])
                );
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/heroes/"
                                      + career + "_"
                                      + mi.ID.Substring(mi.ID.Length - 3) + "_" + mi.Name + ".asset");
        }
        #endregion
        return;

        #region enemy
        xxListResult = CreateConfig.ReadVSC("enemy");
        EnemyRank[] eRanks = Resources.LoadAll <EnemyRank>("");
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            EnemyInfo    mi  = ScriptableObject.CreateInstance <EnemyInfo>();
            CharacterSex sex = (CharacterSex)(StringToInteger(Dic["gender"]));
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], sex, "");
            mi.Race = EnemyRaces(Dic["race"]);

            int ranktype = StringToInteger(Dic["rank"]);
            foreach (EnemyRank rank in eRanks)
            {
                if (rank.Index == ranktype)
                {
                    mi.EnemyRank = rank; break;
                }
            }
            mi.RAL              = RALByDictionary(Dic);
            mi.weight           = StringToInteger(Dic["weight"]);
            mi.dropPercent      = StringToInteger(Dic["dropRate"]);
            mi.StartAppearLevel = StringToInteger(Dic["startLevel"]);
            mi.EndAppearLevel   = StringToInteger(Dic["endLevel"]);
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/enemies/"
                                      + mi.ID.Split('#')[1] + mi.Name + ".asset");
        }
        #endregion
        return;

        #region Equip
        xxListResult = CreateConfig.ReadVSC("equip");
        ArmorRank[]        armor_ranks  = Resources.LoadAll <ArmorRank>("");
        WeaponRace[]       waepon_races = Resources.LoadAll <WeaponRace>("");
        List <SpriteAtlas> allAtlas     = Resources.LoadAll <SpriteAtlas>("Sprites/atlas").ToList();
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            EquipItem ei = ScriptableObject.CreateInstance <EquipItem>();
            ei.initData(Dic["id"], Dic["name"], Dic["desc"], CreateConfig.StringToInteger(Dic["level"])
                        , false, true, true, true, false, Dic["specialStr"]);
            ei.ResistStr = Dic["resistStr"];
            //
            int rankType = CreateConfig.StringToInteger(Dic["type"]);
            foreach (ArmorRank rank in armor_ranks)
            {
                if (rank.Index == rankType)
                {
                    ei.ArmorRank = rank; break;
                }
            }
            if (!string.IsNullOrEmpty(Dic["suit"]))
            {
                ei.SuitBelong = true; ei.SuitId = Dic["suit"];
            }
            //
            ei.RAL           = RALBySpecialStr(RoleAttributeList.zero, Dic["specialStr"]);
            ei.RAL           = RALByResistStr(ei.RAL, Dic["resistStr"]);
            ei.PassiveEffect = Dic["passiveEffect"];
            //
            string        _class = Dic["class"];
            EquipPosition pos    = ROHelp.EQUIP_POS(_class);
            ei.EquipPos = pos;
            if (pos == EquipPosition.Hand)
            {
                string weaponClass = Dic["weaponClass"].ToLower();
                foreach (WeaponRace r in waepon_races)
                {
                    if (weaponClass == r.NAME.ToLower())
                    {
                        ei.WeaponRace = r; break;
                    }
                }
            }


            //
            AssetDatabase.CreateAsset(ei, "Assets/Resources/ScriptableObjects/items/Equips/"
                                      + (int)ei.EquipPos + "_"
                                      + ei.LEVEL + "_" + ei.NAME + ".asset");
        }
        #endregion
        return;

        xxListResult = ReadVSC("hero");
        //HeroRace[] heroRaces = Resources.LoadAll<HeroRace>("");
        //RoleCareer[] careers = Resources.LoadAll<RoleCareer>("");
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            HeroInfo     mi  = ScriptableObject.CreateInstance <HeroInfo>();
            CharacterSex sex = (CharacterSex)(StringToInteger(Dic["gender"]));
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], sex, "");
            int Race = StringToInteger(Dic["race"]);
            foreach (HeroRace race in heroRaces)
            {
                if (race.Index == Race)
                {
                    mi.Race = race; break;
                }
            }
            int career = StringToInteger(Dic["career"]);
            foreach (RoleCareer c in careers)
            {
                if (c.Index == career)
                {
                    mi.Career = c; break;
                }
            }
            mi.InitRAL(RALByDictionary(Dic));
            mi.WeaponRaceList = GetWeaponTypeList(Dic["weaponClass"]);
            mi.SpecialStr     = Dic["specialStr"];
            mi.AddSkillData(
                getSkillsByString(Dic["skill0"])
                , getSkillsByString(Dic["skill1"])
                , getSkillsByString(Dic["skillOmega"])
                );
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/heroes/"
                                      + career + "_"
                                      + mi.ID.Substring(mi.ID.Length - 3) + "_" + mi.Name + ".asset");
        }

        return;



        return;

        #region Consumable
        xxListResult = CreateConfig.ReadVSC("material");
        for (int i = 0; i < xxListResult.Count; i++)
        {
            Dictionary <string, string> Dic = xxListResult[i];
            SDConstants.MaterialType    MT  = CreateConfig.getMTypeByString(Dic["materialType"]);
            consumableItem mi = ScriptableObject.CreateInstance <consumableItem>();
            mi.initData(Dic["id"], Dic["name"], Dic["desc"], CreateConfig.StringToInteger(Dic["level"])
                        , false, true, true, true, false, Dic["specialStr"], SDConstants.ItemType.Consumable);
            mi.MaterialType     = MT;
            mi.buyPrice_coin    = StringToInteger(Dic["buyPrice_coin"]);
            mi.buyPrice_diamond = StringToInteger(Dic["buyPrice_diamond"]);
            mi.minLv            = StringToInteger(Dic["minLv"]);
            mi.maxLv            = StringToInteger(Dic["maxLv"]);
            mi.exchangeType     = StringToInteger(Dic["exchangeType"]);
            mi.weight           = StringToInteger(Dic["weight"]);
            mi.ConsumableType   = (SDConstants.ConsumableType)StringToInteger(Dic["consumableType"]);
            if (Dic.ContainsKey("range"))
            {
                mi.AOE = ROHelp.AOE_TYPE(Dic["range"]);
            }
            if (Dic.ContainsKey("target"))
            {
                mi.AIM = Dic["target"].ToUpper();
            }
            //
            AssetDatabase.CreateAsset(mi, "Assets/Resources/ScriptableObjects/items/Consumables/"
                                      + mi.ID.Substring(mi.ID.Length - 3) + mi.NAME + ".asset");
        }
        #endregion
    }