Esempio n. 1
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        switch (notification.Name)
        {
        case NotificationConst.LevelUp:

            Debug.Log("接收到请求消息");

            object cInfoObj = notification.Body;

            TestProxy proxy = Facade.RetrieveProxy(TestProxy.NAME) as TestProxy;
            proxy.ChangeLevel(cInfoObj);

            break;
        }
    }
Esempio n. 2
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        MonsterProxy proxy = (MonsterProxy)Facade.RetrieveProxy("MonsterProxy");        //通过名字获取Proxy

        switch (notification.Name)
        {
        case NotificationConstant.MonsterCommand.SetMonsters: {
            PastMonsters past = notification.Body as PastMonsters;
            proxy.setMonsterBasic(past);
        } break;

        case NotificationConstant.MonsterCommand.MonsterAtk: {
            proxy.atk();
        } break;
        }
    }
Esempio n. 3
0
        public override void HandleNotification(PureMVC.Interfaces.INotification notification)
        {
            switch (notification.Name)
            {
            case FashionMinigame.EARNED_EXPERIENCE_NOTIFICATION:
                if (!(notification.Body is ExperienceInfo))
                {
                    throw new Exception("EARNED_EXPERIENCE_NOTIFICATION expected an ExperienceInfo object as the body of the notification. Found " + notification.Body.ToString());
                }
                HandleExperienceGain((ExperienceInfo)notification.Body);
                break;

            default:
                base.HandleNotification(notification);
                break;
            }
        }
Esempio n. 4
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        CameraProxy proxy = (CameraProxy)Facade.RetrieveProxy("CameraProxy");        //通过名字获取Proxy

        switch (notification.Name)
        {
        case NotificationConstant.CameraCommand.CameraMove:
        {
            proxy.CamerMove();
        } break;

        case NotificationConstant.CameraCommand.ReStartCameraCommond:
        {
            proxy.ReStart();
        } break;
        }
    }
Esempio n. 5
0
    //监听消息回调
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        switch (notification.Name)
        {
        case NotificationConst.LevelChange:

            //改变界面
            CharaterInfo cInfo = CharaterInfo.ShareInfo;

            levelText.text = "LV:" + cInfo.Level.ToString();
            hpText.text    = "HP:" + cInfo.Hp.ToString();

            Debug.Log("name:" + cInfo.Name + " level:" + cInfo.Level + " hp:" + cInfo.Hp);
            break;

        default:
            break;
        }
    }
Esempio n. 6
0
        public override void HandleNotification(PureMVC.Interfaces.INotification notification)
        {
            base.HandleNotification(notification);

            switch (notification.Name)
            {
            case GameFacade.CLIENT_ASSET_REPOSITORY_LOADED:
                if (this.CurrentState == mGameStateMachineLoadingState)
                {
                    mGameStateMachineLoadingState.ClientAssetRepositoryDoneLoading();
                    LoadStrcuturesWhichDependOnClientAssetRepository();
                }
                else
                {
                    Console.LogError("Client asset repository has loaded but the game state machine is not in the Loading State.");
                }
                break;

            case GameFacade.SOUND_PROXY_LOADED:
                if (this.CurrentState == mGameStateMachineLoadingState)
                {
                    mGameStateMachineLoadingState.SoundProxyDoneLoading();
                }
                else
                {
                    Console.LogError("Sound Proxy has loaded but the game state machine is not in the Loading State.");
                }
                break;

            case GameFacade.SWITCHING_TO_FASHION_MINI_GAME:
                this.TransitionToState(mInactiveState);
                this.TransitionToState(mFashionGameState);
                break;

            case GameFacade.SWITCHING_TO_GREEN_SCREEN_ROOM:
                this.TransitionToState(mInactiveState);
                this.TransitionToState(mGreenScreenRoomState);
                break;

            default:
                throw new Exception("Unexpected notification (" + notification.Name + ")");
            }
        }
Esempio n. 7
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        Debug.Log("LoginCommand.Execute()");

        object obj = notification.Body;

        LoginProxy loginProxy;

        loginProxy = Facade.RetrieveProxy(LoginProxy.NAME) as LoginProxy;

        string name = notification.Name;

        switch (name)
        {
        case NotifyConst.S_LOGIN:
            loginProxy.sendLogin(obj);
            break;
        }
    }
