Beispiel #1
0
    private void SetGemIcon(int typeId)
    {
        Items items = DataReader <Items> .Get(typeId);

        if (items == null)
        {
            return;
        }
        Image component = this.imgIcon.GetComponent <Image>();

        ResourceManager.SetSprite(component, GameDataUtils.GetItemFrameByColor(items.color));
        Image component2 = this.imgIcon.get_transform().FindChild("imgItem").GetComponent <Image>();

        ResourceManager.SetSprite(component2, GameDataUtils.GetIcon(items.icon));
        Text component3 = this.imgIcon.get_transform().FindChild("texName").GetComponent <Text>();

        component3.set_text(GameDataUtils.GetItemName(items, true));
        Dictionary <string, Color> textColorByQuality = GameDataUtils.GetTextColorByQuality(items.color);

        component3.set_color(textColorByQuality.get_Item("TextColor"));
        this.imgIcon.get_transform().FindChild("texName").GetComponent <Outline>().set_effectColor(textColorByQuality.get_Item("TextOutlineColor"));
        Text component4 = this.imgIcon.get_transform().FindChild("texLv").GetComponent <Text>();

        component4.set_text(string.Empty);
        if (!GemGlobal.IsGemEnoughLv(typeId))
        {
            int roleLvRequire = GemGlobal.GetRoleLvRequire(typeId);
            component4.set_text(string.Format(GameDataUtils.GetChineseContent(509011, false), roleLvRequire));
        }
        base.FindTransform("texDesc").GetComponent <Text>().set_text(GameDataUtils.GetChineseContent(items.describeId1, false));
    }
Beispiel #2
0
    public static List <MaterialGem> GetMaterialGems(EquipLibType.ELT equipNum, int slotNum)
    {
        List <MaterialGem> list           = new List <MaterialGem>();
        List <int>         oneLevelGemIds = GemGlobal.GetOneLevelGemIds(equipNum, slotNum);

        for (int i = 0; i < oneLevelGemIds.get_Count(); i++)
        {
            int num = oneLevelGemIds.get_Item(i);
            List <MaterialGem> list2 = new List <MaterialGem>();
            for (int num2 = num; num2 != 0; num2 = GemGlobal.GetAfterId(num2))
            {
                if (GemGlobal.IsGemEnoughLv(num2))
                {
                    List <Goods> list3 = BackpackManager.Instance.OnGetGood(num2);
                    for (int j = 0; j < list3.get_Count(); j++)
                    {
                        Goods goods = list3.get_Item(j);
                        list2.Add(new MaterialGem
                        {
                            typeId = num2,
                            gemId  = goods.GetLongId(),
                            count  = goods.GetCount()
                        });
                    }
                }
            }
            list2.Reverse();
            list.AddRange(list2.ToArray());
        }
        return(list);
    }
Beispiel #3
0
    private bool IsEnoughGemToCompose(int itemId)
    {
        int         num            = 0;
        List <long> materailGemIds = this.GetMaterailGemIds(itemId, ref num);

        return(materailGemIds.get_Count() >= GemGlobal.GetComposeAmount(itemId));
    }
Beispiel #4
0
    public static long getAllGemAttrValue()
    {
        long       num  = 0L;
        List <int> list = new List <int>();

        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                if (GemManager.Instance.equipSlots.GetLength(0) >= i)
                {
                    if (GemManager.Instance.equipSlots.GetLength(1) >= j)
                    {
                        GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[i, j];
                        if (gemEmbedInfo != null && gemEmbedInfo.typeId > 0)
                        {
                            list.Add(gemEmbedInfo.typeId);
                        }
                    }
                }
            }
        }
        for (int k = 0; k < list.get_Count(); k++)
        {
            int        itemId = list.get_Item(k);
            List <int> attrs  = GemGlobal.GetAttrs(itemId);
            List <int> values = GemGlobal.GetValues(itemId);
            num += EquipGlobal.CalculateFightingByIDAndValue(attrs, values);
        }
        return(num);
    }
