73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
using System;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class GatheringReceiveInfoDialog : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private GatheringRuleView _ruleView;
|
|
|
|
private Action _onReject;
|
|
|
|
private const int ADDITIONAL_DIALOG_DEPTH = 10;
|
|
|
|
public static void Create(GameObject prefab, string id, Action onReject)
|
|
{
|
|
GatheringGetInfoTask task = new GatheringGetInfoTask();
|
|
task.SetParameter(id);
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
|
{
|
|
CreateDialog(prefab, task, onReject);
|
|
}));
|
|
}
|
|
|
|
public static void CreateDialog(GameObject prefab, GatheringGetInfoTask task, Action onReject)
|
|
{
|
|
GatheringInfo info = task.Info;
|
|
DialogBase dialog = UIManager.GetInstance().CreateDialogClose();
|
|
UnityEngine.Object.Instantiate(prefab).GetComponent<GatheringReceiveInfoDialog>().Initialize(info, dialog, onReject);
|
|
}
|
|
|
|
private void Initialize(GatheringInfo info, DialogBase dialog, Action onReject)
|
|
{
|
|
_onReject = onReject;
|
|
SystemText systemText = Data.SystemText;
|
|
dialog.SetObj(base.gameObject);
|
|
dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_RedBtn);
|
|
dialog.SetTitleLabel(systemText.Get("Gathering_Menu_0002"));
|
|
dialog.SetSize(DialogBase.Size.M);
|
|
dialog.SetButtonText(systemText.Get("Gathering_Join_0003"), systemText.Get("Gathering_Join_0004"));
|
|
dialog.onPushButton1 = delegate
|
|
{
|
|
OnClickJoinButton(info);
|
|
};
|
|
dialog.onPushButton2 = delegate
|
|
{
|
|
_onReject.Call();
|
|
};
|
|
_ruleView.SetGatheringInfo(info);
|
|
}
|
|
|
|
private static void OnClickJoinButton(GatheringInfo info)
|
|
{
|
|
if (info.Rule.IsEntryDeckOnly || info.Rule.IsTournament)
|
|
{
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
|
dialogBase.SetButtonText(Data.SystemText.Get("Gathering_0022"));
|
|
dialogBase.SetTitleLabel(Data.SystemText.Get("Gathering_0025"));
|
|
dialogBase.SetText(Data.SystemText.Get("Gathering_Join_0007"));
|
|
dialogBase.onPushButton1 = delegate
|
|
{
|
|
GatheringEntryConfirm.ShowDeckListDialog(info);
|
|
};
|
|
}
|
|
else
|
|
{
|
|
GatheringEntryConfirm.EntryGathering(null, info);
|
|
}
|
|
}
|
|
}
|