Esempio n. 8
0
        public override void HandleNotification(PureMVC.Interfaces.INotification notification)
        {
            base.HandleNotification(notification);
            switch (notification.Name)
            {
            case GameFacade.PLAY_SOUND_APPLY_ROOM_BACKGROUND:
                mSoundProxy.PlaySound(SoundName.ApplyRoomBackground);
                break;

            case GameFacade.PLAY_SOUND_BUTTON_PRESS:
                mSoundProxy.PlaySound(SoundName.ButtonPress);
                break;

            case GameFacade.PLAY_SOUND_CLOSE:
                mSoundProxy.PlaySound(SoundName.Close);
                break;

            case GameFacade.PLAY_SOUND_ERROR:
                mSoundProxy.PlaySound(SoundName.Error);
                break;

            case GameFacade.PLAY_SOUND_LEVEL_UP:
                mSoundProxy.PlaySound(SoundName.LevelUp);
                break;

            case GameFacade.PLAY_SOUND_MAP_OPEN:
                mSoundProxy.PlaySound(SoundName.MapOpen);
                break;

            case GameFacade.PLAY_SOUND_POPUP_APPEAR_A:
                mSoundProxy.PlaySound(SoundName.PopupAppearA);
                break;

            case GameFacade.PLAY_SOUND_POPUP_APPEAR_B:
                mSoundProxy.PlaySound(SoundName.PopupAppearB);
                break;

            case GameFacade.PLAY_SOUND_SWAPPING_ITEMS:
                mSoundProxy.PlaySound(SoundName.SwappingItems);
                break;
            }
        }
Esempio n. 9
0
    /// <summary>
    /// 处理接受到的消息列表
    /// </summary>
    /// <param name="notification"></param>
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        Model_GameData gameData = null;

        switch (notification.Name)
        {
        case "Msg_DisPlayGameInfo":
            gameData = notification.Body as Model_GameData;
            if (gameData != null && _TxtShowGameTime != null && _TxtShowGameHighestScore != null && _TxtShowGameHighestScore != null)
            {
                _TxtShowGameTime.text         = gameData.GameTime.ToString();
                _TxtShowGameScore.text        = gameData.Score.ToString();
                _TxtShowGameHighestScore.text = gameData.HighScore.ToString();
            }
            break;

        default:
            break;
        }
        base.HandleNotification(notification);
    }
Esempio n. 10
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        CamerBasic cb = notification.Body as CamerBasic;

        switch (notification.Name)
        {
        //执行和显示有关的命令

        /*初始时获取player和摄像机的相对位置*/
        case NotificationConstant.CameraMediator.SetCameraPlayerDistance:
        {
            CameraProxy proxy = (CameraProxy)Facade.RetrieveProxy("CameraProxy");
            proxy.setCameraPlayerDistance(player, Main_Camera);
        } break;


        case NotificationConstant.CameraMediator.CameraFollowMove:
        {
            Main_Camera.transform.position = cb.player_camera_distance + new Vector3(player.transform.position.x, 0, 0);
        } break;
        }
    }
Esempio n. 11
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        switch (notification.Name)
        {
        case NotificationConstant.LevelChange:
            CharacterInfo ci = notification.Body as CharacterInfo;
            levelText.text = ci.Level.ToString();
            break;

        case NotificationConstant.ButtonColor:
            CharacterInfo cha = notification.Body as CharacterInfo;
            if (cha.Level % 2 == 0)
            {
                levelText.color = Color.red;
            }
            else
            {
                levelText.color = Color.blue;
            }
            break;
        }
    }
Esempio n. 12
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        switch (notification.Name)
        {
        //执行和显示有关的命令

        case NotificationConstant.UIMediator.ChangeButtonColor:
        {
            PastBtnColor recive = notification.Body as PastBtnColor;
            Image        img    = button.GetComponent <Image>();
            img.color = recive.color;
        }
        break;

        case NotificationConstant.UIMediator.ChangeMonsterCount:
        {
            PlayerBasic pb = notification.Body as PlayerBasic;
            monsterCount.text = "" + pb.Monster;
        }
        break;

        case NotificationConstant.UIMediator.ChangeHpUI:
        {
            PlayerBasic pb = notification.Body as PlayerBasic;
            HpSlider.value = pb.Hp;
        }
        break;

        case NotificationConstant.UIMediator.ChangeCoinCount:
        {
            PlayerBasic pb = notification.Body as PlayerBasic;
            coinCount.text = "" + pb.Coin;
        }
        break;
        }
    }