Beispiel #5
0
    private void SetScroll(int rootTypeId, int branchTypeId)
    {
        for (int i = 0; i < this.gridLayoutGroup.get_transform().get_childCount(); i++)
        {
            Transform child = this.gridLayoutGroup.get_transform().GetChild(i);
            Object.Destroy(child.get_gameObject());
        }
        List <int> genealogy = this.GetGenealogy(rootTypeId, branchTypeId);

        using (List <int> .Enumerator enumerator = genealogy.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                int        current            = enumerator.get_Current();
                GameObject instantiate2Prefab = ResourceManager.GetInstantiate2Prefab("GemNavCell");
                instantiate2Prefab.get_transform().SetParent(this.gridLayoutGroup.get_transform(), false);
                instantiate2Prefab.get_transform().FindChild("ImageSelectBG").get_gameObject().SetActive(false);
                instantiate2Prefab.set_name(current.ToString());
                instantiate2Prefab.GetComponent <ButtonCustom>().onClickCustom = new ButtonCustom.VoidDelegateObj(this.OnClickTopGridItem);
                Image component  = instantiate2Prefab.get_transform().FindChild("ImageFrame").GetComponent <Image>();
                Image component2 = instantiate2Prefab.get_transform().FindChild("ImageIcon").GetComponent <Image>();
                ResourceManager.SetSprite(component, GameDataUtils.GetItemFrame(current));
                ResourceManager.SetSprite(component2, GemGlobal.GetIconSprite(current));
                if (current == genealogy.get_Item(genealogy.get_Count() - 1))
                {
                    instantiate2Prefab.get_transform().FindChild("ImageArrow").get_gameObject().SetActive(false);
                }
                if (current == branchTypeId)
                {
                    instantiate2Prefab.get_transform().FindChild("ImageSelectBG").get_gameObject().SetActive(true);
                }
            }
        }
    }
Beispiel #6
0
    private void SetGemButton(int typeId)
    {
        Transform transform  = base.FindTransform("btnComposeOne");
        Transform transform2 = base.FindTransform("btnComposeAll");

        transform.Find("texBest").get_gameObject().SetActive(true);
        transform.Find("texBest").GetComponent <Text>().set_text(GemGlobal.GetComposeGemTip(typeId));
        if (GemGlobal.IsCanCompose(typeId))
        {
            SpriteRenderer iconSprite = ResourceManager.GetIconSprite("button_yellow_1");
            transform.GetComponent <ButtonCustom>().set_enabled(true);
            ResourceManager.SetSprite(transform.GetComponent <Image>(), iconSprite);
            transform2.GetComponent <ButtonCustom>().set_enabled(true);
            ResourceManager.SetSprite(transform2.GetComponent <Image>(), iconSprite);
        }
        else
        {
            SpriteRenderer iconSprite2 = ResourceManager.GetIconSprite("button_gray_1");
            transform.GetComponent <ButtonCustom>().set_enabled(false);
            ResourceManager.SetSprite(transform.GetComponent <Image>(), iconSprite2);
            transform2.GetComponent <ButtonCustom>().set_enabled(false);
            ResourceManager.SetSprite(transform2.GetComponent <Image>(), iconSprite2);
        }
        Transform     transform3    = base.FindTransform("btnWear");
        GemEmbedInfo  gemInfo       = GemGlobal.GetGemInfo((EquipLibType.ELT) this.currEquip, this.currSlot);
        BaoShiShengJi baoShiShengJi = DataReader <BaoShiShengJi> .Get(this.currTypeId);
    }
Beispiel #7
0
    private void OnClickBtnComposeAll(GameObject sender)
    {
        Debug.Log("OnClickBtnComposeAll");
        int afterId = GemGlobal.GetAfterId(this.currTypeId);

        GemManager.Instance.SendGemSysCompositeReq(afterId, -1);
    }
