using System; using UnityEngine; using wf; public class StatusViewer : MonoBehaviour { public bool visible { get { return base.gameObject.activeSelf; } set { base.gameObject.SetActive(value); } } public bool isEnabledClubNameChangeButton { get { return this.clubNameChangeBtn.gameObject.activeSelf; } set { this.clubNameChangeBtn.gameObject.SetActive(value); } } public bool isEnabledMainBusinessChangeButton { get { return this.mainBusinessChangeBtn.gameObject.activeSelf; } set { this.mainBusinessChangeBtn.gameObject.SetActive(value); } } public bool isEnabledGameModeChangeButton { get { return !(this.gameModeChangeBtn == null) && this.gameModeChangeBtn.gameObject.activeSelf; } set { if (this.gameModeChangeBtn == null) { return; } this.gameModeChangeBtn.gameObject.SetActive(value); } } public void Awake() { if (DailyMgr.IsLegacy) { base.gameObject.SetActive(false); return; } for (int i = 0; i < this.clubGauges.Length; i++) { this.clubGauges[i].type = UIBasicSprite.Type.Filled; } this.clubNameInputPanel.gameObject.SetActive(false); EventDelegate.Add(this.clubNameInput.onChange, new EventDelegate.Callback(this.OnInputClubName)); EventDelegate.Add(this.clubNameChangeBtn.onClick, new EventDelegate.Callback(this.OpenClubNameInputPanel)); EventDelegate.Add(this.clubNameInputOk.onClick, new EventDelegate.Callback(this.OnInputClubNameOK)); EventDelegate.Add(this.clubNameInputCancel.onClick, new EventDelegate.Callback(this.CloseClubNameInputPanel)); EventDelegate.Add(this.mainBusinessChangeBtn.onClick, new EventDelegate.Callback(this.OnClickMainBusinessChange)); if (this.gameModeChangeBtn != null) { EventDelegate.Add(this.gameModeChangeBtn.onClick, new EventDelegate.Callback(this.OnClickGameModeChange)); } bool flag = false; this.isEnabledMainBusinessChangeButton = flag; this.isEnabledClubNameChangeButton = flag; this.isEnabledGameModeChangeButton = false; } public void Start() { this.UpdateInfoData(); } public void UpdateInfoData() { CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; this.clubNameLabel.text = characterMgr.status.clubName; this.clubEvaluationLabel.text = characterMgr.status.clubEvaluation.ToString(); this.numberOfMaidsLabel.text = characterMgr.GetStockMaidCount().ToString(); this.daysLabel.text = characterMgr.status.days.ToString(); this.moneyLabel.text = characterMgr.status.moneyText; for (int i = 0; i < this.gradeImages.Length; i++) { this.gradeImages[i].SetActive(i < characterMgr.status.clubGrade); } int num = characterMgr.status.clubGauge; for (int j = 0; j < this.clubGauges.Length; j++) { float num2 = (float)num / (100f / (float)this.clubGauges.Length); num2 = wf.Math.RoundMinMax(num2, 0f, 1f); this.clubGauges[j].fillAmount = num2; num -= (int)(100f / (float)this.clubGauges.Length); } if (0 <= GameMain.Instance.FacilityMgr.NowBusinessTypeID) { FacilityDataTable.BusinessTypeData facilityBusinessTypeData = FacilityDataTable.GetFacilityBusinessTypeData(GameMain.Instance.FacilityMgr.NowBusinessTypeID); this.mainBusinessLabel.text = facilityBusinessTypeData.name; } else { this.mainBusinessLabel.text = "-"; } if (PluginData.IsEnabled("GP001")) { this.mainBusinessImage.spriteName = GameModeManager.GetData().strBannerImageName; } else { this.mainBusinessImage.spriteName = "main_banner_dammy"; } } private void OnClickMainBusinessChange() { Action callback = delegate(bool changed, string imageName) { if (changed) { this.UpdateInfoData(); } }; this.mainBusinessWindow.OpenBusinessWindow(callback); } private void OnClickGameModeChange() { this.gameModeChangeWindow.Open(delegate { this.mainBusinessImage.spriteName = GameModeManager.GetData().strBannerImageName; }); } private void OnInputClubName() { string clubName = GameMain.Instance.CharacterMgr.status.clubName; GameMain.Instance.CharacterMgr.status.clubName = UIInput.current.value; UIInput.current.value = GameMain.Instance.CharacterMgr.status.clubName; GameMain.Instance.CharacterMgr.status.clubName = clubName; } private void OnInputClubNameOK() { GameMain.Instance.CharacterMgr.status.clubName = this.clubNameInput.value; this.clubNameLabel.text = GameMain.Instance.CharacterMgr.status.clubName; this.CloseClubNameInputPanel(); } private void OpenClubNameInputPanel() { this.clubNameInput.value = GameMain.Instance.CharacterMgr.status.clubName; this.clubNameInputPanel.gameObject.SetActive(true); this.clubNameInputPanel.alpha = 0f; this.clubNameInputOk.GetComponent().enabled = true; this.clubNameInputCancel.GetComponent().enabled = true; TweenAlpha tweenAlpha = this.clubNameInputPanel.gameObject.GetComponent(); if (tweenAlpha != null) { UnityEngine.Object.DestroyImmediate(tweenAlpha); } tweenAlpha = this.clubNameInputPanel.gameObject.AddComponent(); tweenAlpha.from = 0f; tweenAlpha.to = 1f; tweenAlpha.duration = 0.3f; tweenAlpha.PlayForward(); EventDelegate.Set(tweenAlpha.onFinished, delegate() { TweenAlpha component = this.clubNameInputPanel.gameObject.GetComponent(); if (component != null) { UnityEngine.Object.DestroyImmediate(component); } this.clubNameInput.isSelected = true; }); } private void CloseClubNameInputPanel() { this.clubNameInput.RemoveFocus(); this.clubNameInputOk.GetComponent().enabled = false; this.clubNameInputCancel.GetComponent().enabled = false; TweenAlpha tweenAlpha = this.clubNameInputPanel.gameObject.GetComponent(); if (tweenAlpha != null) { UnityEngine.Object.DestroyImmediate(tweenAlpha); } tweenAlpha = this.clubNameInputPanel.gameObject.AddComponent(); tweenAlpha.from = 1f; tweenAlpha.to = 0f; tweenAlpha.duration = 0.3f; tweenAlpha.PlayForward(); EventDelegate.Set(tweenAlpha.onFinished, delegate() { TweenAlpha component = this.clubNameInputPanel.gameObject.GetComponent(); if (component != null) { UnityEngine.Object.DestroyImmediate(component); } this.clubNameInputPanel.gameObject.SetActive(false); }); } [SerializeField] private UILabel clubNameLabel; [SerializeField] private UIButton clubNameChangeBtn; [SerializeField] private UILabel mainBusinessLabel; [SerializeField] private UIButton mainBusinessChangeBtn; [SerializeField] private UISprite mainBusinessImage; [SerializeField] private UIButton gameModeChangeBtn; [SerializeField] private UILabel clubEvaluationLabel; [SerializeField] private UILabel numberOfMaidsLabel; [SerializeField] private UILabel daysLabel; [SerializeField] private UILabel moneyLabel; [SerializeField] private GameObject[] gradeImages; [SerializeField] private UISprite[] clubGauges; [SerializeField] private UIPanel clubNameInputPanel; [SerializeField] private UIInput clubNameInput; [SerializeField] private UIButton clubNameInputOk; [SerializeField] private UIButton clubNameInputCancel; [SerializeField] private MainBusinessWindow mainBusinessWindow; [SerializeField] private LifeModeChangeWindow gameModeChangeWindow; }