using System; using System.Collections; using System.Collections.Generic; using PlayerStatus; using UnityEngine; public class ResultIncomeCtrl : MonoBehaviour { public void Init(ResultIncomeMgr resultIncomeMgr, GameObject goPanel) { this.m_goPanel = goPanel; this.m_mgr = resultIncomeMgr; foreach (GameObject gameObject in this.disableObjectList) { gameObject.SetActive(false); } } private void InitViewer() { this.m_listTween = new List(); GameObject childObject = UTY.GetChildObject(this.m_goPanel, "SalonEvaluation", false); GameObject childObject2 = UTY.GetChildObject(childObject, "ClientEvaluation/Value", false); this.m_lClientEvaluation = childObject2.GetComponent(); GameObject childObject3 = UTY.GetChildObject(childObject, "AcquisitionEvaluation/Value", false); this.m_lAcquisitionEvaluation = childObject3.GetComponent(); ResultIncomeCtrl.TweenAlphaHelper tweenAlphaHelper = new ResultIncomeCtrl.TweenAlphaHelper(); tweenAlphaHelper.syncTarget = new List { childObject2, childObject3 }; this.m_listTween.Add(tweenAlphaHelper); GameObject childObject4 = UTY.GetChildObject(childObject, "Result/Value", false); this.m_lResult = childObject4.GetComponent(); tweenAlphaHelper = new ResultIncomeCtrl.TweenAlphaHelper(); tweenAlphaHelper.target = childObject4; this.m_listTween.Add(tweenAlphaHelper); this.m_goIncome = UTY.GetChildObject(this.m_goPanel, "Income", false); GameObject childObject5 = UTY.GetChildObject(this.m_goIncome, "WorkingFunds/Value", false); this.m_lWorkingFunds = childObject5.GetComponent(); GameObject childObject6 = UTY.GetChildObject(this.m_goIncome, "ClubIncome/Value", false); this.m_lClubIncome = childObject6.GetComponent(); GameObject childObject7 = UTY.GetChildObject(this.m_goIncome, "BonusIncome/Value", false); this.m_lBonusIncome = childObject7.GetComponent(); GameObject childObject8 = UTY.GetChildObject(this.m_goIncome, "BonusIncome", false); this.m_lBonusIncomeParent = childObject8.GetComponent(); tweenAlphaHelper = new ResultIncomeCtrl.TweenAlphaHelper(); tweenAlphaHelper.syncTarget = new List { childObject5, childObject6 }; this.m_listTween.Add(tweenAlphaHelper); GameObject childObject9 = UTY.GetChildObject(this.m_goIncome, "TotalAmount/Value", false); this.m_lTotalAmount = childObject9.GetComponent(); tweenAlphaHelper = new ResultIncomeCtrl.TweenAlphaHelper(); tweenAlphaHelper.target = childObject9; this.m_listTween.Add(tweenAlphaHelper); this.m_spBG = UTY.GetChildObject(this.m_goPanel, "BG", false).GetComponent(); this.orgHeightOfBG = this.m_spBG.height; UIButton component = UTY.GetChildObject(this.m_goPanel, "Ok", false).GetComponent(); EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.m_mgr.CloseResultIncome)); } public void CreateViewer(ResultIncomeCtrl.ResultIncome loadData) { if (!this.m_bInit) { this.InitViewer(); this.m_bInit = true; } this.setData(loadData); } public void setData(ResultIncomeCtrl.ResultIncome loadData) { this.m_lClientEvaluation.text = loadData.clientEvaluation.ToString(); this.m_lAcquisitionEvaluation.text = this.Sign(loadData.acquisitionEvaluation); this.m_lResult.text = loadData.result.ToString(); this.m_goIncome.SetActive(true); this.m_lWorkingFunds.text = loadData.workingFunds.ToString("#,0"); this.m_lClubIncome.text = this.SignIncome((int)loadData.clubIncome); if (loadData.bonusIncome != 0L) { this.m_lBonusIncome.text = "+" + loadData.bonusIncome.ToString("#,0"); } else { this.m_lBonusIncomeParent.gameObject.SetActive(false); } this.m_lTotalAmount.text = loadData.totalAmount.ToString("#,0"); } private string Sign(int input) { if (input >= 0) { return "+" + input.ToString(); } return "-" + input.ToString(); } private string SignIncome(int input) { if (input >= 0) { return "+" + input.ToString("#,0"); } return input.ToString("#,0"); } public void DispLevelUp() { Status status = GameMain.Instance.CharacterMgr.status; int clubGrade = status.clubGrade; string text = string.Format("クラブのグレードが{0}にあがりました", clubGrade); text += "\n新しい夜伽ステージが追加されました"; if (3 <= clubGrade) { text += "\n新しい依頼が追加されました"; } if (GameMain.Instance.CharacterMgr.status.isAvailableShop) { text += "\nショップに新しい商品が追加されました"; } GameMain.Instance.SoundMgr.PlaySystem("SE008.ogg"); GameMain.Instance.SysDlg.Show(text, SystemDialog.TYPE.OK, new SystemDialog.OnClick(this.m_mgr.CloseResultIncome), null); } public IEnumerator StartAnimation(Action onFinished = null) { foreach (ResultIncomeCtrl.TweenAlphaHelper tween in this.m_listTween) { if (tween.target != null) { this.PlayTweenAlpha(tween.target); yield return new WaitForSeconds(0.5f); } else if (tween.syncTarget != null) { foreach (GameObject target in tween.syncTarget) { this.PlayTweenAlpha(target); } yield return new WaitForSeconds(0.5f); } } yield return new WaitForSeconds(0.5f); if (onFinished != null) { onFinished(); } yield break; } private void PlayTweenAlpha(GameObject target) { TweenAlpha tweenAlpha = target.GetComponent(); if (tweenAlpha) { UnityEngine.Object.Destroy(tweenAlpha); } tweenAlpha = target.AddComponent(); tweenAlpha.from = 0f; tweenAlpha.to = 1f; tweenAlpha.delay = 0.5f; tweenAlpha.duration = 1f; tweenAlpha.PlayForward(); } public void OnDisable() { UICamera.InputEnable = true; } private ResultIncomeMgr m_mgr; private List m_listTween; private GameObject m_goPanel; private GameObject m_goIncome; private UILabel m_lClientEvaluation; private UILabel m_lAcquisitionEvaluation; private UILabel m_lResult; private UILabel m_lWorkingFunds; private UILabel m_lClubIncome; private UILabel m_lBonusIncome; private UILabel m_lBonusIncomeParent; private UILabel m_lTotalAmount; private UILabel m_lBalance; private UILabel m_lUntilFullPayment; private UISprite m_spBG; private bool m_bInit; private int orgHeightOfBG; private const int HEIGHT_OF_BG_TO_UNDISP_LOAN = 560; private const float DEFAULT_INTERVAL = 0.5f; private const string SYSTEM_UI_ROOT_PATH = "__GameMain__/SystemUI Root"; private const string TEMPLATE_LEVEL_UP = "クラブのグレードが{0}にあがりました"; [SerializeField] private List disableObjectList = new List(); private class TweenAlphaHelper { public TweenAlphaHelper() { this.delay = 1f; this.duration = 1f; this.AlphaFrom = 0f; this.AlphaTo = 1f; } public List syncTarget; public GameObject target; public float delay; public float duration; public float AlphaFrom; public float AlphaTo; public const float DEFAULT_INTERVAL = 0.1f; } public class ResultIncome { public int clientEvaluation; public int acquisitionEvaluation; public int result; public long workingFunds; public long clubIncome; public long bonusIncome; public long totalAmount; public long balance; public long balanceClubIncome; public long untilFullPaymen; public int beforeCleanliness; public int afterCleanliness; public int beforeBrilliant; public int afterBrilliant; public bool fullPayment; } }