125 lines
4.2 KiB
C#
125 lines
4.2 KiB
C#
|
|
|||
|
using Cal.DataTable;
|
|||
|
using ET;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
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;
|
|||
|
//!显示第一页内容
|
|||
|
var npcBase = DataTableHelper.Get<NPCBase>(1004);
|
|||
|
//!窗口名字
|
|||
|
ui.m_frame.self.title = npcBase.Name;
|
|||
|
//!对话内容
|
|||
|
ui.m_txtDialog.text = " " + npcBase.Dialog;
|
|||
|
ui.m_taskList.RemoveChildrenToPool();
|
|||
|
|
|||
|
var 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(() =>
|
|||
|
{
|
|||
|
var tip = TipHelper.OpenUI("是否花费20代金券增加一次拾取地图中随机金币的次数?当天有效!", tipType: TipType.Double);
|
|||
|
tip.m_btnYes.self.onClick.Set(async() =>
|
|||
|
{
|
|||
|
var 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(() =>
|
|||
|
{
|
|||
|
var 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;
|
|||
|
}
|
|||
|
var 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()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|