using System; using System.Collections.Generic; using UnityEngine; namespace Kasizuki { public class KasizukiManSelectCtrl : MonoBehaviour { public Action OnClickManTypeButton { get; set; } public ManDataType nowSelectManType { get; set; } private void Awake() { uGUIListViewer component = this.m_WindowManList.GetComponent(); this.m_ButtonSelectedColor = (this.m_ButtonDefaultColor = component.tempItem.GetComponent().color); this.m_ButtonSelectedColor.a = 1f; this.SetUpManList(); this.SetUpManProfile(); this.SetUpManInfo(); this.m_WindowManInfo.SetActive(false); } private void SetUpManList() { KasizukiManSelectCtrl.c__AnonStorey0 c__AnonStorey = new KasizukiManSelectCtrl.c__AnonStorey0(); c__AnonStorey.$this = this; this.m_ManListCache = new ObjectCacheDic(); c__AnonStorey.dataArray = ManData.GetAllDatas(true, true); uGUIListViewer component = this.m_WindowManList.GetComponent(); component.Show(c__AnonStorey.dataArray.Count, delegate(int index, UIButton button) { UILabel componentInChildren2 = button.GetComponentInChildren(); componentInChildren2.text = c__AnonStorey.dataArray[index].drawName; EventDelegate.Add(button.onClick, delegate() { c__AnonStorey.OnClickManListButton(c__AnonStorey.dataArray[index].ID); }); c__AnonStorey.$this.m_ManListCache.AddCache(c__AnonStorey.dataArray[index].ID.ToString(), button); }); UIGrid component2 = component.parentItemArea.GetComponent(); if (component2) { component2.Reposition(); } UIScrollView componentInChildren = component.GetComponentInChildren(); if (componentInChildren) { componentInChildren.UpdatePosition(); } componentInChildren.ResetPosition(); } private void SetUpManProfile() { this.m_ManProfileCache = new ObjectCacheDic(); this.m_ManProfileCache.CacheChildObject(this.m_WindowManProfile, "Text Free Comment", "フリーコメント"); this.m_ManProfileCache.CacheChildObject(this.m_WindowManProfile, "Favorite/Value", "好きなプレイ"); } private void SetUpManInfo() { this.m_ManInfoCache = new ObjectCacheDic(); this.m_ManInfoCache.CacheChildObject(this.m_WindowManInfo, "PlayCount/Value", "プレイ回数"); List allDatas = ItemData.GetAllDatas(true); uGUIListViewer component = this.m_WindowManInfo.GetComponent(); component.Show(allDatas.Count, delegate(int index, UISprite sprite) { UILabel componentInChildren2 = sprite.GetComponentInChildren(); componentInChildren2.text = "未実装"; this.ChangeButtonColor(sprite.gameObject, false); }); UITable component2 = component.parentItemArea.GetComponent(); if (component2) { component2.Reposition(); } UIScrollView componentInChildren = component.GetComponentInChildren(); if (componentInChildren) { componentInChildren.UpdatePosition(); } componentInChildren.ResetPosition(); } public void OnClickManListButton(int selectedManID) { UIButton cache = this.m_ManListCache.GetCache(selectedManID.ToString()); uGUIListViewer component = this.m_WindowManList.GetComponent(); this.ChangeButtonArrayColor(component.ItemArray, cache.gameObject); this.nowSelectManType = ManData.GetData(selectedManID).manType; this.UpdateManProfile(selectedManID); this.UpdateManInfo(); if (this.OnClickManTypeButton != null) { this.OnClickManTypeButton(selectedManID); } } private void UpdateManProfile(int manID) { ManData.Data data = ManData.GetData(manID); UILabel cache = this.m_ManProfileCache.GetCache("フリーコメント"); cache.text = data.profileText; cache = this.m_ManProfileCache.GetCache("好きなプレイ"); cache.text = data.favoritePlayText; } private void UpdateManInfo() { UILabel cache = this.m_ManInfoCache.GetCache("プレイ回数"); cache.text = "未実装"; } private void ChangeButtonArrayColor(GameObject[] buttonArray, GameObject target) { foreach (GameObject gameObject in buttonArray) { this.ChangeButtonColor(gameObject, gameObject == target); } } private void ChangeButtonColor(GameObject buttonObj, bool isHighLightColor) { if (buttonObj == null) { return; } UIButton component = buttonObj.GetComponent(); if (component) { component.defaultColor = ((!isHighLightColor) ? this.m_ButtonDefaultColor : this.m_ButtonSelectedColor); return; } UIWidget component2 = buttonObj.GetComponent(); if (component2) { component2.color = ((!isHighLightColor) ? this.m_ButtonDefaultColor : this.m_ButtonSelectedColor); return; } } [SerializeField] private GameObject m_WindowManList; [SerializeField] private GameObject m_WindowManProfile; [SerializeField] private GameObject m_WindowManInfo; private ObjectCacheDic m_ManListCache; private ObjectCacheDic m_ManProfileCache; private ObjectCacheDic m_ManInfoCache; private Color m_ButtonDefaultColor; private Color m_ButtonSelectedColor; } }