Esempio n. 13
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        TerrainProxy proxy = (TerrainProxy)Facade.RetrieveProxy("TerrainProxy");        //通过名字获取Proxy

        switch (notification.Name)
        {
        case NotificationConstant.TerrainCommand.SetMapBasic:
        {
            PastTerrains past = notification.Body as PastTerrains;
            proxy.SetMapBasic(past);
        } break;

        //case NotificationConstant.TerrainCommand.InitMap:
        //{
        //	proxy.InitMap();
        //}break;

        case NotificationConstant.TerrainCommand.UpdateMap:
        {
            PastSingle past = notification.Body as PastSingle;
            proxy.UpdateMap(past);
        } break;
        }
    }
        public override void HandleNotification(PureMVC.Interfaces.INotification notification)
        {
            Console.WriteLine("GreenScreenRoomLoadingMediator.HandleNotification");
            base.HandleNotification(notification);

            switch (notification.Name)
            {
            case GameFacade.LOCAL_AVATAR_LOADED:
                Console.WriteLine("LOCAL_AVATAR_LOADED");
                mAvatarLoaded = true;
                CheckLoadingFinished();
                break;

            case GameFacade.ANIMATION_PROXY_LOADED:
                Console.WriteLine("ANIMATION_PROXY_LOADED");
                mClientAssetRepoLoaded = true;
                CheckLoadingFinished();
                break;

            default:
                Console.WriteLine("UNEXPECTED NOTIFICATION");
                throw new Exception("Unexpected notification (" + notification.Name + ")");
            }
        }
        public override void HandleNotification(PureMVC.Interfaces.INotification notification)
        {
            base.HandleNotification(notification);

            switch (notification.Name)
            {
            case GameFacade.SHOP_BODY_VIEW:
                if (this.CurrentState == mShoppingCameraState)
                {
                    mShoppingCameraState.BodyView();
                }
                break;

            case GameFacade.SHOP_HEAD_VIEW:
                if (this.CurrentState == mShoppingCameraState)
                {
                    mShoppingCameraState.FaceView();
                }
                break;

            default:
                throw new Exception("Unexpected notification (" + notification.Name + ")");
            }
        }
Esempio n. 16
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        switch (notification.Name)
        {
        //执行和显示有关的命令
        case NotificationConstant.MonsterMediator.ChangeMonsterCompent:
        {
            PastMonsterCompent recive      = notification.Body as PastMonsterCompent;
            GameObject         MonsterItem = recive.monster;
            MonsterItem.GetComponent <Rigidbody>().isKinematic     = recive.isKinematic;
            MonsterItem.GetComponent <CapsuleCollider>().isTrigger = recive.isTrigger;
        }
        break;

        case NotificationConstant.MonsterMediator.ChangeMonsterAnimation:
        {
            PastAnimator recive      = notification.Body as PastAnimator;
            GameObject   MonsterItem = recive.monster;
            switch (recive.type)
            {
            case Tags.animator_type.Trigger: MonsterItem.GetComponent <Animator>().SetTrigger(recive.name); break;

            case Tags.animator_type.Bool: MonsterItem.GetComponent <Animator>().SetBool(recive.name, recive.boolState); break;
            }
        }
        break;


        case NotificationConstant.MonsterMediator.MonsterMove:
        {
            PastSingle recive = notification.Body as PastSingle;
            switch (recive.obj.name)
            {
            case Tags.monster_type.fly:
            {
                Vector3 fly_position = recive.obj.transform.position;
                fly_position.y = 2f + (float)Mathf.Sin(fly_x) * 0.5f;
                recive.obj.transform.position = fly_position;
                fly_x = 0;
            }
            break;

            case Tags.monster_type.water:
            {
                water_x += Time.deltaTime;
                if (water_x >= 2)
                {
                    Debug.Log("Jump");
                    recive.obj.GetComponent <Rigidbody>().velocity = new Vector3(0, 5, 0);
                    water_x = 0;
                }
            }
            break;

            case Tags.monster_type.Boss:
            {
                Vector3 pos = new Vector3(Player.transform.position.x + recive.f, recive.obj.transform.position.y, recive.obj.transform.position.z);
                recive.obj.transform.position = pos;
            }
            break;

            case Tags.monster_type.smallBoss:
            {
                recive.obj.GetComponent <Rigidbody>().AddForce(recive.vect);
            }
            break;
            }
        }
        break;

        case NotificationConstant.MonsterMediator.ChangeBossColor:
        {
            PastSingle recive = notification.Body as PastSingle;
            Renderer   rend   = recive.obj.GetComponent <Renderer>();
            rend.material.shader = Shader.Find("Specular");
            rend.material.SetColor("_SpecColor", recive.c);
        }
        break;

        case NotificationConstant.MonsterMediator.SpawnSmallBoss:
        {
            PastSingle recive = notification.Body as PastSingle;
        }
        break;
        }
    }
