Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
159 lines
4.2 KiB
C#
159 lines
4.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
|
|
public abstract class ArenaEntryBase : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
protected GameObject ArenaEntryDialog;
|
|
|
|
[SerializeField]
|
|
protected GameObject CompetitionEntryDialog;
|
|
|
|
[SerializeField]
|
|
protected UIButton ButtonEntry;
|
|
|
|
[SerializeField]
|
|
protected UIButton ButtonResume;
|
|
|
|
[SerializeField]
|
|
protected GameObject HeadLineObject;
|
|
|
|
private UIWidget[] _headlineWidgetArray;
|
|
|
|
private Color[] _headlineWidgetDefaultColorArray;
|
|
|
|
private Coroutine _initCoroutine;
|
|
|
|
protected bool _isFreeEntry;
|
|
|
|
protected bool _isCompetition;
|
|
|
|
protected string[] _labelsText;
|
|
|
|
protected string _entryDialogTitleText;
|
|
|
|
protected Action _initFunc;
|
|
|
|
protected Action _resumeFunc;
|
|
|
|
protected Func<bool> _isJoinFunc;
|
|
|
|
protected Action _freeEntryFunc;
|
|
|
|
protected Action _freeBattleFunc;
|
|
|
|
protected Func<bool> _isFreeBattleCompetition;
|
|
|
|
protected Action _entryFunc;
|
|
|
|
private const float GLAY_SCALE = 0.33f;
|
|
|
|
protected abstract void EntryDialogCreate(GameObject inDialog);
|
|
|
|
protected virtual void EntryBaseInit(GameObject costRootObject)
|
|
{
|
|
_headlineWidgetArray = costRootObject.transform.GetComponentsInChildren<UIWidget>();
|
|
_headlineWidgetDefaultColorArray = new Color[_headlineWidgetArray.Length];
|
|
for (int i = 0; i < _headlineWidgetArray.Length; i++)
|
|
{
|
|
_headlineWidgetDefaultColorArray[i] = _headlineWidgetArray[i].color;
|
|
}
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
UpdateMenu();
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (_initCoroutine != null)
|
|
{
|
|
StopCoroutine(_initCoroutine);
|
|
}
|
|
}
|
|
|
|
public void UpdateMenu()
|
|
{
|
|
_initCoroutine = UIManager.GetInstance().StartCoroutine(_InitCoroutine());
|
|
}
|
|
|
|
protected virtual IEnumerator _InitCoroutine()
|
|
{
|
|
while (!MyPageMenu.IsMyPageRequestEnd)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (_initFunc != null)
|
|
{
|
|
_initFunc();
|
|
}
|
|
ButtonEntry.onClick.Clear();
|
|
ButtonEntry.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
|
if (_entryFunc != null)
|
|
{
|
|
_entryFunc();
|
|
}
|
|
else if (_isFreeEntry)
|
|
{
|
|
_freeEntryFunc();
|
|
}
|
|
else
|
|
{
|
|
DialogBase.Size size = ((Data.ArenaData.CompetitionData.CostType != ArenaCompetition.EntryCostType.EntryWithCost) ? DialogBase.Size.M : DialogBase.Size.XL);
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase.SetSize(size);
|
|
dialogBase.SetTitleLabel(_entryDialogTitleText);
|
|
GameObject gameObject = UnityEngine.Object.Instantiate(_isCompetition ? CompetitionEntryDialog : ArenaEntryDialog);
|
|
EntryDialogCreate(gameObject);
|
|
if (_isCompetition && Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithCost)
|
|
{
|
|
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID, Data.ArenaData.CompetitionData.CompetitionId);
|
|
Data.MyPageNotifications.data.IsCompetitionBadge = false;
|
|
UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon();
|
|
UpdateCompetitionEntryBadge();
|
|
}
|
|
gameObject.GetComponent<ArenaEntryDialogBase>().ParentDialog = dialogBase;
|
|
dialogBase.SetObj(gameObject.gameObject);
|
|
DialogBase.ButtonLayout buttonLayout = DialogBase.ButtonLayout.CloseBtn;
|
|
dialogBase.SetButtonLayout(buttonLayout);
|
|
}
|
|
}));
|
|
ButtonResume.onClick.Clear();
|
|
ButtonResume.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
_resumeFunc();
|
|
}));
|
|
UpdateEntryResumeButton();
|
|
}
|
|
|
|
protected virtual void UpdateCompetitionEntryBadge()
|
|
{
|
|
}
|
|
|
|
protected virtual void UpdateEntryResumeButton()
|
|
{
|
|
bool flag = _isJoinFunc();
|
|
ButtonEntry.gameObject.SetActive(!flag);
|
|
ButtonResume.gameObject.SetActive(flag);
|
|
if (flag)
|
|
{
|
|
for (int i = 0; i < _headlineWidgetArray.Length; i++)
|
|
{
|
|
_headlineWidgetArray[i].color = new Color(_headlineWidgetDefaultColorArray[i].r * 0.33f, _headlineWidgetDefaultColorArray[i].g * 0.33f, _headlineWidgetDefaultColorArray[i].b * 0.33f, 255f);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int j = 0; j < _headlineWidgetArray.Length; j++)
|
|
{
|
|
_headlineWidgetArray[j].color = _headlineWidgetDefaultColorArray[j];
|
|
}
|
|
}
|
|
}
|
|
}
|