Пример #1
0
 public void initEquipVision(GDEEquipmentData data)
 {
     if (data == null || string.IsNullOrEmpty(data.id))
     {
         initAsEmpty();
     }
     else
     {
         EquipItem item = SDDataManager.Instance.GetEquipItemById(data.id);
         if (item)
         {
             IconImg.gameObject.SetActive(true);
             IconImg.sprite      = SDDataManager.Instance.GetEquipIconById(data.id);
             BgIconImg.sprite    = SDDataManager.Instance.baseBgSpriteByRarity(item.LEVEL);
             IconFrameImg.sprite = SDDataManager.Instance.baseFrameSpriteByRarity(item.LEVEL);
         }
         else
         {
             initAsEmpty();
         }
     }
     if (ItemNameText)
     {
         ItemNameText.gameObject.SetActive(false);
     }
     if (starVision)
     {
         starVision.gameObject.SetActive(false);
     }
 }
Пример #2
0
    public void initWeapon(int heroHashCode)
    {
        GDEEquipmentData armor = SDDataManager.Instance.getHeroWeapon(heroHashCode);
        SDWeapon         a     = unit_model.gameObject.AddComponent <SDWeapon>();

        HeroProperty._weapon = a;
        if (armor == null || string.IsNullOrEmpty(armor.id))
        {
            HeroProperty._weapon.initDataEmpty(); return;
        }
        EquipItem Item = SDDataManager.Instance.GetEquipItemById(armor.id);

        if (Item == null)
        {
            HeroProperty._weapon.initDataEmpty(); return;
        }
        //
        HeroProperty._weapon.initData(Item.LEVEL, Item.RAL, 0, 0, 0, 0, RoleBarChart.zero
                                      , Item.ID, Item.NAME, 0);
        HeroProperty._weapon.PassiveEffectInit(Item.PassiveEffect);
        HeroProperty._weapon.armorRank = Item.ArmorRank;
        int lv = armor.lv;

        HeroProperty._weapon.initGradeShow(lv);
    }
Пример #3
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);
        }
    }
Пример #4
0
    public void btnToLvUp()
    {
        if (!isClicking)
        {
            isClicking = true;
            //
            consumableItem   item  = AllLvupArray[lvupTypeIndex].Item;
            int              ss    = SDDataManager.Instance.getInteger(item.SpecialStr);
            GDEEquipmentData equip = SDDataManager.Instance.getEquipmentByHashcode
                                         (equipDetail.equipHashcode);
            if (equip == null)
            {
                StartCoroutine(IEClickEnd());
                return;
            }

            bool flag = SDDataManager.Instance.consumeConsumable
                            (item.ID, out int residue, SDConstants.MinExpPerLevel);
            if (!flag)
            {
                StartCoroutine(IEClickEnd()); return;
            }

            int   currentLv = equip.lv;
            float rate      = 1;
            float change    = ss * 1f / 100;
            if (currentLv < SDConstants.equipMaxPreferLv)
            {
                for (int i = 0; i < currentLv; i++)
                {
                    rate *= change;
                }
            }
            else
            {
                rate    = 0.5f;
                change *= 0.5f;
                for (int i = 0; i < currentLv; i++)
                {
                    rate *= change;
                }
            }
            float r = UnityEngine.Random.Range(0, 1);
            if (r < rate)
            {
                Debug.Log("装备升级成功");
                SDDataManager.Instance.LvupEquipByHashcode(equipDetail.equipHashcode);
            }
            else
            {
                Debug.Log("装备升级失败");
            }
            refreshPanel_lvup();
            int hc = equipDetail.equipHashcode;
            equipDetail.initEquipDetailVision(hc);
            StartCoroutine(IEClickEnd());
        }
    }
Пример #5
0
    public override void RefreshImprovePanel()
    {
        base.RefreshImprovePanel();

        int hashcode           = equipDetail.equipHashcode;
        GDEEquipmentData equip = SDDataManager.Instance.getEquipmentByHashcode(hashcode);

        if (lvText && expText && expSlider && expSlider_listorder)
        {
            int lv = equip.lv;
            lvText.text = SDGameManager.T("Lv.") + lv;
        }
    }
