当前位置: 首页>>代码示例>>C#>>正文


C# MessageEventArgs.ContainsMessage方法代码示例

本文整理汇总了C#中MessageEventArgs.ContainsMessage方法的典型用法代码示例。如果您正苦于以下问题:C# MessageEventArgs.ContainsMessage方法的具体用法?C# MessageEventArgs.ContainsMessage怎么用?C# MessageEventArgs.ContainsMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageEventArgs的用法示例。


在下文中一共展示了MessageEventArgs.ContainsMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartBattle

    IEnumerator StartBattle(MessageEventArgs args)
    {
        if(args.ContainsMessage("Man"))
        {
            GameObject player = Instantiate(Resources.Load(GlobalDataStructure.PATH_UIPREFAB_BATTLE + "Character")) as GameObject;
            player.transform.SetParent(playerPanel.transform, false);
            player.GetComponent<Player>().Init(0);

            player.transform.DOLocalMoveX(-250,0.5f);
        }

        if(args.ContainsMessage("Girl"))
        {
            GameObject player = Instantiate(Resources.Load(GlobalDataStructure.PATH_UIPREFAB_BATTLE + "Character")) as GameObject;
            player.transform.SetParent(playerPanel.transform, false);
            player.GetComponent<Player>().Init(1);

            player.transform.DOLocalMoveX(250,0.5f);
        }

        if(args.ContainsMessage("Enemy"))
        {
            int[] enemyIDs = args.GetMessage<int[]>("Enemy");
            for(int i = 0; i < enemyIDs.Length; i++)
            {
                GameObject enemy = Instantiate(Resources.Load(GlobalDataStructure.PATH_UIPREFAB_BATTLE + "Enemy")) as GameObject;
                enemy.transform.SetParent(enemyPanel.transform, false);
                enemy.GetComponent<Enemy>().Init(enemyIDs[i]);
                enemy.transform.localScale = new Vector3(0,0,0);
                enemy.transform.DOScale(1, 1);
                yield return new WaitForSeconds(1f);
                switch(enemyIDs.Length)
                {
                case 2: if(i == 0)
                        enemy.transform.DOLocalMoveX(-150,0.5f);
                    else if(i == 1)
                        enemy.transform.DOLocalMoveX(150,0.5f);
                    break;
                case 3:	if(i == 0)
                        enemy.transform.DOLocalMoveX(-200,0.5f);
                    else if(i == 1)
                        enemy.transform.DOLocalMoveX(200,0.5f);
                    break;
                }
            }
        }

        yield return new WaitForSeconds(0.5f);
        EventManager.Instance.PostEvent (BattleEvent.OnBattleStart);
    }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:50,代码来源:BattleWindow.cs

示例2: OnCommandSelected

    void OnCommandSelected(MessageEventArgs args)
    {
        currentPlayer.commandToExecute = currentCommand;
        bool result = SkillHelper.FillCommandTarget(currentPlayer);
        if(!result)
        {
            if(args.ContainsMessage("Target"))
            {
                BattleObject bo = args.GetMessage<BattleObject>("Target");
                currentCommand.targetList.Add(bo);
            }
        }
        currentPlayer.GetComponent<BattleObjectUIEvent>().EndReady();
        currentPlayer.battleStatus = BattleStatus.Action;
        foreach(Enemy enemy in enemys)
        {
            enemy.GetComponent<BattleObjectUIEvent>().DisableClick();
        }
        foreach(Player player in players)
        {
            player.GetComponent<BattleObjectUIEvent>().DisableClick();
        }

        readyQueue.Dequeue();
    }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:25,代码来源:BattleManager.cs


注:本文中的MessageEventArgs.ContainsMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。