Exemple #1
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);
    }
    private void OnClickBtnComposeAll(GameObject sender)
    {
        Debug.Log("OnClickBtnComposeAll");
        int afterId = GemGlobal.GetAfterId(this.currTypeId);

        GemManager.Instance.SendGemSysCompositeReq(afterId, -1);
    }
Exemple #3
0
 public static int GetNextGemItemId(int itemId)
 {
     if (itemId == 0)
     {
         return(-888);
     }
     return(GemGlobal.GetAfterId(itemId));
 }
Exemple #4
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);
    }
Exemple #5
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);
    }
Exemple #6
0
    private void Refresh(int slotIndex, int typeId)
    {
        int afterId = GemGlobal.GetAfterId(typeId);

        if (this.IsEnoughGemToCompose(afterId))
        {
            this.SetItemIcons(afterId);
        }
        else
        {
            this.SetItemIcons(typeId);
        }
    }
Exemple #7
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));
    }
Exemple #8
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);
    }
Exemple #9
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);
    }
Exemple #10
0
    private void OnClickBtnGrid(GameObject go)
    {
        string text = go.get_name().Substring(7);
        int    afterId;

        if (int.Parse(text) == 0)
        {
            if (GemUI.instance.typeIdNext == this.rootTypeId)
            {
                return;
            }
            afterId = GemGlobal.GetAfterId(this.rootTypeId);
        }
        else
        {
            afterId = this.branchTypeId;
            if (GemGlobal.GetNeedId(afterId) == 0)
            {
                UIManagerControl.Instance.OpenSourceReferenceUI(afterId, new Action(this.CloseUI));
                return;
            }
        }
        this.SetItemIcons(afterId);
    }
Exemple #11
0
 public static bool IsGemMaxLv(int itemId)
 {
     return(itemId > 0 && GemGlobal.GetAfterId(itemId) == 0);
 }
Exemple #12
0
    public static int GetOneKeyComposeCost(List <MaterialGem> gems, int typeId)
    {
        gems.Reverse();
        List <MaterialGem> list = new List <MaterialGem>();

        using (List <MaterialGem> .Enumerator enumerator = gems.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                MaterialGem current = enumerator.get_Current();
                for (int i = 0; i < current.count; i++)
                {
                    MaterialGem materialGem = new MaterialGem
                    {
                        typeId = current.typeId,
                        gemId  = current.gemId,
                        count  = current.count
                    };
                    list.Add(materialGem);
                }
            }
        }
        int num  = 0;
        int num2 = 0;

        while (num < list.get_Count() && list.get_Count() > 1)
        {
            int typeId2       = list.get_Item(num).typeId;
            int afterId       = GemGlobal.GetAfterId(typeId2);
            int composeAmount = GemGlobal.GetComposeAmount(afterId);
            int num3          = 0;
            while (num < list.get_Count() && typeId2 == list.get_Item(num++).typeId)
            {
                num3++;
            }
            list.RemoveRange(0, num3);
            int num4 = num3 / composeAmount;
            for (int j = 0; j < num4; j++)
            {
                MaterialGem materialGem2 = new MaterialGem
                {
                    typeId = afterId,
                    gemId  = -1L,
                    count  = 1
                };
                list.Insert(0, materialGem2);
                num2 += GemGlobal.GetAmount(afterId);
            }
            string text = string.Empty;
            using (List <MaterialGem> .Enumerator enumerator2 = list.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    MaterialGem current2 = enumerator2.get_Current();
                    text = text + current2.typeId + " ";
                }
            }
            if (list.get_Count() == 1)
            {
                break;
            }
            num = 0;
        }
        return(num2);
    }
Exemple #13
0
    public static void ComposeGemAll(int typeId)
    {
        int afterId = GemGlobal.GetAfterId(typeId);

        GemManager.Instance.SendGemSysCompositeReq(afterId, -1);
    }