当前位置: 首页>>代码示例>>C#>>正文


C# ConsoleSystem类代码示例

本文整理汇总了C#中ConsoleSystem的典型用法代码示例。如果您正苦于以下问题:C# ConsoleSystem类的具体用法?C# ConsoleSystem怎么用?C# ConsoleSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConsoleSystem类属于命名空间,在下文中一共展示了ConsoleSystem类的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..");
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:29,代码来源:net.cs

示例2: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string str = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str = str + ChatArguments[i] + " ";
     }
     string[] strArray = Facepunch.Utility.String.SplitQuotesStrings(str.Trim());
     if (strArray.Length == 2)
     {
         string oldValue = strArray[0].Replace("\"", "");
         string str3 = "";
         for (int j = 1; j < ChatArguments.Length; j++)
         {
             str3 = str3 + ChatArguments[j] + " ";
         }
         string str4 = str3.Replace("\"", "");
         if ((oldValue != "") && (str4 != ""))
         {
             string[] strArray2 = str4.Replace(oldValue, "").Trim().Split(new char[] { ' ' });
             Arguments.Args = new string[] { oldValue, strArray2[strArray2.Length - 1] };
             inv.give(ref Arguments);
         }
     }
     else
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Spawn Item usage:  /i \"itemName\" \"quantity\"");
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:29,代码来源:SpawnItemCommand.cs

示例3: Execute

        public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
        {
            string str = String.Join(" ", ChatArguments).Trim();

            Contract.Assume(PlayerClient.All != null);
            Contract.Assume(Contract.ForAll(PlayerClient.All, p => p != null));

            foreach (PlayerClient client in PlayerClient.All)
            {
                if (client.netUser.displayName.ToLower() != str.ToLower()) continue;

                if (!Core.muteList.Contains(client.userID))
                {
                    Core.muteList.Add(client.userID);
                    Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, client.netUser.displayName + " has been muted!");
                }
                else
                {
                    Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, client.netUser.displayName + " is already muted.");
                }
                return;
            }
            Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
            
        }
开发者ID:balu92,项目名称:Fougerite,代码行数:25,代码来源:MuteCommand.cs

示例4: HandleCommand

            public void HandleCommand(ConsoleSystem.Arg arg)
            {
                for (var i = 0; i < PluginCallbacks.Count; i++)
                    if (PluginCallbacks[i].Callback(arg)) return;

                OriginalCallback?.Invoke(arg);
            }
开发者ID:strykes,项目名称:Oxide,代码行数:7,代码来源:Command.cs

示例5: GetCharacterStuff

 private static bool GetCharacterStuff(ref ConsoleSystem.Arg args, out Character character, out CameraMount camera, out ItemRepresentation itemRep, out ArmorModelRenderer armor)
 {
     character = null;
     itemRep = null;
     armor = null;
     camera = CameraMount.current;
     if (!camera)
     {
         args.ReplyWith("Theres no active camera mount.");
         return false;
     }
     character = IDBase.GetMain(camera) as Character;
     if (!character)
     {
         args.ReplyWith("theres no character for the current mounted camera");
         return false;
     }
     armor = character.GetLocal<ArmorModelRenderer>();
     InventoryHolder local = character.GetLocal<InventoryHolder>();
     if (local)
     {
         itemRep = local.itemRepresentation;
     }
     return true;
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:25,代码来源:actor.cs

示例6: reload

        public static void reload(ConsoleSystem.Arg arg)
        {
            if (PluginLoader.GetInstance().Plugins.ContainsKey(arg.ArgsStr)) {
                PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr);
                arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr));
            } else if (arg.ArgsStr == "") {
                DirectoryConfig.GetInstance().Reload();
                CoreConfig.GetInstance().Reload();
                Config.GetInstance().Reload();

                Server.GetInstance().LoadLoadouts();

                if (Server.GetInstance().Loaded)
                    Hooks.On_ServerInit();

                PluginLoader.GetInstance().ReloadPlugins();

                arg.ReplyWith("Pluton reloaded!");

                var planes = (from plane in UnityEngine.Object.FindObjectsOfType<CargoPlane>()
                                          where plane.transform.position.x == 0f && plane.transform.position.z == 0f
                                          select plane).ToList();
                planes.ForEach(p => p.SendMessage("KillMessage", UnityEngine.SendMessageOptions.DontRequireReceiver));
                if (planes.Count != 0) {
                    Pluton.Logger.LogWarning(String.Format("Destroyed {0} plane at Vector3.zero", planes.Count));
                }
            } else {
                arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr));
            }
        }
