2021-04-08 20:09:59 +08:00
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using ET;
|
|
|
|
|
using FairyGUI;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class QuestUIAwakeSyatem : AwakeSystem<Quest1UI>
|
|
|
|
|
{
|
|
|
|
|
public override void Awake(Quest1UI self)
|
|
|
|
|
{
|
|
|
|
|
self.Awake();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class QuestUIStartSyatem : StartSystem<Quest1UI>
|
|
|
|
|
{
|
|
|
|
|
public override void Start(Quest1UI self)
|
|
|
|
|
{
|
|
|
|
|
self.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class QuestUIDestroySyatem : DestroySystem<Quest1UI>
|
|
|
|
|
{
|
|
|
|
|
public override void Destroy(Quest1UI self)
|
|
|
|
|
{
|
|
|
|
|
self.Destroy();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class Quest1UI : Entity
|
|
|
|
|
{
|
|
|
|
|
private FUI_Quest1UI ui;
|
|
|
|
|
public int cardCount;
|
2021-04-20 00:25:04 +08:00
|
|
|
|
private Scene zoneScene;
|
|
|
|
|
|
2021-04-08 20:09:59 +08:00
|
|
|
|
public void Awake()
|
|
|
|
|
{
|
|
|
|
|
ui = GetParent<FUI_Quest1UI>();
|
|
|
|
|
}
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
AwakeAsync().Coroutine();
|
|
|
|
|
}
|
|
|
|
|
private async ETVoid AwakeAsync()
|
|
|
|
|
{
|
2021-04-20 00:25:04 +08:00
|
|
|
|
zoneScene = this.ZoneScene();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
ui.m_btnStart.onClick.Set(StartAnswer);
|
|
|
|
|
ui.m_btnRank.onClick.Set(GetScordRank);
|
|
|
|
|
ui.m_txtCardCount.text = string.Empty + cardCount;
|
|
|
|
|
ui.m_btnTrans.self.onClick.Set(TransLevel);
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void TransLevel()
|
|
|
|
|
{
|
2021-04-20 00:25:04 +08:00
|
|
|
|
M2C_TransLevel ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_TransLevel>(new C2M_TransLevel { });
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
TipHelper.OpenUI(ret.Message);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void StartAnswer()
|
|
|
|
|
{
|
2021-04-20 00:25:04 +08:00
|
|
|
|
M2C_StartAnswerQuest ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_StartAnswerQuest>(new C2M_StartAnswerQuest { });
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
TipHelper.OpenUI(ret.Message);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Game.EventSystem.Publish(new ET.EventType.Quest_Answer_Open
|
|
|
|
|
{
|
|
|
|
|
zoneScene = ui.ZoneScene(),
|
|
|
|
|
configId = ret.ConfigId
|
|
|
|
|
}).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
private async void GetScordRank()
|
|
|
|
|
{
|
2021-04-20 00:25:04 +08:00
|
|
|
|
M2C_GetQuestScordInfo ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_GetQuestScordInfo>(new C2M_GetQuestScordInfo { });
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if (!ret.Message.IsNullOrEmpty())
|
|
|
|
|
{
|
|
|
|
|
TipHelper.OpenUI(ret.Message);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Game.EventSystem.Publish(new ET.EventType.Quest_Rank_Open
|
|
|
|
|
{
|
|
|
|
|
zoneScene = ui.ZoneScene(),
|
|
|
|
|
list = ret.InfoList
|
|
|
|
|
}).Coroutine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Destroy()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|