Esempio n. 17
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        proxy = (PlayerProxy)Facade.RetrieveProxy("PlayerProxy");//通过名字获取Proxy

        PastSingle recive = notification.Body as PastSingle;

        switch (notification.Name)
        {
        case NotificationConstant.playerCommand.PlayerMove:
        {
            proxy.Move();
        }
        break;

        case NotificationConstant.playerCommand.JumpCommond:
        {
            proxy.Jump();
        }
        break;

        case NotificationConstant.playerCommand.CollisionBaseCommond:
        {
            proxy.CollisionBase();
        }
        break;

        case NotificationConstant.playerCommand.DiedCommond:
        {
            proxy.Died();
        }
        break;

        case NotificationConstant.playerCommand.CollisionStay:
        {
            proxy.CollisionStay();
        }
        break;

        case NotificationConstant.playerCommand.MouseLeftDown:
        {
            proxy.MouseDown();
        }
        break;

        case NotificationConstant.playerCommand.MouseLeftUP:
        {
            proxy.MouseUp();
        }
        break;


        case NotificationConstant.playerCommand.AtkMonsterArea:
        {
            proxy.inAtkArea(recive);
        }
        break;

        case NotificationConstant.playerCommand.JuageMonsterDistance:
        {
            proxy.JuageMonsterDis(recive);
        }
        break;

        case NotificationConstant.playerCommand.AtkMonster:
        {
            proxy.atkMonster(recive);
        }
        break;

        case NotificationConstant.playerCommand.ChangeHp:
        {
            proxy.ChangeHp(recive);
        }
        break;

        case NotificationConstant.playerCommand.ChangeCoin:
        {
            proxy.ChangeCoin(recive);
        }
        break;

        case NotificationConstant.playerCommand.ChainStateToFallState:
        {
            proxy.ChainStateToFallState();
        } break;

        case NotificationConstant.playerCommand.ResetJumpData:
        {
            proxy.ResetJumpData();
        } break;
        }
    }
Esempio n. 18
0
    public override void Execute(PureMVC.Interfaces.INotification notification)
    {
        TestProxy proxy = (TestProxy)Facade.RetrieveProxy(TestProxy.NAME);

        proxy.ChangeLevel(1);
    }
 override public void Execute(PureMVC.Interfaces.INotification notification)
 {
     //Facade.RegisterProxy( new SampleProxy( ) );
 }
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     base.Execute(notification);
     Facade.RegisterProxy(new Model_GameDataProxy());
     Facade.RegisterMediator(new View_GamePlayingMediator());
 }
Esempio n. 21
0
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     Debug.Log("ModelPreCommand.Execute()");
     Facade.RegisterProxy(new UserProxy());
     Facade.RegisterProxy(new LoginProxy());
 }
        public override void HandleNotification(PureMVC.Interfaces.INotification notification)
        {
            base.HandleNotification(notification);

            switch (notification.Name)
            {
            case GameFacade.SHOP_OPENED:
                if (mTutorialsToShow.Contains(mMapTutorialState) || mTutorialsToShow.Contains(mDecorateTutorialState))
                {
                    if (this.CurrentState == mGoShoppingTutorialState)
                    {
                        mGoShoppingTutorialState.TutorialComplete();
                    }
                    else if (this.CurrentState == mDecorateTutorialState)
                    {
                        mDecorateTutorialState.TutorialComplete();
                    }
                    // TODO: PUt in the code to differentiate between your own room so we can tell which one of these
                    // to remove.
                    mTutorialsToShow.Remove(mGoShoppingTutorialState);
                    mTutorialsToShow.Remove(mDecorateTutorialState);
                }
                break;

            case GameFacade.ENTERED_GREEN_SCREEN_ROOM_DEFAULT_STATE:
                SetTutorialToUse();
                break;

            case GameFacade.MAP_GUI_OPENED:
                if (mTutorialsToShow.Contains(mMapTutorialState))
                {
                    if (this.CurrentState == mMapTutorialState)
                    {
                        mMapTutorialState.TutorialComplete();
                    }
                    mTutorialsToShow.Remove(mMapTutorialState);
                }
                break;

            case GameFacade.MAP_GUI_CLOSED:
                if (this.CurrentState == mMapTutorialState)
                {
                    NextTutorial(mMapTutorialState);
                }
                break;

            case GameFacade.GET_CASH_GUI_OPENED:
                if (mTutorialsToShow.Contains(mGetCashTutorialState))
                {
                    if (this.CurrentState == mGetCashTutorialState)
                    {
                        mGetCashTutorialState.TutorialComplete();
                    }
                    mTutorialsToShow.Remove(mGetCashTutorialState);
                }
                break;

            case GameFacade.GET_CASH_GUI_CLOSED:
                if (this.CurrentState == mMapTutorialState)
                {
                    SetTutorialToUse();
                }
                break;

            default:
                throw new Exception("Unexpected notification (" + notification.Name + ")");
            }
        }
 public override void HandleNotification(PureMVC.Interfaces.INotification notification)
 {
     base.HandleNotification(notification);
 }
