using Thousandto.Code.Center; using Thousandto.Code.Global; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Thousandto.Code.Logic { /// /// 帮会实时语音逻辑 /// public class GuildVoiceLogic:BaseVoiceLogic { //是否是指挥官模式 private bool _isCommanderModel = false; //麦权状态 private VoiceState _state; #region//属性 //是指挥模式 public bool IsCommanderModel { get { return _isCommanderModel; } set { if (_isCommanderModel != value) { _isCommanderModel = value; if (_isCommanderModel && IsActived) { SystemIsMute = true; } else { SystemIsMute = false; } } } } //当前角色状态 public VoiceState State { get { return _state; } set { _state = value; if (_state == VoiceState.None || _state == VoiceState.Waiting) { SystemIsMute = true; } else { SystemIsMute = false; } } } #endregion #region//构造函数 public GuildVoiceLogic() : base(VoiceChannel.Guild) { } #endregion #region//重写 protected override void OnInitialize() { base.OnInitialize(); GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_GUILD_LEAVE, OnExitGuildHandler); } protected override void OnUninitialize() { base.OnUninitialize(); GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_GUILD_LEAVE, OnExitGuildHandler); } protected override bool OnEnter() { //如果没有帮会,那么就退出 if (!GameCenter.LuaSystem.Adaptor.HasJoinedGuild()) return false; if (LocalPlayerRoot.LocalPlayer == null) return false; ID = LocalPlayerRoot.LocalPlayer.GuildID; if (_isCommanderModel) { SystemIsMute = (_state == VoiceState.Talking); } else { SystemIsMute = false; } base.OnEnter(); base.EnterOfSDK(); return true; } protected override bool OnExit() { base.OnExit(); base.ExitOfSDK(); return true; } #endregion #region//私有函数 //帮会信息改变--比如自己被踢出帮会 private void OnExitGuildHandler(object obj,object sender) { //这里处理的是直接退出 Exit(); ClearUsers(); } #endregion } }