using System; using System.Collections.Generic; using I2.Loc; using UnityEngine; using UnityEngine.UI; public class FacilityUIPowerUpList : MonoBehaviour { public void Show(Facility facility, Action callbackSelect) { this.SetupFacilityPowerUpListButton(facility, callbackSelect); } private void SetupFacilityPowerUpListButton(Facility facility, Action callbackSelect) { FacilityUIPowerUpList.c__AnonStorey0 c__AnonStorey = new FacilityUIPowerUpList.c__AnonStorey0(); c__AnonStorey.callbackSelect = callbackSelect; c__AnonStorey.$this = this; this.m_uGUIListViewer.parentItemArea.gameObject.SetActive(true); c__AnonStorey.powerUpRecipeIDArray = new int[0]; if (FacilityDataTable.IsExistFacilityPowerUpRecipe(facility.param.typeID, true)) { c__AnonStorey.powerUpRecipeIDArray = FacilityDataTable.GetFacilityPowerUpRecipeIDArray(facility.param.typeID, true); } this.m_uGUIListViewer.Show(c__AnonStorey.powerUpRecipeIDArray.Length, delegate(int i, Transform trans) { Facility.PowerUpRecipe powerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(c__AnonStorey.powerUpRecipeIDArray[i]); Toggle componentInChildren = trans.GetComponentInChildren(); Text componentInChildren2 = trans.GetComponentInChildren(); Localize component = componentInChildren2.GetComponent(); componentInChildren2.text = powerUpRecipe.name; if (component != null) { component.SetTerm("SceneFacilityManagement/強化種類/" + powerUpRecipe.name); } componentInChildren.onValueChanged.RemoveAllListeners(); componentInChildren.onValueChanged.AddListener(delegate(bool isOn) { if (!isOn) { return; } if (c__AnonStorey.callbackSelect != null) { c__AnonStorey.callbackSelect(powerUpRecipe); } c__AnonStorey.UpdateConditionsText(powerUpRecipe.id); }); }); if (c__AnonStorey.powerUpRecipeIDArray.Length <= 0) { this.m_uGUIListViewer.Show(1, delegate(int i, Transform trans) { Toggle componentInChildren = trans.GetComponentInChildren(); Text componentInChildren2 = trans.GetComponentInChildren(); Localize component = componentInChildren2.GetComponent(); componentInChildren.enabled = false; componentInChildren2.text = "レシピは存在しません。"; if (component != null) { component.SetTerm("SceneFacilityManagement/強化種類/レシピは存在しません"); } }); } this.m_uGUIListConditions.ResetList(); } private void UpdateConditionsText(int recipeID) { FacilityDataTable.FacilityRecipeData facilityRecipeData = FacilityDataTable.GetFacilityRecipeData(recipeID); if (facilityRecipeData == null) { this.m_uGUIListConditions.ResetList(); return; } string[] conditions = facilityRecipeData.conditions; List strConditionsList = new List(); for (int j = 0; j < conditions.Length; j++) { if (!string.IsNullOrEmpty(conditions[j])) { strConditionsList.Add(conditions[j]); } } this.m_uGUIListConditions.Show(strConditionsList.Count, delegate(int i, RectTransform trans) { string text = strConditionsList[i]; Text[] componentsInChildren = trans.GetComponentsInChildren(); Localize component = componentsInChildren[1].GetComponent(); componentsInChildren[0].text = (i + 1).ToString(); componentsInChildren[1].text = text; if (component != null) { component.SetTerm("SceneFacilityManagement/実行条件/" + text); } Image componentInChildren = trans.GetComponentInChildren(); componentInChildren.enabled = (i % 2 != 0); }); } public void Hide() { this.m_uGUIListViewer.parentItemArea.gameObject.SetActive(false); } [SerializeField] private uGUIListViewer m_uGUIListViewer; [SerializeField] private uGUIListViewer m_uGUIListConditions; }