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


C# MessageEventArgs.GetMessage方法代码示例

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


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

示例1: OnItemClicked

 void OnItemClicked(MessageEventArgs args)
 {
     int itemID = args.GetMessage<int>("ItemID");
     ItemData itemData = DataManager.Instance.GetItemDataSet().GetItemData(itemID);
     args.AddMessage ("Message", itemData.description);
     EventManager.Instance.PostEvent (UIEvent.OnMessageSet, args);
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:7,代码来源:ItemPanel.cs

示例2: OnMessageSet

 void OnMessageSet(MessageEventArgs args)
 {
     string msg = args.GetMessage<string>("Message");
     message.text = msg;
     msgList.Clear();
     msgList.Add(msg);
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:7,代码来源:MessagePanel.cs

示例3: OnMessageUpdate

 void OnMessageUpdate(MessageEventArgs args)
 {
     string msg = args.GetMessage<string>("Message");
     //handle msgList
     msgList.Add(msg);
     while(msgList.Count > MAX_MSG_COUNT)
     {
         msgList.RemoveAt(0);
     }
     //handle alignment
     if (msgList.Count >= ALIGNMENT_MSG_COUNT)
     {
         message.alignment = TextAnchor.LowerLeft;
     }
     else
     {
         message.alignment = TextAnchor.UpperLeft;
     }
     //reassamble message
     message.text = "";
     for(int i = 0; i < msgList.Count - 1; i++)
     {
         message.text += msgList[i] + "\n";
     }
     //highlight latest message with animation
     message.DOKill();
     message.DOText(message.text + "<color=yellow>" + msgList[msgList.Count - 1] + "</color>", 0.5f).SetEase(Ease.Linear);
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:28,代码来源:MessagePanel.cs

示例4: OnBattleObjectDied

    void OnBattleObjectDied(MessageEventArgs args)
    {
        BattleObject bo = args.GetMessage<BattleObject>("Object");
        if(bo.isEnemy)
        {
            enemys.Remove((Enemy)bo);
            bo.GetComponent<BattleObjectUIEvent>().DestoryUI();
            if(enemys.Count == 0)
            {
                EventManager.Instance.PostEvent(BattleEvent.OnBattleWin);

                StartCoroutine(FinishBattle());
            }
        }
        else
        {
            EventManager.Instance.PostEvent(BattleEvent.OnBattleLose);
            StartCoroutine(FinishBattle());
        }
    }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:20,代码来源:BattleManager.cs

示例5: OpenUIWindow

    void OpenUIWindow(MessageEventArgs args)
    {
        UIWindowID windowID = args.GetMessage<UIWindowID>("WindowID");

        if(windowStack.Count > 0)
        {
            GameObject lastWindow = windowStack[windowStack.Count - 1];
            CanvasGroup canvasGroup = lastWindow.GetComponent<CanvasGroup>();
            canvasGroup.alpha = 1;
            canvasGroup.DOFade(0, 0.25f).OnComplete(()=>{lastWindow.SetActive(false);});
        }

        GameObject window = windowStack.Find((GameObject x)=>{return x.name.Contains(windowID.ToString());});
        if(window != null)
        {
            window.SetActive(true);
            windowStack.Remove(window);
            windowStack.Add(window);
        }
        else
        {
            window = GameObject.Instantiate(Resources.Load(GlobalDataStructure.PATH_UIPREFAB_WINDOW + windowID.ToString()) as GameObject);
            windowStack.Add(window);
        }

        if(windowStack.Count > 1)
        {
            CanvasGroup canvasGroup = window.GetComponent<CanvasGroup>();
            canvasGroup.alpha = 0;
            canvasGroup.DOFade(1, 0.5f);
        }
    }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:32,代码来源:UIManager.cs

示例6: PlayBattleBGM

 void PlayBattleBGM(MessageEventArgs args)
 {
     int battleType = args.GetMessage<int>("BattleType");
     if(battleType == 0)
         AudioManager.Instance.PlayBGM ("Battle0" + UnityEngine.Random.Range(1,4));
     else if(battleType == 1)
         AudioManager.Instance.PlayBGM ("Boss0" + UnityEngine.Random.Range(1,3));
     else if(battleType == 2)
         AudioManager.Instance.PlayBGM ("FinalBoss");
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:10,代码来源:GameMusicLogic.cs

示例7: OnItemClicked

 void OnItemClicked(MessageEventArgs args)
 {
     if(args.GetMessage<int>("ItemID") == itemData.id)
     {
         this.GetComponent<Image>().sprite = Resources.Load(GlobalDataStructure.PATH_UIIMAGE_COMMON + "Box_Light", typeof(Sprite)) as Sprite;
     }
     else
     {
         this.GetComponent<Image>().sprite = Resources.Load(GlobalDataStructure.PATH_UIIMAGE_COMMON + "Box_Dark", typeof(Sprite)) as Sprite;
     }
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:11,代码来源:ItemButtonUIEvent.cs

示例8: OnCommandClicked

 void OnCommandClicked(MessageEventArgs args)
 {
     if(args.GetMessage<string>("CommandName") == nameText.text)
     {
         this.GetComponent<Image>().sprite = Resources.Load(GlobalDataStructure.PATH_UIIMAGE_COMMON + "Box_Light", typeof(Sprite)) as Sprite;
     }
     else
     {
         this.GetComponent<Image>().sprite = Resources.Load(GlobalDataStructure.PATH_UIIMAGE_COMMON + "Box_Dark", typeof(Sprite)) as Sprite;
     }
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:11,代码来源:CommandButtonUIEvent.cs

示例9: PlayBGM

 void PlayBGM(MessageEventArgs args)
 {
     UIWindowID windowID = args.GetMessage<UIWindowID>("WindowID");
     if(windowID == UIWindowID.IntroWindow)
     {
         AudioManager.Instance.PlayBGM ("Theme");
     }
     else if(windowID == UIWindowID.MapWindow)
     {
         AudioManager.Instance.PlayBGM ("Map");
     }
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:12,代码来源:GameMusicLogic.cs

示例10: OnBasicCommandSelected

    void OnBasicCommandSelected(MessageEventArgs args)
    {
        Player player = BattleManager.Instance.GetCurrentPlayer();
        foreach(Transform child in commandButtonPanel)
        {
            Destroy(child.gameObject);
        }

        CommandType commandType = (CommandType)args.GetMessage<int>("CommandID");
        List<Command> validCommands = player.availableCommands.FindAll((x)=>{return x.commandType == commandType;});
        for(int i = 0 ; i < validCommands.Count; i++)
        {
            GameObject commandButton = Instantiate(Resources.Load(GlobalDataStructure.PATH_UIPREFAB_BATTLE + "CommandButton")) as GameObject;
            commandButton.transform.SetParent(commandButtonPanel, false);
            commandButton.GetComponent<CommandButtonUIEvent>().Init(validCommands[i], validCommands[i].IsAvailable());
        }
    }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:17,代码来源:BattleWindow.cs

示例11: OnCommandClicked

 void OnCommandClicked(MessageEventArgs args)
 {
     string commandName = args.GetMessage<string>("CommandName");
     currentCommand = currentPlayer.availableCommands.Find((Command cmd)=>{return cmd.commandName == commandName;});
     switch(currentCommand.targetType)
     {
     case TargetType.SingleEnemy:
         foreach(Enemy enemy in enemys)
         {
             enemy.GetComponent<BattleObjectUIEvent>().EnableClick();
         }
         break;
     case TargetType.SingleAlly:
         foreach(Player player in players)
         {
             player.GetComponent<BattleObjectUIEvent>().EnableClick();
         }
         break;
     case TargetType.OtherAlly:
         foreach(Player player in players)
         {
             if(player != currentPlayer)
             {
                 player.GetComponent<BattleObjectUIEvent>().EnableClick();
             }
         }
         break;
     default:
         EventManager.Instance.PostEvent(BattleEvent.OnCommandSelected);
         break;
     }
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:32,代码来源:BattleManager.cs

示例12: OnBuffDeactivated

 void OnBuffDeactivated(MessageEventArgs args)
 {
     string message = args.GetMessage<string>("Message");
     AddMessage(message);
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:5,代码来源:BattleMessage.cs

示例13: OnBattleObjectMiss

 void OnBattleObjectMiss(MessageEventArgs args)
 {
     string name = args.GetMessage<string>("Name");
     AddMessage("被" + name + "躲开了!");
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:5,代码来源:BattleMessage.cs

示例14: OnBattleObjectInterrupted

 void OnBattleObjectInterrupted(MessageEventArgs args)
 {
     string name = args.GetMessage<string>("Name");
     AddMessage(name + " 的行动被打断了!");
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:5,代码来源:BattleMessage.cs

示例15: OnPlayerReady

 void OnPlayerReady(MessageEventArgs args)
 {
     Player player = args.GetMessage<Player>("Player");
     readyQueue.Enqueue(player);
 }
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:5,代码来源:BattleManager.cs


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