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(UnityEngine.Object.op_Equality((UnityEngine.Object) this.mSelectedEquipItem, (UnityEngine.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 = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mSelectedEquipItem, (UnityEngine.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) { ItemData item = this.mMaterialItems[index]; EnhanceMaterial enhanceMaterial1 = this.mEnhanceMaterials.Find((Predicate <EnhanceMaterial>)(p => p.item == item)); if (enhanceMaterial1 == null) { EnhanceMaterial enhanceMaterial2 = new EnhanceMaterial(); enhanceMaterial2.item = item; enhanceMaterial2.num = 0; this.mEnhanceMaterials.Add(enhanceMaterial2); enhanceMaterial1 = enhanceMaterial2; } if (equipData != null) { num1 += item.Param.enhace_cost * equipData.GetEnhanceCostScale() / 100 * enhanceMaterial1.num; num2 += item.Param.enhace_point * enhanceMaterial1.num; } } bool flag1 = false; if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.EquipSelectParent, (UnityEngine.Object)null)) { DataSource.Bind <EnhanceEquipData>(this.EquipSelectParent, (EnhanceEquipData)null); this.EquipSelectParent.get_gameObject().SetActive(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtComment, (UnityEngine.Object)null)) { ((Component)this.TxtComment).get_gameObject().SetActive(false); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mSelectedEquipItem, (UnityEngine.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)UnityEngine.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 (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtComment, (UnityEngine.Object)null)) { this.TxtComment.set_text(LocalizedText.Get("sys.DIABLE_ENHANCE_RANKCAP_MESSAGE")); ((Component)this.TxtComment).get_gameObject().SetActive(true); } flag1 = false; } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.EquipSelectParent, (UnityEngine.Object)null)) { DataSource.Bind <EnhanceEquipData>(this.EquipSelectParent, this.mEnhanceEquipData); this.EquipSelectParent.get_gameObject().SetActive(true); } } else if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtComment, (UnityEngine.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 (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SelectedParent, (UnityEngine.Object)null)) { DataSource.Bind <EnhanceEquipData>(this.SelectedParent, this.mEnhanceEquipData); this.SelectedParent.get_gameObject().SetActive(flag1); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtDisableEnhanceOnGauge, (UnityEngine.Object)null)) { ((Component)this.TxtDisableEnhanceOnGauge).get_gameObject().SetActive(!flag1); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtCost, (UnityEngine.Object)null)) { this.TxtCost.set_text(num1.ToString()); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TxtJob, (UnityEngine.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 (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BtnAdd, (UnityEngine.Object)null)) { ((Selectable)this.BtnAdd).set_interactable(flag1 && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mSelectedMaterialItem, (UnityEngine.Object)null)); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.BtnSub, (UnityEngine.Object)null)) { ((Selectable)this.BtnSub).set_interactable(flag1 && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mSelectedMaterialItem, (UnityEngine.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()); }
private void Refresh() { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.UnitTemplate, (UnityEngine.Object)null)) { return; } List <UnitData> units = MonoSingleton <GameManager> .Instance.Player.Units; for (int index = 0; index < this.mUnits.Count; ++index) { this.mUnits[index].get_gameObject().SetActive(false); } this.mShopitem = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData().items.FirstOrDefault <LimitedShopItem>((Func <LimitedShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex)); bool flag1 = !this.mShopitem.IsNotLimited || this.mShopitem.saleType == ESaleType.Coin_P; if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.limited_item, (UnityEngine.Object)null)) { this.limited_item.SetActive(flag1); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.no_limited_item, (UnityEngine.Object)null)) { this.no_limited_item.SetActive(!flag1); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Sold, (UnityEngine.Object)null)) { this.Sold.SetActive(!this.mShopitem.IsNotLimited); } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SoldNum, (UnityEngine.Object)null)) { this.SoldNum.set_text(this.mShopitem.remaining_num.ToString()); } this.mEnabledSlider = false; if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderHolder, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSlider, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderNum, (UnityEngine.Object)null)) { if (!this.mShopitem.IsNotLimited && this.mShopitem.remaining_num > 1) { this.mEnabledSlider = true; GameParameter component = (GameParameter)((Component)this.LimitedItemPriceText).GetComponent <GameParameter>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null)) { ((Behaviour)component).set_enabled(false); } this.AmountSliderHolder.SetActive(true); int remainingCurrency = ShopData.GetRemainingCurrency((ShopItem)this.mShopitem); int buyPrice = ShopData.GetBuyPrice((ShopItem)this.mShopitem); int num1 = 1; if (buyPrice > 0) { while (buyPrice * num1 <= remainingCurrency) { ++num1; } } int num2 = Math.Max(Math.Min(num1 - 1, this.mShopitem.remaining_num), 1); this.AmountSlider.set_minValue(1f); this.AmountSlider.set_maxValue((float)num2); this.SetSliderValue(1f); // ISSUE: method pointer ((UnityEvent <float>) this.AmountSlider.get_onValueChanged()).AddListener(new UnityAction <float>((object)this, __methodptr(OnSliderValueChanged))); } else { this.mEnabledSlider = false; this.AmountSliderHolder.SetActive(false); } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasJem, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasCoin, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasZenny, (UnityEngine.Object)null)) { switch (this.mShopitem.saleType) { case ESaleType.Gold: this.HasJem.SetActive(false); this.HasCoin.SetActive(false); this.HasZenny.SetActive(true); break; case ESaleType.Coin: case ESaleType.Coin_P: this.HasJem.SetActive(true); this.HasCoin.SetActive(false); this.HasZenny.SetActive(false); break; default: this.HasJem.SetActive(false); this.HasCoin.SetActive(true); this.HasZenny.SetActive(false); break; } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.EnableEquipUnitWindow, (UnityEngine.Object)null)) { this.EnableEquipUnitWindow.get_gameObject().SetActive(false); int index1 = 0; for (int index2 = 0; index2 < units.Count; ++index2) { UnitData data = units[index2]; bool flag2 = false; for (int index3 = 0; index3 < data.Jobs.Length; ++index3) { JobData job = data.Jobs[index3]; if (job.IsActivated) { int equipSlotByItemId = job.FindEquipSlotByItemID(this.mShopitem.iname); if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId)) { flag2 = true; break; } } } if (flag2) { if (index1 >= this.mUnits.Count) { this.UnitTemplate.SetActive(true); GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.UnitTemplate); gameObject.get_transform().SetParent((Transform)this.UnitLayoutParent, false); this.mUnits.Add(gameObject); this.UnitTemplate.SetActive(false); } GameObject gameObject1 = this.mUnits[index1].get_gameObject(); DataSource.Bind <UnitData>(gameObject1, data); gameObject1.SetActive(true); this.EnableEquipUnitWindow.get_gameObject().SetActive(true); GameUtility.SetGameObjectActive(this.LayoutRight, true); ++index1; } } } DataSource.Bind <LimitedShopItem>(((Component)this).get_gameObject(), this.mShopitem); if (this.mShopitem.IsArtifact) { DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.iname)); } else if (this.mShopitem.IsConceptCard) { GameUtility.SetGameObjectActive(this.ItemIconRoot, false); GameUtility.SetGameObjectActive(this.ConceptCardIconRoot, true); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ConceptCardDetail, (UnityEngine.Object)null)) { ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(this.mShopitem.iname); GlobalVars.SelectedConceptCardData.Set(cardDataForDisplay); GameUtility.SetGameObjectActive(this.ConceptCardDetail, true); GameUtility.SetGameObjectActive(this.LayoutRight, true); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null)) { this.TextDesc.set_text(cardDataForDisplay.Param.expr); } } } else { ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(this.mShopitem.iname); if (itemDataByItemId != null) { DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId); if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null)) { this.TextDesc.set_text(itemDataByItemId.Param.Expr); } } else { ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(this.mShopitem.iname); if (itemParam != null && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null)) { DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), itemParam); this.TextDesc.set_text(itemParam.Expr); } } } GameParameter.UpdateAll(((Component)this).get_gameObject()); }
private void Refresh() { if (Object.op_Equality((Object)this.UnitTemplate, (Object)null)) { return; } List <UnitData> units = MonoSingleton <GameManager> .Instance.Player.Units; for (int index = 0; index < this.mUnits.Count; ++index) { this.mUnits[index].get_gameObject().SetActive(false); } EventShopItem data1 = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items[GlobalVars.ShopBuyIndex]; if (Object.op_Inequality((Object)this.limited_item, (Object)null)) { this.limited_item.SetActive(!data1.IsNotLimited); } if (Object.op_Inequality((Object)this.no_limited_item, (Object)null)) { this.no_limited_item.SetActive(data1.IsNotLimited); } if (Object.op_Inequality((Object)this.SoldNum, (Object)null)) { this.SoldNum.set_text(data1.remaining_num.ToString()); } ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data1.iname); if (Object.op_Inequality((Object)this.EnableEquipUnitWindow, (Object)null)) { this.EnableEquipUnitWindow.get_gameObject().SetActive(false); int index1 = 0; for (int index2 = 0; index2 < units.Count; ++index2) { UnitData data2 = units[index2]; bool flag = false; for (int index3 = 0; index3 < data2.Jobs.Length; ++index3) { JobData job = data2.Jobs[index3]; if (job.IsActivated) { int equipSlotByItemId = job.FindEquipSlotByItemID(data1.iname); if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId)) { flag = true; break; } } } if (flag) { if (index1 >= this.mUnits.Count) { this.UnitTemplate.SetActive(true); GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitTemplate); gameObject.get_transform().SetParent((Transform)this.UnitLayoutParent, false); this.mUnits.Add(gameObject); this.UnitTemplate.SetActive(false); } GameObject gameObject1 = this.mUnits[index1].get_gameObject(); DataSource.Bind <UnitData>(gameObject1, data2); gameObject1.SetActive(true); this.EnableEquipUnitWindow.get_gameObject().SetActive(true); ++index1; } } } DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), data1); DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId); DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname)); GameParameter.UpdateAll(((Component)this).get_gameObject()); }
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 += itemData.Param.enhace_cost * selectedEquipData.GetEnhanceCostScale() / 100 * enhanceMaterial.num; exp += 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); 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(); } } }
public void Refresh(UnitData unit) { if (unit == null) { return; } DataSource.Bind <UnitData>(((Component)this).get_gameObject(), unit); int index1 = 0; int index2 = 0; this.mJobSlots.Clear(); Toggle.ToggleEvent toggleEvent = new Toggle.ToggleEvent(); for (int jobNo = 0; jobNo < unit.Jobs.Length; ++jobNo) { JobData job = unit.Jobs[jobNo]; if (job != null && job.Param != null) { if (unit.IsJobAvailable(jobNo)) { this.mJobSlots.Add(this.mJobIcons[index1]); ++index1; } else { this.mJobSlots.Add(this.mCCIcons[index2]); ++index2; } AnimatedToggle mJobIcon = this.mJobIcons[this.mJobSlots.Count - 1]; DataSource.Bind <JobData>(((Component)mJobIcon).get_gameObject(), unit.Jobs[jobNo]); ((Component)mJobIcon).get_gameObject().SetActive(true); ((Selectable)mJobIcon).set_interactable(unit.CheckJobUnlockable(jobNo)); Toggle.ToggleEvent onValueChanged = (Toggle.ToggleEvent)mJobIcon.onValueChanged; mJobIcon.onValueChanged = (__Null)toggleEvent; mJobIcon.set_isOn(jobNo == unit.JobIndex); mJobIcon.onValueChanged = (__Null)onValueChanged; ((Animator)((Component)mJobIcon).GetComponent <Animator>()).SetBool(this.JobIconUnlockBool, job.IsActivated); } } for (int index3 = index2; index3 < this.mCCIcons.Count; ++index3) { ((Component)this.mCCIcons[index3]).get_gameObject().SetActive(false); } for (int index3 = index1; index3 < this.mJobIcons.Count; ++index3) { ((Component)this.mJobIcons[index3]).get_gameObject().SetActive(false); } if (Object.op_Inequality((Object)this.SkinButton, (Object)null)) { ((Selectable)this.SkinButton).set_interactable(unit.IsSkinUnlocked()); } DataSource.Bind <UnitData>(this.JobNameObject, unit); bool flag = true; for (int index3 = 0; index3 < this.mJobSlots.Count; ++index3) { this.mJobSlots[index3].set_isOn(unit.JobIndex == index3); Animator component = (Animator)((Component)this.mJobSlots[index3]).GetComponent <Animator>(); int num = 0; do { component.Update(!flag ? 0.0f : 1f); ++num; }while (component.IsInTransition(0) && num < 10); } if (Object.op_Inequality((Object)this.VoiceButton, (Object)null) && Object.op_Inequality((Object)this.VoiceUnlock, (Object)null)) { this.VoiceUnlock.SetActive(!unit.CheckUnlockPlaybackVoice()); } GameParameter.UpdateAll(((Component)this).get_gameObject()); }