CTT/Unity/Assets/HotfixView/UI/ButlerUI/ButlerUI.cs

126 lines
4.3 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00

using Cal.DataTable;
using ET;
using System;
using System.Collections.Generic;
2021-04-11 19:50:39 +08:00
using FairyGUI;
2021-04-08 20:09:59 +08:00
namespace ET
{
public class ButlerUIAwakeSyatem : AwakeSystem<ButlerUI>
{
public override void Awake(ButlerUI self)
{
self.Awake();
}
}
public class ButlerUIDestroySyatem : DestroySystem<ButlerUI>
{
public override void Destroy(ButlerUI self)
{
self.Destroy();
}
}
public class ButlerUI : Entity
{
public FUI_NPCTaskUI ui;
public void Awake()
{
ui = GetParent<FUI_NPCTaskUI>();
AwakeAsync().Coroutine();
}
private async ETVoid AwakeAsync()
{
//!切换控制器
ui.m_contrl.selectedIndex = 0;
//!显示第一页内容
2021-04-11 19:50:39 +08:00
NPCBase npcBase = DataTableHelper.Get<NPCBase>(1004);
2021-04-08 20:09:59 +08:00
//!窗口名字
ui.m_frame.self.title = npcBase.Name;
//!对话内容
ui.m_txtDialog.text = " " + npcBase.Dialog;
ui.m_taskList.RemoveChildrenToPool();
2021-04-11 19:50:39 +08:00
GButton btn = ui.m_taskList.AddItemFromPool().asButton;
2021-04-08 20:09:59 +08:00
btn.title = "仓库";
btn.onClick.Set(() =>
{
Game.EventSystem.Publish(new ET.EventType.OpenStoreUI
{
zoneScene =ui.ZoneScene(),
}).Coroutine();
});
btn = ui.m_taskList.AddItemFromPool().asButton;
btn.title = "手工";
btn.onClick.Set(() =>
{
Game.EventSystem.Publish(new ET.EventType.OpenManulEquipUI
{
zoneScene = ui.ZoneScene(),
}).Coroutine();
});
btn = ui.m_taskList.AddItemFromPool().asButton;
btn.title = "强化";
btn.onClick.Set(() =>
{
Game.EventSystem.Publish(new ET.EventType.OpenStrengthEquipUI
{
zoneScene = ui.ZoneScene(),
}).Coroutine();
});
btn = ui.m_taskList.AddItemFromPool().asButton;
btn.title = "洗练";
btn.onClick.Set(() =>
{
Game.EventSystem.Publish(new ET.EventType.OpenRefreshEquipUIUI
{
zoneScene = ui.ZoneScene(),
}).Coroutine();
});
btn = ui.m_taskList.AddItemFromPool().asButton;
btn.title = "增加随机地图金币次数";
btn.onClick.Set(() =>
{
2021-04-11 19:50:39 +08:00
FUI_TipUI tip = TipHelper.OpenUI("是否花费20代金券增加一次拾取地图中随机金币的次数当天有效", tipType: TipType.Double);
2021-04-08 20:09:59 +08:00
tip.m_btnYes.self.onClick.Set(async() =>
{
2021-04-11 19:50:39 +08:00
M2C_AddMapCoinCount ret = await SessionComponent.Instance.Call<M2C_AddMapCoinCount>(new C2M_AddMapCoinCount { });
2021-04-08 20:09:59 +08:00
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
});
});
btn = ui.m_taskList.AddItemFromPool().asButton;
btn.title = "改名";
btn.onClick.Set(() =>
{
2021-04-11 19:50:39 +08:00
FUI_TipUI tip = TipHelper.OpenUI("是否花费1000代金券改名", tipType: TipType.DoubleInput);
2021-04-08 20:09:59 +08:00
tip.m_btnYes.self.onClick.Set(async () =>
{
string name = tip.m_IptTxt.text.Trim();
if (name.IsNullOrEmpty()) return;
if (IllegalWordHelper.DetectIllegalWords(name).Count != 0)
{
TipHelper.OpenUI("不能包含违禁字!");
return;
}
2021-04-11 19:50:39 +08:00
M2C_ChangeNickName ret = await SessionComponent.Instance.Call<M2C_ChangeNickName>(new C2M_ChangeNickName {name=name });
2021-04-08 20:09:59 +08:00
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
});
});
await ETTask.CompletedTask;
}
public void Destroy()
{
}
}
}