cull(engine-cleanup): pass-8 phase-2 — stub MyPageItemHome to live surface
This commit is contained in:
@@ -1,471 +1,21 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Cute;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Wizard;
|
using Wizard;
|
||||||
|
|
||||||
|
// PASS-8/Phase-2 STUB: 471-line client-side home-tab MyPage panel reduced to its
|
||||||
|
// compile-time surface. MyPageMenu.Instance returns null so instance-member chains
|
||||||
|
// are never reachable at runtime on the headless node. Four members preserved:
|
||||||
|
// TUTORIAL_OFFSET_FOOTER (Mail.cs static ref), ContentsRoot (MyPageBannerBase),
|
||||||
|
// OnDecideMyPageBG (SceneTransition delegate), HideAndRepositionSubBanner
|
||||||
|
// (BattlePassPurchaseDialog). Held alive by MyPageMenu.HomeMenu return-type reference.
|
||||||
|
// See Task 2a of PASS8-PLAN.md.
|
||||||
public class MyPageItemHome : MyPageItem
|
public class MyPageItemHome : MyPageItem
|
||||||
{
|
{
|
||||||
private enum Notification
|
|
||||||
{
|
|
||||||
Info }
|
|
||||||
|
|
||||||
public static readonly Vector3 TUTORIAL_OFFSET_FOOTER = new Vector3(0f, 19f, 0f);
|
public static readonly Vector3 TUTORIAL_OFFSET_FOOTER = new Vector3(0f, 19f, 0f);
|
||||||
|
|
||||||
private GameObject _bannerObject;
|
public GameObject ContentsRoot => null;
|
||||||
|
|
||||||
private GameObject _subBannerObject;
|
public void OnDecideMyPageBG(MyPageDetail.BGType bgType, string selectId, List<string> randomIdList) { }
|
||||||
|
|
||||||
private MyPageBanner _banner;
|
public void HideAndRepositionSubBanner(string click) { }
|
||||||
|
|
||||||
private MyPageSubBanner _subBanner;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _giftButton;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private GameObject _giftNumberRoot;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UILabel _giftNumber;
|
|
||||||
|
|
||||||
private int _giftCount;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _missionButton;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UILabel _missionNumberLabel;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _guildButton;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UILabel _guildNotificationLabel;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private GameObject _contentsRoot;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _battlePassButton;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private GameObject _homeDialogPrefab;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private GameObject[] _customMyPageHideList;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private GameObject[] _customMyPageOnlyList;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _bgCustomButton;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _hideUIButton;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private GameObject[] _hideUIList;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private UIButton _restoreUIButton;
|
|
||||||
|
|
||||||
private MyPageHomeStatic _homeStatic;
|
|
||||||
|
|
||||||
private int _notificationMask;
|
|
||||||
|
|
||||||
public GameObject ContentsRoot => _contentsRoot;
|
|
||||||
|
|
||||||
public bool IsCustomMyPage => Data.MyPage.data.BGInfo.BGType != MyPageDetail.BGType.Deck;
|
|
||||||
|
|
||||||
public override void Initialize(MyPageMenu parent)
|
|
||||||
{
|
|
||||||
base.Initialize(parent);
|
|
||||||
_giftButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushGiftButton();
|
|
||||||
}));
|
|
||||||
_missionButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushMissionButton();
|
|
||||||
}));
|
|
||||||
_guildButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushGuildButton();
|
|
||||||
}));
|
|
||||||
_battlePassButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushBattlePassButton();
|
|
||||||
}));
|
|
||||||
_bgCustomButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushBGCustomButton();
|
|
||||||
}));
|
|
||||||
_hideUIButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushHideUIButton();
|
|
||||||
}));
|
|
||||||
_restoreUIButton.onClick.Add(new EventDelegate(delegate
|
|
||||||
{
|
|
||||||
OnPushRestoreUIButton();
|
|
||||||
}));
|
|
||||||
_guildNotificationLabel.gameObject.SetActive(value: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnMyPageInfoReceive()
|
|
||||||
{
|
|
||||||
base.OnMyPageInfoReceive();
|
|
||||||
_bannerObject.GetComponent<MyPageBanner>().CreateMyPageBanner();
|
|
||||||
_subBanner.CreateMyPageBanner();
|
|
||||||
UpdateGuildNotification();
|
|
||||||
UpdateMissionNumber();
|
|
||||||
_giftCount = Data.MyPage.data.unread_mail_count;
|
|
||||||
SetUnreadGiftCount(_giftCount);
|
|
||||||
UIManager.GetInstance().StartCoroutine(WaitForTreasureBoxCpRewardDialogClosed(delegate
|
|
||||||
{
|
|
||||||
CheckNotify(delegate
|
|
||||||
{
|
|
||||||
CheckHomeDialog();
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
UpdateMaintenance();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator WaitForTreasureBoxCpRewardDialogClosed(Action onFinish)
|
|
||||||
{
|
|
||||||
while (!base.Parent._treasureBoxCpRewardDialogClosed)
|
|
||||||
{
|
|
||||||
yield return null;
|
|
||||||
}
|
|
||||||
onFinish.Call();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Show(bool skipCardAnimation = false)
|
|
||||||
{
|
|
||||||
base.Show(skipCardAnimation);
|
|
||||||
_contentsRoot.SetActive(value: true);
|
|
||||||
if (!IsCustomMyPage)
|
|
||||||
{
|
|
||||||
_homeStatic.Show();
|
|
||||||
}
|
|
||||||
_hideUIButton.gameObject.SetActive(IsCustomMyPage);
|
|
||||||
_restoreUIButton.gameObject.SetActive(value: false);
|
|
||||||
_bannerObject.SetActive(!base.Parent.IsFirstGuid);
|
|
||||||
_subBannerObject.SetActive(!base.Parent.IsFirstGuid);
|
|
||||||
_bgCustomButton.gameObject.SetActive(Data.Load.data.AcquiredMyPageBGList.Count > 0);
|
|
||||||
UpdateMaintenance();
|
|
||||||
CheckShopTutorial();
|
|
||||||
OnUpdateCustomMyPageEnable(isHomeActive: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnUpdateCustomMyPageEnable(bool isHomeActive)
|
|
||||||
{
|
|
||||||
_hideUIButton.gameObject.SetActive(IsCustomMyPage);
|
|
||||||
if (isHomeActive && IsCustomMyPage)
|
|
||||||
{
|
|
||||||
_banner.Show();
|
|
||||||
_subBanner.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CommonBackGround.Instance.EffectVisible = true;
|
|
||||||
}
|
|
||||||
GameObject[] customMyPageHideList = _customMyPageHideList;
|
|
||||||
foreach (GameObject gameObject in customMyPageHideList)
|
|
||||||
{
|
|
||||||
if (gameObject != null)
|
|
||||||
{
|
|
||||||
gameObject.SetActive(!IsCustomMyPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
customMyPageHideList = _customMyPageOnlyList;
|
|
||||||
foreach (GameObject gameObject2 in customMyPageHideList)
|
|
||||||
{
|
|
||||||
if (gameObject2 != null)
|
|
||||||
{
|
|
||||||
gameObject2.SetActive(IsCustomMyPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_homeStatic != null && _homeStatic.CardLoadFinish)
|
|
||||||
{
|
|
||||||
_homeStatic.SetActive(!IsCustomMyPage && isHomeActive);
|
|
||||||
}
|
|
||||||
if (!(base.Parent.CustomBGControl != null))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
base.Parent.CustomBGControl.SetEnable(IsCustomMyPage && isHomeActive);
|
|
||||||
if (!(IsCustomMyPage && isHomeActive))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
base.Parent.CustomBGControl.Show(delegate
|
|
||||||
{
|
|
||||||
if (isHomeActive && IsCustomMyPage)
|
|
||||||
{
|
|
||||||
CommonBackGround.Instance.EffectVisible = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckShopTutorial()
|
|
||||||
{
|
|
||||||
if (Data.Load.data._userTutorial.TutorialStep == 41)
|
|
||||||
{
|
|
||||||
DialogBase dialogBase = MyPageMenu.CreateDialogForTutorial();
|
|
||||||
dialogBase.SetText(Data.SystemText.Get("Tutorial_0012"));
|
|
||||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
||||||
base.Parent.SetGuideToOkOnlyDialog(dialogBase);
|
|
||||||
UIManager.SetObjectToGrey(_giftButton.gameObject, b: true);
|
|
||||||
UIManager.SetObjectToGrey(_missionButton.gameObject, b: true);
|
|
||||||
UIManager.SetObjectToGrey(_guildButton.gameObject, b: true);
|
|
||||||
UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: true);
|
|
||||||
UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: true);
|
|
||||||
_homeStatic.SetTutorialMode();
|
|
||||||
dialogBase.OnClose = delegate
|
|
||||||
{
|
|
||||||
Footer footer = UIManager.GetInstance()._Footer;
|
|
||||||
base.Parent.SetGuideEffect(footer._underButtons[5].transform, TUTORIAL_OFFSET_FOOTER, 180f);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Hide()
|
|
||||||
{
|
|
||||||
base.Hide();
|
|
||||||
_homeStatic.Hide();
|
|
||||||
base.gameObject.SetActive(value: true);
|
|
||||||
_contentsRoot.SetActive(value: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateMaintenance()
|
|
||||||
{
|
|
||||||
if (!base.Parent.IsFirstGuid)
|
|
||||||
{
|
|
||||||
bool b = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GIFT_MAINTENANCE);
|
|
||||||
bool b2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.MISSION_MAINTENANCE);
|
|
||||||
bool b3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GUILD_MAINTENANCE);
|
|
||||||
UIManager.SetObjectToGrey(_giftButton.gameObject, b);
|
|
||||||
UIManager.SetObjectToGrey(_missionButton.gameObject, b2);
|
|
||||||
UIManager.SetObjectToGrey(_guildButton.gameObject, b3);
|
|
||||||
bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.BATTLE_PASS);
|
|
||||||
bool flag2 = !Data.IsBattlePassPeriod;
|
|
||||||
UIManager.SetObjectToGrey(_battlePassButton.gameObject, flag || flag2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckNotify(Action onFinish)
|
|
||||||
{
|
|
||||||
if (!_contentsRoot.activeSelf || Data.Load.data._userTutorial.TutorialStep != 100)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DateTime last_announce_time = Data.MyPage.data.last_announce_time;
|
|
||||||
// Pre-Phase-5b: gated on ambient GameMgr.AnnounceTime cursor to avoid
|
|
||||||
// re-showing the same announcement. Headless has no announcement UI to display;
|
|
||||||
// always fall through to the else branch below.
|
|
||||||
if (false)
|
|
||||||
{
|
|
||||||
_notificationMask |= 1;
|
|
||||||
if (_notificationMask != 0)
|
|
||||||
{
|
|
||||||
StartCoroutine(ShowNextNotification(onFinish));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onFinish.Call();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckHomeDialog()
|
|
||||||
{
|
|
||||||
MyPageHomeDialogData myPageHomeDialogData = Data.MyPage.data.MyPageHomeDialogData;
|
|
||||||
if (myPageHomeDialogData.IsEnable)
|
|
||||||
{
|
|
||||||
MyPageHomeDialog.Create(_homeDialogPrefab, myPageHomeDialogData, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator ShowNextNotification(Action onFinish)
|
|
||||||
{
|
|
||||||
while (UIManager.GetInstance().isFading() || UIManager.GetInstance().isOpenDialog())
|
|
||||||
{
|
|
||||||
yield return null;
|
|
||||||
}
|
|
||||||
if (_notificationMask == 0)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
int i;
|
|
||||||
for (i = 0; (_notificationMask & (1 << i)) == 0; i++)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
_notificationMask ^= 1 << i;
|
|
||||||
DialogBase dialogBase = null;
|
|
||||||
if (1 == 0)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
if (_notificationMask != 0 && dialogBase != null)
|
|
||||||
{
|
|
||||||
dialogBase.OnClose = delegate
|
|
||||||
{
|
|
||||||
StartCoroutine(ShowNextNotification(onFinish));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
onFinish.Call();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushGiftButton()
|
|
||||||
{
|
|
||||||
// Pre-Phase-5b: fired MailTopTask via NetworkManager. Headless has no wire tasks;
|
|
||||||
// short-circuit to the success callback so the UI scene-change still fires.
|
|
||||||
OnRequestGift(default(NetworkTask.ResultCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnRequestGift(NetworkTask.ResultCode error)
|
|
||||||
{
|
|
||||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mail);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushMissionButton()
|
|
||||||
{
|
|
||||||
// Pre-Phase-5b: fired MissionInfoTask via NetworkManager. See OnPushGiftButton.
|
|
||||||
OpenMission(default(NetworkTask.ResultCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenMission(NetworkTask.ResultCode error)
|
|
||||||
{
|
|
||||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mission);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateMissionNumber()
|
|
||||||
{
|
|
||||||
if (!(_missionNumberLabel.gameObject == null))
|
|
||||||
{
|
|
||||||
int unreceived_mission_reward_count = Data.MyPage.data.unreceived_mission_reward_count;
|
|
||||||
_missionNumberLabel.gameObject.SetActive(unreceived_mission_reward_count > 0);
|
|
||||||
_missionNumberLabel.text = unreceived_mission_reward_count.ToString();
|
|
||||||
if (unreceived_mission_reward_count > 99)
|
|
||||||
{
|
|
||||||
_missionNumberLabel.text = 99 + "+";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_missionNumberLabel.text = unreceived_mission_reward_count.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushBattlePassButton()
|
|
||||||
{
|
|
||||||
|
|
||||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BattlePass);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushBGCustomButton()
|
|
||||||
{
|
|
||||||
|
|
||||||
MyPageBGCustomDialog.Create(OnDecideMyPageBG);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushHideUIButton()
|
|
||||||
{
|
|
||||||
|
|
||||||
ToggleUIVisible(visible: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushRestoreUIButton()
|
|
||||||
{
|
|
||||||
ToggleUIVisible(visible: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggleUIVisible(bool visible)
|
|
||||||
{
|
|
||||||
GameObject[] hideUIList = _hideUIList;
|
|
||||||
foreach (GameObject gameObject in hideUIList)
|
|
||||||
{
|
|
||||||
if (gameObject != null)
|
|
||||||
{
|
|
||||||
gameObject.SetActive(visible);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
base.Parent.TopBar.gameObject.SetActive(visible);
|
|
||||||
UIManager.GetInstance()._Footer.ShowFooterMenu(visible);
|
|
||||||
_restoreUIButton.gameObject.SetActive(!visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnDecideMyPageBG(MyPageDetail.BGType bgType, string selectId, List<string> randomIdList)
|
|
||||||
{
|
|
||||||
if (bgType == MyPageDetail.BGType.RandomBG)
|
|
||||||
{
|
|
||||||
selectId = DecideRandomBG(randomIdList);
|
|
||||||
}
|
|
||||||
base.Parent.ChangeMyPageBG(bgType, selectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string DecideRandomBG(List<string> randomIdList)
|
|
||||||
{
|
|
||||||
System.Random random = new System.Random();
|
|
||||||
return randomIdList[random.Next(0, randomIdList.Count)];
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPushGuildButton()
|
|
||||||
{
|
|
||||||
|
|
||||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Guild);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateGuildNotification()
|
|
||||||
{
|
|
||||||
_guildNotificationLabel.gameObject?.SetActive(IsGuildNotification());
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsGuildNotification()
|
|
||||||
{
|
|
||||||
GuildNotification guildNotification = Data.MyPageNotifications.data.GuildNotification;
|
|
||||||
if (!guildNotification.GuildId.HasValue)
|
|
||||||
{
|
|
||||||
return guildNotification.IsInvited;
|
|
||||||
}
|
|
||||||
if (guildNotification.GuildId.Value != PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.JOINING_GUILD_ID))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (guildNotification.GuildRoomMessageId.HasValue && guildNotification.GuildRoomMessageId.Value > PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.READ_LATEST_GUILD_CHAT_MESSAGE_ID))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (guildNotification.IsJoinRequest)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetUnreadGiftCount(int count)
|
|
||||||
{
|
|
||||||
if (!(_giftNumberRoot.gameObject == null))
|
|
||||||
{
|
|
||||||
_giftNumberRoot.gameObject.SetActive(count > 0);
|
|
||||||
if (count > 99)
|
|
||||||
{
|
|
||||||
_giftNumber.text = 99 + "+";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_giftNumber.text = count.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HideAndRepositionSubBanner(string click)
|
|
||||||
{
|
|
||||||
_subBanner.HideAndRepositionBanner(click);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user