开发者ID:Notulp,项目名称:Pluton,代码行数:30,代码来源:Pluton.cs

示例7: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string str = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str = str + ChatArguments[i] + " ";
     }
     str = str.Trim();
     if ((ChatArguments != null) || (str == ""))
     {
         if (str != null)
         {
             int num2 = 0;
             foreach (PList.Player player in Core.blackList.Values)
             {
                 if (player.DisplayName.ToLower() == str.ToLower())
                 {
                     Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, player.DisplayName + " has been unbanned.");
                     Core.blackList.Remove(player.UserID);
                 }
                 else
                 {
                     num2++;
                 }
             }
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, str + " is not banned.");
         }
     }
     else
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Unban Usage:  /unban \"playerName\"");
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:33,代码来源:UnbanCommand.cs

示例8: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string str = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str = str + ChatArguments[i] + " ";
     }
     str = str.Trim();
     PlayerClient client = null;
     foreach (PlayerClient client2 in PlayerClient.All)
     {
         if (client2.netUser.displayName.ToLower() == str.ToLower())
         {
             client = client2;
         }
     }
     if (client != null)
     {
         if (!Core.whiteList.Contains(client.userID))
         {
             Core.whiteList.Add(client.userID, client.netUser.displayName);
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, client.netUser.displayName + " has been added to the whitelist.");
             Helper.CreateSaves();
         }
         else
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, client.netUser.displayName + " is already on the whitelist.");
         }
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:30,代码来源:WhiteListAddCommand.cs

示例9: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string str = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str = str + ChatArguments[i] + " ";
     }
     str = str.Trim();
     if (((ChatArguments != null) || (str == "")) && (str != ""))
     {
         foreach (PlayerClient client in PlayerClient.All)
         {
             if (client.netUser.displayName.ToLower() == str.ToLower())
             {
                 if (Core.muteList.Contains(client.userID))
                 {
                     Core.muteList.Remove(client.userID);
                     Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, client.netUser.displayName + " has been unmuted!");
                 }
                 else
                 {
                     Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, client.netUser.displayName + " is not muted.");
                 }
                 return;
             }
         }
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:29,代码来源:UnmuteCommand.cs

示例10: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     bool flag = false;
     if (!this.starterkits.ContainsKey(Arguments.argUser.playerClient.userID))
     {
         flag = true;
         this.starterkits.Add(Arguments.argUser.playerClient.userID, Environment.TickCount);
     }
     else
     {
         int num = (int)this.starterkits[Arguments.argUser.playerClient.userID];
         if ((Environment.TickCount - num) < (int.Parse(Core.config.GetSetting("Settings", "starterkit_cooldown")) * 0x3e8))
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You must wait awhile before using this..");
         }
         else
         {
             flag = true;
             this.starterkits.Remove(Arguments.argUser.playerClient.userID);
             this.starterkits.Add(Arguments.argUser.playerClient.userID, Environment.TickCount);
         }
     }
     if (flag)
     {
         for (int i = 0; i < int.Parse(Core.config.GetSetting("StarterKit", "items")); i++)
         {
             Arguments.Args = new string[] { Core.config.GetSetting("StarterKit", "item" + (i + 1) + "_name"), Core.config.GetSetting("StarterKit", "item" + (i + 1) + "_amount") };
             ConsoleSystem.Arg arg = Arguments;
             inv.give(ref arg);
         }
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have spawned a Starter Kit!");
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:33,代码来源:StarterCommand.cs

示例11: 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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:7,代码来源:notice.cs

示例12: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     if (ChatArguments != null)
     {
         string strText = "";
         for (int i = 0; i < ChatArguments.Length; i++)
         {
             strText = strText + ChatArguments[i] + " ";
         }
         if (strText == string.Empty)
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter a valid message.");
         }
         else
         {
             char ch = '☢';
             foreach (PlayerClient client in PlayerClient.All)
             {
                 Notice.Popup(client.netPlayer, ch.ToString(), strText, 5f);
             }
         }
     }
     else
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Announce Usage:  /announce \"message\"");
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:27,代码来源:AnnounceCommand.cs