Beispiel #8
0
    private void OnClickBtnCompose(GameObject go)
    {
        if (!GemGlobal.IsGemEnoughLv(this.rootTypeId))
        {
            string text = string.Format(GameDataUtils.GetChineseContent(621005, false), new object[0]);
            UIManagerControl.Instance.ShowToastText(text, 2f, 2f);
            return;
        }
        if (!this.IsEnoughGemToCompose(this.rootTypeId))
        {
            int    gemLv    = GemGlobal.GetGemLv(this.branchTypeId);
            string gemColor = GemGlobal.GetGemColor(this.branchTypeId);
            string text2    = string.Format(GameDataUtils.GetChineseContent(621008, false), gemLv, gemColor);
            UIManagerControl.Instance.ShowToastText(text2, 2f, 2f);
            return;
        }
        int arg_B7_0 = (!this.IsComposeGemtoSlot(this.rootTypeId)) ? 0 : GemUI.instance.slotCurr;

        GemManager.Instance.SendGemSysCompositeReq(this.rootTypeId, 1);
        if (this.IsComposeGemtoSlot(this.rootTypeId))
        {
            GemSingleUI gemSingleUI = UIManagerControl.Instance.GetUIIfExist("GemSingleUI") as GemSingleUI;
            if (gemSingleUI != null)
            {
                gemSingleUI.Show(false);
            }
            this.Show(false);
        }
    }
Beispiel #9
0
    private List <MaterialGem> GetLowerGems(int currSlot, int typeId)
    {
        List <MaterialGem> list = new List <MaterialGem>();

        for (int needId = GemGlobal.GetNeedId(typeId); needId != 0; needId = GemGlobal.GetNeedId(needId))
        {
            List <Goods> list2 = BackpackManager.Instance.OnGetGood(needId);
            using (List <Goods> .Enumerator enumerator = list2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Goods current = enumerator.get_Current();
                    list.Add(new MaterialGem
                    {
                        typeId = needId,
                        gemId  = current.GetLongId(),
                        count  = current.GetCount()
                    });
                }
            }
        }
        list.Reverse();
        GemEmbedInfo equipSlot = this.GetEquipSlot(currSlot);

        if (equipSlot.typeId != 0)
        {
            list.Add(new MaterialGem
            {
                typeId = equipSlot.typeId,
                gemId  = equipSlot.id,
                count  = 1
            });
        }
        return(list);
    }
Beispiel #10
0
 public static int GetNextGemItemId(int itemId)
 {
     if (itemId == 0)
     {
         return(-888);
     }
     return(GemGlobal.GetAfterId(itemId));
 }
Beispiel #11
0
    public static SpriteRenderer GetGemItemFrameSprite(EquipLibType.ELT pos, int slotIndex)
    {
        BaoShiKongPeiZhi baoShiKongPeiZhi = DataReader <BaoShiKongPeiZhi> .DataList.Find((BaoShiKongPeiZhi a) => a.position == (int)pos && a.slotOpen == slotIndex);

        if (baoShiKongPeiZhi != null && baoShiKongPeiZhi.gemType.get_Count() > 0)
        {
            int color = baoShiKongPeiZhi.gemType.get_Item(0);
            return(GemGlobal.GetGemItemFrameByColor(color));
        }
        return(ResourceManagerBase.GetNullSprite());
    }
Beispiel #12
0
    public static List <int> GetValues(int itemId)
    {
        int attrId = GemGlobal.GetAttrId(itemId);

        if (attrId > 0)
        {
            return(GemGlobal.GetAttrInfo(attrId).values);
        }
        Debug.Log("<color=red>Error:</color>propertyType <= 0");
        return(new List <int>());
    }
Beispiel #13
0
    public static int GetAttrId(int itemId)
    {
        BaoShiShengJi bSSJ = GemGlobal.GetBSSJ(itemId);

        if (bSSJ == null)
        {
            Debug.Log("<color=red>Error:</color>获取宝石属性失败,没找到对应配置:" + itemId);
            return(-1);
        }
        return(bSSJ.propertyType);
    }
