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


C# PlayerCharacter.EnergiesUpdateHealth方法代码示例

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


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

示例1: handleRawText

        private void handleRawText(PlayerCharacter pc, IncommingMessage msg)
        {
            if (pc.LoginState == PlayerCharacterLoginState.LoginSuccesfull)
            {
                RawTextIncommingMessage msgRawText = (RawTextIncommingMessage)msg;

                // Handling for different types of raw text
                // TODO: Rewrite - add a separate module for handling server commands
                switch (msgRawText.Text[0])
                {
                    case('#'):
                        if (msgRawText.Text.ToLower() == "#save")
                        {
                            RawTextOutgoingMessage msgRawTextOut =
                                (RawTextOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.RAW_TEXT);
                            msgRawTextOut.Channel = PredefinedChannel.CHAT_LOCAL;

                            try
                            {
                                pc.Serialize(pcSerializer);
                                msgRawTextOut.Text = "Another page in Book of Life is filled...";
                                msgRawTextOut.Color = PredefinedColor.Blue1;
                            }
                            catch (Exception ex)
                            {
                                logger.LogError(LogSource.World, "Failed to serialize player " + pc.Name, ex);
                                msgRawTextOut.Text = "Your page in Book of Life remains blank...";
                                msgRawTextOut.Color = PredefinedColor.Red2;
                            }

                            pc.PutMessageIntoMyQueue(msgRawTextOut);
                            return;
                        }
                        if (msgRawText.Text.ToLower() == "#list_commands")
                        {
                            RawTextOutgoingMessage msgRawTextOut =
                                (RawTextOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.RAW_TEXT);
                            msgRawTextOut.Channel = PredefinedChannel.CHAT_LOCAL;
                            msgRawTextOut.Color = PredefinedColor.Green3;
                            msgRawTextOut.Text = "Available commands: list_commands, save, follow, stop_following, release_followers, list_skills";
                            pc.PutMessageIntoMyQueue(msgRawTextOut);
                            return;
                        }
                        if (msgRawText.Text.ToLower() == "#stop_following")
                        {
                            pc.FollowingStopFollowing();
                            return;
                        }
                        if (msgRawText.Text.ToLower() == "#release_followers")
                        {
                            pc.FollowingReleaseFollowers();
                            return;
                        }
                        if (msgRawText.Text.ToLower().IndexOf("#follow") == 0)
                        {
                            RawTextOutgoingMessage msgRawTextOut =
                                (RawTextOutgoingMessage)OutgoingMessagesFactory.Create(OutgoingMessageType.RAW_TEXT);
                            msgRawTextOut.Channel = PredefinedChannel.CHAT_LOCAL;

                            string[] tokens = msgRawText.Text.Split(' ');
                            if (tokens.Length != 2)
                            {
                                msgRawTextOut.Color = PredefinedColor.Red2;
                                msgRawTextOut.Text = "You are replied by silence...";
                                pc.PutMessageIntoMyQueue(msgRawTextOut);
                                return;
                            }

                            // Does character exist
                            PlayerCharacter pcTakenByHand = getPlayerByName(tokens[1]);
                            if (pcTakenByHand == null)
                            {
                                msgRawTextOut.Color = PredefinedColor.Blue1;
                                msgRawTextOut.Text = "The one you seek is not here...";
                                pc.PutMessageIntoMyQueue(msgRawTextOut);
                                return;
                            }

                            pc.FollowingFollow(pcTakenByHand);

                            return;
                        }
                        if ((msgRawText.Text.ToLower().IndexOf("#change_health") != -1) &&
                            serverConfiguration.EnableTestCommands)
                        {
                            string[] tokens = msgRawText.Text.Split(' ');
                            short changeVal = Convert.ToInt16(tokens[1]);
                            pc.EnergiesUpdateHealth(changeVal);
                            return;
                        }
                        if ((msgRawText.Text.ToLower().IndexOf("#resurrect") != -1) &&
                            serverConfiguration.EnableTestCommands)
                        {
                            pc.EnergiesResurrect();
                            return;
                        }

                        if ((msgRawText.Text.ToLower().IndexOf("#add_item") != -1) &&
                            serverConfiguration.EnableTestCommands)
                        {
//.........这里部分代码省略.........
开发者ID:rauchc,项目名称:Calindor,代码行数:101,代码来源:WorldSimulationMessagingHandling.cs


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