Example #1
0
        private void OnEnhance()
        {
            bool flag = false;

            for (int index = 0; index < this.mEnhanceMaterials.Count; ++index)
            {
                EnhanceMaterial mEnhanceMaterial = this.mEnhanceMaterials[index];
                if (mEnhanceMaterial.num != 0 && (mEnhanceMaterial.item.Rarity > 1 || mEnhanceMaterial.item.ItemType == EItemType.Material))
                {
                    flag = true;
                }
            }
            GlobalVars.SelectedUnitUniqueID.Set(this.mUnit.UniqueID);
            GlobalVars.SelectedUnitJobIndex.Set(this.mJobIndex);
            GlobalVars.SelectedEquipData        = DataSource.FindDataOfClass <EquipData>(this.mSelectedEquipItem, (EquipData)null);
            GlobalVars.SelectedEnhanceMaterials = this.mEnhanceMaterials;
            if (flag)
            {
                UIUtility.ConfirmBox(LocalizedText.Get("sys.ENHANCE_ITEM_RARITY_CAUTION"), (string)null, new UIUtility.DialogResultEvent(this.OnDecide), new UIUtility.DialogResultEvent(this.OnCancel), (GameObject)null, false, -1);
            }
            else
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 100);
            }
        }
Example #2
0
        private void OnSubMaterial()
        {
            if (Object.op_Equality((Object)this.mSelectedMaterialItem, (Object)null))
            {
                return;
            }
            EnhanceMaterial dataOfClass = DataSource.FindDataOfClass <EnhanceMaterial>(this.mSelectedMaterialItem, (EnhanceMaterial)null);

            if (dataOfClass != null)
            {
                dataOfClass.num = Math.Max(--dataOfClass.num, 0);
                DataSource.Bind <EnhanceMaterial>(this.mSelectedMaterialItem, dataOfClass);
            }
            this.RefreshData();
        }
Example #3
0
        protected override void OnItemSelect(GameObject go)
        {
            if (!Object.op_Inequality((Object)this.mSelectedMaterialItem, (Object)go))
            {
                return;
            }
            this.mSelectedMaterialItem = go;
            EnhanceMaterial dataOfClass = DataSource.FindDataOfClass <EnhanceMaterial>(this.mSelectedMaterialItem, (EnhanceMaterial)null);

            if (dataOfClass != null)
            {
                for (int index = 0; index < this.mEnhanceMaterials.Count; ++index)
                {
                    this.mEnhanceMaterials[index].selected = dataOfClass == this.mEnhanceMaterials[index];
                }
            }
            this.RefreshData();
        }
Example #4
0
        private void OnAddMaterial()
        {
            if (Object.op_Equality((Object)this.mSelectedMaterialItem, (Object)null))
            {
                return;
            }
            EnhanceMaterial dataOfClass = DataSource.FindDataOfClass <EnhanceMaterial>(this.mSelectedMaterialItem, (EnhanceMaterial)null);

            if (dataOfClass != null)
            {
                if (!this.CheckEquipItemEnhance())
                {
                    UIUtility.NegativeSystemMessage(LocalizedText.Get("sys.FAILED_ENHANCE"), LocalizedText.Get("sys.DIABLE_ENHANCE_RANKCAP_MESSAGE"), (UIUtility.DialogResultEvent)null, (GameObject)null, false, -1);
                    return;
                }
                dataOfClass.num = Math.Min(++dataOfClass.num, dataOfClass.item.Num);
                DataSource.Bind <EnhanceMaterial>(this.mSelectedMaterialItem, dataOfClass);
            }
            this.RefreshData();
        }
Example #5
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());
        }
Example #6
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 0 || ((Behaviour)this).get_enabled())
            {
                return;
            }
            GameManager            instance           = MonoSingleton <GameManager> .Instance;
            PlayerData             player             = instance.Player;
            UnitData               unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID);
            JobData                job = unitDataByUniqueId.Jobs[(int)GlobalVars.SelectedUnitJobIndex];
            int                    selectedEquipmentSlot = (int)GlobalVars.SelectedEquipmentSlot;
            EquipData              selectedEquipData     = GlobalVars.SelectedEquipData;
            int                    num = 0;
            int                    exp = 0;
            List <EnhanceMaterial> enhanceMaterials = GlobalVars.SelectedEnhanceMaterials;

            if (enhanceMaterials == null || enhanceMaterials.Count < 1)
            {
                return;
            }
            for (int index = 0; index < enhanceMaterials.Count; ++index)
            {
                EnhanceMaterial enhanceMaterial = enhanceMaterials[index];
                ItemData        itemData        = enhanceMaterial.item;
                num += (int)itemData.Param.enhace_cost * selectedEquipData.GetEnhanceCostScale() / 100 * enhanceMaterial.num;
                exp += (int)itemData.Param.enhace_point * enhanceMaterial.num;
            }
            if (num > player.Gold)
            {
                this.ActivateOutputLinks(2);
            }
            else
            {
                selectedEquipData.GainExp(exp);
                if (unitDataByUniqueId != null)
                {
                    unitDataByUniqueId.CalcStatus();
                }
                for (int index = 0; index < enhanceMaterials.Count; ++index)
                {
                    EnhanceMaterial enhanceMaterial = enhanceMaterials[index];
                    enhanceMaterial.item.Used(enhanceMaterial.num);
                }
                player.GainGold(-num);
                AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.Zeni, AnalyticsManager.CurrencySubType.FREE, (long)num, "Enhance Equip", (Dictionary <string, object>)null);
                if (Network.Mode == Network.EConnectMode.Online)
                {
                    Dictionary <string, int> usedItems = new Dictionary <string, int>();
                    for (int index = 0; index < enhanceMaterials.Count; ++index)
                    {
                        EnhanceMaterial enhanceMaterial = enhanceMaterials[index];
                        ItemData        itemData        = enhanceMaterial.item;
                        if (enhanceMaterial.num >= 1)
                        {
                            if (!usedItems.ContainsKey(itemData.ItemID))
                            {
                                usedItems[itemData.ItemID] = 0;
                            }
                            Dictionary <string, int> dictionary;
                            string itemId;
                            (dictionary = usedItems)[itemId = itemData.ItemID] = dictionary[itemId] + enhanceMaterial.num;
                        }
                    }
                    this.ExecRequest((WebAPI) new ReqEquipExpAdd(job.UniqueID, selectedEquipmentSlot, usedItems, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    ((Behaviour)this).set_enabled(true);
                }
                else
                {
                    this.Success();
                }
            }
        }