/// <summary> /// Broadcasts an event with data for specified eventType. /// EType is the enum to cast eventType into. /// </summary> public void Broadcast <EType> (int eventType, EventData eventData, GameObject sender = null) { if (typeof(EType) == typeof(EventType_Updates)) { _updateEventSystem.Broadcast((EventType_Updates)eventType, (eventData as EventData_Updates), sender); } else if (typeof(EType) == typeof(EventType_UI)) { _uiEventSystem.Broadcast((EventType_UI)eventType, (eventData as EventData_UI), sender); } else if (typeof(EType) == typeof(EventType_Gameplay)) { _gameplayEventSystem.Broadcast((EventType_Gameplay)eventType, (eventData as EventData_Gameplay), sender); } else if (typeof(EType) == typeof(EventType_Trigger)) { _triggerEventSystem.Broadcast((EventType_Trigger)eventType, (eventData as EventData_Trigger), sender); } else if (typeof(EType) == typeof(EventType_Collision)) { _collisionEventSystem.Broadcast((EventType_Collision)eventType, (eventData as EventData_Collision), sender); } }
public void Exit() { EventSystem.RemoveListener <GSToGC.UserBaseInfo>(EGameEvent.OnReceiveUserBaseInfo, OnReceiveUserBaseInfo); EventSystem.Broadcast(EGameEvent.HideLoginView); GameObject.DestroyImmediate(mSceneRoot); }
public void Exit() { EventSystem.Broadcast(EGameEvent.HideGamePlayView); EventSystem.RemoveListener <GSToGC.GOAppear>(EGameEvent.OnReceiveGameObjectAppear, OnReceiveGameObjectAppear); EventSystem.RemoveListener <GSToGC.RunningState>(EGameEvent.OnReceiveGameObjectRunState, OnReceiveGameObjectRunState); EventSystem.RemoveListener <GSToGC.FreeState>(EGameEvent.OnReceiveGameObjectFreeState, OnReceiveGameObjectFreeState); }
public void OnNotifySkillModelRange(Stream stream) { GSToGC.RangeEffect msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveSkillModelRange, msg); }
public void OnNotifyReleaseSkill(Stream stream) { GSToGC.ReleasingSkillState msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveGameObjectReleaseSkill, msg); }
public void OnNotifyGameObjectFreeState(Stream stream) { GSToGC.FreeState msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveGameObjectFreeState, msg); }
public void OnNotifyGameObjectAppear(Stream stream) { GSToGC.GOAppear msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveGameObjectAppear, msg); }
public void OnNotifyHeroList(Stream stream) { GSToGC.HeroList msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveHeroList, msg); }
public void OnNetNotifyBattleStateChange(Stream stream) { GSToGC.BattleStateChange msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveBattleStateChange, msg); }
public void OnNotifyBattleSeatPosInfo(Stream stream) { GSToGC.BattleSeatPosInfo msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveBattleSeatPosInfo, msg); }
public void OnNotifyUserBaseInfo(Stream stream) { GSToGC.UserBaseInfo msg; if (!ParseProto(out msg, stream)) { return; } EventSystem.Broadcast(EGameEvent.OnReceiveUserBaseInfo, msg); }
// 连接到Gate Server成功回调 public void OnConnectGSSuccess() { NetworkManager.Instance.OnConnectServerSuccess -= OnConnectGSSuccess; MessageCenter.Instance.AskLoginToGateServer(); // TalkGame初始化 EventSystem.Broadcast(EGameEvent.OnConnectGateServerSuccess); }
public void Enter() { EventSystem.AddListener <GSToGC.GOAppear>(EGameEvent.OnReceiveGameObjectAppear, OnReceiveGameObjectAppear); MessageCenter.Instance.AskSceneLoadComplete(); EventSystem.Broadcast(EGameEvent.ShowGamePlayView); EventSystem.AddListener <GSToGC.RunningState>(EGameEvent.OnReceiveGameObjectRunState, OnReceiveGameObjectRunState); EventSystem.AddListener <GSToGC.FreeState>(EGameEvent.OnReceiveGameObjectFreeState, OnReceiveGameObjectFreeState); }
} = EGameStateType.Login; // 等于自身,则不切换状态 public void Enter() { ResourceUnit unit = ResourceManager.Instance.LoadImmediate(GameConfig.LoginPrefabPath, EResourceType.PREFAB); mSceneRoot = GameObject.Instantiate(unit.Asset) as GameObject; EventSystem.Broadcast(EGameEvent.ShowLoginView); ResourceUnit audioClipUnit = ResourceManager.Instance.LoadImmediate(GameConfig.UIBGSoundPath, EResourceType.ASSET); AudioClip clip = audioClipUnit.Asset as AudioClip; // 播放背景音乐 AudioSource source = GameObject.Find("GameLogic").AddComponent <AudioSource>(); source.loop = true; source.playOnAwake = false; source.volume = GameSettings.AudioVolume; source.clip = clip; source.Play(); EventSystem.AddListener <GSToGC.UserBaseInfo>(EGameEvent.OnReceiveUserBaseInfo, OnReceiveUserBaseInfo); }
public void OnReceiveBattleStateChange(GSToGC.BattleStateChange msg) { var curStateType = GameStateManager <EGameStateType> .Instance.CurrentState.Type; switch ((EBattleState)msg.state) { case EBattleState.SelectHero: break; case EBattleState.SelectRune: break; case EBattleState.Loading: EventSystem.Broadcast(EGameEvent.LoadingGame, EGameStateType.Play); break; case EBattleState.Playing: break; case EBattleState.Finished: break; } }
public override void Update(float deltaTime) { if (mAsync == null) { return; } float curProgress = View.GetProgress(); if (curProgress < mMaxProgressPercent) { curProgress += 0.1f; } else { curProgress = mMaxProgressPercent; } View.SetProgress(curProgress); if (mAsync.Complete) { // 与读取数据 EventSystem.Broadcast(EGameEvent.LoadGameSceneFinish); HideView(); } }
/// <summary> /// 发送事件 /// </summary> public void Send(string eventTag, IEventMessage message) { InternalSystem.Broadcast(eventTag, message); }
public void Exit() { EventSystem.Broadcast(EGameEvent.HideLobbyView); EventSystem.RemoveListener <EGameStateType>(EGameEvent.LoadingGame, OnLoadingGame); }
public void Enter() { EventSystem.Broadcast(EGameEvent.ShowLobbyView); EventSystem.AddListener <EGameStateType>(EGameEvent.LoadingGame, OnLoadingGame); }
/* 消息接收 */ public void OnNotifyServerAddress(Stream stream) { LSToGC.ServerBSAddr msg = ProtoBuf.Serializer.Deserialize <LSToGC.ServerBSAddr>(stream); EventSystem.Broadcast(EGameEvent.OnReceiveBSAddress, msg); }
public void OnCheckLoginBSRet(Stream stream) { BSToGC.ClinetLoginCheckRet msg = ProtoBuf.Serializer.Deserialize <BSToGC.ClinetLoginCheckRet>(stream); EventSystem.Broadcast(EGameEvent.OnReceiveCheckLoginBSRet, msg); }
public void Exit() { EventSystem.RemoveListener(EGameEvent.LoadGameSceneFinish, OnLoadGameSceneFinish); EventSystem.Broadcast(EGameEvent.HideLoadingView); }
public void Exit() { EventSystem.Broadcast(EGameEvent.HideUserInfoView); }
public void OnNotifyGateServerInfo(Stream stream) { BSToGC.AskGateAddressRet msg = ProtoBuf.Serializer.Deserialize <BSToGC.AskGateAddressRet>(stream); EventSystem.Broadcast(EGameEvent.OnReceiveGSInfo, msg); }
public void Enter() { EventSystem.AddListener(EGameEvent.LoadGameSceneFinish, OnLoadGameSceneFinish); EventSystem.Broadcast(EGameEvent.ShowLoadingView); }
public void Enter() { EventSystem.Broadcast(EGameEvent.ShowUserInfoView); // play bg audio }