當前位置: 首頁>>代碼示例>>C#>>正文


C# BasePlayer.ConsoleMessage方法代碼示例

本文整理匯總了C#中BasePlayer.ConsoleMessage方法的典型用法代碼示例。如果您正苦於以下問題:C# BasePlayer.ConsoleMessage方法的具體用法?C# BasePlayer.ConsoleMessage怎麽用?C# BasePlayer.ConsoleMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BasePlayer的用法示例。


在下文中一共展示了BasePlayer.ConsoleMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TicketFunction

		void TicketFunction(string function, string arg, BasePlayer player)
		{

			switch(function)
			{
				case "reply":
					SendTicketReply(arg);
					SendChatMessage(player, "Tickets", "Your reply has been submitted.");
					break;
					
				case "add":
					int id = GetNewID();
					Puts(player.transform.position.x.ToString());
					data.tickets.Add(new Ticket(id, player, arg));
					SendToAPI(new Ticket(id, player, arg));
					SendChatMessage(player, "Tickets", $"Your Ticket has been submitted. <color=#00FF8D>Ticket ID {id}</color>");
					
					foreach(BasePlayer current in BasePlayer.activePlayerList)
					{
						if(IsAdmin(current, false)) SendChatMessage(current, "Tickets", $"A new Ticket has been submitted. <color=#00FF8D>Ticket ID {id}</color>. To view it type <color=#00FF8D>/ticket view {id}</color>");
					}
					
					break;
						
				case "remove":
					if(IsAdmin(player, false))
					{
						foreach(Ticket ticket in data.tickets)
						{
							if(ticket.ticketID.ToString() == arg) 
							{
								data.tickets.Remove(ticket);
								SendChatMessage(player, "Tickets", $"Removed Ticket {ticket.ticketID.ToString()}");
								break;
							}
						}
					}
					else
					{
						foreach(Ticket ticket in data.tickets)
						{
							if(ticket.ticketID.ToString() == arg && ticket.steamID == player.userID.ToString())
							{
								data.tickets.Remove(ticket);
								SendChatMessage(player, "Tickets", $"Removed Ticket {ticket.ticketID.ToString()}");
								break;
							}
						}
					}
					break;
						
				case "view":
					if(IsAdmin(player, false))
					{
						foreach(Ticket ticket in data.tickets)
						{
							if(ticket.ticketID.ToString() == arg)
							{
								SendChatMessage(player, "Tickets", $"<color=white><color=#00FF8D>------------------ Ticket {ticket.ticketID} ------------------</color>\n" +
									$"<color=#00FF8D>Timestamp:</color> {ticket.timestamp}\n" +
									$"<color=#00FF8D>Player:</color> {ticket.player}\n" +
									$"<color=#00FF8D>SteamID:</color> {ticket.steamID}\n" +
									$"<color=#00FF8D>Steam Profile:</color> {ticket.profile}\n" +
									$"<color=#00FF8D>Position</color>: {ticket.position}\n" +
									$"<color=#00FF8D>Message</color>: {ticket.message}\n" +
									$"<color=#00FF8D>Reply</color>: {ticket.reply}</color>"
								);
								
								player.ConsoleMessage($"<color=white><color=#00FF8D>------------------ Ticket {ticket.ticketID} ------------------</color>\n" +
									$"<color=#00FF8D>Timestamp:</color> {ticket.timestamp}\n" +
									$"<color=#00FF8D>Player:</color> {ticket.player}\n" +
									$"<color=#00FF8D>SteamID:</color> {ticket.steamID}\n" +
									$"<color=#00FF8D>Steam Profile:</color> {ticket.profile}\n" +
									$"<color=#00FF8D>Position</color>: {ticket.position}\n" +
									$"<color=#00FF8D>Message</color>: {ticket.message}\n" +
									$"<color=#00FF8D>Reply</color>: {ticket.reply}</color>"
								);
							}
						}
					}
					else
					{
						foreach(Ticket ticket in data.tickets)
						{
							if(ticket.ticketID.ToString() == arg && ticket.steamID == player.userID.ToString())
							{
								SendChatMessage(player, "Tickets", $"<color=white><color=#00FF8D>------------------ Ticket {ticket.ticketID} ------------------</color>\n" +
									$"<color=#00FF8D>Timestamp:</color> {ticket.timestamp}\n" +
									$"<color=#00FF8D>Message</color>: {ticket.message}\n" +
									$"<color=#00FF8D>Reply</color>: {ticket.reply}</color>"
								);
							}
							
						}
					}
					break;
						
				case "tp":
					foreach(Ticket ticket in data.tickets)
					{
//.........這裏部分代碼省略.........
開發者ID:anthok,項目名稱:RustPlugins,代碼行數:101,代碼來源:Tickets.cs

示例2: Clear

		void Clear(BasePlayer player)
		{
			for(int i = 200; i > 0; i--)
			{
				player.ConsoleMessage("<color=white>²</color>\n");
			}
		}
開發者ID:anthok,項目名稱:RustPlugins,代碼行數:7,代碼來源:Tickets.cs


注:本文中的BasePlayer.ConsoleMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。