Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public void Exit()
        {
            EventSystem.RemoveListener <GSToGC.UserBaseInfo>(EGameEvent.OnReceiveUserBaseInfo, OnReceiveUserBaseInfo);

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

            // TalkGame初始化

            EventSystem.Broadcast(EGameEvent.OnConnectGateServerSuccess);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// 发送事件
 /// </summary>
 public void Send(string eventTag, IEventMessage message)
 {
     InternalSystem.Broadcast(eventTag, message);
 }
Exemplo n.º 18
0
        public void Exit()
        {
            EventSystem.Broadcast(EGameEvent.HideLobbyView);

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

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

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