54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using ET;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ET
|
|
{
|
|
public static class BattleHelper
|
|
{
|
|
public static void StartBattleIdle(Action<bool> setBtnSelected)
|
|
{
|
|
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 SessionComponent.Instance.Call<M2C_StartBattleIdleFight>(new C2M_StartBattleIdleFight { SceneId = sceneId });
|
|
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(Action<bool> setBtnSelected)
|
|
{
|
|
M2C_EndBattleIdleFight ret = await SessionComponent.Instance.Call<M2C_EndBattleIdleFight>(new C2M_EndBattleIdleFight());
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
{
|
|
setBtnSelected?.Invoke(false);
|
|
Game.EventSystem.Publish(new ET.EventType.ShowTipUI
|
|
{
|
|
tip = ret.Message,
|
|
}).Coroutine();
|
|
return;
|
|
}
|
|
setBtnSelected?.Invoke(true);
|
|
}
|
|
}
|
|
}
|