zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/UI/MainStoryAIUI/MainStoryAIUI.cs

86 lines
2.2 KiB
C#

using Cal.DataTable;
using ET.EventType;
using ET;
using FairyGUI;
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using System.Text;
namespace ET
{
public class MainStoryAIUIAwakeSyatem : AwakeSystem<MainStoryAIUI>
{
public override void Awake(MainStoryAIUI self)
{
self.Awake();
}
}
public class MainStoryAIUIDestroySyatem : DestroySystem<MainStoryAIUI>
{
public override void Destroy(MainStoryAIUI self)
{
self.Destroy();
}
}
public class MainStoryAIUI : Entity
{
public FUI_MainStoryAIUI ui;
private Scene zoneScene;
private enum AutoBattleAIType{MainStory,StarSoul}
private AutoBattleAIType type;
public void Awake()
{
AwakeAsync().Coroutine();
}
private async ETVoid AwakeAsync()
{
zoneScene = this.ZoneScene();
ui = GetParent<FUI_MainStoryAIUI>();
Register();
Load();
await ETTask.CompletedTask;
}
private void Register()
{
this.ui.m_comBoxType.self.onChanged.Set(() =>
{
type = (AutoBattleAIType) this.ui.m_comBoxType.self.selectedIndex;
});
ui.m_btnStart.self.onClick.Set(async() =>
{
M2C_StartMainStoryAI ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartMainStoryAI>(new C2M_StartMainStoryAI { Index = (int) this.type });
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
});
ui.m_btnEnd.self.onClick.Set(async() =>
{
M2C_EndMainStoryAI ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_EndMainStoryAI>(new C2M_EndMainStoryAI());
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
});
}
private void Load()
{
}
public void Destroy()
{
}
}
}