Exemplo n.º 1
0
        public string GetCommonItemListString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            using (Dictionary <byte, NeedEquipItemDictionary> .KeyCollection.Enumerator enumerator = this.CommonNeedNum.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    NeedEquipItemDictionary equipItemDictionary = this.CommonNeedNum[enumerator.Current];
                    stringBuilder.Append(LocalizedText.Get("sys.COMMON_EQUIP_CHECK_ITEM", (object)equipItemDictionary.CommonItemParam.name, (object)equipItemDictionary.NeedPicec, (object)equipItemDictionary.CommonEquipItemNum));
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Remove(stringBuilder.Length - 1, 1);
            stringBuilder.Append("\n");
            return(stringBuilder.ToString());
        }
Exemplo n.º 2
0
        private void Refresh()
        {
            this.mItemParam = MonoSingleton <GameManager> .Instance.GetItemParam(GlobalVars.SelectedCreateItemID);

            int  cost       = 0;
            bool is_ikkatsu = false;
            Dictionary <string, int> consumes  = (Dictionary <string, int>)null;
            NeedEquipItemList        item_list = new NeedEquipItemList();

            MonoSingleton <GameManager> .Instance.Player.CheckEnableCreateItem(this.mItemParam, ref is_ikkatsu, ref cost, ref consumes, item_list);

            for (int index = 0; index < this.mConsumeObjects.Count; ++index)
            {
                this.mConsumeObjects[index].get_gameObject().SetActive(false);
            }
            if (consumes != null)
            {
                int index = 0;
                using (Dictionary <string, int> .Enumerator enumerator = consumes.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <string, int> current = enumerator.Current;
                        if (index >= this.mConsumeObjects.Count)
                        {
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                            gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                            this.mConsumeObjects.Add(gameObject);
                        }
                        GameObject mConsumeObject = this.mConsumeObjects[index];
                        DataSource.Bind <ConsumeItemData>(mConsumeObject, new ConsumeItemData()
                        {
                            param = MonoSingleton <GameManager> .Instance.GetItemParam(current.Key),
                            num   = current.Value
                        });
                        mConsumeObject.SetActive(true);
                        ++index;
                    }
                }
            }
            using (Dictionary <byte, NeedEquipItemDictionary> .KeyCollection.Enumerator enumerator = item_list.CommonNeedNum.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    byte current = enumerator.Current;
                    NeedEquipItemDictionary equipItemDictionary = item_list.CommonNeedNum[current];
                    ItemParam commonItemParam = equipItemDictionary.CommonItemParam;
                    if (commonItemParam != null)
                    {
                        for (int index = 0; index < equipItemDictionary.list.Count; ++index)
                        {
                            ItemParam itemParam = equipItemDictionary.list[index].Param;
                            if (itemParam != null)
                            {
                                if ((int)itemParam.cmn_type - 1 == 2)
                                {
                                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                                    gameObject.get_gameObject().SetActive(true);
                                    gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                                    ItemData itemData = this.CreateItemData(itemParam.iname, 1);
                                    DataSource.Bind <ItemData>(gameObject, itemData);
                                }
                                else
                                {
                                    GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.CommonItemTemplate);
                                    gameObject.get_gameObject().SetActive(true);
                                    gameObject.get_transform().SetParent((Transform)this.CommonItemLayoutParent, false);
                                    ItemData data = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(itemParam.iname) ?? this.CreateItemData(commonItemParam.iname, 0);

                                    ItemData cmmon_data = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(commonItemParam.iname) ?? this.CreateItemData(commonItemParam.iname, 0);

                                    ((CommonConvertItem)gameObject.GetComponent <CommonConvertItem>()).Bind(data, cmmon_data, equipItemDictionary.list[index].NeedPiece);
                                }
                            }
                        }
                    }
                }
            }
            DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), this.mItemParam);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Exemplo n.º 3
