本文整理汇总了C#中ConsoleSystem.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleSystem.GetString方法的具体用法?C# ConsoleSystem.GetString怎么用?C# ConsoleSystem.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleSystem
的用法示例。
在下文中一共展示了ConsoleSystem.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: connect
public static void connect(ref ConsoleSystem.Arg arg)
{
if (UnityEngine.Object.FindObjectOfType(typeof(ClientConnect)))
{
Debug.Log("Connect already in progress!");
return;
}
if (NetCull.isClientRunning)
{
Debug.Log("Use net.disconnect before trying to connect to a new server.");
return;
}
string[] strArrays = arg.GetString(0, string.Empty).Split(new char[] { ':' });
if ((int)strArrays.Length != 2)
{
Debug.Log("Not a valid ip - or port missing");
return;
}
string str = strArrays[0];
int num = int.Parse(strArrays[1]);
Debug.Log(string.Concat(new object[] { "Connecting to ", str, ":", num }));
PlayerPrefs.SetString("net.lasturl", arg.GetString(0, string.Empty));
if (!ClientConnect.Instance().DoConnect(str, num))
{
return;
}
LoadingScreen.Show();
LoadingScreen.Update("connecting..");
}
示例2: popup
public static void popup(ref ConsoleSystem.Arg arg)
{
float num = arg.GetFloat(0, 2f);
string str = arg.GetString(1, "!");
string str1 = arg.GetString(2, "This is the text");
PopupUI.singleton.CreateNotice(num, str, str1);
}
示例3:
public static void @add(ref ConsoleSystem.Arg arg)
{
if (!chat.enabled)
{
return;
}
string str = arg.GetString(0, string.Empty);
string str1 = arg.GetString(1, string.Empty);
if (str == string.Empty || str1 == string.Empty)
{
return;
}
ChatUI.AddLine(str, str1);
}
示例4: ExtractArgs
private static string[] ExtractArgs(ConsoleSystem.Arg arg)
{
if (arg == null) return new string[0];
var argsList = new List<string>();
var i = 0;
while (arg.HasArgs(++i)) argsList.Add(arg.GetString(i - 1));
return argsList.ToArray();
}
示例5: handleCommand
public static void handleCommand(ref ConsoleSystem.Arg arg)
{
string name = arg.argUser.user.Displayname;
string command = arg.GetString(0, "text").Trim();
uLink.NetworkPlayer player = arg.argUser.networkPlayer;
Debug.Log((object) ("[HANDLE COMMAND:] " + name + " " + command));
string[] tmp = command.Split (' ');
command = tmp [0].Trim ();
for (int i=3; i < tmp.Length; i++)
tmp [2] += " " + tmp [i];
switch (command) {
case "/share":
share (ref arg, ref tmp);
break;
case "/unshare":
unshare (ref arg, ref tmp);
break;
case "/pm":
pm (ref arg, ref tmp);
break;
case "/ping":
ping (ref arg);
break;
case "/help":
help (ref arg);
break;
case "/location":
location (ref arg);
break;
case "/history":
history (ref arg);
break;
case "/players":
players (ref arg);
break;
case "/starter":
starter (ref arg);
break;
default:
API.sayUser (player, "Invalid Command! type /help for a list of commmands");
break;
}
}
示例6: handleCommand
public static void handleCommand(ConsoleSystem.Arg arg)
{
string displayname = arg.argUser.user.Displayname;
string[] strArray = arg.GetString(0, "text").Trim().Split(new char[] { ' ' });
string cmd = strArray[0].Trim();
string[] chatArgs = new string[strArray.Length - 1];
for (int i = 1; i < strArray.Length; i++)
{
chatArgs[i - 1] = strArray[i];
}
ChatCommand.CallCommand(cmd, arg, chatArgs);
}
示例7: handleCommand
public static void handleCommand(ref ConsoleSystem.Arg arg)
{
uLink.NetworkPlayer player = arg.argUser.networkPlayer;
string name = arg.argUser.user.Displayname;
string command = arg.GetString(0, "text").Trim();
string full = command;
string[] tmp = command.Split (' ');
command = tmp [0].Trim ();
string[] args = new string[tmp.Length - 1];
switch (command) {
case "/share":
share (ref arg, ref args);
break;
case "/unshare":
unshare (ref arg, ref args);
break;
case "/pm":
pm (ref arg, ref args);
break;
case "/ping":
ping (ref arg);
break;
case "/help":
help (ref arg);
break;
case "/location":
location (ref arg);
break;
case "/history":
history (ref arg);
break;
case "/players":
players (ref arg);
break;
case "/starter":
starter (ref arg);
break;
default:
API.sayUser (player, "Invalid Command! type /help for a list of commmands");
break;
}
}
示例8: say
public static void say(ref ConsoleSystem.Arg arg)
{
if (!chat.enabled)
return;
string str1 = String.QuoteSafe(arg.argUser.user.Displayname);
string str2 = String.QuoteSafe(arg.GetString(0, "text"));
if(str2 != null && str2.Length > 1 && str2.Substring(1, 1).Equals("/")) {
rustpp.handleCommand(ref arg);
} else {
if (chat.serverlog)
Debug.Log((object) ("[YES HIJACKED CHAT:] " + str1 + ":" + str2));
messages.Add (str2);
users.Add (str1);
ConsoleNetworker.Broadcast("chat.add " + str1 + " " + str2);
}
}
示例9: cmdShow
private void cmdShow(ConsoleSystem.Arg arg)
{
if (!PermissionsLoaded(arg)) return;
if (!IsAdmin(arg)) return;
if (!arg.HasArgs())
{
var reply = "Syntax: show <group|user> <name>\n";
reply += "Syntax: show <groups|perms>";
arg.ReplyWith(reply);
return;
}
var mode = arg.GetString(0);
var name = arg.GetString(1);
if (mode.Equals("perms"))
{
var result = "Permissions:\n";
result += string.Join(", ", permission.GetPermissions());
arg.ReplyWith(result);
}
else if (mode.Equals("user"))
{
var player = FindPlayer(name);
if (player == null && !permission.UserExists(name))
{
arg.ReplyWith("User '" + name + "' not found");
return;
}
var userId = name;
if (player != null)
{
userId = player.userID.ToString();
name = player.displayName;
permission.UpdateNickname(userId, name);
name += $"({userId})";
}
var result = "User '" + name + "' permissions:\n";
result += string.Join(", ", permission.GetUserPermissions(userId));
result += "\nUser '" + name + "' groups:\n";
result += string.Join(", ", permission.GetUserGroups(userId));
arg.ReplyWith(result);
}
else if (mode.Equals("group"))
{
if (!permission.GroupExists(name))
{
arg.ReplyWith("Group '" + name + "' doesn't exist");
return;
}
var result = "Group '" + name + "' users:\n";
result += string.Join(", ", permission.GetUsersInGroup(name));
result += "\nGroup '" + name + "' permissions:\n";
result += string.Join(", ", permission.GetGroupPermissions(name));
var parent = permission.GetGroupParent(name);
while (permission.GroupExists(parent))
{
result = "\nParent group '" + parent + "' permissions:\n";
result += string.Join(", ", permission.GetGroupPermissions(parent));
parent = permission.GetGroupParent(name);
}
arg.ReplyWith(result);
}
else if (mode.Equals("groups"))
{
var result = "Groups:\n";
result += string.Join(", ", permission.GetGroups());
arg.ReplyWith(result);
}
}
示例10: cmdRevoke
private void cmdRevoke(ConsoleSystem.Arg arg)
{
if (!PermissionsLoaded(arg)) return;
if (!IsAdmin(arg)) return;
if (!arg.HasArgs(3))
{
arg.ReplyWith("Usage: revoke <group|user> <name|id> <permission>");
return;
}
var mode = arg.GetString(0);
var name = arg.GetString(1);
var perm = arg.GetString(2);
if (mode.Equals("group"))
{
if (!permission.GroupExists(name))
{
arg.ReplyWith("Group '" + name + "' doesn't exist");
return;
}
permission.RevokeGroupPermission(name, perm);
arg.ReplyWith("Group '" + name + "' revoked permission: " + perm);
}
else if (mode.Equals("user"))
{
var player = FindPlayer(name);
if (player == null && !permission.UserExists(name))
{
arg.ReplyWith("User '" + name + "' not found");
return;
}
var userId = name;
if (player != null)
{
userId = player.userID.ToString();
name = player.displayName;
permission.UpdateNickname(userId, name);
}
permission.RevokeUserPermission(userId, perm);
arg.ReplyWith("User '" + name + "' revoked permission: " + perm);
}
}
示例11:
public static void @add(ref ConsoleSystem.Arg arg)
{
FavouriteList.Add(arg.GetString(0, string.Empty));
}
示例12: OnRunCommand
private object OnRunCommand(ConsoleSystem.Arg arg)
{
if (arg?.cmd == null) return null;
if (arg.cmd.namefull != "chat.say") return null;
if (arg.connection != null)
{
if (arg.Player() == null) return true;
var rustCovalence = Libraries.Covalence.RustCovalenceProvider.Instance;
var livePlayer = rustCovalence.PlayerManager.GetOnlinePlayer(arg.connection.userid.ToString());
if (rustCovalence.CommandSystem.HandleChatMessage(livePlayer, arg.GetString(0))) return true;
}
// Get the args
var str = arg.GetString(0, "text");
if (str.Length == 0) return null;
// Is it a chat command?
if (str[0] == '/' || str[0] == '!')
{
// Get the message
var message = str.Substring(1);
// Parse it
string cmd;
string[] args;
ParseChatCommand(message, out cmd, out args);
if (cmd == null) return null;
// Handle it
var player = arg.connection.player as BasePlayer;
if (player == null)
Interface.Oxide.LogDebug("Player is actually a {0}!", arg.connection.player.GetType());
else
if (!cmdlib.HandleChatCommand(player, cmd, args)) ReplyWith(player.net.connection, "UnknownCommand", cmd);
// Handled
arg.ReplyWith(string.Empty);
return true;
}
// Default behavior
return null;
}
示例13: CmdRevoke
private void CmdRevoke(ConsoleSystem.Arg arg)
{
if (!PermissionsLoaded(arg)) return;
if (!IsAdmin(arg)) return;
if (!arg.HasArgs(3))
{
ReplyWith(arg.connection, "CommandUsageRevoke");
return;
}
var mode = arg.GetString(0);
var name = arg.GetString(1);
var perm = arg.GetString(2);
if (!permission.PermissionExists(perm))
{
ReplyWith(arg.connection, "PermissionNotFound", perm);
return;
}
if (mode.Equals("group"))
{
if (!permission.GroupExists(name))
{
ReplyWith(arg.connection, "GroupNotFound", name);
return;
}
permission.RevokeGroupPermission(name, perm);
ReplyWith(arg.connection, "GroupPermissionRevoked", name, perm);
}
else if (mode.Equals("user"))
{
var player = FindPlayer(name);
if (player == null && !permission.UserExists(name))
{
ReplyWith(arg.connection, "UserNotFound", name);
return;
}
var userId = name;
if (player != null)
{
userId = player.userID.ToString();
name = player.displayName;
permission.UpdateNickname(userId, name);
}
permission.RevokeUserPermission(userId, perm);
ReplyWith(arg.connection, "UserPermissionRevoked", $"{name} ({userId})", perm);
}
}
示例14: CmdGroup
private void CmdGroup(ConsoleSystem.Arg arg)
{
if (!PermissionsLoaded(arg)) return;
if (!IsAdmin(arg)) return;
if (!arg.HasArgs(2))
{
ReplyWith(arg.connection, "CommandUsageGroup");
return;
}
var mode = arg.GetString(0);
var name = arg.GetString(1);
if (mode.Equals("add"))
{
if (permission.GroupExists(name))
{
ReplyWith(arg.connection, "GroupAlreadyExists", name);
return;
}
permission.CreateGroup(name, arg.GetString(2), arg.GetInt(3));
ReplyWith(arg.connection, "GroupCreated", name);
}
else if (mode.Equals("remove"))
{
if (!permission.GroupExists(name))
{
ReplyWith(arg.connection, "GroupNotFound", name);
return;
}
permission.RemoveGroup(name);
ReplyWith(arg.connection, "GroupDeleted", name);
}
else if (mode.Equals("set"))
{
if (!permission.GroupExists(name))
{
ReplyWith(arg.connection, "GroupNotFound", name);
return;
}
permission.SetGroupTitle(name, arg.GetString(2));
permission.SetGroupRank(name, arg.GetInt(3));
ReplyWith(arg.connection, "GroupChanged", name);
}
else if (mode.Equals("parent"))
{
if (!permission.GroupExists(name))
{
ReplyWith(arg.connection, "GroupNotFound", name);
return;
}
var parent = arg.GetString(2);
if (!string.IsNullOrEmpty(parent) && !permission.GroupExists(parent))
{
ReplyWith(arg.connection, "GroupParentNotFound", parent);
return;
}
if (permission.SetGroupParent(name, parent))
ReplyWith(arg.connection, "GroupParentChanged", name, parent);
else
ReplyWith(arg.connection, "GroupParentNotChanged", name);
}
}
示例15: CmdUnload
private void CmdUnload(ConsoleSystem.Arg arg)
{
if (!IsAdmin(arg)) return;
if (!arg.HasArgs())
{
ReplyWith(arg.connection, "CommandUsageUnload");
return;
}
if (arg.GetString(0).Equals("*"))
{
Interface.Oxide.UnloadAllPlugins();
return;
}
foreach (var name in arg.Args)
if (!string.IsNullOrEmpty(name)) Interface.Oxide.UnloadPlugin(name);
}