本文整理汇总了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);
}
示例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();
}