示例13: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string str = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str = str + ChatArguments[i] + " ";
     }
     str = str.Trim();
     PlayerClient client = null;
     foreach (PlayerClient client2 in PlayerClient.All)
     {
         if (client2.netUser.displayName.ToLower() == str.ToLower())
         {
             client = client2;
         }
     }
     if (client != null)
     {
         try
         {
             Character character;
             Character.FindByUser(client.userID, out character);
             IDBase victim = character;
             TakeDamage.Kill(Arguments.argUser.playerClient, victim, null);
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You killed " + client.netUser.displayName);
             Util.sayUser(client.netPlayer, Core.Name, Arguments.argUser.displayName + " killed you with his admin power.");
         }
         catch (Exception ex)
         {
             Logger.LogException(ex);
         }
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:33,代码来源:KillCommand.cs

示例14: OnRunCommand

 object OnRunCommand(ConsoleSystem.Arg arg) {
     if (arg.connection == null || arg.connection.player == null || arg.cmd.name != "kill")
         return null;
     var player = arg.connection.player as BasePlayer;
     if (player == null)
         return null;
     List<DateTime> times;
     DateTime now = DateTime.UtcNow;
     if (suicides.TryGetValue(player.userID, out times)) {
         int n = 0;
         for (var i = 0; i < times.Count;) {
             var time = times[i];
             if (time < now.AddSeconds(-timespan))
                 times.RemoveAt(i);
             else {
                 ++n; ++i;
             }
         }
         if (n >= limit) {
             player.ChatMessage("You may only suicide " + (limit == 1 ? "once" : limit + " times") + " per " + timespan + " seconds.");
             return true;
         }
         times.Add(now);
     } else {
         times = new List<DateTime>();
         times.Add(now);
         suicides.Add(player.userID, times);
     }
     return null;
 }
开发者ID:Arkoudaphobia,项目名称:ArkoudaphobiaConfig,代码行数:30,代码来源:LimitedSuicide.cs

示例15: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string displayName;
     string str2 = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str2 = str2 + ChatArguments[i] + " ";
     }
     str2 = str2.Trim();
     if (str2 == "")
     {
         displayName = Arguments.argUser.displayName;
     }
     else
     {
         if (!Administrator.IsAdmin(Arguments.argUser.userID))
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Only administrators can ask for another player's location.");
             return;
         }
         displayName = str2;
     }
     foreach (PlayerClient client in PlayerClient.FindAllWithString(displayName))
     {
         string strValue = string.Concat(new object[] { "Location: X: ", (int)client.lastKnownPosition.x, " Y: ", (int)client.lastKnownPosition.y, " Z: ", (int)client.lastKnownPosition.z });
         Arguments.ReplyWith(strValue);
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Concat(new object[] { (str2 == "") ? "Your" : (displayName + "'s"), " Location Is: X: ", (int)client.lastKnownPosition.x, " Y: ", (int)client.lastKnownPosition.y, " Z: ", (int)client.lastKnownPosition.z }));
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:29,代码来源:LocationCommand.cs


注:本文中的ConsoleSystem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。