Exemple #1
0
 public override void Execute()
 {
     //更改倍数,获取派发器传送的值
     model.m_Mulitiple *= (int)evt.data;
     //添加新的面板
     ToolsManager.CreatePrefab(PrefabType.CharacterPanel);
     ToolsManager.CreatePrefab(PrefabType.IntegrationPanel);
 }
Exemple #2
0
    /// <summary>
    /// 需要被执行的事件
    /// </summary>
    public override void Execute()
    {
        //调用数据模型初始化事件
        model.InitIntegration(); //初始化玩家基础积分以及游戏倍数
        roundModelP.Init();      //初始化当前最大牌的权值、类型、牌的归属
        cardModel.Init();        //生成一副牌

        //调用执行的事件
        ToolsManager.CreatePrefab(PrefabType.StartPanel);

        //读取数据
        GetData();

        //背景音效
        //  Sound.Instance.PlayBG(Consts.Bg);
    }
Exemple #3
0
    public override void Execute()
    {
        //更新数据
        int          temp = integrationModel.Result;
        GameOverArgs e    = (GameOverArgs)evt.data;

        //玩家胜利
        if (e.PlayerWin)
        {
            if (e.type == CharacterType.Player)
            {
                integrationModel.PlayerIntegration += temp * 2;
            }
            else
            {
                integrationModel.PlayerIntegration += temp;
            }
        }
        else
        {
            if (e.type == CharacterType.Player)
            {
                integrationModel.PlayerIntegration -= temp * 2;
            }
            else
            {
                integrationModel.PlayerIntegration -= temp;
            }
        }
        //右边电脑玩家胜利
        if (e.ComputerRigh)
        {
            if (e.type == CharacterType.ComputerRight)
            {
                integrationModel.ComputerRightIntegration += temp * 2;
            }
            else
            {
                integrationModel.ComputerRightIntegration += temp;
            }
        }
        else
        {
            if (e.type == CharacterType.ComputerRight)
            {
                integrationModel.ComputerRightIntegration -= temp * 2;
            }
            else
            {
                integrationModel.ComputerRightIntegration -= temp;
            }
        }
        //左边电脑玩家胜利
        if (e.ComputerLeft)
        {
            if (e.type == CharacterType.ComputerLeft)
            {
                integrationModel.ComputerLeftIntegration += temp * 2;
            }
            else
            {
                integrationModel.ComputerLeftIntegration += temp;
            }
        }
        else
        {
            if (e.type == CharacterType.ComputerLeft)
            {
                integrationModel.ComputerLeftIntegration -= temp * 2;
            }
            else
            {
                integrationModel.ComputerLeftIntegration -= temp;
            }
        }
        ///用于更新结束面板的显示
        round.isLand = e.isLand;
        round.isWin  = e.PlayerWin;
        //存储数据
        GameData data = new GameData()
        {
            m_playerIntegration        = integrationModel.PlayerIntegration,
            m_computerLeftIntegration  = integrationModel.ComputerLeftIntegration,
            m_computerRightIntegration = integrationModel.ComputerRightIntegration
        };

        ToolsManager.SaveData(data);
        //显示数据
        GameData gameData = new GameData()
        {
            m_playerIntegration        = integrationModel.PlayerIntegration,
            m_computerLeftIntegration  = integrationModel.ComputerLeftIntegration,
            m_computerRightIntegration = integrationModel.ComputerRightIntegration
        };

        dispatcher.Dispatch(ViewEvent.UpdateIntegration, gameData);
        //添加游戏结束面板
        ToolsManager.CreatePrefab(PrefabType.GameOverPanel);
        //清空游戏缓存,初始化游戏数据
        round.Init();
        cardModel.Init();
    }