Exemple #1
0
	private NeedMaterial[] GetMaterialDB(int aim_lv)
	{
		int num = aim_lv - baseLv - 1;
		if (needMmaterialDB[num] == null)
		{
			int num2 = num;
			if (num > 0)
			{
				int num3 = num;
				while (num3 >= 0 && needMmaterialDB[num3] == null)
				{
					if (needMmaterialDB[num3] == null)
					{
						num2 = num3;
					}
					num3--;
				}
			}
			for (int i = num2; i <= num; i++)
			{
				int lv = baseLv + 1 + i;
				GrowEquipItemTable.GrowEquipItemNeedItemData growEquipItemNeedItemData = Singleton<GrowEquipItemTable>.I.GetGrowEquipItemNeedUniqueItemData(GetEquipData().tableData.needUniqueId, (uint)lv);
				if (growEquipItemNeedItemData == null)
				{
					growEquipItemNeedItemData = Singleton<GrowEquipItemTable>.I.GetGrowEquipItemNeedItemData(GetEquipData().tableData.needId, (uint)lv);
				}
				NeedMaterial[] needMaterial = growEquipItemNeedItemData.needMaterial;
				int needMoney = growEquipItemNeedItemData.needMoney;
				if (i > 0)
				{
					List<NeedMaterial> before_material = new List<NeedMaterial>();
					Array.ForEach(needMmaterialDB[i - 1], delegate(NeedMaterial _mat)
					{
						before_material.Add(new NeedMaterial(_mat.itemID, _mat.num));
					});
					Array.ForEach(needMaterial, delegate(NeedMaterial _material)
					{
						NeedMaterial needMaterial2 = before_material.Find((NeedMaterial _data) => _data.itemID == _material.itemID);
						if (needMaterial2 != null)
						{
							needMaterial2.num += _material.num;
						}
						else
						{
							before_material.Add(new NeedMaterial(_material.itemID, _material.num));
						}
					});
					needMoney += needMoneyDB[i - 1];
					needMmaterialDB[i] = before_material.ToArray();
					needMoneyDB[i] = needMoney;
				}
				else
				{
					needMmaterialDB[i] = growEquipItemNeedItemData.needMaterial;
					needMoneyDB[i] = growEquipItemNeedItemData.needMoney;
				}
			}
		}
		return needMmaterialDB[num];
	}
Exemple #2
0
        public MaterialSortData(NeedMaterial need_data, bool is_key = false)
        {
            needData = need_data;
            table    = Singleton <ItemTable> .I.GetItemData(need_data.itemID);

            isKey = (is_key ? 1 : 0);
        }
    public bool IsHaveingKeyMaterial(LOGICAL_ORDER_TYPE needKeyOrder, NeedMaterial[] needMaterial)
    {
        List <NeedMaterial> list = new List <NeedMaterial>();
        int i = 0;

        for (int num = needMaterial.Length; i < num; i++)
        {
            if (needMaterial[i].isKey)
            {
                list.Add(needMaterial[i]);
            }
        }
        int count = list.Count;

        if (count <= 0)
        {
            return(true);
        }
        LinkedListNode <ItemInfo> node;

        for (node = itemInventory.GetFirstNode(); node != null; node = node.Next)
        {
            NeedMaterial find_material = null;
            list.ForEach(delegate(NeedMaterial material)
            {
                if (material.itemID == node.Value.tableID)
                {
                    find_material = material;
                }
            });
            if (find_material != null)
            {
                list.Remove(find_material);
            }
        }
        switch (needKeyOrder)
        {
        case LOGICAL_ORDER_TYPE.OR:
            if (list.Count == count)
            {
                return(false);
            }
            break;

        case LOGICAL_ORDER_TYPE.AND:
            if (list.Count != 0)
            {
                return(false);
            }
            break;
        }
        return(true);
    }
    public override bool Equals(object obj)
    {
        if (obj == null)
        {
            return(false);
        }
        NeedMaterial needMaterial = obj as NeedMaterial;

        if (needMaterial == null)
        {
            return(false);
        }
        return(isKey == needMaterial.isKey && itemID == needMaterial.itemID && num == needMaterial.num);
    }
 public void DumpBinary(BinaryWriter writer)
 {
     for (int i = 0; i < NEED_MATERIAL_LENGTH_MAX; i++)
     {
         if (i < this.needMaterial.Length)
         {
             NeedMaterial needMaterial = this.needMaterial[i];
             writer.Write(needMaterial.itemID);
             writer.Write(needMaterial.num);
         }
         else
         {
             writer.Write(0u);
             writer.Write(0);
         }
     }
     writer.Write(needMoney);
 }
