本文整理汇总了C#中System.Net.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于System.Net命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoteGameController
//public Player Player
//{
// get { return player; }
// set { player = value; }
//}
public RemoteGameController(Player player, ClientSide clientSide, UDPClientServerCommons.Packets.GameInfoPacket gameInfo)
{
gameStatus = GameStatus.WaitingForStart;
clientNetworkLayer = clientSide;
this.player = player;
this.gameInfo = gameInfo;
}
示例2: 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");
}
}
}
示例3: MultiplayerChatRoom
public MultiplayerChatRoom(String Name, String IP)
{
InitializeComponent();
players.Add(player = new Player(Name));
dataGrid.ItemsSource = players;
StartClient(IP);
}
示例4: 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");
}
}
}
示例5: Use
public override void Use(Player p, string message)
{
if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
if (!Directory.Exists("extra/copy"))
Directory.CreateDirectory("extra/copy");
if (!File.Exists("extra/copy/nyancat.copy"))
{
Player.SendMessage(p, "Nyan Cat copy doesn't exist. Downloading...");
try
{
using (WebClient WEB = new WebClient())
WEB.DownloadFile("http://mcforge.net/uploads/copy/nyancat.copy", "extra/copy/nyancat.copy");
}
catch
{
Player.SendMessage(p, "Sorry, downloading failed. Please try again later.");
return;
}
}
Command.all.Find("retrieve").Use(p, "nyancat");
Command.all.Find("paste").Use(p, "");
ushort[] loc = p.getLoc(false);
Command.all.Find("click").Use(p, loc[0] + " " + loc[1] + " " + loc[2]);
}
示例6: Use
public override void Use(Player p, string message)
{
if (!Directory.Exists("extra/passwords"))
Directory.CreateDirectory("extra/passwords");
if ( p.group.Permission < Server.verifyadminsrank ) {
Player.SendMessage(p, "You do not have the &crequired rank " + Server.DefaultColor + "to use this command!");
return;
}
if ( !Server.verifyadmins ) {
Player.SendMessage(p, "Verification of admins is &cdisabled!");
return;
}
if ( p.adminpen ) {
if ( File.Exists("extra/passwords/" + p.name + ".dat") ) {
Player.SendMessage(p, "&cYou already have a password set. " + Server.DefaultColor + "You &ccannot change " + Server.DefaultColor + "it unless &cyou verify it with &a/pass [Password]. " + Server.DefaultColor + "If you have &cforgotten " + Server.DefaultColor + "your password, contact &c" + Server.server_owner + Server.DefaultColor + " and they can &creset it!");
return;
}
}
if ( String.IsNullOrEmpty(message.Trim()) ) {
Help(p);
return;
}
int number = message.Split(' ').Length;
if ( number > 1 ) {
Player.SendMessage(p, "Your password must be one word!");
return;
}
PasswordHasher.StoreHash(p.name, message);
Player.SendMessage(p, "Your password has &asuccessfully &abeen set to:");
Player.SendMessage(p, "&c" + message);
}
示例7: addGoalieFromPlayer
public void addGoalieFromPlayer(Player myPlayer)
{
Goalie myGoalie = null;
//ensure the current player is removed from the list
for (int i = 0; i < players.Count; i++)
{
if (players[i].Equals(myPlayer))
{
//if there is a player object matching the given player
//if that player is a goalie
if (players[i].GetType().ToString().Equals("icehockeyWA.Models.Goalie"))
{
//set the current goalie to that player
myGoalie = (Goalie)players[i];
}
else
{
players.RemoveAt(i);
//create a new goalie object in the list
myGoalie = new Goalie(myPlayer.playerID, myPlayer.name, myPlayer.number);
players.Add(myGoalie);
}
}
}
currentGoalie = myGoalie;
}
示例8: DoAttack
private void DoAttack(Player attacker, Player attacked)
{
List<CardModel> revealed = attacked.DrawCards(2);
if (revealed.Count > 0)
{
string cards = Log.FormatSortedCards(revealed);
string target = attacked == attacker ? "You" : attacked.Name;
int choice = attacker.Chooser.ChooseOneEffect(attacker == attacked ? EffectChoiceType.DiscardOrPutOnDeckToDraw: EffectChoiceType.ForceDiscardOrPutOnDeck, revealed, target + " revealed " + cards, choices, choices);
if (choice == 0)
{
IEnumerable<CardModel> order = attacked.Chooser.ChooseOrder(CardOrderType.OrderOnDeck, "Put " + cards + " back in any order", revealed);
foreach (CardModel c in order)
{
attacked.Deck.PlaceOnTop(c);
}
}
else
{
foreach (CardModel c in revealed)
{
attacked.DiscardCard(c);
}
}
}
}
示例9: DoAttack
private void DoAttack(Player attacker, Player attacked)
{
List<CardModel> cards = attacked.DrawCards(2);
bool hadTreasure = cards.Any(c => c.Is(CardType.Treasure));
IEnumerable<CardModel> gainable = cards.Where(c => c is Silver || c is Gold);
if (gainable.Any())
{
CardModel treasure = attacker.Chooser.ChooseOneCard(CardChoiceType.TrashForNobleBrigand, "Trash a treasure", ChoiceSource.None, gainable);
if (treasure != null)
{
attacked.Trash(treasure);
attacker.GainCard(treasure, null);
cards.Remove(treasure);
}
}
foreach (CardModel other in cards)
{
attacked.DiscardCard(other);
}
if (!hadTreasure)
{
attacked.GainCard(typeof(Copper));
}
}
示例10: AddPlayerFlagAndName
public static void AddPlayerFlagAndName(ScrollItemWidget template, Player player)
{
var flag = template.Get<ImageWidget>("FLAG");
flag.GetImageCollection = () => "flags";
if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally)
flag.GetImageName = () => player.DisplayFaction.InternalName;
else
flag.GetImageName = () => player.Faction.InternalName;
var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex);
var playerName = template.Get<LabelWidget>("PLAYER");
var playerNameFont = Game.Renderer.Fonts[playerName.Font];
var suffixLength = new CachedTransform<string, int>(s => playerNameFont.Measure(s).X);
var name = new CachedTransform<Pair<string, int>, string>(c =>
WidgetUtils.TruncateText(c.First, playerName.Bounds.Width - c.Second, playerNameFont));
playerName.GetText = () =>
{
var suffix = player.WinState == WinState.Undefined ? "" : " (" + player.WinState + ")";
if (client != null && client.State == Session.ClientState.Disconnected)
suffix = " (Gone)";
var sl = suffixLength.Update(suffix);
return name.Update(Pair.New(player.PlayerName, sl)) + suffix;
};
playerName.GetColor = () => player.Color.RGB;
}
示例11: Start
public void Start(Player player, TcpClient inClientSocket)
{
IsRunning = true;
Player = player;
clientSocket = inClientSocket;
Thread ctThread = new Thread(Listen);
ctThread.Start();
}
示例12: Use
public override void Use(Player p, string message)
{
if ( p.group.Permission < Server.verifyadminsrank ) {
Player.SendMessage(p, "You do not have the &crequired rank to use this command!");
return;
}
if ( !Server.verifyadmins ) {
Player.SendMessage(p, "Verification of admins is &cdisabled!");
return;
}
if ( !p.adminpen ) {
Player.SendMessage(p, "You have &calready verified.");
return;
}
if ( p.passtries >= 3 ) {
p.Kick("Did you really think you could keep on guessing?");
return;
}
if ( String.IsNullOrEmpty(message.Trim()) ) {
Help(p);
return;
}
int number = message.Split(' ').Length;
if ( number > 1 ) {
Player.SendMessage(p, "Your password must be &cone " + Server.DefaultColor + "word!");
return;
}
if ( !Directory.Exists("extra/passwords") ) {
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
DirectoryInfo di = new DirectoryInfo("extra/passwords/");
FileInfo[] fi = di.GetFiles("*.dat");
if ( !File.Exists("extra/passwords/" + p.name + ".dat") ) {
Player.SendMessage(p, "You have not &cset a password, " + Server.DefaultColor + "use &a/setpass [Password] &cto set one!");
return;
}
if ( PasswordHasher.MatchesPass(p.name, message) ) {
Player.SendMessage(p, "Thank you, " + p.color + p.name + Server.DefaultColor + "! You have now &averified " + Server.DefaultColor + "and have &aaccess to admin commands and features!");
if ( p.adminpen ) {
p.adminpen = false;
}
return;
}
p.passtries++;
Player.SendMessage(p, "&cWrong Password. " + Server.DefaultColor + "Remember your password is &ccase sensitive!");
Player.SendMessage(p, "Forgot your password? " + Server.DefaultColor + "Contact the owner so they can reset it!");
}
示例13: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, ushort type)
{
p.ClearBlockchange();
ushort b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例14: OnGain
public override void OnGain(GameModel gameModel, Player player)
{
foreach (Player otherPlayer in gameModel.Players)
{
if (otherPlayer != player)
{
this.DoAttack(player, otherPlayer);
}
}
}
示例15: Help
public override void Help(Player p)
{
Player.SendMessage(p, "%f/report [Player] [Reason] " + Server.DefaultColor + "- Reports the specified player for the reason");
if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) {
Player.SendMessage(p, "%f/report list " + Server.DefaultColor + "- Checks the reported list!");
Player.SendMessage(p, "%f/report check [Player] " + Server.DefaultColor + "- View the report on the specified player");
Player.SendMessage(p, "%f/report delete [Player] " + Server.DefaultColor + "- Delete the report on the specified player");
Player.SendMessage(p, "%f/report clear " + Server.DefaultColor + "- %c!!!Clears all reports!!!");
}
}