123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- using System;
- using I2.Loc;
- using UnityEngine;
- using UnityEngine.UI;
- public class FacilityUIPreviewParams : MonoBehaviour
- {
- public void Show(int id)
- {
- this.SetupRecipeDefaultEffect(id);
- }
- public void UpdateAdditionalParams(Facility.FacilityParameter parameter)
- {
- this.SetupRecipeAdditionalEffect(parameter);
- }
- public void UpdateAdditionalParamsComparison(Facility.FacilityParameter previous, Facility.FacilityParameter next)
- {
- this.SetupRecipeAdditionalEffectComparison(previous, next);
- }
- public void ResetDefaultParam()
- {
- this.m_ParentDefaultEffect.ResetList();
- }
- public void ResetAdditionalParam()
- {
- this.m_ParentAdditionalEffect.ResetList();
- }
- private void SetupRecipeDefaultEffect(int id)
- {
- Facility.PowerUpRecipe recipe = FacilityDataTable.GetFacilityPowerUpRecipe(id);
- this.m_ParentDefaultEffect.Show<Text>(recipe.parameter.Length, delegate(int i, Text text)
- {
- Facility.FacilityParameter parameter = recipe.parameter;
- int num = parameter[i];
- if (num <= 0)
- {
- text.gameObject.SetActive(false);
- }
- string parameterName = parameter.GetParameterName(i);
- text.text = string.Format("{0} +{1}", parameterName, num);
- Image componentInChildren = text.GetComponentInChildren<Image>();
- componentInChildren.enabled = (i % 2 == 0);
- Localize component = text.GetComponent<Localize>();
- if (component != null)
- {
- component.TermArgs = new Localize.ArgsPair[]
- {
- Localize.ArgsPair.Create(num.ToString())
- };
- component.SetTerm("SceneFacilityManagement/パラメータ/" + parameterName);
- }
- });
- }
- private void SetupRecipeAdditionalEffect(Facility.FacilityParameter parameter)
- {
- int itemCount = 0;
- this.m_ParentAdditionalEffect.Show<Text>(parameter.Length, delegate(int i, Text text)
- {
- if (parameter[i] <= 0)
- {
- text.gameObject.SetActive(false);
- return;
- }
- itemCount++;
- string parameterName = parameter.GetParameterName(i);
- int num = parameter[i];
- text.text = string.Format("{0} +{1}", parameterName, num);
- Image componentInChildren = text.GetComponentInChildren<Image>();
- componentInChildren.enabled = (itemCount % 2 == 1);
- Localize component = text.GetComponent<Localize>();
- if (component != null)
- {
- component.TermArgs = new Localize.ArgsPair[]
- {
- Localize.ArgsPair.Create(num.ToString())
- };
- component.SetTerm("SceneFacilityManagement/パラメータ/" + parameterName);
- }
- });
- }
- private void SetupRecipeAdditionalEffectComparison(Facility.FacilityParameter previous, Facility.FacilityParameter next)
- {
- Facility.FacilityParameter compatison = next - previous;
- int itemCount = 0;
- this.m_ParentAdditionalEffect.Show<Text>(next.Length, delegate(int i, Text text)
- {
- if (previous[i] == 0 && next[i] == 0)
- {
- text.gameObject.SetActive(false);
- return;
- }
- itemCount++;
- string parameterName = next.GetParameterName(i);
- int num = next[i];
- text.text = string.Format("{0} +{1}", parameterName, num);
- Image componentInChildren = text.GetComponentInChildren<Image>();
- componentInChildren.enabled = (itemCount % 2 == 1);
- if (compatison[i] == 0)
- {
- text.color = Color.white;
- }
- else if (compatison[i] < 0)
- {
- text.color = Color.magenta;
- }
- else if (compatison[i] > 0)
- {
- text.color = Color.cyan;
- }
- Localize component = text.GetComponent<Localize>();
- if (component != null)
- {
- component.TermArgs = new Localize.ArgsPair[]
- {
- Localize.ArgsPair.Create(num.ToString())
- };
- component.SetTerm("SceneFacilityManagement/パラメータ/" + parameterName);
- }
- });
- }
- [SerializeField]
- private uGUIListViewer m_ParentDefaultEffect;
- [SerializeField]
- private uGUIListViewer m_ParentAdditionalEffect;
- }
|