Пример #6
0
    public void setJewelry(int hashcode, bool isSecondPos = false)
    {
        GDEEquipmentData armor = SDDataManager.Instance.getHeroEquipJewelry(hashcode, isSecondPos);

        if (!isSecondPos)
        {
            if (armor == null || string.IsNullOrEmpty(armor.id))
            {
                equipList.EquipVision(EquipPosition.Finger, isSecondPos).initEquipVision(armor);
                _jewelry0.initDataEmpty(); return;
            }
            EquipItem Item = SDDataManager.Instance.GetEquipItemById(armor.id);
            if (Item == null)
            {
                equipList.EquipVision(EquipPosition.Finger, isSecondPos).initEquipVision(armor);
                _jewelry0.initDataEmpty(); return;
            }
            //
            _jewelry0.initData(Item.LEVEL, Item.RAL, 0, 0, 0, 0, RoleBarChart.zero
                               , Item.ID, Item.NAME, 0);
            _jewelry0.PassiveEffectInit(Item.PassiveEffect);
            _jewelry0.armorRank = Item.ArmorRank;
            //
            equipList.EquipVision(EquipPosition.Finger, isSecondPos).initEquipVision(armor);
        }
        else
        {
            if (armor == null || string.IsNullOrEmpty(armor.id))
            {
                equipList.EquipVision(EquipPosition.Finger, isSecondPos).initEquipVision(armor);
                _jewelry1.initDataEmpty(); return;
            }
            EquipItem Item = SDDataManager.Instance.GetEquipItemById(armor.id);
            if (Item == null)
            {
                equipList.EquipVision(EquipPosition.Finger, isSecondPos).initEquipVision(armor);
                _jewelry1.initDataEmpty(); return;
            }
            //
            _jewelry1.initData(Item.LEVEL, Item.RAL, 0, 0, 0, 0, RoleBarChart.zero
                               , Item.ID, Item.NAME, 0);
            _jewelry1.PassiveEffectInit(Item.PassiveEffect);
            _jewelry1.armorRank = Item.ArmorRank;
            //
            equipList.EquipVision(EquipPosition.Finger, isSecondPos).initEquipVision(armor);
        }
    }
Пример #7
0
    public void initJewelry(int heroHashCode, bool isSecondPos = false)
    {
        GDEEquipmentData armor = SDDataManager.Instance.getHeroEquipJewelry(heroHashCode);
        Jewelry          a     = unit_model.gameObject.AddComponent <Jewelry>();

        if (!isSecondPos)
        {
            HeroProperty._jewelry0 = a;
            if (armor == null || string.IsNullOrEmpty(armor.id))
            {
                HeroProperty._jewelry0.initDataEmpty(); return;
            }
            EquipItem Item = SDDataManager.Instance.GetEquipItemById(armor.id);
            if (Item == null)
            {
                HeroProperty._jewelry0.initDataEmpty(); return;
            }
            //
            HeroProperty._jewelry0.initData(Item.LEVEL, Item.RAL, 0, 0, 0, 0, RoleBarChart.zero
                                            , Item.ID, Item.NAME, 0);
            HeroProperty._jewelry0.PassiveEffectInit(Item.PassiveEffect);
            HeroProperty._jewelry0.armorRank = Item.ArmorRank;
            int lv = armor.lv;
            HeroProperty._jewelry0.initGradeShow(lv);
        }
        else
        {
            HeroProperty._jewelry1 = a;
            if (armor == null || string.IsNullOrEmpty(armor.id))
            {
                HeroProperty._jewelry1.initDataEmpty(); return;
            }
            EquipItem Item = SDDataManager.Instance.GetEquipItemById(armor.id);
            if (Item == null)
            {
                HeroProperty._jewelry1.initDataEmpty(); return;
            }
            //
            HeroProperty._jewelry1.initData(Item.LEVEL, Item.RAL, 0, 0, 0, 0, RoleBarChart.zero
                                            , Item.ID, Item.NAME, 0);
            HeroProperty._jewelry1.PassiveEffectInit(Item.PassiveEffect);
            HeroProperty._jewelry1.armorRank = Item.ArmorRank;
            int lv = armor.lv;
            HeroProperty._jewelry1.initGradeShow(lv);
        }
    }
