zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/Hotfix/Logic/Behaviour/Game/Helper/BattleHelper.cs

54 lines
1.9 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET;
using System;
using System.Collections.Generic;
namespace ET
{
public static class BattleHelper
{
public static void StartBattleIdle(Scene zoneScene, Action<bool> setBtnSelected)
2021-04-08 20:09:59 +08:00
{
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
{
tip = "请输入要挂机的章节:",
isClearIpt = true,
tipType = TipType.DoubleInput,
okAction = async (txt) =>
{
if (!int.TryParse(txt, out int sceneId))
{
return;
}
if (sceneId <= 0) return;
M2C_StartBattleIdleFight ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartBattleIdleFight>(new C2M_StartBattleIdleFight { SceneId = sceneId });
2021-04-08 20:09:59 +08:00
if (!ret.Message.IsNullOrEmpty())
{
setBtnSelected?.Invoke(false);
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
{
tip = ret.Message,
}).Coroutine();
return;
}
setBtnSelected?.Invoke(true);
}
}).Coroutine();
}
public static async ETVoid EndBattleIdle(Scene zoneScene, Action<bool> setBtnSelected)
2021-04-08 20:09:59 +08:00
{
M2C_EndBattleIdleFight ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_EndBattleIdleFight>(new C2M_EndBattleIdleFight());
2021-04-08 20:09:59 +08:00
if (!ret.Message.IsNullOrEmpty())
{
setBtnSelected?.Invoke(false);
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
{
tip = ret.Message,
}).Coroutine();
return;
}
setBtnSelected?.Invoke(true);
}
}
}