Exemple #6
0
    /// <summary>
    /// 获取升级需要的材料及等级
    /// </summary>
    /// <param name="BuildType">类型</param>
    /// <param name="Quality">品阶</param>
    /// <param name="NeedMaterial">需要材料,key item id,value 数量</param>
    public static void GetUpQualityNeed(int BuildType, int Quality, ref Dictionary <int, int> NeedMaterial, ref int NeedLevel)
    {
        NeedLevel = 1;
        if (NeedMaterial == null)
        {
            NeedMaterial = new Dictionary <int, int>();
        }
        NeedMaterial.Clear();

        s_buildqualityInfo Info = GetBuildQuality(BuildType, Quality);

        if (Info != null)
        {
            NeedLevel = Info.levellimit;
            if (Info.num1 != 0 && Info.material1id > 0)
            {
                NeedMaterial.Add(Info.material1id, Info.num1);
            }
            if (Info.num2 > 0 && Info.material2id > 0)
            {
                NeedMaterial.Add(Info.material2id, Info.num2);
            }
            if (Info.num3 > 0 && Info.material3id > 0)
            {
                NeedMaterial.Add(Info.material3id, Info.num3);
            }
            if (Info.num4 > 0 && Info.material4id > 0)
            {
                NeedMaterial.Add(Info.material4id, Info.num4);
            }
            if (Info.num5 > 0 && Info.material5id > 0)
            {
                NeedMaterial.Add(Info.material5id, Info.num5);
            }
            if (Info.num6 > 0 && Info.material6id > 0)
            {
                NeedMaterial.Add(Info.material6id, Info.num6);
            }
        }
    }
