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

126 lines
4.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Cal.DataTable;
using ET;
using System;
using System.Collections.Generic;
using FairyGUI;
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;
//!显示第一页内容
NPCBase npcBase = DataTableHelper.Get<NPCBase>(1004);
//!窗口名字
ui.m_frame.self.title = npcBase.Name;
//!对话内容
ui.m_txtDialog.text = " " + npcBase.Dialog;
ui.m_taskList.RemoveChildrenToPool();
GButton btn = ui.m_taskList.AddItemFromPool().asButton;
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(() =>
{
FUI_TipUI tip = TipHelper.OpenUI("是否花费20代金券增加一次拾取地图中随机金币的次数当天有效", tipType: TipType.Double);
tip.m_btnYes.self.onClick.Set(async() =>
{
M2C_AddMapCoinCount ret = await SessionComponent.Instance.Call<M2C_AddMapCoinCount>(new C2M_AddMapCoinCount { });
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
});
});
btn = ui.m_taskList.AddItemFromPool().asButton;
btn.title = "改名";
btn.onClick.Set(() =>
{
FUI_TipUI tip = TipHelper.OpenUI("是否花费1000代金券改名", tipType: TipType.DoubleInput);
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;
}
M2C_ChangeNickName ret = await SessionComponent.Instance.Call<M2C_ChangeNickName>(new C2M_ChangeNickName {name=name });
if (!ret.Message.IsNullOrEmpty())
{
TipHelper.OpenUI(ret.Message);
return;
}
});
});
await ETTask.CompletedTask;
}
public void Destroy()
{
}
}
}