Beispiel #14
0
    private List <CostGem> GetComposeMaterialGems(int currSlot, int typeId)
    {
        List <MaterialGem> lowerGems = this.GetLowerGems(currSlot, typeId);

        if (lowerGems.get_Count() == 0)
        {
            return(null);
        }
        int value = GemGlobal.GetValue(typeId);

        int[] array = new int[lowerGems.get_Count()];
        bool  flag  = false;

        while (array[lowerGems.get_Count() - 1] <= lowerGems.get_Item(lowerGems.get_Count() - 1).count)
        {
            for (int i = 0; i < lowerGems.get_Count() - 1; i++)
            {
                if (array[i] > lowerGems.get_Item(i).count)
                {
                    array[i] = 0;
                    array[i + 1]++;
                }
            }
            int num = 0;
            for (int j = 0; j < lowerGems.get_Count(); j++)
            {
                num += array[j] * GemGlobal.GetValue(lowerGems.get_Item(j).typeId);
            }
            if (num == value)
            {
                flag = true;
                break;
            }
            array[0]++;
        }
        if (!flag)
        {
            return(null);
        }
        List <CostGem> list = new List <CostGem>();

        for (int k = 0; k < array.Length; k++)
        {
            if (array[k] > 0)
            {
                list.Add(new CostGem
                {
                    gemId  = lowerGems.get_Item(k).gemId,
                    gemNum = (uint)array[k]
                });
            }
        }
        return(list);
    }
Beispiel #15
0
    public static List <MaterialGem> GetOneKeyComposeGems(EquipLibType.ELT equipNum, int slotNum, int nextTypeId)
    {
        List <MaterialGem> list   = new List <MaterialGem>();
        int          value        = GemGlobal.GetValue(nextTypeId);
        int          num          = 0;
        GemEmbedInfo gemEmbedInfo = GemGlobal.GetGemInfo(equipNum, slotNum);

        for (int needId = GemGlobal.GetNeedId(nextTypeId); needId != 0; needId = GemGlobal.GetNeedId(needId))
        {
            if (gemEmbedInfo != null && gemEmbedInfo.typeId == needId)
            {
                list.Add(new MaterialGem
                {
                    typeId = gemEmbedInfo.typeId,
                    gemId  = gemEmbedInfo.id,
                    count  = 1
                });
                num += GemGlobal.GetValue(needId);
                if (num == value)
                {
                    return(list);
                }
                gemEmbedInfo = null;
            }
            List <Goods> list2 = BackpackManager.Instance.OnGetGood(needId);
            for (int i = 0; i < list2.get_Count(); i++)
            {
                Goods goods = list2.get_Item(i);
                int   num2  = 0;
                for (int j = 0; j < goods.GetCount(); j++)
                {
                    num2++;
                    num += GemGlobal.GetValue(needId);
                    if (num == value)
                    {
                        list.Add(new MaterialGem
                        {
                            typeId = needId,
                            gemId  = goods.GetLongId(),
                            count  = num2
                        });
                        return(list);
                    }
                }
                list.Add(new MaterialGem
                {
                    typeId = needId,
                    gemId  = goods.GetLongId(),
                    count  = goods.GetCount()
                });
            }
        }
        return(null);
    }
Beispiel #16
0
    public static bool IsEnoughMoneyToOneKeyCompose(EquipLibType.ELT equipNum, int slotNum, int nextTypeId)
    {
        List <MaterialGem> oneKeyComposeGems = GemGlobal.GetOneKeyComposeGems(equipNum, slotNum, nextTypeId);

        if (oneKeyComposeGems != null)
        {
            int oneKeyComposeCost = GemGlobal.GetOneKeyComposeCost(oneKeyComposeGems, nextTypeId);
            return(EntityWorld.Instance.EntSelf.Gold >= (long)oneKeyComposeCost);
        }
        return(false);
    }