Exemple #7
0
    public NeedMaterial[] MaterialSort(NeedMaterial[] material_ary)
    {
        if (material_ary == null)
        {
            return(null);
        }
        if (material_ary.Length < 1)
        {
            return(material_ary);
        }
        MaterialSortData[] array = new MaterialSortData[material_ary.Length];
        int i = 0;

        for (int num = array.Length; i < num; i++)
        {
            array[i] = new MaterialSortData(material_ary[i], material_ary[i].isKey);
        }
        Array.Sort(array, delegate(MaterialSortData l, MaterialSortData r)
        {
            int num3 = r.isKey - l.isKey;
            if (num3 == 0)
            {
                num3 = r.table.rarity - l.table.rarity;
                if (num3 == 0)
                {
                    num3 = ((l.table.id != r.table.id) ? ((l.table.id > r.table.id) ? 1 : (-1)) : 0);
                }
            }
            return(num3);
        });
        NeedMaterial[] array2 = new NeedMaterial[array.Length];
        int            j      = 0;

        for (int num2 = array.Length; j < num2; j++)
        {
            array2[j] = array[j].needData;
        }
        return(array2);
    }
    public override void UpdateUI()
    {
        base.UpdateUI();
        object[] array      = (object[])GameSection.GetEventData();
        uint     materialID = (uint)array[0];

        CreateEquipItemTable.CreateEquipItemData[] equipItems = Singleton <CreateEquipItemTable> .I.GetSortedCreateEquipItemsByPart(materialID);

        SetTable(UI.TBL_LIST, "GachaEquipItem", equipItems.Length, false, delegate(int i, Transform t, bool b)
        {
            //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
            //IL_00dc: Expected O, but got Unknown
            CreateEquipItemTable.CreateEquipItemData createEquipItemData = equipItems[i];
            uint equipItemID = createEquipItemData.equipItemID;
            EquipItemTable.EquipItemData equipItemData = Singleton <EquipItemTable> .I.GetEquipItemData(equipItemID);
            SetLabelText(t, UI.LBL_NAME, equipItemData.name);
            SetEquipmentTypeIcon(t, UI.SPR_TYPE_ICON, UI.SPR_TYPE_ICON_BG, UI.SPR_TYPE_ICON_RARITY, equipItemData);
            NeedMaterial[] needMaterial = createEquipItemData.needMaterial;
            NeedMaterial needMaterial2  = (needMaterial.Length < 1) ? null : needMaterial[0];
            if (needMaterial2 != null)
            {
                SetItemIcon(needMaterial2.itemID, t, UI.ITEM_ICON_1);
            }
            NeedMaterial needMaterial3 = (needMaterial.Length < 2) ? null : needMaterial[1];
            if (needMaterial3 != null)
            {
                SetItemIcon(needMaterial3.itemID, t, UI.ITEM_ICON_2);
            }
            Coroutine item = this.StartCoroutine(LoadEquipModel(t, UI.TEX_EQUIP_MODEL, equipItemData.id));
            coroutineList.Add(item);
            Transform t2 = FindCtrl(t, UI.BTN_EQUIP_MODEL);
            SetEvent(t2, "DETAIL_MAX_PARAM", new object[3]
            {
                ItemDetailEquip.CURRENT_SECTION.GACHA_EQUIP_PREVIEW,
                equipItemData,
                materialID
            });
        });
    }
    public bool IsHaveingMaterial(NeedMaterial[] needMaterial)
    {
        if (needMaterial == null)
        {
            return(false);
        }
        List <NeedMaterial>       list = new List <NeedMaterial>(needMaterial);
        LinkedListNode <ItemInfo> node;

        for (node = itemInventory.GetFirstNode(); node != null; node = node.Next)
        {
            bool         not_enough    = false;
            NeedMaterial find_material = null;
            list.ForEach(delegate(NeedMaterial material)
            {
                if (!not_enough && material.itemID == node.Value.tableID)
                {
                    if (material.num > node.Value.num)
                    {
                        not_enough = true;
                    }
                    find_material = material;
                }
            });
            if (not_enough)
            {
                return(false);
            }
            if (find_material != null)
            {
                list.Remove(find_material);
            }
        }
        if (list.Count != 0)
        {
            return(false);
        }
        return(true);
    }
    protected override void DrawIcon()
    {
        base.DrawIcon();
        NeedMaterial[] reward_ary      = CreateNeedMaterialAry();
        int            sELL_SELECT_MAX = MonoBehaviourSingleton <UserInfoManager> .I.userInfo.constDefine.SELL_SELECT_MAX;

        SetGrid(UI.GRD_REWARD_ICON, null, sELL_SELECT_MAX, false, delegate(int i, Transform t, bool is_recycle)
        {
            if (i < reward_ary.Length)
            {
                NeedMaterial needMaterial = reward_ary[i];
                ItemIcon itemIcon         = ItemIcon.CreateRewardItemIcon(REWARD_TYPE.ITEM, needMaterial.itemID, t, needMaterial.num, "NONE", 0, false, -1, false, null, false, false, ItemIcon.QUEST_ICON_SIZE_TYPE.DEFAULT);
                itemIcon.SetRewardBG(true);
                Transform ctrl = GetCtrl(UI.GRD_REWARD_ICON);
                SetMaterialInfo(itemIcon.transform, REWARD_TYPE.ITEM, needMaterial.itemID, ctrl);
            }
            else
            {
                SetActive(t, false);
            }
        });
        SetActive((Enum)UI.STR_NON_REWARD, reward_ary.Length == 0);
    }
    protected virtual NeedMaterial[] CreateNeedMaterialAry()
    {
        SortCompareData[]   array  = sellData.ToArray();
        List <NeedMaterial> reward = new List <NeedMaterial>();

        Array.ForEach(array, delegate(SortCompareData _data)
        {
            EquipItemInfo equipItemInfo = _data.GetItemData() as EquipItemInfo;
            if (equipItemInfo != null)
            {
                uint lapis_id = 0u;
                EquipItemExceedTable.EquipItemExceedData equipItemExceedData = Singleton <EquipItemExceedTable> .I.GetEquipItemExceedData(equipItemInfo.tableData.rarity, equipItemInfo.tableData.getType, equipItemInfo.tableData.eventId);
                if (equipItemExceedData != null)
                {
                    lapis_id = equipItemExceedData.exchangeItemId;
                }
                if (lapis_id != 0)
                {
                    ItemTable.ItemData itemData = Singleton <ItemTable> .I.GetItemData(lapis_id);
                    if (itemData != null)
                    {
                        NeedMaterial needMaterial = reward.Find((NeedMaterial regist_lapis) => regist_lapis.itemID == lapis_id);
                        if (needMaterial == null)
                        {
                            reward.Add(new NeedMaterial(lapis_id, 1));
                        }
                        else
                        {
                            needMaterial.num++;
                        }
                    }
                }
            }
        });
        return(reward.ToArray());
    }
    public int IsHaveingMaterialAndPayAndObtained(SmithCreateItemInfo createData)
    {
        bool flag  = false;
        bool flag2 = true;
        bool flag3 = false;
        int  num   = 0;
        bool flag4 = equipItemFilterList.ContainsKey(createData.smithCreateTableData.equipItemID);

        if (flag4)
        {
            flag2 = equipItemFilterList[createData.smithCreateTableData.equipItemID].isCreateble;
            flag  = equipItemFilterList[createData.smithCreateTableData.equipItemID].isPay;
            flag3 = equipItemFilterList[createData.smithCreateTableData.equipItemID].isObtained;
        }
        else
        {
            NeedMaterial[] needMaterial = createData.smithCreateTableData.needMaterial;
            if (createData.equipTableData.getType == GET_TYPE.PAY)
            {
                flag = true;
            }
            flag3 = MonoBehaviourSingleton <AchievementManager> .I.CheckEquipItemCollection(createData.equipTableData);

            List <NeedMaterial> list = new List <NeedMaterial>(needMaterial);
            int count = list.Count;
            if (count > 0)
            {
                LinkedListNode <ItemInfo> node;
                for (node = itemInventory.GetFirstNode(); node != null; node = node.Next)
                {
                    NeedMaterial find_enough_material = null;
                    list.ForEach(delegate(NeedMaterial material)
                    {
                        if (material.itemID == node.Value.tableID && material.num <= node.Value.num)
                        {
                            find_enough_material = material;
                        }
                    });
                    if (find_enough_material != null)
                    {
                        list.Remove(find_enough_material);
                    }
                }
                if (list.Count != 0)
                {
                    flag2 = false;
                }
            }
        }
        if (MonoBehaviourSingleton <UserInfoManager> .I.userStatus.money < (int)createData.smithCreateTableData.needMoney)
        {
            flag2 = false;
        }
        if (!flag4)
        {
            EquipItemFilter equipItemFilter = new EquipItemFilter();
            equipItemFilter.itemId      = createData.smithCreateTableData.equipItemID;
            equipItemFilter.isCreateble = flag2;
            equipItemFilter.isPay       = flag;
            equipItemFilter.isObtained  = flag3;
            equipItemFilterList[equipItemFilter.itemId] = equipItemFilter;
        }
        num = ((!flag2) ? (num | 8) : (num | 4));
        num = ((!flag) ? (num | 2) : (num | 1));
        if (!flag3)
        {
            return(num | 0x20);
        }
        return(num | 0x10);
    }