using System.Collections; using UnityEngine; using Wizard; public class MyPageBattleCampaign : MonoBehaviour { [SerializeField] private UILabel _timeLabel; [SerializeField] private GameObject _boxRoot; [SerializeField] private UILabel _boxLabel; [SerializeField] private UISprite _boxSprite; [SerializeField] private UILabel _specialBoxLabel; [SerializeField] private UISprite _specialBoxSprite; private const int SECONDS_PER_MINUTE = 60; private const string BOX_SPRITE_NAME = "box_campaign_"; private const int BOX_NONE_LABEL_WIDTH = 50; private const int BOX_LABEL_WIDTH = 150; private const float NORMAL_BOXROOT_ORIGIN_POSITION = -5.8f; private const float NORMAL_BOXROOT_POSITION = -90f; private float _updateTimer; public IEnumerator Init() { base.gameObject.SetActive(value: false); while (Data.MyPage.data == null) { yield return null; } _specialBoxLabel.gameObject.SetActive(value: false); _specialBoxSprite.gameObject.SetActive(value: false); CampaignBattleWin campaignBattleWin = Data.MyPageNotifications.data.CampaignBattleWin; if (campaignBattleWin.IsInSessionCampaign) { base.gameObject.SetActive(value: true); _timeLabel.text = Data.SystemText.Get("MyPage_0048", ConvertTime.ToLocal(ConvertTime.UnixTimeToDateTime(campaignBattleWin.EndUnixTime))); if (campaignBattleWin.BoxGrade == CampaignBattleWin.eBoxGrade.None) { _boxLabel.width = 50; _boxLabel.text = Data.SystemText.Get("MyPage_0046", campaignBattleWin.GetBoxNum.ToString(), campaignBattleWin.MaxBoxNum.ToString()); _boxSprite.spriteName = "box_campaign_00"; if (campaignBattleWin.IsHaveSpecialWinReward && !campaignBattleWin.SpecialTreasureInfo.IsGotSpecialTreasureBox) { _boxRoot.transform.localPosition = new Vector3(-90f, _boxRoot.transform.localPosition.y, _boxRoot.transform.localPosition.z); _specialBoxLabel.gameObject.SetActive(value: true); _specialBoxSprite.gameObject.SetActive(value: true); } } else { _boxLabel.width = 150; _boxLabel.text = Data.SystemText.Get("MyPage_0047"); _boxSprite.spriteName = "box_campaign_" + ((int)(campaignBattleWin.BoxGrade - 1)).ToString("00"); } } else { base.gameObject.SetActive(value: false); } } public void RedrawAfterSpecialWinRewardOpened() { _ = Data.MyPageNotifications.data.CampaignBattleWin; _specialBoxLabel.gameObject.SetActive(value: false); _specialBoxSprite.gameObject.SetActive(value: false); _boxRoot.transform.localPosition = new Vector3(-5.8f, _boxRoot.transform.localPosition.y, _boxRoot.transform.localPosition.z); } private void Update() { if (Data.MyPage.data == null) { return; } _updateTimer -= Time.deltaTime; if (_updateTimer < 0f) { CampaignBattleWin campaignBattleWin = Data.MyPageNotifications.data.CampaignBattleWin; double num = Data.MyPage.data.ServerUnixTime + (double)Time.realtimeSinceStartup - (double)Data.MyPage.data.SinceTime; _updateTimer = (float)(60.0 - num % 60.0); if (num > (double)Data.MyPageNotifications.data.CampaignBattleWin.EndUnixTime) { campaignBattleWin.OnFinishCanpaignTime(); base.gameObject.SetActive(value: false); } } } }