• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConsoleSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ConsoleSystem类属于命名空间,在下文中一共展示了ConsoleSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Execute

 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Concat(new object[] { PlayerClient.All.Count, " Player", (PlayerClient.All.Count > 1) ? "s" : "", " Online: " }));
     int num = 0;
     int num2 = 0;
     string str = "";
     foreach (PlayerClient client in PlayerClient.All)
     {
         num2++;
         if (num2 >= 60)
         {
             num = 0;
             break;
         }
         str = str + client.userName + ", ";
         if (num == 6)
         {
             num = 0;
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, str.Substring(0, str.Length - 2));
             str = "";
         }
         else
         {
             num++;
         }
     }
     if (num != 0)
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, str.Substring(0, str.Length - 2));
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:31,代码来源:PlayersCommand.cs


示例17: OutputList

 public void OutputList(ref ConsoleSystem.Arg arg)
 {
     ArrayList list = new ArrayList();
     ArrayList list2 = new ArrayList();
     foreach (Friend friend in this)
     {
         PlayerClient client;
         try
         {
             client = EnumerableToArray.ToArray<PlayerClient>(PlayerClient.FindAllWithString(friend.GetUserID().ToString()))[0];
         }
         catch
         {
             list2.Add(friend.GetDisplayName());
             continue;
         }
         list.Add(client.netUser.displayName + " (Online)");
         friend.SetDisplayName(client.netUser.displayName);
     }
     if (list.Count > 0)
     {
         Util.sayUser(arg.argUser.networkPlayer, Core.Name, string.Concat(new object[] { "You currently have ", list.Count, " friend", (list.Count > 1) ? "s" : "", " online." }));
     }
     else
     {
         Util.sayUser(arg.argUser.networkPlayer, Core.Name, "None of your friend is playing right now.");
     }
     foreach (string str in list2)
     {
         list.Add(str);
     }
     int num = 0;
     int num2 = 0;
     string str2 = "";
     foreach (string str3 in list)
     {
         num2++;
         if (num2 >= 60)
         {
             num = 0;
             break;
         }
         str2 = str2 + str3 + ", ";
         if (num == 6)
         {
             num = 0;
             Util.sayUser(arg.argUser.networkPlayer, Core.Name, str2.Substring(0, str2.Length - 3));
             str2 = "";
         }
         else
         {
             num++;
         }
     }
     if (num != 0)
     {
         Util.sayUser(arg.argUser.networkPlayer, Core.Name, str2.Substring(0, str2.Length - 3));
     }
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:59,代码来源:FriendList.cs


示例18: 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();
 }
开发者ID:yas-online,项目名称:Oxide,代码行数:8,代码来源:RustLegacyCommandSystem.cs


示例19: cmdConsoleReload

 void cmdConsoleReload(ConsoleSystem.Arg arg)
 {
     if (!LoadConfig())
         return;
     CheckConfig();
     UpdateConstructions();
     Puts("Config reloaded.");
 }
开发者ID:bloodyblaze,项目名称:rep-Mods,代码行数:8,代码来源:ConstructionConfig.cs


示例20: login

 public static void login(ConsoleSystem.Arg arg)
 {
     if (arg.connection != null && arg.ArgsStr == rcon.password) {
         ServerUsers.Set(arg.connection.userid, ServerUsers.UserGroup.Moderator, arg.connection.username, "Console login!");
         ServerUsers.Save();
         arg.ReplyWith("You are a moderator now!");
     }
 }
开发者ID:Notulp,项目名称:Pluton,代码行数:8,代码来源:Pluton.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Constant类代码示例发布时间:2022-05-24
下一篇:
C# ConsoleService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap