123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using System;
- using System.Collections.Generic;
- using I2.Loc;
- using UnityEngine;
- using UnityEngine.UI;
- public class FacilityUIPowerUpList : MonoBehaviour
- {
- public void Show(Facility facility, Action<Facility.PowerUpRecipe> callbackSelect)
- {
- this.SetupFacilityPowerUpListButton(facility, callbackSelect);
- }
- private void SetupFacilityPowerUpListButton(Facility facility, Action<Facility.PowerUpRecipe> callbackSelect)
- {
- FacilityUIPowerUpList.<SetupFacilityPowerUpListButton>c__AnonStorey0 <SetupFacilityPowerUpListButton>c__AnonStorey = new FacilityUIPowerUpList.<SetupFacilityPowerUpListButton>c__AnonStorey0();
- <SetupFacilityPowerUpListButton>c__AnonStorey.callbackSelect = callbackSelect;
- <SetupFacilityPowerUpListButton>c__AnonStorey.$this = this;
- this.m_uGUIListViewer.parentItemArea.gameObject.SetActive(true);
- <SetupFacilityPowerUpListButton>c__AnonStorey.powerUpRecipeIDArray = new int[0];
- if (FacilityDataTable.IsExistFacilityPowerUpRecipe(facility.param.typeID, true))
- {
- <SetupFacilityPowerUpListButton>c__AnonStorey.powerUpRecipeIDArray = FacilityDataTable.GetFacilityPowerUpRecipeIDArray(facility.param.typeID, true);
- }
- this.m_uGUIListViewer.Show<Transform>(<SetupFacilityPowerUpListButton>c__AnonStorey.powerUpRecipeIDArray.Length, delegate(int i, Transform trans)
- {
- Facility.PowerUpRecipe powerUpRecipe = FacilityDataTable.GetFacilityPowerUpRecipe(<SetupFacilityPowerUpListButton>c__AnonStorey.powerUpRecipeIDArray[i]);
- Toggle componentInChildren = trans.GetComponentInChildren<Toggle>();
- Text componentInChildren2 = trans.GetComponentInChildren<Text>();
- Localize component = componentInChildren2.GetComponent<Localize>();
- 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 (<SetupFacilityPowerUpListButton>c__AnonStorey.callbackSelect != null)
- {
- <SetupFacilityPowerUpListButton>c__AnonStorey.callbackSelect(powerUpRecipe);
- }
- <SetupFacilityPowerUpListButton>c__AnonStorey.UpdateConditionsText(powerUpRecipe.id);
- });
- });
- if (<SetupFacilityPowerUpListButton>c__AnonStorey.powerUpRecipeIDArray.Length <= 0)
- {
- this.m_uGUIListViewer.Show<Transform>(1, delegate(int i, Transform trans)
- {
- Toggle componentInChildren = trans.GetComponentInChildren<Toggle>();
- Text componentInChildren2 = trans.GetComponentInChildren<Text>();
- Localize component = componentInChildren2.GetComponent<Localize>();
- 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<string> strConditionsList = new List<string>();
- for (int j = 0; j < conditions.Length; j++)
- {
- if (!string.IsNullOrEmpty(conditions[j]))
- {
- strConditionsList.Add(conditions[j]);
- }
- }
- this.m_uGUIListConditions.Show<RectTransform>(strConditionsList.Count, delegate(int i, RectTransform trans)
- {
- string text = strConditionsList[i];
- Text[] componentsInChildren = trans.GetComponentsInChildren<Text>();
- Localize component = componentsInChildren[1].GetComponent<Localize>();
- componentsInChildren[0].text = (i + 1).ToString();
- componentsInChildren[1].text = text;
- if (component != null)
- {
- component.SetTerm("SceneFacilityManagement/実行条件/" + text);
- }
- Image componentInChildren = trans.GetComponentInChildren<Image>();
- 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;
- }
|