Esempio n. 24
0
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     Facade.RegisterProxy(new PanelCoinProxy(PanelCoinProxy.NAME));
 }
Esempio n. 25
0
    public override void HandleNotification(PureMVC.Interfaces.INotification notification)
    {
        PlayerBasic pb = notification.Body as PlayerBasic;

        switch (notification.Name)
        {
        //执行和显示有关的命令
        case NotificationConstant.playerMediator.PlayerRunMove:
        {
            player.transform.Translate(Vector3.right * pb.run_speed * Time.deltaTime, Space.World);
        } break;


        case NotificationConstant.playerMediator.JumpMediator:
        {
            if (player_ac.GetBool(Tags.animator_player.Jump) == false)
            {
                player_rigidboy.velocity = new Vector3(0, pb.jump_Velocity, 0);
                player_ac.SetBool(Tags.animator_player.Jump, true);
            }
            else if (player_ac.GetBool(Tags.animator_player.Jump2) == false)                    //二段跳
            {
                player_rigidboy.velocity = new Vector3(0, pb.jump_Velocity, 0);
                player_ac.SetBool(Tags.animator_player.Jump2, true);
                player_ac.SetBool(Tags.animator_player.Jump, false);
            }
        } break;

        case NotificationConstant.playerMediator.AtkMediator:
        {
            player_ac.SetTrigger(Tags.animator_player.isAtk);
        }
        break;

        case NotificationConstant.playerMediator.HitMediator:
        {
            player_ac.SetTrigger(Tags.animator_player.isHit);
        }
        break;

        case NotificationConstant.playerMediator.ResetJumpAnimator:
        {
            player_ac.SetBool(Tags.animator_player.Jump, false);
            player_ac.SetBool(Tags.animator_player.Jump2, false);
        } break;

        case NotificationConstant.playerMediator.ReStart:
        {
            Application.LoadLevel(Application.loadedLevel);
        } break;


        case NotificationConstant.playerMediator.CreatRope:
        {
            GameObject obj = Resources.Load(Tags.prb_path.Rope) as GameObject;
            obj.transform.position    = player.transform.GetChild(Tags.PlayerChilds.Send_target).position;
            obj.transform.eulerAngles = new Vector3(0, 0, pb.angle - 90f);
            player.GetComponent <Player>().InstantiateGameOjbect(obj);
        } break;

        case NotificationConstant.playerMediator.ChangePlayerCompnentState:
        {
            PastPlayerCompenetState recive = notification.Body as PastPlayerCompenetState;
            player.GetComponent <Rigidbody>().isKinematic      = recive.isKinematic;
            player.GetComponent <Rigidbody>().mass             = recive.mass;
            player.GetComponent <CapsuleCollider> ().isTrigger = recive.isTrigger;
        } break;

        case NotificationConstant.playerMediator.AddPlayerJointCompnent:
        {
            PastAddJointCompnent recive = notification.Body as PastAddJointCompnent;
            if (recive.Compnent_type.Equals("FixedJoint"))
            {
                FixedJoint fiexd = player.AddComponent <FixedJoint>();
                fiexd.connectedBody = recive.connect;
            }
        } break;

        case NotificationConstant.playerMediator.DeletePlayerCompnent:
        {
            if (player.GetComponent <FixedJoint> ())
            {
                player.GetComponent <Player>().DestroyObject(player.GetComponent <FixedJoint> ());
            }
        } break;
        }
    }