0
        private void Start()
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ListItem, (UnityEngine.Object)null) || UnityEngine.Object.op_Equality((UnityEngine.Object) this.ListTransform, (UnityEngine.Object)null))
            {
                return;
            }
            this.ListItem.SetActive(false);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CostText, (UnityEngine.Object)null))
            {
                this.CostText.set_text("0");
            }
            this.mCurrentUnit = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);
            if (this.mCurrentUnit == null)
            {
                return;
            }
            bool flag1 = this.mCurrentUnit.CurrentJob.Rank == 0;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.RankMaxEquipAttention, (UnityEngine.Object)null))
            {
                this.RankMaxEquipAttention.SetActive(!flag1);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.JobInfo, (UnityEngine.Object)null))
            {
                this.JobInfo.SetActive(!flag1);
                DataSource.Bind <JobData>(this.JobInfo, this.mCurrentUnit.CurrentJob);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AllEquipConfirm, (UnityEngine.Object)null))
            {
                if (this.mCurrentUnit.JobIndex >= this.mCurrentUnit.NumJobsAvailable)
                {
                    this.AllEquipConfirm.set_text(LocalizedText.Get("sys.UNIT_ALLEQUIP_CHANGE_CONFIRM"));
                }
                else
                {
                    this.AllEquipConfirm.set_text(!flag1 ? LocalizedText.Get("sys.UNIT_ALLEQUIP_CONFIRM") : LocalizedText.Get("sys.UNIT_ALLEQUIP_UNLOCK_CONFIRM"));
                }
            }
            int cost = 0;
            Dictionary <string, int> equips   = new Dictionary <string, int>();
            Dictionary <string, int> consumes = new Dictionary <string, int>();

            this.NeedEquipList = new NeedEquipItemList();
            if (!this.mCurrentUnit.CurrentJob.CanAllEquip(ref cost, ref equips, ref consumes, ref this.target_rank, ref this.can_jobmaster, ref this.can_jobmax, this.NeedEquipList, this.IsAllIn))
            {
                return;
            }
            this.target_rank = Mathf.Min(this.mCurrentUnit.GetJobRankCap(), Mathf.Max(this.target_rank, this.mCurrentUnit.CurrentJob.Rank + 1));
            if (!this.IsAllIn)
            {
                this.can_jobmaster = this.mCurrentUnit.GetJobRankCap() == JobParam.MAX_JOB_RANK && this.target_rank == this.mCurrentUnit.GetJobRankCap() && this.mCurrentUnit.CurrentJob.Rank == this.mCurrentUnit.GetJobRankCap();
            }
            this.SetCommonFlag(this.NeedEquipList.IsEnoughCommon());
            List <ItemParam> items = MonoSingleton <GameManager> .Instance.MasterParam.Items;

            using (Dictionary <string, int> .KeyCollection.Enumerator enumerator = equips.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string    key       = enumerator.Current;
                    ItemParam itemParam = items.Find((Predicate <ItemParam>)(eq => eq.iname == key));
                    if (itemParam != null)
                    {
                        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ListItem);
                        gameObject.get_gameObject().SetActive(true);
                        gameObject.get_transform().SetParent(this.ListTransform, false);
                        ItemData itemData = this.CreateItemData(itemParam.iname, equips[key]);
                        DataSource.Bind <ItemData>(gameObject, itemData);
                    }
                }
            }
            using (Dictionary <string, int> .KeyCollection.Enumerator enumerator = consumes.Keys.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string    key       = enumerator.Current;
                    ItemParam itemParam = items.Find((Predicate <ItemParam>)(eq => eq.iname == key));
                    if (itemParam != null)
                    {
                        GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ListItem);
                        gameObject.get_gameObject().SetActive(true);
                        gameObject.get_transform().SetParent(this.ListTransform, false);
                        ItemData itemData = this.CreateItemData(itemParam.iname, consumes[key]);
                        DataSource.Bind <ItemData>(gameObject, itemData);
                    }
                }
            }
            if (this.NeedEquipList.IsEnoughCommon())
            {
                using (Dictionary <byte, NeedEquipItemDictionary> .KeyCollection.Enumerator enumerator = this.NeedEquipList.CommonNeedNum.Keys.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        NeedEquipItemDictionary equipItemDictionary = this.NeedEquipList.CommonNeedNum[enumerator.Current];
                        ItemParam commonItemParam = equipItemDictionary.CommonItemParam;
                        if (commonItemParam != null)
                        {
                            bool flag2 = true;
                            for (int index = 0; index < equipItemDictionary.list.Count; ++index)
                            {
                                ItemParam itemParam = equipItemDictionary.list[index].Param;
                                if (itemParam != null && (int)itemParam.cmn_type - 1 != 2)
                                {
                                    flag2 = false;
                                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.CommonListItem);
                                    gameObject.get_gameObject().SetActive(true);
                                    gameObject.get_transform().SetParent(this.CommonListTransform, false);
                                    ItemData data = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(itemParam.iname) ?? this.CreateItemData(itemParam.iname, 0);

                                    ItemData cmmon_data = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(commonItemParam.iname) ?? this.CreateItemData(commonItemParam.iname, 0);

                                    ((CommonConvertItem)gameObject.GetComponent <CommonConvertItem>()).Bind(data, cmmon_data, equipItemDictionary.list[index].NeedPiece);
                                }
                            }
                            if (flag2)
                            {
                                this.IsSoul = true;
                                GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ListItem);
                                gameObject.get_gameObject().SetActive(true);
                                gameObject.get_transform().SetParent(this.ListTransform, false);
                                ItemData itemData = this.CreateItemData(commonItemParam.iname, equipItemDictionary.list.Count);
                                DataSource.Bind <ItemData>(gameObject, itemData);
                            }
                        }
                    }
                }
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;
            bool        flag3    = cost > instance.Player.Gold;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.YesButton, (UnityEngine.Object)null))
            {
                ((Selectable)this.YesButton).set_interactable(!flag3);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.NoGoldWarningText, (UnityEngine.Object)null))
            {
                ((Component)this.NoGoldWarningText).get_gameObject().SetActive(flag3);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CostText, (UnityEngine.Object)null))
            {
                this.CostText.set_text(cost.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.MaxJobLv, (UnityEngine.Object)null))
            {
                this.MaxJobLv.set_text("/" + this.mCurrentUnit.GetJobRankCap().ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TargetJobLv, (UnityEngine.Object)null))
            {
                this.TargetJobLv.set_text(this.target_rank.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ScrollParent, (UnityEngine.Object)null))
            {
                this.DecelerationRate = this.ScrollParent.get_decelerationRate();
                this.ScrollParent.set_decelerationRate(0.0f);
            }
            this.ListRectTranceform.set_anchoredPosition(new Vector2((float)this.ListRectTranceform.get_anchoredPosition().x, 0.0f));
            this.StartCoroutine(this.ScrollInit());
        }