65 lines
1.7 KiB
C#
65 lines
1.7 KiB
C#
using Thousandto.Code.Center;
|
|
using Thousandto.Code.Global;
|
|
|
|
namespace Thousandto.Code.Logic
|
|
{
|
|
public class TeamVoiceLogic : BaseVoiceLogic
|
|
{
|
|
#region//构造函数
|
|
public TeamVoiceLogic() : base(VoiceChannel.Team) { }
|
|
#endregion
|
|
|
|
#region//重写
|
|
protected override void OnInitialize()
|
|
{
|
|
base.OnInitialize();
|
|
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_UITEAMFORM_UPDATE, OnExitTeamHandler);
|
|
}
|
|
|
|
protected override void OnUninitialize()
|
|
{
|
|
base.OnUninitialize();
|
|
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_UITEAMFORM_UPDATE, OnExitTeamHandler);
|
|
}
|
|
|
|
protected override bool OnEnter()
|
|
{
|
|
//如果没有队伍,那么就退出
|
|
if (!GameCenter.LuaSystem.Adaptor.IsTeamExist())
|
|
return false;
|
|
if (LocalPlayerRoot.LocalPlayer == null)
|
|
return false;
|
|
|
|
SystemIsMute = false;
|
|
base.OnEnter();
|
|
base.EnterOfSDK();
|
|
return true;
|
|
}
|
|
//离开
|
|
protected override bool OnExit()
|
|
{
|
|
base.OnExit();
|
|
base.ExitOfSDK();
|
|
return true;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region//私有函数
|
|
//自己被踢出队伍,或者自己离开队伍
|
|
private void OnExitTeamHandler(object obj, object sender)
|
|
{
|
|
if (IsActived)
|
|
{
|
|
if (!GameCenter.LuaSystem.Adaptor.IsTeamExist())
|
|
{
|
|
//这里处理的是直接退出
|
|
Exit();
|
|
ClearUsers();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|