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


C# IPlayer.SendMessage方法代码示例

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


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

示例1: Render

        public void Render(IPlayer player)
        {
            currentPlayer = player;

            string input = player.ReceivedInput;
            if (player.ReceivedInput.ToLower().StartsWith("say"))
                input = player.ReceivedInput.Substring(3).TrimStart(new char[] { ' ' });

            if (String.IsNullOrEmpty(input))
            {
                player.SendMessage("You didn't provide any message content.");
                return;
            }

            foreach (IPlayer p in player.Location.Occupants)
            {
                if (player.CanTalk && p != player)
                {
                    p.SendMessage(player.Name + " says '" + input + "'");
                }
            }

            if (player.CanTalk)
                player.SendMessage("You say '" + input + "'");
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:25,代码来源:TalkingState.cs

示例2: Render

        public void Render(IPlayer player)
        {
            currentPlayer = player;
            director = player.Director;

            if (!player.Director.Server.Game.HideRoomNames)
                player.SendMessage(player.Location.Name);

            player.SendMessage(player.Location.Description);

            foreach (IDoor door in player.Location.GetDoorways())
            {
                player.SendMessage(door.FacingDirection.ToString() + ": " + door.Arrival.Name);
            }

            List<IPlayer> omit = new List<IPlayer>() { player };
            string message = string.Empty;
            if (player.Location.Occupants.Count == 2) //Only the player + 1 occupant, so we need a simpler message
            {
                foreach (IMob occupant in player.Location.Occupants)
                {
                    //We need it to say "Bob is here", but only to our player
                    if (occupant == player)
                        continue;

                    message = string.Format("{0} is here.", occupant.Name);
                    player.SendMessage(message);
                }
            }
            else if (player.Location.Occupants.Count > 2) //more than just the player and one other occupant.
            {
                // We need it to say "Bob, Sussie and Chris is here"
                foreach (IMob occupant in player.Location.Occupants)
                {
                    if (occupant == player)
                        continue;

                    if (occupant == player.Location.Occupants[player.Location.Occupants.Count - 1])
                        message += "and " + occupant.Name;
                    else
                        message += occupant.Name + ", ";
                }
                message += "is here.";
                player.SendMessage(message);
            }
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:46,代码来源:LookingState.cs

示例3: Execute

        public void Execute(IPlayer player)
        {
            if (String.IsNullOrEmpty(player.ReceivedInput))
                return;

            string[] args = player.ReceivedInput.Split(' ');
            string direction = String.Empty;

            if (args.Length >= 2) //will always be at least 1, as the command itself is at index 0, making length 1
                direction = args[1]; //Assume Walk North, so [1] = North (or any other direction)
            else
            {
                player.SendMessage("Please specify which direction you would like to walk.");
                return;
            }

            AvailableTravelDirections travelDirection = TravelDirections.GetTravelDirectionValue(direction);

            if (travelDirection == AvailableTravelDirections.None)
            {
                player.SendMessage("Invalid direction!");
                return;
            }

            if (player.Location.DoorwayExists(travelDirection))
            {
                IDoor door = player.Location.GetDoorway(travelDirection);
                player.Move(door.Arrival);

                //Make sure we have a valid save path
                var filePath = Path.Combine(Directory.GetCurrentDirectory(), EngineSettings.Default.PlayerSavePath, player.Username + ".char");
                var path = Path.GetDirectoryName(filePath);

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                //Save the player using our serialization class
                FileIO fileSave = new FileIO();
                fileSave.Save(player, filePath);
            }

            player.SwitchState(new LookingState());
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:45,代码来源:WalkCommand.cs

示例4: Execute

 /// <summary>
 /// Executes the command.
 /// </summary>
 /// <param name="player">The player who sent the command.</param>
 public void Execute(IPlayer player)
 {
     // if the player has the correct role..
     if (player != null && (player.Role == CharacterRoles.Owner || player.Role == CharacterRoles.Admin))
     {
         if (player.Director.Server.Game != null)
         {
             // Restore the world to the state it was in prior to the last save.
             player.Director.Server.Game.RestoreWorld();
             player.SendMessage("World restoration completed.");
             Log.Info("World restoration completed.");
         }
     }
 }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:18,代码来源:LoadFileCommand.cs

示例5: Execute

        /// <summary>
        /// Executes the command.
        /// </summary>
        /// <param name="player">The player who sent the command.</param>
        public void Execute(IPlayer player)
        {
            // if the player exists and has the proper role...
            if (player != null && (player.Role == CharacterRoles.Admin || player.Role == CharacterRoles.Owner))
            {
                if (player.Director.Server.Game != null)
                {
                    // Save the world.
                    player.Director.Server.Game.SaveWorld();
                    player.SendMessage("Save completed.");
                    Log.Info("Save completed.");

                }
            }
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:19,代码来源:SaveWorldFileCommand.cs

示例6: Execute

        public void Execute(IPlayer player)
        {
            var message = string.Empty;
            if (player.ReceivedInput.ToLower().StartsWith("say"))
            {
                message = player.ReceivedInput.Substring(3).TrimStart();

                string correctedMessage = string.Format("{0} says '{1}'", player.Name, message);

                player.Location.BroadcastMessage(correctedMessage, new List<IPlayer>() { player });

                correctedMessage = string.Format("You say '{0}'", message);
                player.SendMessage(correctedMessage);
            }
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:15,代码来源:SayCommand.cs

示例7: Render

        public void Render(IPlayer player)
        {
            connectedPlayer = player;
            if(player != null)
            {
                player.SendMessage(string.Format("Welcome {0}, what do you want to do?", player.Name));
            }

            // Some Fancy Menu
            player.SendMessage("");
            player.SendMessage("-----------------------------------------");
            player.SendMessage(string.Format("|{0}|", Director.Server.Game.Name)); // @ToDo: I'll look into Text Centering stuff.
            player.SendMessage("-----------------------------------------");
            //player.SendMessage("| [Enter] a town                        |");
            //player.SendMessage("| [Join] a chat channel                 |");
            //player.SendMessage("| [Save] my current player              |");
            //player.SendMessage("| Save [World] (Debug)                  |");
            //player.SendMessage("| Change some game [Options]            |");
            player.SendMessage("| [Quit] the game                       |");
            player.SendMessage("-----------------------------------------");
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:21,代码来源:MainMenuState.cs

示例8: Render

 public void Render(IPlayer player)
 {
     currentPlayer = player;
     director = player.Director;
     currentPlayer.SendMessage("Command: ", false);
 }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:6,代码来源:EnteringCommandState.cs

示例9: Render

        public void Render(IPlayer player)
        {
            connectedPlayer = player;

            player.SendMessage("Are you a Male or a Female? ", false);
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:6,代码来源:GenderSelect.cs

示例10: Render

        public void Render(IPlayer player)
        {
            connectedPlayer = player;

            switch (currentState)
            {
                case CurrentState.InitialWelcome:
                    {
                        player.SendMessage("Welcome " + player.Name + "!");
                        break;
                    }
                case CurrentState.EnteringPasswordFirst:
                    {
                        player.SendMessage("Please provide a password for your character: ", false);
                        break;
                    }
                case CurrentState.EnteringPasswordSecond:
                    {
                        player.SendMessage("Please re-enter your password for this character: ", false);
                        break;
                    }
            }
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:23,代码来源:CreateNewCharacter.cs

示例11: Inspect

        /// <summary>
        /// Inspects the item and tells the player what is seen.
        /// </summary>
        /// <param name="player">The player that wants to inspect this item</param>
        public virtual void Inspect(IPlayer player)
        {
            player.SendMessage(Name);
            player.SendMessage(Description);
            player.SendMessage("Weight: " + Weight);
            player.SendMessage("Durability: " + Health);

            if (Indestructible)
                player.SendMessage("This item is permanent");

            player.SendMessage(""); // blank line
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:16,代码来源:BaseItem.cs

示例12: Render

        public void Render(IPlayer player)
        {
            //Store a reference for the GetCommand method to use
            connectedPlayer = player;

            //Check which state we are in
            switch(currentState)
            {
                //User is entering his/her character name
            case CurrentState.EnteringName:
                player.SendMessage("What is your username, adventurer? ", false);
                break;
                //User is entering his/her password
            case CurrentState.EnteringPassword:
                player.SendMessage("Please enter your password " + player.Name + ": ", false);
                break;
            }
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:18,代码来源:ClientLoginState.cs

示例13: Execute

 /// <summary>
 /// Executes the command.
 /// </summary>
 /// <param name="player">The player sending the command.</param>
 public void Execute(IPlayer player)
 {
     player.SendMessage("This command is not yet implemented.");
 }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:8,代码来源:HelpCommand.cs


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