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

82 lines
2.5 KiB
C#

using Cal.DataTable;
using ET;
using System;
using System.Collections.Generic;
using FairyGUI;
namespace ET
{
public class PvpBoardUIAwakeSyatem : AwakeSystem<PvpBoardUI>
{
public override void Awake(PvpBoardUI self)
{
self.Awake();
}
}
public class PvpBoardUIDestroySyatem : DestroySystem<PvpBoardUI>
{
public override void Destroy(PvpBoardUI self)
{
self.Destroy();
}
}
public class PvpBoardUI : Entity
{
public FUI_PvpBoardUI ui;
private Scene zoneScene;
public void Awake()
{
zoneScene = this.ZoneScene();
ui = GetParent<FUI_PvpBoardUI>();
AwakeAsync().Coroutine();
}
private async ETVoid AwakeAsync()
{
M2C_GetPvpBoardInfo ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_GetPvpBoardInfo>(new C2M_GetPvpBoardInfo { });
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
ui.m_txtScord.text = "积分:"+ret.scord;
ui.m_txtMatchCount.text = "当前匹配人数:"+ret.matchCount;
ui.m_txtBattleCount.text = $"战斗次数:{ret.battleCount}/100";
ui.m_btnMatch.Visible = !ret.isMatch;
ui.m_btnMatch.self.onClick.Set(() =>
{
OnReQestMathch().Coroutine();
});
ui.m_list.RemoveChildrenToPool();
int rank = 0;
foreach (PvpRankInfo item in ret.rankList)
{
GObject go = ui.m_list.AddItemFromPool();
FUI_LabelPvpRankItem label = FUI_LabelPvpRankItem.GetFormPool(ui.DomainScene(),go);
label.m_txtRank.text = ++rank + string.Empty;
label.m_txtName.text = item.name;
label.m_txtLevel.text = item.level+string.Empty;
label.m_txtScord.text = item.scord+string.Empty;
}
await ETTask.CompletedTask;
}
private async ETVoid OnReQestMathch()
{
ui.m_btnMatch.Visible = false;
M2C_RequestPersonalPvp ret = await zoneScene.GetComponent<SessionComponent>().Call<M2C_RequestPersonalPvp>(new C2M_RequestPersonalPvp { });
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
}
public void Destroy()
{
}
}
}