コード例 #1
0
        private void RefreshData()
        {
            JobData jobData = this.mUnit.GetJobData(this.mJobIndex);

            DataSource.Bind <UnitData>(this.Unit, this.mUnit);
            for (int index = 0; index < this.Equipments.Count; ++index)
            {
                EquipData equip = jobData.Equips[index];
                DataSource.Bind <EquipData>(((Component)this.Equipments[index]).get_gameObject(), equip);
                bool flag = equip != null && (equip.IsValid() && equip.IsEquiped());
                ((Selectable)this.Equipments[index]).set_interactable(flag);
                ((Component)this.EquipmentRawImages[index]).get_gameObject().SetActive(flag);
                this.EquipmentCursors[index].SetActive(Object.op_Equality((Object)this.mSelectedEquipItem, (Object)((Component)this.Equipments[index]).get_gameObject()));
            }
            this.mEnhanceEquipData.equip       = (EquipData)null;
            this.mEnhanceEquipData.gainexp     = 0;
            this.mEnhanceEquipData.is_enhanced = false;
            for (int index = 0; index < this.mEnhanceParameters.Count; ++index)
            {
                this.mEnhanceParameters[index].SetActive(false);
            }
            ((Selectable)this.BtnEnhance).set_interactable(false);
            EquipData equipData = !Object.op_Inequality((Object)this.mSelectedEquipItem, (Object)null) ? (EquipData)null : DataSource.FindDataOfClass <EquipData>(this.mSelectedEquipItem, (EquipData)null);
            int       num1      = 0;
            int       num2      = 0;

            for (int index = 0; index < this.mMaterialItems.Count; ++index)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                EnhanceEquipDetailWindow.\u003CRefreshData\u003Ec__AnonStorey242 dataCAnonStorey242 = new EnhanceEquipDetailWindow.\u003CRefreshData\u003Ec__AnonStorey242();
                // ISSUE: reference to a compiler-generated field
                dataCAnonStorey242.item = this.mMaterialItems[index];
                // ISSUE: reference to a compiler-generated method
                EnhanceMaterial enhanceMaterial1 = this.mEnhanceMaterials.Find(new Predicate <EnhanceMaterial>(dataCAnonStorey242.\u003C\u003Em__26F));
                if (enhanceMaterial1 == null)
                {
                    EnhanceMaterial enhanceMaterial2 = new EnhanceMaterial();
                    // ISSUE: reference to a compiler-generated field
                    enhanceMaterial2.item = dataCAnonStorey242.item;
                    enhanceMaterial2.num  = 0;
                    this.mEnhanceMaterials.Add(enhanceMaterial2);
                    enhanceMaterial1 = enhanceMaterial2;
                }
                if (equipData != null)
                {
                    // ISSUE: reference to a compiler-generated field
                    num1 += (int)dataCAnonStorey242.item.Param.enhace_cost * equipData.GetEnhanceCostScale() / 100 * enhanceMaterial1.num;
                    // ISSUE: reference to a compiler-generated field
                    num2 += (int)dataCAnonStorey242.item.Param.enhace_point * enhanceMaterial1.num;
                }
            }
            bool flag1 = false;

            if (Object.op_Inequality((Object)this.EquipSelectParent, (Object)null))
            {
                DataSource.Bind <EnhanceEquipData>(this.EquipSelectParent, (EnhanceEquipData)null);
                this.EquipSelectParent.get_gameObject().SetActive(false);
            }
            if (Object.op_Inequality((Object)this.TxtComment, (Object)null))
            {
                ((Component)this.TxtComment).get_gameObject().SetActive(false);
            }
            if (Object.op_Inequality((Object)this.mSelectedEquipItem, (Object)null))
            {
                this.mEnhanceEquipData.equip   = equipData;
                this.mEnhanceEquipData.gainexp = num2;
                if (equipData != null)
                {
                    BuffEffect buffEffect = equipData.Skill.GetBuffEffect(SkillEffectTargets.Target);
                    if (buffEffect != null && buffEffect.targets != null)
                    {
                        for (int index = 0; index < buffEffect.targets.Count; ++index)
                        {
                            if (index >= this.mEnhanceParameters.Count)
                            {
                                this.ParamUpTemplate.SetActive(true);
                                GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.ParamUpTemplate);
                                gameObject.get_transform().SetParent(this.ParamUpLayoutParent, false);
                                this.mEnhanceParameters.Add(gameObject);
                                this.ParamUpTemplate.SetActive(false);
                            }
                            GameObject         enhanceParameter = this.mEnhanceParameters[index];
                            EquipItemParameter data             = DataSource.FindDataOfClass <EquipItemParameter>(enhanceParameter, (EquipItemParameter)null) ?? new EquipItemParameter();
                            data.equip       = equipData;
                            data.param_index = index;
                            DataSource.Bind <EquipItemParameter>(enhanceParameter, data);
                            enhanceParameter.SetActive(true);
                        }
                    }
                    flag1 = true;
                    if (equipData.Rank == equipData.GetRankCap())
                    {
                        if (Object.op_Inequality((Object)this.TxtComment, (Object)null))
                        {
                            this.TxtComment.set_text(LocalizedText.Get("sys.DIABLE_ENHANCE_RANKCAP_MESSAGE"));
                            ((Component)this.TxtComment).get_gameObject().SetActive(true);
                        }
                        flag1 = false;
                    }
                }
                if (Object.op_Inequality((Object)this.EquipSelectParent, (Object)null))
                {
                    DataSource.Bind <EnhanceEquipData>(this.EquipSelectParent, this.mEnhanceEquipData);
                    this.EquipSelectParent.get_gameObject().SetActive(true);
                }
            }
            else if (Object.op_Inequality((Object)this.TxtComment, (Object)null))
            {
                this.TxtComment.set_text(LocalizedText.Get("sys.ENHANCE_EQUIPMENT_MESSAGE"));
                ((Component)this.TxtComment).get_gameObject().SetActive(true);
            }
            this.mEnhanceEquipData.is_enhanced = flag1;
            if (Object.op_Inequality((Object)this.SelectedParent, (Object)null))
            {
                DataSource.Bind <EnhanceEquipData>(this.SelectedParent, this.mEnhanceEquipData);
                this.SelectedParent.get_gameObject().SetActive(flag1);
            }
            if (Object.op_Inequality((Object)this.TxtDisableEnhanceOnGauge, (Object)null))
            {
                ((Component)this.TxtDisableEnhanceOnGauge).get_gameObject().SetActive(!flag1);
            }
            if (Object.op_Inequality((Object)this.TxtCost, (Object)null))
            {
                this.TxtCost.set_text(num1.ToString());
            }
            if (Object.op_Inequality((Object)this.TxtJob, (Object)null))
            {
                this.TxtJob.set_text(jobData.Name);
            }
            if (flag1)
            {
                int num3 = equipData.CalcRankFromExp(equipData.Exp + num2);
                ((Selectable)this.BtnEnhance).set_interactable(equipData != null && equipData.Rank < num3);
            }
            if (Object.op_Inequality((Object)this.BtnAdd, (Object)null))
            {
                ((Selectable)this.BtnAdd).set_interactable(flag1 && Object.op_Inequality((Object)this.mSelectedMaterialItem, (Object)null));
            }
            if (Object.op_Inequality((Object)this.BtnSub, (Object)null))
            {
                ((Selectable)this.BtnSub).set_interactable(flag1 && Object.op_Inequality((Object)this.mSelectedMaterialItem, (Object)null));
            }
            this.mEnableEnhanceMaterials.Clear();
            for (int index = 0; index < this.mEnhanceMaterials.Count; ++index)
            {
                if (this.mEnhanceMaterials[index].item != null && this.mEnhanceMaterials[index].item.Num != 0)
                {
                    this.mEnableEnhanceMaterials.Add(this.mEnhanceMaterials[index]);
                }
            }
            this.SetData((object[])this.mEnableEnhanceMaterials.ToArray(), typeof(EnhanceMaterial));
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
コード例 #2
0
        public void Refresh(UnitData unit, int slot)
        {
            if (unit == null)
            {
                unit = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);
            }
            if (unit == null)
            {
                return;
            }
            int selectedJobIndex = this.GetSelectedJobIndex(unit);

            EquipData[] rankupEquips = unit.GetRankupEquips(selectedJobIndex);
            if (slot < 0 || rankupEquips.Length <= slot)
            {
                return;
            }
            EquipData equipData = rankupEquips[slot];
            ItemParam itemParam = equipData.ItemParam;

            if (this.mItemParamTree.Count == 0 || this.mItemParamTree[0] != itemParam)
            {
                this.mItemParamTree.Clear();
                this.mItemParamTree.Add(itemParam);
            }
            if (equipData != null && equipData.IsValid() && equipData.IsEquiped())
            {
                this.mEquipmentData = equipData;
            }
            else
            {
                this.mEquipmentData = new EquipData();
                this.mEquipmentData.Setup(itemParam.iname);
            }
            for (int index = 0; index < this.mEquipmentParameters.Count; ++index)
            {
                this.mEquipmentParameters[index].SetActive(false);
            }
            if (this.mEquipmentData != null && this.mEquipmentData.Skill != null)
            {
                BuffEffect buffEffect = this.mEquipmentData.Skill.GetBuffEffect(SkillEffectTargets.Target);
                if (buffEffect != null && buffEffect.targets != null)
                {
                    for (int index = 0; index < buffEffect.targets.Count; ++index)
                    {
                        if (index >= this.mEquipmentParameters.Count)
                        {
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.EquipItemParamTemplate);
                            gameObject.get_transform().SetParent((Transform)this.EquipItemParamParent, false);
                            this.mEquipmentParameters.Add(gameObject);
                        }
                        GameObject         equipmentParameter = this.mEquipmentParameters[index];
                        EquipItemParameter data = DataSource.FindDataOfClass <EquipItemParameter>(equipmentParameter, (EquipItemParameter)null) ?? new EquipItemParameter();
                        data.equip       = this.mEquipmentData;
                        data.param_index = index;
                        DataSource.Bind <EquipItemParameter>(equipmentParameter, data);
                        equipmentParameter.SetActive(true);
                    }
                }
            }
            this.RefreshEquipButton(unit);
            DataSource.Bind <EquipData>(((Component)this).get_gameObject(), this.mEquipmentData);
            this.RefreshItemTree(this.mCreateItemSuccessed);
            this.RefreshRecipeItems();
            this.RefreshGainedQuests();
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
コード例 #3
0
        public void Refresh(UnitData unit, int slot)
        {
            if (unit == null)
            {
                unit = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);
            }
            if (unit == null)
            {
                return;
            }
            int selectedJobIndex = this.GetSelectedJobIndex(unit);

            EquipData[] rankupEquips = unit.GetRankupEquips(selectedJobIndex);
            if (slot < 0 || rankupEquips.Length <= slot)
            {
                return;
            }
            EquipData equipData = rankupEquips[slot];
            ItemParam itemParam = equipData.ItemParam;

            if (this.mItemParamTree.Count == 0 || this.mItemParamTree[0] != itemParam)
            {
                this.mItemParamTree.Clear();
                this.mItemParamTree.Add(itemParam);
            }
            bool is_common = false;

            if (equipData != null && equipData.IsValid() && equipData.IsEquiped())
            {
                this.mEquipmentData = equipData;
            }
            else
            {
                this.mEquipmentData = new EquipData();
                ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(itemParam.iname);

                ItemParam item_param = itemDataByItemId == null ? MonoSingleton <GameManager> .Instance.MasterParam.GetItemParam(itemParam.iname) : itemDataByItemId.Param;

                ItemParam commonEquip = MonoSingleton <GameManager> .Instance.MasterParam.GetCommonEquip(item_param, true);

                ItemData itemData = (ItemData)null;
                if (commonEquip != null)
                {
                    itemData = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(commonEquip.iname);
                }
                if ((itemDataByItemId == null || itemDataByItemId.Num <= 0) && (item_param.IsCommon && unit.Jobs[selectedJobIndex].Rank == 0) && (itemData != null && itemData.Num > 0))
                {
                    this.mEquipmentData.Setup(commonEquip.iname);
                    is_common = true;
                }
                else
                {
                    this.mEquipmentData.Setup(itemParam.iname);
                }
            }
            this.ActivateCommonUI(is_common);
            for (int index = 0; index < this.mEquipmentParameters.Count; ++index)
            {
                this.mEquipmentParameters[index].SetActive(false);
            }
            if (this.mEquipmentData != null && this.mEquipmentData.Skill != null)
            {
                BuffEffect buffEffect = this.mEquipmentData.Skill.GetBuffEffect(SkillEffectTargets.Target);
                if (buffEffect != null && buffEffect.targets != null)
                {
                    for (int index = 0; index < buffEffect.targets.Count; ++index)
                    {
                        if (index >= this.mEquipmentParameters.Count)
                        {
                            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.EquipItemParamTemplate);
                            gameObject.get_transform().SetParent((Transform)this.EquipItemParamParent, false);
                            this.mEquipmentParameters.Add(gameObject);
                        }
                        GameObject         equipmentParameter = this.mEquipmentParameters[index];
                        EquipItemParameter data = DataSource.FindDataOfClass <EquipItemParameter>(equipmentParameter, (EquipItemParameter)null) ?? new EquipItemParameter();
                        data.equip       = this.mEquipmentData;
                        data.param_index = index;
                        DataSource.Bind <EquipItemParameter>(equipmentParameter, data);
                        equipmentParameter.SetActive(true);
                    }
                }
            }
            this.RefreshEquipButton(unit);
            DataSource.Bind <EquipData>(((Component)this).get_gameObject(), this.mEquipmentData);
            this.RefreshItemTree(this.mCreateItemSuccessed);
            this.RefreshRecipeItems();
            this.RefreshGainedQuests();
            ItemData itemDataByItemId1 = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(this.mEquipmentData.ItemParam.iname);

            ((Graphic)this.EquipAmount).set_color(itemDataByItemId1 == null || itemDataByItemId1.Num == 0 ? this.EquipAmountColorZero : this.EquipAmountColor);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }