2021-04-08 20:09:59 +08:00
|
|
|
|
using ET;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public static class BattleHelper
|
|
|
|
|
{
|
2021-04-20 00:25:04 +08:00
|
|
|
|
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;
|
2021-04-20 00:25:04 +08:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-20 00:25:04 +08:00
|
|
|
|
public static async ETVoid EndBattleIdle(Scene zoneScene, Action<bool> setBtnSelected)
|
2021-04-08 20:09:59 +08:00
|
|
|
|
{
|
2021-04-20 00:25:04 +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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|