Beispiel #17
0
    public static List <string> GetStrAttrs(int itemId)
    {
        List <int>    attrs  = GemGlobal.GetAttrs(itemId);
        List <int>    values = GemGlobal.GetValues(itemId);
        List <string> list   = new List <string>();

        for (int i = 0; i < attrs.get_Count(); i++)
        {
            list.Add(AttrUtility.GetStandardAddDesc(attrs.get_Item(i), values.get_Item(i), "ff7d4b"));
        }
        return(list);
    }
Beispiel #18
0
    public static bool IsCanCompose(int typeId)
    {
        if (GemGlobal.IsGemMaxLv(typeId))
        {
            return(false);
        }
        int afterId            = GemGlobal.GetAfterId(typeId);
        int composeAmount      = GemGlobal.GetComposeAmount(afterId);
        int gemTotalCountInBag = GemGlobal.GetGemTotalCountInBag(typeId);

        return(gemTotalCountInBag >= composeAmount);
    }
Beispiel #19
0
    public static List <int> GetBetterItemIds(int nextItemId)
    {
        List <int> list = new List <int>();

        while (nextItemId != 0)
        {
            list.Add(nextItemId);
            nextItemId = GemGlobal.GetAfterId(nextItemId);
        }
        list.Reverse();
        return(list);
    }
Beispiel #20
0
 public static string GetComposeGemTip(int typeId)
 {
     if (GemGlobal.IsGemMaxLv(typeId))
     {
         return("已升至顶级宝石");
     }
     if (!GemGlobal.IsCanCompose(typeId))
     {
         return("材料不足");
     }
     return(string.Empty);
 }
Beispiel #21
0
    private void Refresh(int slotIndex, int typeId)
    {
        int afterId = GemGlobal.GetAfterId(typeId);

        if (this.IsEnoughGemToCompose(afterId))
        {
            this.SetItemIcons(afterId);
        }
        else
        {
            this.SetItemIcons(typeId);
        }
    }
Beispiel #22
0
    public static bool IsWearSameColorGem(EquipLibType.ELT equipNum, int slotNum, int color)
    {
        List <int> alreadyUsedGemTypes = GemGlobal.GetAlreadyUsedGemTypes(equipNum, slotNum);

        for (int i = 0; i < alreadyUsedGemTypes.get_Count(); i++)
        {
            if (alreadyUsedGemTypes.get_Item(i) == color)
            {
                return(true);
            }
        }
        return(false);
    }
Beispiel #23
0
    public static bool IsCanOneKeyCompose(EquipLibType.ELT equipNum, int slotNum, int currTypeId)
    {
        if (GemGlobal.IsGemMaxLv(currTypeId))
        {
            return(false);
        }
        if (currTypeId == 0)
        {
            return(false);
        }
        int afterId = GemGlobal.GetAfterId(currTypeId);

        return(GemGlobal.IsGemEnoughLv(afterId) && GemGlobal.IsEnoughMoneyToOneKeyCompose(equipNum, slotNum, afterId));
    }
Beispiel #24
0
    private List <int> GetGenealogy(int rootTypeId, int branchTypeId)
    {
        List <int> list = new List <int>();

        list.Add(rootTypeId);
        int needId = GemGlobal.GetNeedId(rootTypeId);

        while (needId != 0 && needId >= branchTypeId)
        {
            list.Add(needId);
            needId = GemGlobal.GetNeedId(needId);
        }
        return(list);
    }
