本文整理汇总了C#中PlayerClient类的典型用法代码示例。如果您正苦于以下问题:C# PlayerClient类的具体用法?C# PlayerClient怎么用?C# PlayerClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerClient类属于命名空间,在下文中一共展示了PlayerClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoPlayerConnected
public static void DoPlayerConnected(PlayerClient player)
{
if (GameEvent.PlayerConnected != null)
{
GameEvent.PlayerConnected(player);
}
}
示例2: EjectPlayer
static void EjectPlayer(Zone zone, PlayerClient player)
{
cachedDirection = player.lastKnownPosition - zone.transform.position;
player.lastKnownPosition = zone.transform.position + (cachedDirection / cachedDirection.magnitude * (zone.GetComponent<UnityEngine.SphereCollider>().radius + 2f));
management.TeleportPlayerToWorld(player.netPlayer, player.lastKnownPosition);
Interface.CallHook("IsCollidingEject",zone, player);
}
示例3: Player
//public Player()
//{
// this.justDied = true;
//}
public Player(PlayerClient client)
{
Contract.Requires(client != null);
this.justDied = true;
this.ourPlayer = client;
this.connectedAt = DateTime.UtcNow.Ticks;
this.FixInventoryRef();
}
示例4: hasTag
static bool hasTag(PlayerClient player, string tagname)
{
if (playerZones[player] == null) { return false; }
if (playerZones[player].Count == 0) { return false; }
fieldInfo = typeof(ZoneDefinition).GetField(tagname, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
foreach (Zone zone in playerZones[player])
{
if (fieldInfo.GetValue(zone.info) != null)
return true;
}
return false;
}
示例5: Handle
public void Handle(PlayerClient nClient, QueueAccountPlayerMessage queue)
{
var client = Players.Find(p => p.Client == nClient);
if (client == null)
{
client = new ClientQueue(nClient);
Players.Add(client);
}
var position = (Players.IndexOf(client) + 1);
client.Client.SendMessage(FormatData(position, GetMaxSubscriber(), GetMaxNoSubscriber(), IsSubscribed(nClient.Infos.AccountId)));
if(!client.CanConnect) return;
client.Client.SendMessage("Adxprpgy\0Ac4\0AH601;1;75;1|602;1;75;1\0AlK0\0AQQuel+est+mon+joueur+de+football+pr%C3%A9f%C3%A9r%C3%A9+%3F");
Players.Remove(client);
}
示例6: shareWith
public static void shareWith(PlayerClient senderClient, string[] args)
{
if (args.Count() > 1)
{
PlayerClient[] possibleTargets = Array.FindAll(PlayerClient.All.ToArray(), (PlayerClient pc) => pc.userName.Contains(args[1]));
if (possibleTargets.Count() == 0)
Broadcast.broadcastTo(senderClient.netPlayer, "No player names equal or contain '" + args[1] + "'.");
else if (possibleTargets.Count() > 1)
Broadcast.broadcastTo(senderClient.netPlayer, "Too many player names contain '" + args[1] + "'.");
else
{
PlayerClient targetClient = possibleTargets[0];
string senderUID = senderClient.userID.ToString();
string targetUID = targetClient.userID.ToString();
if (senderUID != null && targetUID != null && senderUID.Length == 17 && targetUID.Length == 17 && senderUID != targetUID)
{
if (Vars.sharingData.ContainsKey(senderUID))
{
if (!Vars.sharingData[senderUID].Contains(targetUID))
{
string oldVal = Vars.sharingData[senderUID];
Vars.sharingData[senderUID] = oldVal + ":" + targetUID;
Broadcast.noticeTo(senderClient.netPlayer, ":D", "Doors shared with " + targetClient.userName + ".");
Broadcast.noticeTo(targetClient.netPlayer, ":D", "You can now open " + senderClient.userName + "'s doors.");
Vars.addDoorData(senderUID, targetUID);
}
else
{
Broadcast.noticeTo(senderClient.netPlayer, ":D", "You have already shared doors with " + targetClient.userName + ".");
}
}
else
{
Vars.sharingData.Add(senderUID, targetUID);
Broadcast.noticeTo(senderClient.netPlayer, ":D", "Doors shared with " + targetClient.userName + ".");
Broadcast.noticeTo(targetClient.netPlayer, ":D", "You can now open " + senderClient.userName + "'s doors.");
Vars.addDoorData(senderUID, targetUID);
}
}
}
}
}
示例7: ShowTalker
void ShowTalker(uLink.NetworkPlayer player, PlayerClient p)
{
}
示例8: OnPlayerSpawned
private void OnPlayerSpawned(PlayerClient client)
{
var netUser = client.netUser;
if (!playerData.ContainsKey(netUser)) playerData.Add(netUser, new PlayerData());
playerData[netUser].character = client.controllable.GetComponent<Character>();
playerData[netUser].inventory = client.controllable.GetComponent<PlayerInventory>();
}
示例9: executeCMD
public static void executeCMD(string playerName, string message, uLink.NetworkPlayer player, PlayerClient playerClient, Character playerChar)
{
string[] commandArgs = message.Split(' ');
string command = commandArgs[0];
if (Vars.totalCommands.Contains(command) || (playerChar.netUser.CanAdmin() && commandArgs[0] == "/reload"))
{
if (Vars.enabledCommands[Vars.findRank(playerClient.userID.ToString())].Contains(command) || (playerChar.netUser.CanAdmin() && commandArgs[0] == "/reload"))
{
if (Vars.enabledCommands[Vars.findRank(playerClient.userID.ToString())].Contains("/whitelist check") && message.StartsWith("/whitelist check"))
Vars.whitelistCheck(playerClient);
else if (Vars.enabledCommands[Vars.findRank(playerClient.userID.ToString())].Contains("/f safezone") && message.StartsWith("/f safezone"))
Vars.manageZones(playerClient, commandArgs, true);
else if (Vars.enabledCommands[Vars.findRank(playerClient.userID.ToString())].Contains("/f warzone") && message.StartsWith("/f warzone"))
Vars.manageZones(playerClient, commandArgs, false);
else if (Vars.enabledCommands[Vars.findRank(playerClient.userID.ToString())].Contains("/f build") && message.StartsWith("/f build"))
Vars.handleFactions(playerClient, commandArgs);
else
{
switch (command)
{
case "/client":
Vars.grabClient(playerClient, commandArgs);
break;
case "/clearinv":
Vars.clearPlayer(playerClient, commandArgs);
break;
case "/craft":
Vars.craftTool(playerClient, commandArgs);
break;
case "/vanish":
Vars.vanishTool(playerClient, commandArgs);
break;
case "/hide":
Vars.hideTool(playerClient, commandArgs);
break;
case "/dist":
Vars.showDistance(playerClient, commandArgs);
break;
case "/owner":
Vars.showOwner(playerClient, commandArgs);
break;
case "/removeall":
Vars.removerAllTool(playerClient, commandArgs);
break;
case "/remove":
Vars.removerTool(playerClient, commandArgs);
break;
case "/f":
Vars.handleFactions(playerClient, commandArgs);
break;
case "/r":
Broadcast.reply(playerClient, commandArgs);
break;
case "/rules":
Vars.showRules(playerClient);
break;
case "/players":
Vars.showPlayers(playerClient);
break;
case "/warps":
Vars.showWarps(playerClient);
break;
case "/kits":
Vars.showKits(playerClient);
break;
case "/feed":
Vars.feedPlayer(player, playerName, commandArgs);
break;
case "/heal":
Vars.healPlayer(player, playerName, commandArgs);
break;
case "/access":
Vars.giveAccess(playerClient, commandArgs);
break;
case "/version":
Broadcast.broadcastTo(player, "The server is running Rust Essentials v" + Vars.currentVersion + ".");
break;
case "/save":
Vars.save(playerClient);
break;
case "/saypop":
Vars.saypop(commandArgs);
break;
case "/tppos":
Vars.teleportPos(playerClient, commandArgs);
break;
case "/tphere":
Vars.teleportHere(playerClient, commandArgs);
break;
case "/tpaccept":
Vars.teleportAccept(playerClient, commandArgs);
break;
case "/tpdeny":
Vars.teleportDeny(playerClient, commandArgs);
break;
case "/tpa":
Vars.teleportRequest(playerClient, commandArgs);
break;
case "/tp":
//.........这里部分代码省略.........
示例10: showWarps
public static void showWarps(PlayerClient senderClient)
{
string rank = Vars.findRank(senderClient.userID.ToString());
Broadcast.broadcastTo(senderClient.netPlayer, "Available warps:", true);
Vars.listWarps(rank, senderClient);
}
示例11: showPlayers
public static void showPlayers(PlayerClient senderClient)
{
Broadcast.broadcastTo(senderClient.netPlayer, "All online players:", true);
List<string> names = new List<string>();
List<string> names2 = new List<string>();
foreach (PlayerClient pc in AllPlayerClients.ToArray())
{
if (pc.userName.Length > 0)
names.Add(pc.userName);
}
List<string> otherNames = new List<string>();
while (names.Count > 0)
{
names2.Clear();
otherNames.Clear();
foreach (string s in names)
{
names2.Add(s);
otherNames.Add(s);
if ((string.Join(", ", names2.ToArray())).Length > 70)
{
names2.Remove(s);
otherNames.Remove(s);
break;
}
}
foreach (string s in otherNames)
{
names.Remove(s);
}
Broadcast.broadcastTo(senderClient.netPlayer, string.Join(", ", names2.ToArray()), true);
}
}
示例12: requestTimeout
public static void requestTimeout(PlayerClient targetClient, PlayerClient senderClient)
{
if (teleportRequests[targetClient].ContainsKey(senderClient))
{
teleportRequests[targetClient].Remove(senderClient);
Broadcast.broadcastTo(senderClient.netPlayer, "Request to teleport to " + targetClient.userName + " has timed out.");
}
}
示例13: removerTool
public static void removerTool(PlayerClient senderClient, string[] args)
{
if (args.Count() > 1)
{
string mode = args[1];
string UID = senderClient.userID.ToString();
switch (mode)
{
case "on":
if (!destroyerList.Contains(UID))
{
if (ownershipList.Contains(UID))
{
Broadcast.broadcastTo(senderClient.netPlayer, "Ownership tool deactivated.");
ownershipList.Remove(UID);
}
Broadcast.broadcastTo(senderClient.netPlayer, "Remover tool activated. Hit AI or structures to delete them.");
destroyerList.Add(UID);
}
else
Broadcast.broadcastTo(senderClient.netPlayer, "You already have the remover tool activated.");
break;
case "off":
if (destroyerList.Contains(UID))
{
Broadcast.broadcastTo(senderClient.netPlayer, "Remover tool deactivated.");
destroyerList.Remove(UID);
}
else
Broadcast.broadcastTo(senderClient.netPlayer, "You do not have the remover tool activated.");
break;
}
}
}
示例14: removeItem
public static void removeItem(PlayerClient playerClient, IInventoryItem item)
{
Inventory inventory = playerClient.controllable.GetComponent<Inventory>();
inventory.RemoveItem(item.slot);
}
示例15: showHistory
public static void showHistory(PlayerClient senderClient, string[] args)
{
if (args.Count() > 1)
{
try
{
int lineAmount = Convert.ToInt16(args[1]);
if (lineAmount > 50)
lineAmount = 50;
int curIndex = 0;
int goalIndex = historyGlobal.Count - lineAmount;
foreach (string s in historyGlobal)
{
if (curIndex >= goalIndex)
{
string playerName = s.Split(new string[] { "$:|:$" }, StringSplitOptions.None)[0].ToString();
string message = s.Split(new string[] { "$:|:$" }, StringSplitOptions.None)[1].ToString();
Broadcast.broadcastCustomTo(senderClient.netPlayer, playerName, message);
}
curIndex++;
}
}
catch (Exception ex)
{
Broadcast.broadcastTo(senderClient.netPlayer, "Line amount must be an integer!");
}
}
else
{
Broadcast.broadcastTo(senderClient.netPlayer, "You must specify a number, 1 - 50, of lines!");
}
}