657 lines
26 KiB
C#
657 lines
26 KiB
C#
using ET;
|
||
using FairyGUI;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
namespace ET
|
||
{
|
||
public class MainUIAwakSyatem : AwakeSystem<MainUI>
|
||
{
|
||
public override void Awake(MainUI self)
|
||
{
|
||
self.Awake();
|
||
}
|
||
}
|
||
|
||
public class MainUI : Entity
|
||
{
|
||
public static FUI_MainUI ui;
|
||
private static Dictionary<long, int> unitListIndexDic = new Dictionary<long, int>();
|
||
public void Awake()
|
||
{
|
||
ui = GetParent<FUI_MainUI>();
|
||
AddComponent<MainUIGlobalText>();
|
||
AwakeAsync().Coroutine();
|
||
frameClickMap.UnitInfo = new UnitPosInfo();
|
||
}
|
||
private async ETVoid AwakeAsync()
|
||
{
|
||
//!初始化格子和设置
|
||
await InitMainUISlotAndSetting(ui);
|
||
|
||
//!+聊天相关以及注册事件
|
||
InitChatFunction(ui);
|
||
//!+头像点击事件
|
||
ui.m_mineHeadInfo.m_btn.onRightClick.Set( () =>
|
||
{
|
||
});
|
||
ui.m_txtUID.text = $"uid: {GlobalVariable.MyId}";
|
||
//!+自动战斗
|
||
ui.m_btnAuto.onClick.Set(async () =>
|
||
{
|
||
M2C_AutoBattle ret = await SessionComponent.Instance.Call<M2C_AutoBattle>(new C2M_AutoBattle());
|
||
if (!ret.Message.IsNullOrEmpty())
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
});
|
||
//!隐藏玩家
|
||
ui.m_btnDisOther.onClick.Set(HideUnitComponent.SetDisOther);
|
||
|
||
//!行动值
|
||
ui.m_btnBuyEnergy.self.onClick.Set(async () =>
|
||
{
|
||
|
||
await SessionComponentHelper.TipCall(new C2M_GetAddEnergyPrice { }, (M2C_GetAddEnergyPrice query) =>
|
||
{
|
||
string str = $"是否花费{query.Price / 10000}金币增加[u][b]100[/b][/u]行动值?";
|
||
return (str, new C2M_AddEnergy());
|
||
},
|
||
(M2C_AddEnergy ret) => { }
|
||
);
|
||
});
|
||
//!邮件
|
||
ui.m_btnMail.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.MailUI_Open
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
//!排行榜
|
||
ui.m_btnRank.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.RankingUI_Open
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
//!组队
|
||
ui.m_btnTeam.onClick.Set(async () =>
|
||
{
|
||
await SessionComponentHelper.TipCall(new C2M_GetOpenRemoteStore { }, (M2C_GetOpenRemoteStore query) =>
|
||
{
|
||
string str = $"是否花费{query.Price / 10000}金币打开远程仓库?";
|
||
return (str, new C2M_OpenRemoteStore());
|
||
},
|
||
(M2C_OpenRemoteStore ret) =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenStoreUI
|
||
{
|
||
zoneScene = ui.ZoneScene(),
|
||
ignoreInfo = true
|
||
}).Coroutine();
|
||
}
|
||
);
|
||
|
||
});
|
||
//!退出游戏
|
||
ui.m_btnExit.onClick.Set(() =>
|
||
{
|
||
FUI_TipUI tip = TipHelper.OpenUI("是否退出游戏?", tipType: TipType.Double);
|
||
tip.m_btnYes.self.onClick.Set(ET.Init.Quit);
|
||
});
|
||
//!退出战斗
|
||
ui.m_btnQuitBattle.onClick.Set(() =>
|
||
{
|
||
FUI_TipUI tip = TipHelper.OpenUI("是否退出战斗?", tipType: TipType.Double);
|
||
tip.m_btnYes.self.onClick.Set(() =>
|
||
{
|
||
SessionComponent.Instance.Session.Send(new C2M_QuitBattle());
|
||
});
|
||
});
|
||
//!挂机
|
||
ui.m_btnBattleIdle.onClick.Set(() =>
|
||
{
|
||
if (ui.m_btnBattleIdle.selected)
|
||
{
|
||
BattleHelper.StartBattleIdle((selected) =>
|
||
{
|
||
ui.m_btnBattleIdle.selected = selected;
|
||
});
|
||
}
|
||
else
|
||
{
|
||
BattleHelper.EndBattleIdle((selected) =>
|
||
{
|
||
ui.m_btnBattleIdle.selected = selected;
|
||
}).Coroutine();
|
||
}
|
||
});
|
||
//!查看状态Buff
|
||
ui.m_btnStateBuff.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenMainStoryAIUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
|
||
//!+人物UI
|
||
ui.m_FunctionList.GetChild("人物").asButton.onClick.Set(() =>
|
||
{
|
||
GlobalVariable.IsMineCharacter = true;
|
||
Game.EventSystem.Publish(new ET.EventType.OpenCharacterUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
//!+技能UI
|
||
ui.m_FunctionList.GetChild("技能").asButton.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenSkillUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
//!+背包UI
|
||
ui.m_FunctionList.GetChild("背包").asButton.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenBagUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
//!+任务
|
||
ui.m_FunctionList.GetChild("任务").asButton.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.TaskUI_Open
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
ui.m_FunctionList.GetChild("社交").asButton.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenFriendUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
ui.m_FunctionList.GetChild("宠物").asButton.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenPetUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
ui.m_FunctionList.GetChild("商城").asButton.onClick.Set(() =>
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.OpenMarketUI
|
||
{
|
||
zoneScene = ui.ZoneScene()
|
||
}).Coroutine();
|
||
});
|
||
}
|
||
|
||
private static async ETTask InitMainUISlotAndSetting(FUI_MainUI ui)
|
||
{
|
||
M2C_GetMainUISetting m2cGetMainUISetting = await SessionComponent.Instance.Call<M2C_GetMainUISetting>(new C2M_GetMainUISetting());
|
||
ui.m_btnAuto.selected = m2cGetMainUISetting.IsAutoSkill;
|
||
ui.m_btnDisOther.selected = m2cGetMainUISetting.IsDisplayOthers;
|
||
//!初始化格子
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.UpdateMainUISlot
|
||
{
|
||
list = m2cGetMainUISetting.MainUISlotList
|
||
}).Coroutine();
|
||
}
|
||
//!设置格子事件
|
||
{
|
||
int slotCount = ui.m_mainUISlotList.numChildren;
|
||
for (int i = 0; i < slotCount; i++)
|
||
{
|
||
int index = i;
|
||
GButton btn = ui.m_mainUISlotList.GetChildAt(i).asButton;
|
||
//!放入事件
|
||
btn.onDrop.Set1(async content =>
|
||
{
|
||
if (content.data is UIDragArgs args)
|
||
{
|
||
int btnIndex = args.index;
|
||
//!放入道具
|
||
if (args.uiType == UIDragArgs.UIType.Bag)
|
||
{
|
||
if (ClientItemDataComponent.Instance.ItemDic.TryGetValueByKey1(btnIndex, out ClientItemData data))
|
||
{
|
||
if (data.ItemType != ItemType.GoodsItem)
|
||
{
|
||
TipHelper.OpenUI("只能放入道具,请重新拖拽!");
|
||
return;
|
||
}
|
||
}
|
||
M2C_DropItem ret = await SessionComponent.Instance.Call<M2C_DropItem>(new C2M_DropItem() { SlotId = index, BagIndex = btnIndex });
|
||
if (ret.Message.IsNullOrEmpty())
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.UpdateMainUISlot
|
||
{
|
||
list = ret.MainUISlotList
|
||
}).Coroutine();
|
||
}
|
||
else
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
//!放入技能
|
||
if (args.uiType == UIDragArgs.UIType.Skill)
|
||
{
|
||
int skillId = args.index;
|
||
if (skillId == 0)
|
||
{
|
||
Log.Error($"skill Id == 0 when drop the skill into the slot if main ui!");
|
||
return;
|
||
}
|
||
//item.icon = DragDropManager.inst.dragAgent.icon;
|
||
//var skilldata = skillitemUI.GetComponent<ClientSkillData>();
|
||
M2C_DropSkill ret = await SessionComponent.Instance.Call<M2C_DropSkill>(new C2M_DropSkill() { SkillId = skillId, SlotId = index });
|
||
if (ret.Message.IsNullOrEmpty())
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.UpdateMainUISlot
|
||
{
|
||
list = ret.MainUISlotList
|
||
}).Coroutine();
|
||
}
|
||
else
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
}
|
||
args.Release();
|
||
|
||
}
|
||
});
|
||
//!取下事件
|
||
btn.onRightClick.Set1(async content =>
|
||
{
|
||
//!取下技能
|
||
MainUISlot mainUISlot = MainUISlotComponent.Instance.Get(index);
|
||
if (mainUISlot.MainUIType == MainUIType.SkillSlot)
|
||
{
|
||
M2C_DropSkill ret = await SessionComponent.Instance.Call<M2C_DropSkill>(new C2M_DropSkill() { SlotId = index });
|
||
if (ret.Message.IsNullOrEmpty())
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.UpdateMainUISlot
|
||
{
|
||
list = ret.MainUISlotList
|
||
}).Coroutine();
|
||
}
|
||
else
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
return;
|
||
}
|
||
//!取下道具
|
||
{
|
||
M2C_DropItem ret = await SessionComponent.Instance.Call<M2C_DropItem>(new C2M_DropItem() { SlotId = index, BagIndex = -1 });
|
||
if (ret.Message.IsNullOrEmpty())
|
||
{
|
||
Game.EventSystem.Publish(new ET.EventType.UpdateMainUISlot
|
||
{
|
||
list = ret.MainUISlotList
|
||
}).Coroutine();
|
||
}
|
||
else
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
}
|
||
return;
|
||
|
||
});
|
||
//!点击事件
|
||
btn.onClick.Set1(async content =>
|
||
{
|
||
MainUISlot mainUISlot = MainUISlotComponent.Instance.Get(index);
|
||
if (mainUISlot.MainUIType == MainUIType.SkillSlot)
|
||
{
|
||
M2C_UseMainUISkill ret = await SessionComponent.Instance.Call<M2C_UseMainUISkill>(new C2M_UseMainUISkill() { SlotId = index });
|
||
if (!ret.Message.IsNullOrEmpty())
|
||
{
|
||
//TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
M2C_UseMainUIGoods ret = await SessionComponent.Instance.Call<M2C_UseMainUIGoods>(new C2M_UseMainUIGoods() { SlotId = index });
|
||
if (!ret.Message.IsNullOrEmpty())
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
Game.EventSystem.Publish_Sync(new ET.EventType.UpdateBagUI
|
||
{
|
||
list=ret.BagMapList
|
||
});
|
||
Game.EventSystem.Publish(new ET.EventType.UpdateMainUISlot
|
||
{
|
||
list = ret.MainUISlotList
|
||
}).Coroutine();
|
||
return;
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
private static ChatContiator chatContiator;
|
||
private static ChatType chatType;
|
||
private static long tagetChatId;
|
||
|
||
public static ChatContiator GetChatContiator => chatContiator = chatContiator ?? new ChatContiator();
|
||
public static FUI_LabelGlobalText GlobalText => ui?.m_txtGlobal;
|
||
public class ChatContiator
|
||
{
|
||
private readonly List<(ChatType, string, string, string)> contentList;
|
||
|
||
private const int MaxContentCount = 100;
|
||
|
||
private GList gList;
|
||
public ChatContiator()
|
||
{
|
||
contentList = new List<(ChatType, string, string, string)>();
|
||
}
|
||
|
||
public void InitChatContentList(GList gList)
|
||
{
|
||
this.gList = gList;
|
||
gList.SetVirtual();
|
||
gList.itemRenderer = ListItemRender;
|
||
}
|
||
|
||
public void Add(ChatType chatType, string senderName, string content)
|
||
{
|
||
if (contentList.Count >= MaxContentCount)
|
||
{
|
||
contentList.RemoveAt(0);
|
||
}
|
||
contentList.Add((chatType, $"{DateTime.Now:HH:mm:ss}", senderName, content));
|
||
ShowChatContentList();
|
||
}
|
||
public void Refresh(ChatType _chatType = ChatType.NoneChat)
|
||
{
|
||
contentList.Clear();
|
||
var dic = ChatMessageComponent.Instance.messageDic;
|
||
if(dic.TryGetValue(chatType,out var list))
|
||
{
|
||
foreach (ChatMessageComponent.MessageInfo item in list)
|
||
{
|
||
contentList.Add((chatType,item.time, item.name, item.content));
|
||
}
|
||
}
|
||
ShowChatContentList();
|
||
if(_chatType!= ChatType.NoneChat && chatType!= _chatType)
|
||
{
|
||
SwitchRedPoint((int)(_chatType - 1), true);
|
||
}
|
||
}
|
||
|
||
private void ShowChatContentList()
|
||
{
|
||
gList.numItems = contentList.Count;
|
||
gList.RefreshVirtualList();
|
||
//!强制展示
|
||
ForceShowChatBoard();
|
||
gList.ScrollToView(gList.numItems - 1, true);
|
||
}
|
||
private void ListItemRender(int index, GObject item)
|
||
{
|
||
FUI_LabelChatItem labelItem = FUI_LabelChatItem.GetFormPool(ui, item);
|
||
(ChatType chatType, string time, string senderName, string content) = contentList[index];
|
||
labelItem.m_txtType.text = $"[color={GetStrColorByChatType(chatType)}][{GetStrByChatType(chatType)} {time}][/color]";
|
||
labelItem.m_txtContent.text = $"[color=#ff9900][u]{senderName}[/u]:[/color]{content}";
|
||
}
|
||
|
||
}
|
||
private enum ChatBoardState { Short, High, None }
|
||
|
||
private static ChatBoardState chatBoardState;
|
||
private static void SwitchRedPoint(int index,bool value)
|
||
{
|
||
ui.m_chatList.GetChildAt(index).asButton.GetChild("imgCicle").visible = value;
|
||
}
|
||
private static void InitChatFunction(FUI_MainUI ui)
|
||
{
|
||
GetChatContiator.InitChatContentList(ui.m_chatContentList);
|
||
chatType = ChatType.Normal;
|
||
chatBoardState = ChatBoardState.Short;
|
||
//!初始化
|
||
ui.m_txtChatType.text = GetStrByChatType(chatType);
|
||
ui.m_chatList.selectedIndex = 0;
|
||
ui.m_chat.selectedIndex = (int)chatBoardState;
|
||
//!频道选择
|
||
ui.m_chatList.onClickItem.Set(() =>
|
||
{
|
||
chatType = (ChatType)ui.m_chatList.selectedIndex + 1;
|
||
ui.m_txtChatType.text = GetStrByChatType(chatType);
|
||
tagetChatId = 0;
|
||
GetChatContiator.Refresh();
|
||
SwitchRedPoint((int)(chatType - 1), false);
|
||
});
|
||
//!展示聊天版按钮
|
||
ui.m_btnChatReceive.onClick.Set(() =>
|
||
{
|
||
int value = (int)chatBoardState;
|
||
value++;
|
||
if (value > (int)ChatBoardState.None)
|
||
{
|
||
value = 0;
|
||
}
|
||
chatBoardState = (ChatBoardState)value;
|
||
ui.m_chat.selectedIndex = value;
|
||
if (chatBoardState != ChatBoardState.None)
|
||
ui.m_chatContentList.ScrollToView(ui.m_chatContentList.numItems - 1, true);
|
||
});
|
||
//!发送按钮
|
||
ui.m_btnChatSend.onClick.Set(SendChat);
|
||
//!回车发送
|
||
ui.m_inptChatContent.onSubmit.Set(SendChat);
|
||
|
||
async void SendChat()
|
||
{
|
||
if (chatType == ChatType.System) return;
|
||
if (chatType == ChatType.Private && tagetChatId==0) return;
|
||
string content = ui.m_inptChatContent.text;
|
||
if (ui.m_inptChatContent.text.IsNullOrEmpty()) return;
|
||
//!过滤非法字符
|
||
content = IllegalWordHelper.Filter(content);
|
||
|
||
M2C_RequestChat ret = await SessionComponent.Instance.Call<M2C_RequestChat>(new C2M_RequestChat { Type = chatType, Content = content, Id = tagetChatId });
|
||
if (!ret.Message.IsNullOrEmpty())
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
return;
|
||
}
|
||
ui.m_inptChatContent.text = null;
|
||
ClientUnitCharacter clientCharacter = ClientUnitCharacterComponent.Instance.Get(GlobalVariable.MyId);
|
||
ChatMessageComponent.Instance.Add(new ChatMessageComponent.MessageInfo
|
||
{
|
||
name = clientCharacter.NickName,
|
||
type = chatType,
|
||
content = content,
|
||
time = $"{DateTime.Now:HH:mm:ss}"
|
||
});
|
||
GetChatContiator.Refresh();
|
||
}
|
||
}
|
||
private static void ForceShowChatBoard()
|
||
{
|
||
if (chatBoardState == ChatBoardState.High) return;
|
||
chatBoardState = ChatBoardState.Short;
|
||
ui.m_chat.selectedIndex = (int)chatBoardState;
|
||
}
|
||
private static string GetStrByChatType(ChatType chatType)
|
||
{
|
||
switch (chatType)
|
||
{
|
||
default:
|
||
case ChatType.Normal:
|
||
return "普通";
|
||
case ChatType.Team:
|
||
return "组队";
|
||
case ChatType.Family:
|
||
return "家族";
|
||
case ChatType.Camp:
|
||
return "阵营";
|
||
case ChatType.World:
|
||
return "世界";
|
||
case ChatType.Private:
|
||
return "私聊";
|
||
case ChatType.System:
|
||
return "系统";
|
||
}
|
||
}
|
||
private static string GetStrColorByChatType(ChatType chatType)
|
||
{
|
||
switch (chatType)
|
||
{
|
||
default:
|
||
case ChatType.Normal:
|
||
return "#FFFFFF";
|
||
case ChatType.Team:
|
||
return "#0000FF";
|
||
case ChatType.Family:
|
||
return "#00FF00";
|
||
case ChatType.Camp:
|
||
return "#FFFF00";
|
||
case ChatType.World:
|
||
return "#00FFFF";
|
||
case ChatType.Private:
|
||
return "#FF00FF";
|
||
case ChatType.System:
|
||
return "#990000";
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 私聊
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
public static void PrivateChat(long id)
|
||
{
|
||
chatType = ChatType.Private;
|
||
tagetChatId = id;
|
||
ui.m_txtChatType.text = GetStrByChatType(chatType);
|
||
ui.m_inptChatContent.RequestFocus();
|
||
}
|
||
public static void ChangeEnergy(int energy)
|
||
{
|
||
ui.m_txtEnergy.text = energy + string.Empty;
|
||
}
|
||
private static Frame_ClickMap frameClickMap = new Frame_ClickMap();
|
||
public static void ClearUnitList()
|
||
{
|
||
unitListIndexDic.Clear();
|
||
ui.m_unitNameList.RemoveChildrenToPool();
|
||
}
|
||
|
||
public static void AddUnit(long id, string job, string name)
|
||
{
|
||
GButton btn = ui.m_unitNameList.AddItemFromPool().asButton;
|
||
btn.title = $"{job} {name}";
|
||
unitListIndexDic[id] = ui.m_unitNameList.GetChildIndex(btn);
|
||
btn.onClick.Set1(async context =>
|
||
{
|
||
try
|
||
{
|
||
long unitId = id;
|
||
if (unitId == GlobalVariable.MyId) return;
|
||
Unit unit = UnitComponent.Instance.Get(unitId);
|
||
if (context.inputEvent.isDoubleClick)
|
||
{
|
||
if (unit.UnitType == UnitType.NPC)
|
||
{
|
||
M2C_ClickNPC ret = await SessionComponent.Instance.Call<M2C_ClickNPC>(new C2M_ClickNPC() { NPCId = unit.ConfigId });
|
||
if (!ret.Message.IsNullOrEmpty())
|
||
{
|
||
TipHelper.OpenUI(ret.Message);
|
||
}
|
||
}
|
||
else
|
||
if (unit.UnitType == UnitType.TransPoint)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
GlobalVariable.SelectUnitId = unitId;
|
||
Game.EventSystem.Publish(new ET.EventType.ClickOtherPlayer
|
||
{
|
||
|
||
}).Coroutine();
|
||
}
|
||
return;
|
||
}
|
||
Vector3 pos = unit.Position;
|
||
|
||
if (!unit.IsFight)
|
||
{
|
||
frameClickMap.UnitInfo.X = pos.x;
|
||
frameClickMap.UnitInfo.Y = pos.y;
|
||
frameClickMap.UnitInfo.YAngle = pos.x >= unit.Position.x ? 0 : 180;
|
||
SessionComponent.Instance.Session.Send(frameClickMap);
|
||
}
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
Log.Error(e);
|
||
}
|
||
});
|
||
}
|
||
public static void RemoveUnit(long id)
|
||
{
|
||
if (!unitListIndexDic.TryGetValue(id, out int index))
|
||
{
|
||
Log.Error($"dic not has the key = {id}");
|
||
return;
|
||
}
|
||
if (index == -1)
|
||
{
|
||
Log.Error($"index==-1 where id = {id}");
|
||
return;
|
||
}
|
||
unitListIndexDic.Remove(id);
|
||
ui.m_unitNameList.RemoveChildToPoolAt(index);
|
||
}
|
||
|
||
public static void ChangePing(int ping)
|
||
{
|
||
if (ui)
|
||
ui.m_txtPing.text = $"ping:{ping}";
|
||
}
|
||
}
|
||
#region 测试日志
|
||
#if TEST
|
||
public static class Test
|
||
{
|
||
public static void Log(string msg)
|
||
{
|
||
MainUI.GetChatContiator.Add(ChatType.System, "本地", msg);
|
||
}
|
||
}
|
||
|
||
#endif
|
||
#endregion
|
||
|
||
}
|