Beispiel #25
0
    public static bool IsCanCompose(int equipNum, int slotNum, int currTypeId)
    {
        if (GemGlobal.IsGemMaxLv(currTypeId))
        {
            return(false);
        }
        if (currTypeId == 0)
        {
            return(false);
        }
        int afterId = GemGlobal.GetAfterId(currTypeId);

        if (!GemGlobal.IsGemEnoughLv(afterId))
        {
            return(false);
        }
        if (!GemGlobal.IsEnoughMoneyToCompose(afterId))
        {
            return(false);
        }
        int value  = GemGlobal.GetValue(afterId);
        int needId = GemGlobal.GetNeedId(afterId);
        int num    = 0;

        while (needId != 0)
        {
            List <Goods> list = BackpackManager.Instance.OnGetGood(needId);
            using (List <Goods> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Goods current = enumerator.get_Current();
                    int   count   = current.GetCount();
                    int   itemId  = current.GetItemId();
                    if (GemGlobal.IsGemEnoughLv(itemId))
                    {
                        int value2 = GemGlobal.GetValue(itemId);
                        num += value2 * count;
                        if (num >= value)
                        {
                            return(true);
                        }
                    }
                }
            }
            needId = GemGlobal.GetNeedId(needId);
        }
        return(false);
    }
Beispiel #26
0
    public static bool IsActiveOneKeyCompose(EquipLibType.ELT equipNum, int slotNum, int typeId)
    {
        Debug.Log("IsActiveOneKeyCompose typeId=" + typeId);
        int           num           = 1;
        BaoShiShengJi baoShiShengJi = DataReader <BaoShiShengJi> .Get(typeId);

        int num2 = GemGlobal.GetGemId(baoShiShengJi.type, 1);

        while (num2 != typeId && num2 != 0)
        {
            num2 = GemGlobal.GetAfterId(num2);
            num++;
        }
        return(num >= 4);
    }
Beispiel #27
0
    private void SetGemAttrs(int typeId)
    {
        List <string> strAttrs  = GemGlobal.GetStrAttrs(typeId);
        string        text      = string.Empty;
        Text          component = base.FindTransform("texAttr0").GetComponent <Text>();
        int           num       = (strAttrs.get_Count() <= 2) ? strAttrs.get_Count() : 2;

        for (int i = 0; i < num; i++)
        {
            text += strAttrs.get_Item(i);
            if (i < num - 1)
            {
                text += "\n";
            }
        }
        component.set_text(text);
    }
Beispiel #28
0
    private void InitTexAttrs(int buttonIndex, int typeId)
    {
        List <string> strAttrs = GemGlobal.GetStrAttrs(typeId);

        for (int i = 0; i < 2; i++)
        {
            Text component = this.btnGrids[buttonIndex].get_transform().FindChild("texAttr" + i).GetComponent <Text>();
            if (i < strAttrs.get_Count())
            {
                component.set_text(strAttrs.get_Item(i));
            }
            else
            {
                component.set_text(string.Empty);
            }
        }
    }
Beispiel #29
0
 public void CheckBadge()
 {
     for (int i = 0; i < 4; i++)
     {
         Transform    transform    = this.btnEquipSlots[i].get_transform();
         GemEmbedInfo gemEmbedInfo = GemManager.Instance.equipSlots[this.equipCurr - EquipLibType.ELT.Weapon, i];
         Image        component    = transform.FindChild("notice").GetComponent <Image>();
         component.get_gameObject().SetActive(false);
         if (gemEmbedInfo != null)
         {
             bool flag = GemGlobal.IsCanWearGem((int)this.equipCurr, i, gemEmbedInfo.typeId);
             if (flag)
             {
                 component.get_gameObject().SetActive(true);
             }
         }
     }
 }
Beispiel #30
0
 private void Init()
 {
     this.InitButtonEvent();
     this.noGem        = base.FindTransform("noGem").GetComponent <Text>();
     this.materialGems = GemGlobal.GetMaterialGems((EquipLibType.ELT) this.currEquip, this.currSlot);
     if (this.materialGems.get_Count() <= 0)
     {
         base.FindTransform("centre").get_gameObject().SetActive(false);
         this.noGem.get_gameObject().SetActive(true);
         this.noGem.set_text(GameDataUtils.GetChineseContent(621016, false));
     }
     else
     {
         base.FindTransform("centre").get_gameObject().SetActive(true);
         this.noGem.get_gameObject().SetActive(false);
         this.SetScrollRect(this.materialGems);
     }
 }