本文整理汇总了C#中System.Net.Player.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendMessage方法的具体用法?C# Player.SendMessage怎么用?C# Player.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Player
的用法示例。
在下文中一共展示了Player.SendMessage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, params string[] args)
{
int port = 25565;
if (args.Length == 0)
{
if (!p.IsConsole) p.SendMessage("Checking port....");
else Logger.Log("Checking Port...");
checkport(25565, p);
}
else if (args.Length == 1)
{
try
{
port = Convert.ToInt32(args[0]);
if (!p.IsConsole) p.SendMessage("Checking port....");
else Logger.Log("Checking Port...");
checkport(port, p);
}
catch (Exception)
{
if (!p.IsConsole) p.SendMessage("port must be a number");
else Logger.Log("Port must be a number");
}
}
}
示例2: Help
public override void Help(Player p)
{
if (p.IsConsole)
{
Logger.Log("/checkport or /cp");
Logger.Log("OPTIONAL you can specify another port by doing /cp <port>");
}
else
{
p.SendMessage("/checkport or /cp");
p.SendMessage("OPTIONAL you can specify another port by doing /cp <port>");
}
}
示例3: Use
public override void Use(Player p, params string[] args)
{
int port = 25565;
if (args.Length == 0)
{
checkport(25565, p);
}
else if (args.Length == 1)
{
try { port = Convert.ToInt16(args[0]); checkport(port, p); }
catch (Exception e) { p.SendMessage("port must be a number"); p.SendMessage(e.Message); p.SendMessage(e.Source); }
}
}
示例4: Help
public override void Help(Player p)
{
p.SendMessage("/cd - Command shortcut.");
p.SendMessage("/countdown join - join the game");
p.SendMessage("/countdown leave - leave the game");
p.SendMessage("/countdown goto - goto the countdown map");
p.SendMessage("/countdown players - view players currently playing");
{
if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1))
{
p.SendMessage("/countdown rules <send> <all/map/player> - the rules of countdown. with send: all to send to all, map to send to map and have a players name to send to a player");
}
else
{
p.SendMessage("/countdown rules - view the rules of countdown");
}
if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 2))
{
p.SendMessage("/countdown download - download the countdown map");
p.SendMessage("/countdown enable - enable the game");
p.SendMessage("/countdown disable - disable the game");
p.SendMessage("/countdown cancel - cancels a game");
p.SendMessage("/countdown start [speed] [mode] - start the game, speeds are 'slow', 'normal', 'fast', 'extreme' and 'ultimate', modes are 'normal' and 'freeze'");
p.SendMessage("/countdown reset [all/map] - reset the whole game (all) or only the map (map)");
p.SendMessage("/countdown tutorial - a tutorial on how to setup countdown");
}
}
}
示例5: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte Type)
{
ppos.x = p.pos[0];
ppos.y = p.pos[1];
ppos.z = p.pos[2];
pllvl = p.level.name;
blox[1].x = x;
blox[1].y = y;
blox[1].z = z;// jetz direction rausfinden und dann unten verwenden.
int direction; //1 = 0,0,0 nach 1,0,0 2= 0,0,0 nach 0,1,0 3= 1,0,0 nach 0 und 4 = 010 nach 0
if (blox[1].x > blox[0].x)
{
direction = 1;
p.SendMessage("dir1");
}
else if (blox[1].x < blox[0].x)
{
direction = 3;
p.SendMessage("dir3");
}
else if (blox[1].z > blox[0].z)
{
direction = 2;
p.SendMessage("dir2");
}
else if (blox[1].z < blox[0].z)
{
direction = 4;
p.SendMessage("dir4");
}
else
{
direction = 1;
p.SendMessage("else");
}
String cinName = "";
cinName = msg;
using (Stream imageStreamSource = new FileStream("extra/images/" + msg + ".gif", FileMode.Open, FileAccess.Read, FileShare.Read))
{
GifBitmapDecoder decoder = new GifBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
for (int i = 0; i < decoder.Frames.Count; i++)
{
//saving all frames as pngs.
BitmapSource bitmapSource = decoder.Frames[i];
using (FileStream fs = new FileStream("extra/images/" + i.ToString() + ".bmp", FileMode.Create))
{
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
encoder.Save(fs);
}
}
using (System.Drawing.Bitmap tbmp = new System.Drawing.Bitmap("extra/images/0.bmp"))
{
picHeight = tbmp.Height;
picWidth = tbmp.Width;
//create the new map...
Command.all.Find("newlvl").Use(p, "gtctempmap " + picWidth.ToString() + " " + picHeight.ToString() + " " + picWidth.ToString() + " space");
Command.all.Find("load").Use(p, "gtctempmap");
//moving the player to this map
Command.all.Find("move").Use(p, p.name + " gtctempmap");
System.Threading.Thread.Sleep(2000);
for (int i = 0; i < decoder.Frames.Count; i++)
{
p.SendMessage("Start processing Frame " + i);
workFrame(i, p, cinName, direction);
p.SendMessage("Done");
}
p.SendMessage("YAY! everything should be done");
Command.all.Find("move").Use(p, p.name + " " + pllvl);
unchecked { p.SendPos((byte)-1, ppos.x, ppos.y, ppos.z, 0, 0); }
Command.all.Find("deletelvl").Use(p, "gtctempmap");//deleting templvl
for (int i = 0; i < decoder.Frames.Count; i++)
{
File.Delete("extra/images/" + i.ToString() + ".bmp");
}
}
}
}
示例6: Use
public override void Use(Player p, string message)
{
//first check if file exists
if (File.Exists("extra/images/" + message + ".gif"))
{
p.SendMessage("Place 2 Blocks to Determine the Direction");
p.ClearBlockchange();
//happens when block is changed. then call blockchange1
msg = message;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
else
{
Player.SendMessage(p, "File does not exist");
return;
}
}
示例7: Use
public override void Use(Player p, string message)
{
if (message == "") { Help(p); return; }
if (p == null)
{
Server.s.Log("'null' or console tried to use /countdown. This command is limited to ingame, sorry!!");
return;
}
string[] command = message.ToLower().Split(' ');
string par0 = String.Empty;
string par1 = String.Empty;
string par2 = String.Empty;
// string par3 = String.Empty;
try
{
par0 = command[0];
par1 = command[1];
par2 = command[2];
}
catch { }
if (par0 == "help")
{
Command.all.Find("help").Use(p, "countdown");
return;
}
if (par0 == "goto")
{
try
{
Command.all.Find("goto").Use(p, "countdown");
}
catch
{
Player.SendMessage(p, "Countdown level not loaded");
return;
}
}
else if (par0 == "join")
{
switch (CountdownGame.gamestatus)
{
case CountdownGameStatus.Disabled:
Player.SendMessage(p, "Sorry - Countdown isn't enabled yet");
return;
case CountdownGameStatus.Enabled:
if (!CountdownGame.players.Contains(p))
{
CountdownGame.players.Add(p);
Player.SendMessage(p, "You've joined the Countdown game!!");
Player.GlobalMessage(p.name + " has joined Countdown!!");
if (p.level != CountdownGame.mapon)
{
Player.SendMessage(p, "You can type '/countdown goto' to goto the countdown map!!");
}
p.playerofcountdown = true;
}
else
{
Player.SendMessage(p, "Sorry, you have already joined!!, to leave please type /countdown leave");
return;
}
break;
case CountdownGameStatus.AboutToStart:
Player.SendMessage(p, "Sorry - The game is about to start");
return; ;
case CountdownGameStatus.InProgress:
Player.SendMessage(p, "Sorry - The game is already in progress.");
return;
case CountdownGameStatus.Finished:
Player.SendMessage(p, "Sorry - The game has finished. Get an op to reset it.");
return;
}
}
else if (par0 == "leave")
{
if (CountdownGame.players.Contains(p))
{
switch (CountdownGame.gamestatus)
{
case CountdownGameStatus.Disabled:
Player.SendMessage(p, "Sorry - Countdown isn't enabled yet");
return;
case CountdownGameStatus.Enabled:
CountdownGame.players.Remove(p);
CountdownGame.playersleftlist.Remove(p);
Player.SendMessage(p, "You've left the game.");
p.playerofcountdown = false;
break;
case CountdownGameStatus.AboutToStart:
Player.SendMessage(p, "Sorry - The game is about to start");
return; ;
case CountdownGameStatus.InProgress:
Player.SendMessage(p, "Sorry - you are in a game that is in progress, please wait till its finished or till you've died.");
return;
case CountdownGameStatus.Finished:
//.........这里部分代码省略.........
示例8: AddPlayer
/// <summary>
/// Add a player to the PUG.
/// </summary>
/// <param name="player"></param>
/// <param name="desiredClass"></param>
public void AddPlayer( Player player, PlayerClass desiredClass )
{
if (desiredClass < PlayerClass.Medic && player.GamesPlayed > 10 && player.MedicPercentage < 0.06)
{
player.SendMessage( @"Your medic percentage is too low. You must maintain a medic percentage higher than %6 to play here." );
return;
}
if (Players[desiredClass].Count < Players[desiredClass].Capacity)
{
// Check to see if the player is already added to the PUG, and just wants to change classes.
foreach (PlayerClass currentClass in Players.Keys)
{
foreach (Player currentPlayer in Players[currentClass])
{
if (currentPlayer.Id == player.Id)
{
Players[currentClass].Remove( currentPlayer );
break;
}
}
}
Players[desiredClass].Add( player );
if (null != OnPlayerAdded)
OnPlayerAdded( this, new PlayerAddedOrRemovedEventArgs( player ) );
if (this.IsFull() && null != OnPugFull)
{
OnPugFull( this, null );
}
return;
}
player.SendMessage( "This class is full. Try adding as a different class." );
}
示例9: checkport
void checkport(int port, Player p)
{
string response;
new Thread(new ThreadStart(delegate
{
try
{
using (WebClient WEB = new WebClient())
{
response = WEB.DownloadString("http://www.mcforge.net/ports.php?port=" + port);
}
if (response == "open")
{
if (!p.IsConsole) p.SendMessage(Color.Green + "Port Open!");
else Logger.Log("Port Open!");
return;
}
if (response == "closed")
{
if (!p.IsConsole) p.SendMessage(Color.Red + "Port Closed");
else Logger.Log("Port Closed");
return;
}
if (!p.IsConsole) p.SendMessage(Color.Yellow + "An Error has occured");
else Logger.Log("An Error has occured");
return;
}
catch
{
if (!p.IsConsole) p.SendMessage(Color.Yellow + "An Error has occured");
else Logger.Log("An Error has occured");
return;
}
})).Start();
}
示例10: checkport
void checkport(int port, Player p)
{
TcpListener listener = null;
try
{
// Try to open the port. If it fails, the port is probably open already.
try
{
listener = new TcpListener(IPAddress.Any, port);
listener.Start();
}
catch
{
// Port is probably open already by the server, so let's just continue :)
listener = null;
}
p.SendMessage("Testing Port: " + port);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://mcfire.tk/port.php?port=" + port);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
using (Stream stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
string line;
while ((line = reader.ReadLine()) != null)
{
if (line == "") { continue; }
if (line == "open")
{
p.SendMessage(Color.Green + "Port Open!");
return;
}
p.SendMessage((Color.Red + "Port " + port + " seems to be closed. You may need to set up port forwarding."));
}
}
}
}
else { p.SendMessage(Color.Red + "Could Not connect to site, aborting operation"); }
}
catch (Exception ex)
{
p.SendMessage(Color.Red + "Testing Port Failed!");
p.SendMessage("Could not start listening on port " + port + ". Another program may be using the port.");
Server.Log("-----------------port error----------------");
Server.Log(ex.Message + Environment.NewLine + ex.Source + Environment.NewLine + ex.StackTrace);
Server.Log("-----------------port error----------------");
}
finally
{
if (listener != null)
{
listener.Stop();
}
}
}
示例11: Help
public override void Help(Player p)
{
p.SendMessage("/checkport or /cp");
p.SendMessage("OPTIONAL you can specify another port by doing /cp <port>");
}