123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- 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") || PluginData.IsEnabled("GP002"))
- {
- this.mainBusinessImage.spriteName = GameModeManager.GetData().strBannerImageName;
- }
- else
- {
- this.mainBusinessImage.spriteName = "main_banner_dammy";
- }
- }
- private void OnClickMainBusinessChange()
- {
- Action<bool, string> 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<BoxCollider>().enabled = true;
- this.clubNameInputCancel.GetComponent<BoxCollider>().enabled = true;
- TweenAlpha tweenAlpha = this.clubNameInputPanel.gameObject.GetComponent<TweenAlpha>();
- if (tweenAlpha != null)
- {
- UnityEngine.Object.DestroyImmediate(tweenAlpha);
- }
- tweenAlpha = this.clubNameInputPanel.gameObject.AddComponent<TweenAlpha>();
- tweenAlpha.from = 0f;
- tweenAlpha.to = 1f;
- tweenAlpha.duration = 0.3f;
- tweenAlpha.PlayForward();
- EventDelegate.Set(tweenAlpha.onFinished, delegate()
- {
- TweenAlpha component = this.clubNameInputPanel.gameObject.GetComponent<TweenAlpha>();
- if (component != null)
- {
- UnityEngine.Object.DestroyImmediate(component);
- }
- this.clubNameInput.isSelected = true;
- });
- }
- private void CloseClubNameInputPanel()
- {
- this.clubNameInput.RemoveFocus();
- this.clubNameInputOk.GetComponent<BoxCollider>().enabled = false;
- this.clubNameInputCancel.GetComponent<BoxCollider>().enabled = false;
- TweenAlpha tweenAlpha = this.clubNameInputPanel.gameObject.GetComponent<TweenAlpha>();
- if (tweenAlpha != null)
- {
- UnityEngine.Object.DestroyImmediate(tweenAlpha);
- }
- tweenAlpha = this.clubNameInputPanel.gameObject.AddComponent<TweenAlpha>();
- tweenAlpha.from = 1f;
- tweenAlpha.to = 0f;
- tweenAlpha.duration = 0.3f;
- tweenAlpha.PlayForward();
- EventDelegate.Set(tweenAlpha.onFinished, delegate()
- {
- TweenAlpha component = this.clubNameInputPanel.gameObject.GetComponent<TweenAlpha>();
- 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;
- }
|