Пример #8
0
    void refreshPanel_fix()
    {
        int num = SDDataManager.Instance.getConsumableNum(ItemForFix.ID);
        GDEEquipmentData equip = SDDataManager.Instance.getEquipmentByHashcode
                                     (equipDetail.equipHashcode);

        if (equip == null)
        {
            AllBtns[2].interactable = false; return;
        }
        if (equip.quality < SDConstants.equipMaxQuality && num > 0)
        {
            AllBtns[2].interactable = true;
        }
        else
        {
            AllBtns[2].interactable = false;
        }
    }
Пример #9
0
    public void initHelmetSelectPanel()
    {
        refreshEquipIcon();
        //titleText.text = "Helmet";
        List <GDEEquipmentData> equips = SDDataManager.Instance.GetPosOwnedEquipsByCareer
                                             (EquipPosition.Head, heroDetail.ID);
        GDEEquipmentData helmet = SDDataManager.Instance.getHeroEquipHelmet(heroDetail.Hashcode);

        if (helmet == null || string.IsNullOrEmpty(helmet.id))
        {
            equipedItemBtn.gameObject.SetActive(false);
            equipedItemName.text  = "";
            equipedItemLevel.text = "";
            setEquipDetailPanelEmpty();
        }
        else
        {
            refreshSelectedEquipmentDetail(helmet.hashcode);
            //helmet.
        }
        pageController.ItemsInit(SDConstants.ItemType.Equip, EquipPosition.Head);
    }
Пример #10
0
 public void btnToFix()
 {
     if (!isClicking)
     {
         isClicking = true;
         int num = SDDataManager.Instance.getConsumableNum(ItemForFix.ID);
         GDEEquipmentData equip = SDDataManager.Instance.getEquipmentByHashcode
                                      (equipDetail.equipHashcode);
         if (num > 0)
         {
             bool flag = SDDataManager.Instance.PromoteEquipQuality
                             (equipDetail.equipHashcode, 1);
             if (flag)
             {
                 SDDataManager.Instance.consumeConsumable(ItemForFix.ID, out int reduice, 1);
                 refreshPanel_fix();
                 int hc = equipDetail.equipHashcode;
                 equipDetail.initEquipDetailVision(hc);
             }
         }
         StartCoroutine(IEClickEnd());
     }
 }
Пример #11
0
    public void initEquipDetailVision(GDEEquipmentData equip)
    {
        equipId       = equip.id;
        equipHashcode = equip.hashcode;
        equipData     = SDDataManager.Instance.GetEquipItemById(equipId);

        //
        int lv = equip.lv;

        nameText.text = (lv > 0?SDGameManager.T("Lv.") + lv + "·":"") + equipData.NAME;


        equipLv            = lv;
        equipPosImg.sprite = SDDataManager.Instance.equipPosIcon(equipData.EquipPos);
        equipPosImg.SetNativeSize();
        starVision.StarNum = equip.quality;
        //
        equipIcon.sprite      = equipData.IconFromAtlas;
        equipBgIcon.sprite    = SDDataManager.Instance.baseBgSpriteByRarity(equipData.LEVEL);
        equipFrameIcon.sprite = SDDataManager.Instance.baseFrameSpriteByRarity(equipData.LEVEL);
        //
        EDP.EmptyPanel.gameObject.SetActive(false);
    }
Пример #12
0
    public void EquipBelowBtn_Tapped()
    {
        GDEEquipmentData e
            = SDDataManager.Instance.getEquipmentByHashcode(currentEquipHashcode);
        int ownerHashcode = e.OwnerHashcode;

        if (ownerHashcode == heroDetail.Hashcode)//解除装备
        {
            SDDataManager.Instance.disrobeEquipment(heroDetail.Hashcode, equipPos, isSecondJewelryPos);
            heroDetail.initHeroDetailPanel(heroDetail.Hashcode);
            refreshSelectedEquipmentDetail(currentEquipHashcode);
        }
        else if (ownerHashcode > 0)//已被其他角色装备
        {
        }
        else//装备
        {
            SDDataManager.Instance.dressEquipment
                (heroDetail.Hashcode, currentEquipHashcode, isSecondJewelryPos);
            heroDetail.initHeroDetailPanel(heroDetail.Hashcode);
            refreshSelectedEquipmentDetail(currentEquipHashcode);
        }
    }
    public void initHeroCharacterModel(int hashcode, float scale = 1, UDE _ude = UDE.Animation)
    {
        thisCMCsUDE  = _ude;
        heroHashcode = hashcode;
        id           = SDDataManager.Instance.getHeroIdByHashcode(hashcode);
        CType        = SDConstants.CharacterType.Hero;
        skinName     = SDDataManager.Instance.getHeroSkinNameInSkeleton(hashcode);

        //
        GDEEquipmentData weapon = SDDataManager.Instance.getHeroWeapon(hashcode);

        if (weapon == null || weapon.hashcode <= 0 || string.IsNullOrEmpty(weapon.id))
        {
            notShowWeaponSlot = true;
        }
        else
        {
            notShowWeaponSlot = false;
            weaponId          = weapon.id;
        }

        //
        initCharacterModel(scale);
    }
