Exemple #1
0
        /// <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);
            }
        }
Exemple #2
0
        public void Exit()
        {
            EventSystem.RemoveListener <GSToGC.UserBaseInfo>(EGameEvent.OnReceiveUserBaseInfo, OnReceiveUserBaseInfo);

            EventSystem.Broadcast(EGameEvent.HideLoginView);
            GameObject.DestroyImmediate(mSceneRoot);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 public void OnNotifySkillModelRange(Stream stream)
 {
     GSToGC.RangeEffect msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveSkillModelRange, msg);
 }
Exemple #5
0
 public void OnNotifyReleaseSkill(Stream stream)
 {
     GSToGC.ReleasingSkillState msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveGameObjectReleaseSkill, msg);
 }
Exemple #6
0
 public void OnNotifyGameObjectFreeState(Stream stream)
 {
     GSToGC.FreeState msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveGameObjectFreeState, msg);
 }
Exemple #7
0
 public void OnNotifyGameObjectAppear(Stream stream)
 {
     GSToGC.GOAppear msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveGameObjectAppear, msg);
 }
Exemple #8
0
 public void OnNotifyHeroList(Stream stream)
 {
     GSToGC.HeroList msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveHeroList, msg);
 }
Exemple #9
0
 public void OnNetNotifyBattleStateChange(Stream stream)
 {
     GSToGC.BattleStateChange msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveBattleStateChange, msg);
 }
Exemple #10
0
 public void OnNotifyBattleSeatPosInfo(Stream stream)
 {
     GSToGC.BattleSeatPosInfo msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveBattleSeatPosInfo, msg);
 }
Exemple #11
0
 public void OnNotifyUserBaseInfo(Stream stream)
 {
     GSToGC.UserBaseInfo msg;
     if (!ParseProto(out msg, stream))
     {
         return;
     }
     EventSystem.Broadcast(EGameEvent.OnReceiveUserBaseInfo, msg);
 }
Exemple #12
0
        // 连接到Gate Server成功回调
        public void OnConnectGSSuccess()
        {
            NetworkManager.Instance.OnConnectServerSuccess -= OnConnectGSSuccess;
            MessageCenter.Instance.AskLoginToGateServer();

            // TalkGame初始化

            EventSystem.Broadcast(EGameEvent.OnConnectGateServerSuccess);
        }
Exemple #13
0
        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);
        }
Exemple #14
0
        } = 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);
        }
Exemple #15
0
        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;
            }
        }
Exemple #16
0
        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);
 }
Exemple #18
0
        public void Exit()
        {
            EventSystem.Broadcast(EGameEvent.HideLobbyView);

            EventSystem.RemoveListener <EGameStateType>(EGameEvent.LoadingGame, OnLoadingGame);
        }
Exemple #19
0
        public void Enter()
        {
            EventSystem.Broadcast(EGameEvent.ShowLobbyView);

            EventSystem.AddListener <EGameStateType>(EGameEvent.LoadingGame, OnLoadingGame);
        }
Exemple #20
0
        /* 消息接收 */

        public void OnNotifyServerAddress(Stream stream)
        {
            LSToGC.ServerBSAddr msg = ProtoBuf.Serializer.Deserialize <LSToGC.ServerBSAddr>(stream);
            EventSystem.Broadcast(EGameEvent.OnReceiveBSAddress, msg);
        }
Exemple #21
0
 public void OnCheckLoginBSRet(Stream stream)
 {
     BSToGC.ClinetLoginCheckRet msg = ProtoBuf.Serializer.Deserialize <BSToGC.ClinetLoginCheckRet>(stream);
     EventSystem.Broadcast(EGameEvent.OnReceiveCheckLoginBSRet, msg);
 }
Exemple #22
0
 public void Exit()
 {
     EventSystem.RemoveListener(EGameEvent.LoadGameSceneFinish, OnLoadGameSceneFinish);
     EventSystem.Broadcast(EGameEvent.HideLoadingView);
 }
Exemple #23
0
 public void Exit()
 {
     EventSystem.Broadcast(EGameEvent.HideUserInfoView);
 }
Exemple #24
0
 public void OnNotifyGateServerInfo(Stream stream)
 {
     BSToGC.AskGateAddressRet msg = ProtoBuf.Serializer.Deserialize <BSToGC.AskGateAddressRet>(stream);
     EventSystem.Broadcast(EGameEvent.OnReceiveGSInfo, msg);
 }
Exemple #25
0
 public void Enter()
 {
     EventSystem.AddListener(EGameEvent.LoadGameSceneFinish, OnLoadGameSceneFinish);
     EventSystem.Broadcast(EGameEvent.ShowLoadingView);
 }
Exemple #26
0
 public void Enter()
 {
     EventSystem.Broadcast(EGameEvent.ShowUserInfoView);
     // play bg audio
 }