private void Refresh() { if (!this._CheckNullReference()) { return; } ((Component)this.MainPanelCloseBtn).get_gameObject().SetActive(true); this.SubPanel.SetActive(false); GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)instanceDirect, (UnityEngine.Object)null)) { return; } GameUtility.DestroyGameObjects(this.mItems); GameUtility.DestroyGameObjects(this.mBoxs); this.mItems.Clear(); this.mBoxs.Clear(); DataSource.Bind <UnitData>(((Component)this).get_gameObject(), this.mCurrentUnit); GameParameter.UpdateAll(((Component)this).get_gameObject()); string key = (string)null; bool flag1 = true; TobiraRecipeParam currentRecipe = this.GetCurrentRecipe(); if (currentRecipe == null) { return; } DataSource.Bind <TobiraRecipeParam>(((Component)this).get_gameObject(), currentRecipe); if (currentRecipe.Cost > instanceDirect.Player.Gold) { key = "sys.GOLD_NOT_ENOUGH"; flag1 = false; } int length = currentRecipe.Materials.Length; if (currentRecipe.UnitPieceNum > 0) { ++length; } if (currentRecipe.ElementNum > 0) { ++length; } if (currentRecipe.UnlockElementNum > 0) { ++length; } if (currentRecipe.UnlockBirthNum > 0) { ++length; } GridLayoutGroup component = (GridLayoutGroup)this.ItemSlotBox.GetComponent <GridLayoutGroup>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null)) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => Refresh2():gridlayout is Not Component [GridLayoutGroup]!"); } else { int num1 = length / component.get_constraintCount() + 1; for (int index = 0; index < num1; ++index) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotBox); gameObject.get_transform().SetParent(this.ItemSlotRoot.get_transform(), false); gameObject.SetActive(true); this.mBoxs.Add(gameObject); } int num2 = 0; int index1 = 0; if (currentRecipe.UnitPieceNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index1].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.UnitParam.piece); if (itemParam == null) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <TobiraEnhanceRecipe>(gameObject.get_gameObject(), new TobiraEnhanceRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnitPieceNum, Index = num2 }); if (flag1 && currentRecipe.UnitPieceNum > instanceDirect.Player.GetItemAmount(itemParam.iname)) { flag1 = false; key = "sys.ITEM_NOT_ENOUGH"; } ++num2; } int index2 = num2 / component.get_constraintCount(); if (currentRecipe.ElementNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index2].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam elementPieceParam = this.mCurrentUnit.GetElementPieceParam(); if (elementPieceParam == null) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), elementPieceParam); DataSource.Bind <TobiraEnhanceRecipe>(gameObject.get_gameObject(), new TobiraEnhanceRecipe() { Amount = instanceDirect.Player.GetItemAmount(elementPieceParam.iname), RequiredAmount = currentRecipe.ElementNum, Index = num2 }); if (flag1 && currentRecipe.ElementNum > instanceDirect.Player.GetItemAmount(elementPieceParam.iname)) { flag1 = false; key = "sys.ITEM_NOT_ENOUGH"; } ++num2; } int index3 = num2 / component.get_constraintCount(); if (currentRecipe.UnlockElementNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index3].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.GetUnlockTobiraElementID()); if (itemParam == null) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <TobiraEnhanceRecipe>(gameObject.get_gameObject(), new TobiraEnhanceRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnlockElementNum, Index = num2 }); if (flag1 && currentRecipe.UnlockElementNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.GetUnlockTobiraElementID())) { flag1 = false; key = "sys.ITEM_NOT_ENOUGH"; } ++num2; } int index4 = num2 / component.get_constraintCount(); if (currentRecipe.UnlockBirthNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index4].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.GetUnlockTobiraBirthID()); if (itemParam == null) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <TobiraEnhanceRecipe>(gameObject.get_gameObject(), new TobiraEnhanceRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnlockBirthNum, Index = num2 }); if (flag1 && currentRecipe.UnlockBirthNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.GetUnlockTobiraBirthID())) { flag1 = false; key = "sys.ITEM_NOT_ENOUGH"; } ++num2; } foreach (TobiraRecipeMaterialParam material in currentRecipe.Materials) { if (material != null && !string.IsNullOrEmpty(material.Iname)) { int index5 = num2 / component.get_constraintCount(); GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index5].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(material.Iname); if (itemParam == null) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <TobiraEnhanceRecipe>(gameObject.get_gameObject(), new TobiraEnhanceRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = material.Num, Index = num2 }); if (flag1 && material.Num > instanceDirect.Player.GetItemAmount(material.Iname)) { flag1 = false; key = "sys.ITEM_NOT_ENOUGH"; } ++num2; } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HelpText, (UnityEngine.Object)null)) { bool flag2 = !string.IsNullOrEmpty(key); ((Component)this.HelpText).get_gameObject().SetActive(flag2); if (flag2) { this.HelpText.set_text(LocalizedText.Get(key)); } } if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.EnhanceTobiraButton, (UnityEngine.Object)null)) { return; } ((Selectable)this.EnhanceTobiraButton).set_interactable(flag1); } }
private void Refresh() { if (!this._CheckNullReference()) { return; } ((Component)this.MainPanelCloseBtn).get_gameObject().SetActive(true); this.SubPanel.SetActive(false); GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)instanceDirect, (UnityEngine.Object)null)) { return; } this.mCurrentUnit = instanceDirect.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID); if (this.mCurrentUnit == null) { return; } GameUtility.DestroyGameObjects(this.mItems); GameUtility.DestroyGameObjects(this.mBoxs); this.mItems.Clear(); this.mBoxs.Clear(); DataSource.Bind <UnitData>(((Component)this).get_gameObject(), this.mCurrentUnit); GameParameter.UpdateAll(((Component)this).get_gameObject()); string errMsg = (string)null; List <UnitData.TobiraConditioError> errors = (List <UnitData.TobiraConditioError>)null; bool flag1 = this.mCurrentUnit.CanUnlockTobira() && this.mCurrentUnit.MeetsTobiraConditions(TobiraParam.Category.START, out errors); int condsLv = TobiraUtility.GetTobiraUnlockLevel(this.mCurrentUnit.UnitParam.iname); TobiraRecipeParam currentRecipe = this.GetCurrentRecipe(); if (currentRecipe == null) { return; } DataSource.Bind <TobiraRecipeParam>(((Component)this).get_gameObject(), currentRecipe); if (errors.Count > 0) { errors.Find((Predicate <UnitData.TobiraConditioError>)(error => { if (error.Type != UnitData.TobiraConditioError.ErrorType.UnitLevel) { return(false); } errMsg = LocalizedText.Get("sys.TOBIRA_CONDS_ERR_UNIT_LV", new object[1] { (object)condsLv }); return(true); })); } else if (currentRecipe.Cost > instanceDirect.Player.Gold) { errMsg = LocalizedText.Get("sys.GOLD_NOT_ENOUGH"); flag1 = false; } int length = currentRecipe.Materials.Length; if (currentRecipe.UnitPieceNum > 0) { ++length; } if (currentRecipe.ElementNum > 0) { ++length; } if (currentRecipe.UnlockElementNum > 0) { ++length; } if (currentRecipe.UnlockBirthNum > 0) { ++length; } GridLayoutGroup component = (GridLayoutGroup)this.ItemSlotBox.GetComponent <GridLayoutGroup>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null)) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh2():gridlayout is Not Component [GridLayoutGroup]!"); } else { int num1 = length / component.get_constraintCount() + 1; for (int index = 0; index < num1; ++index) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotBox); gameObject.get_transform().SetParent(this.ItemSlotRoot.get_transform(), false); gameObject.SetActive(true); this.mBoxs.Add(gameObject); } int num2 = 0; int index1 = 0; if (currentRecipe.UnitPieceNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index1].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.UnitParam.piece); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnitPieceNum, Index = num2 }); if (flag1 && currentRecipe.UnitPieceNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.UnitParam.piece)) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } int index2 = num2 / component.get_constraintCount(); if (currentRecipe.ElementNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index2].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam elementPieceParam = this.mCurrentUnit.GetElementPieceParam(); if (elementPieceParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), elementPieceParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(elementPieceParam.iname), RequiredAmount = currentRecipe.ElementNum, Index = num2 }); if (flag1 && currentRecipe.ElementNum > instanceDirect.Player.GetItemAmount(elementPieceParam.iname)) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } int index3 = num2 / component.get_constraintCount(); if (currentRecipe.UnlockElementNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index3].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.GetUnlockTobiraElementID()); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnlockElementNum, Index = num2 }); if (flag1 && currentRecipe.UnlockElementNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.GetUnlockTobiraElementID())) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } int index4 = num2 / component.get_constraintCount(); if (currentRecipe.UnlockBirthNum > 0) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index4].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(this.mCurrentUnit.GetUnlockTobiraBirthID()); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = currentRecipe.UnlockBirthNum, Index = num2 }); if (flag1 && currentRecipe.UnlockBirthNum > instanceDirect.Player.GetItemAmount(this.mCurrentUnit.GetUnlockTobiraBirthID())) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } foreach (TobiraRecipeMaterialParam material in currentRecipe.Materials) { if (material != null && !string.IsNullOrEmpty(material.Iname)) { int index5 = num2 / component.get_constraintCount(); GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemSlotTemplate); gameObject.get_transform().SetParent(this.mBoxs[index5].get_transform(), false); gameObject.SetActive(true); this.mItems.Add(gameObject.get_gameObject()); ItemParam itemParam = instanceDirect.GetItemParam(material.Iname); if (itemParam == null) { DebugUtility.LogWarning("UnitEvolutionWindow.cs => Refresh():item_param is Null References!"); return; } DataSource.Bind <ItemParam>(gameObject.get_gameObject(), itemParam); DataSource.Bind <UnlockTobiraRecipe>(gameObject.get_gameObject(), new UnlockTobiraRecipe() { Amount = instanceDirect.Player.GetItemAmount(itemParam.iname), RequiredAmount = material.Num, Index = num2 }); if (flag1 && material.Num > instanceDirect.Player.GetItemAmount(material.Iname)) { flag1 = false; errMsg = LocalizedText.Get("sys.ITEM_NOT_ENOUGH"); } ++num2; } } if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HelpText, (UnityEngine.Object)null)) { bool flag2 = !string.IsNullOrEmpty(errMsg); ((Component)this.HelpText).get_gameObject().SetActive(flag2); if (flag2) { this.HelpText.set_text(errMsg); } } if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.UnlockTobiraButton, (UnityEngine.Object)null)) { return; } ((Selectable)this.UnlockTobiraButton).set_interactable(flag1); } }
private void RefreshSubPanel(int index) { GameUtility.DestroyGameObjects(this.mGainedQuests); this.mGainedQuests.Clear(); ((Component)this.MainPanelCloseBtn).get_gameObject().SetActive(false); if (index < 0) { DebugUtility.LogWarning("UnitTobiraEnhanceWindow.cs => RefreshSubPanel():index is 0!"); } else { TobiraRecipeParam currentRecipe = this.GetCurrentRecipe(); if (currentRecipe == null) { DebugUtility.LogError("UnitTobiraEnhanceWindow.cs => RefreshSubPanel():recipeParam is Null References!"); } else { ItemParam data = (ItemParam)null; int num = 0; if (currentRecipe.UnitPieceNum > 0) { if (index == num) { data = MonoSingleton <GameManager> .Instance.GetItemParam(this.mCurrentUnit.UnitParam.piece); goto label_22; } else { ++num; } } if (currentRecipe.ElementNum > 0) { if (index == num) { data = this.mCurrentUnit.GetElementPieceParam(); goto label_22; } else { ++num; } } if (currentRecipe.UnlockElementNum > 0) { if (index == num) { data = MonoSingleton <GameManager> .Instance.GetItemParam(this.mCurrentUnit.GetUnlockTobiraElementID()); goto label_22; } else { ++num; } } if (currentRecipe.UnlockBirthNum > 0) { if (index == num) { data = MonoSingleton <GameManager> .Instance.GetItemParam(this.mCurrentUnit.GetUnlockTobiraBirthID()); goto label_22; } else { ++num; } } int index1 = index - num; if (0 <= index1 && index1 < currentRecipe.Materials.Length) { data = MonoSingleton <GameManager> .Instance.GetItemParam(currentRecipe.Materials[index1].Iname); } label_22: if (data == null) { DebugUtility.LogError("UnitTobiraEnhanceWindow.cs => RefreshSubPanel():itemParam is Null References!"); } else { this.SubPanel.SetActive(true); DataSource.Bind <ItemParam>(this.SubPanel, data); GameParameter.UpdateAll(this.SubPanel.get_gameObject()); if (this.mLastSelectItemIname != data.iname) { this.ResetScrollPosition(); this.mLastSelectItemIname = data.iname; } if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)QuestDropParam.Instance, (UnityEngine.Object)null)) { return; } QuestParam[] availableQuests = MonoSingleton <GameManager> .Instance.Player.AvailableQuests; List <QuestParam> itemDropQuestList = QuestDropParam.Instance.GetItemDropQuestList(data, GlobalVars.GetDropTableGeneratedDateTime()); using (List <QuestParam> .Enumerator enumerator = itemDropQuestList.GetEnumerator()) { while (enumerator.MoveNext()) { QuestParam qp = enumerator.Current; bool isActive = Array.Find <QuestParam>(availableQuests, (Predicate <QuestParam>)(p => p.iname == qp.iname)) != null; this.AddList(qp, isActive); } } } } } }
public static List <ConditionsResult> TobiraRecipeCheck(UnitData unitData, TobiraParam.Category category, int targetLevel) { List <ConditionsResult> conditionsResultList = new List <ConditionsResult>(); GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect(); TobiraRecipeParam tobiraRecipe = instanceDirect.MasterParam.GetTobiraRecipe(unitData.UnitID, category, targetLevel); if (tobiraRecipe.Cost > 0) { conditionsResultList.Add((ConditionsResult) new ConditionsResult_HasGold(tobiraRecipe.Cost)); } if (tobiraRecipe.UnitPieceNum > 0) { conditionsResultList.Add((ConditionsResult) new ConditionsResult_HasItem(unitData.UnitParam.piece, tobiraRecipe.UnitPieceNum)); } if (tobiraRecipe.ElementNum > 0) { int elementNum = tobiraRecipe.ElementNum; ItemParam elementPieceParam = unitData.GetElementPieceParam(); if (elementPieceParam == null) { DebugUtility.LogWarning("対応する属性欠片が見つかりませんでした。"); } else { conditionsResultList.Add((ConditionsResult) new ConditionsResult_HasItem(elementPieceParam.iname, elementNum)); } } if (tobiraRecipe.UnlockElementNum > 0) { int unlockElementNum = tobiraRecipe.UnlockElementNum; ItemParam itemParam = instanceDirect.GetItemParam(unitData.GetUnlockTobiraElementID()); if (itemParam == null) { DebugUtility.LogWarning("属性に対応する扉用素材が見つかりませんでした。"); } else { conditionsResultList.Add((ConditionsResult) new ConditionsResult_HasItem(itemParam.iname, unlockElementNum)); } } if (tobiraRecipe.UnlockBirthNum > 0) { int unlockBirthNum = tobiraRecipe.UnlockBirthNum; ItemParam itemParam = instanceDirect.GetItemParam(unitData.GetUnlockTobiraBirthID()); if (itemParam == null) { DebugUtility.LogWarning("出自に対応する扉用素材が見つかりませんでした。"); } else { conditionsResultList.Add((ConditionsResult) new ConditionsResult_HasItem(itemParam.iname, unlockBirthNum)); } } foreach (TobiraRecipeMaterialParam material in tobiraRecipe.Materials) { if (material != null && !string.IsNullOrEmpty(material.Iname)) { int num = material.Num; ItemParam itemParam = instanceDirect.GetItemParam(material.Iname); if (itemParam == null) { DebugUtility.LogWarning("アイテムが見つかりませんでした。"); } else { conditionsResultList.Add((ConditionsResult) new ConditionsResult_HasItem(itemParam.iname, num)); } } } return(conditionsResultList); }