Пример #14
0
    public void setWeapon(int hashcode)
    {
        GDEEquipmentData armor = SDDataManager.Instance.getHeroWeapon(hashcode);

        if (armor == null || string.IsNullOrEmpty(armor.id) || armor.hashcode == 0)
        {
            equipList.EquipVision(EquipPosition.Hand).initEquipVision(armor);
            _weapon.initDataEmpty(); return;
        }
        EquipItem Item = SDDataManager.Instance.GetEquipItemById(armor.id);

        if (Item == null)
        {
            equipList.EquipVision(EquipPosition.Hand).initEquipVision(armor);
            _weapon.initDataEmpty(); return;
        }
        //
        _weapon.initData(Item.LEVEL, Item.RAL, 0, 0, 0, 0, RoleBarChart.zero
                         , Item.ID, Item.NAME, 0);
        _weapon.PassiveEffectInit(Item.PassiveEffect);
        _weapon.armorRank = Item.ArmorRank;
        //
        equipList.EquipVision(EquipPosition.Hand).initEquipVision(armor);
    }
Пример #15
0
    public void initEquipDetailVision(int equip_hashcode)
    {
        GDEEquipmentData equip = SDDataManager.Instance.getEquipmentByHashcode(equip_hashcode);

        initEquipDetailVision(equip);
    }
Пример #16
0
    public void refreshSelectedEquipmentDetail(int hashcode)
    {
        if (hashcode > 0)
        {
            GDEEquipmentData equip = SDDataManager.Instance.getEquipmentByHashcode(hashcode);

            if (equip != null)
            {
                currentEquipHashcode = equip.hashcode;
                equipedItemName.text
                    = SDDataManager.Instance.getEquipNameByHashcode(currentEquipHashcode);
                equipedItemLevel.text = SDGameManager.T("Lv.")
                                        + equip.lv;
                equipedItemBattleForce.text
                    = "" + SDDataManager.Instance.getEquipBattleForceByHashCode(equip.hashcode);
                //
                equipIcon.sprite = SDDataManager.Instance.GetEquipIconById(equip.id);
                EquipItem item = SDDataManager.Instance.GetEquipItemById(equip.id);
                equipFrameIcon.sprite = SDDataManager.Instance.baseFrameSpriteByRarity(item.LEVEL);
                equipBgIcon.sprite    = SDDataManager.Instance.baseBgSpriteByRarity(item.LEVEL);
                //
                equipedItemBtn.gameObject.SetActive(true);
                if (equip.OwnerHashcode > 0)//判断是否已被装备
                {
                    bool flag = false;
                    if (equip.OwnerHashcode == heroDetail.Hashcode)//是当前角色装备
                    {
                        flag = true;
                        if (SDDataManager.Instance.getEquipPosById(equip.id) == 4)
                        {
                            if (!isSecondJewelryPos &&
                                SDDataManager.Instance.getHeroByHashcode(heroDetail.Hashcode)
                                .jewelry0.hashcode != equip.hashcode)
                            {
                                flag = false;
                            }
                            else if (isSecondJewelryPos &&
                                     SDDataManager.Instance.getHeroByHashcode(heroDetail.Hashcode)
                                     .jewelry1.hashcode != equip.hashcode)
                            {
                                flag = false;
                            }
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    if (flag)
                    {
                        equipItemBtnText.text = SDGameManager.T("解除装备");
                    }
                    else
                    {
                        equipedItemBtn.gameObject.SetActive(false);
                        equipItemBtnText.text = SDGameManager.T("无法装备");
                    }
                }
                else
                {
                    equipItemBtnText.text = SDGameManager.T("装备");
                }
            }
        }
    }