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


C# IRocketPlayer类代码示例

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


IRocketPlayer类属于命名空间,在下文中一共展示了IRocketPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 public void Execute(IRocketPlayer caller, string[] command)
 {
     if (command.Length == 0)
     {
         UnturnedChat.Say(caller, FPSCap.Instance.Translations.Instance.Translate("ltps_command_help"));
         return;
     }
     int limitTPS;
     if (command.Length == 1 && int.TryParse(command[0], out limitTPS))
     {
         //limit the minimum tps that can be used above a value of 0, but less than 10, to 10.
         if (limitTPS > 0 && limitTPS < 10)
         {
             limitTPS = 10;
         }
         UnityEngine.Application.targetFrameRate = limitTPS;
         if (!(caller is ConsolePlayer))
         {
             UnturnedChat.Say(caller, FPSCap.Instance.Translations.Instance.Translate("tps_set", limitTPS));
         }
         Logger.Log(FPSCap.Instance.Translations.Instance.Translate("tps_set", limitTPS));
     }
     else
     {
         UnturnedChat.Say(caller, FPSCap.Instance.Translations.Instance.Translate("invalid_arg"));
         return;
     }
 }
开发者ID:cartman-2000,项目名称:FPSCap,代码行数:28,代码来源:CommandLimitTPS.cs

示例2: Execute

 public void Execute(IRocketPlayer caller, string[] command)
 {
     UnturnedChat.Say(caller, "Rocket Regions by Trojaner [SteamID: ]", Color.cyan);
     UnturnedChat.Say(caller, "Available under GNU Affero General Public License v3", Color.cyan);
     UnturnedChat.Say(caller, "Copyright © 2015-2016 Trojaner", Color.cyan);
     UnturnedChat.Say(caller, "Source code available under http://github.com/Trojaner25/Rocket-Regions", Color.cyan);
 }
开发者ID:Trojaner25,项目名称:Rocket-Regions,代码行数:7,代码来源:InfoCommand.cs

示例3: Execute

 // Run the command.
 public void Execute(IRocketPlayer caller, string[] command)
 {
     UnturnedChat.Say(Feast.Instance.Translate("now_feast_msg", new object[] {
         Feast.Instance.nextLocation.Name
         }), UnturnedChat.GetColorFromName(Feast.Instance.Configuration.Instance.MessageColor, Color.red));
     Feast.Instance.runFeast();
 }
开发者ID:fatboi615,项目名称:ZaupFeast,代码行数:8,代码来源:CommandRunFeast.cs

示例4: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length != 1)
            {
                UnturnedChat.Say(caller, "You must enter a player name!");
                return;
            }

            UnturnedPlayer player = (UnturnedPlayer)caller;
            if (player == null)
            {
                return;
            }

            UnturnedPlayer otherPlayer = UnturnedPlayer.FromName(command[0]);
            if (otherPlayer == null)
            {
                UnturnedChat.Say(caller, "Could not find player by the name of " + command[0]);
                return;
            }

            player.Features.VanishMode = true;
            player.Teleport(otherPlayer);

            UnturnedChat.Say(caller, "You AdminTP'd to " + otherPlayer.DisplayName);
            Logger.Log("Player " + player.DisplayName + " AdminTp'd to " + otherPlayer.DisplayName);
        }
开发者ID:sharkbound,项目名称:csharp-projects,代码行数:27,代码来源:CommandAdminTp.cs

示例5: GetCSteamId

 public static CSteamID GetCSteamId(IRocketPlayer player)
 {
     if (player == null) return CSteamID.Nil;
     //for some reason one of the fiels below can be null
     var steamPlayerId= GetUnturnedPlayer(player)?.Player?.channel?.owner?.playerID;
     return steamPlayerId?.steamID ?? CSteamID.Nil;
 }
开发者ID:Trojaner25,项目名称:Rocket-Regions,代码行数:7,代码来源:PlayerUtil.cs

示例6: GetPermissions

        public List<Permission> GetPermissions(IRocketPlayer player, List<string> requestedPermissions)
        {
            List<Permission> playerPermissions = GetPermissions(player);
            playerPermissions.ForEach((Permission p) => { p.Name = p.Name.ToLower(); });

            List<Permission> applyingPermissions = playerPermissions.Where(p => requestedPermissions.Contains(p.Name)).ToList();

            if (playerPermissions.Where(p => p.Name == "*").FirstOrDefault() != null) applyingPermissions.Add(new Permission("*"));

            foreach (Permission p in playerPermissions)
            {
                string pb = p.Name;
                if (pb.Contains(".")) pb = p.Name.Substring(0, p.Name.IndexOf('.'));

                if (p.Name.EndsWith(".*")) //Player permission is a wildcard permission
                {
                    foreach (string ps in requestedPermissions)
                    {
                        string b = ps;
                        if (ps.Contains("."))
                            b = ps.Substring(0, ps.IndexOf('.')).ToLower();

                        if (ps.StartsWith(pb + ".")) //Check if wildcard base pb is the start of this permission
                        {
                            applyingPermissions.Add(p);
                        }
                    }
                }

                //Grant base permission if required
                requestedPermissions.Where(ps => ps == pb).ToList().ForEach((ap) => { applyingPermissions.Add(p); });
            }
            return applyingPermissions;
        }
开发者ID:tklektesov,项目名称:Rocket,代码行数:34,代码来源:RocketPermissionsHelper.cs

示例7: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            if (command.Length == 0)
            {
                this.SendUsage(caller);
                return;
            }

            var name = command.GetStringParameter(0);
            var region = RegionsPlugin.Instance.GetRegion(name);
            if (region == null)
            {
                UnturnedChat.Say(caller, "Region \"" + name + "\" not found", Color.red);
                return;
            }

            if (!region.IsOwner(caller) && !PermissionUtil.HasPermission(caller, "remove.override"))
            {
                UnturnedChat.Say(caller, "You're not the owner of this region!", Color.red);
                return;
            }

            RegionsPlugin.Instance.Regions.Remove(region);
            RegionsPlugin.Instance.Configuration.Save();
            RegionsPlugin.Instance.OnRegionRemoved(region);

            UnturnedChat.Say(caller, "Successfully removed region: " + name, Color.green);
        }
开发者ID:Trojaner25,项目名称:Rocket-Regions,代码行数:28,代码来源:RemoveCommand.cs

示例8: DropMagsWithLimit

        public void DropMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
        {
            if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit"))
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("dropping_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));

                for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++)
                {
                    ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
                }
            }
            else
            {
                UnturnedItems.GetItemAssetById(1);
                ushort amountoverlimit = ammoAmountToSpawn;
                ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit;

                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_dropping", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));

                for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++)
                {
                    ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
                }

            }
        }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:26,代码来源:CommandDropAmmo.cs

示例9: GetPermissions

 public List<Permission> GetPermissions(IRocketPlayer player)
 {
     List<Permission> UserGroup = new List<Permission>();
     Permission Usergroup = new Permission(string.Join(" ", LIGHT.Instance.Database.getGroupPermission(LIGHT.Instance.Database.CheckUserGroup(player.Id))), LIGHT.Instance.Database.Cooldown(LIGHT.Instance.Database.CheckUserGroup(player.Id)));
     UserGroup.Add(Usergroup);
     return UserGroup;
 }
开发者ID:lightphoenix2,项目名称:LPX,代码行数:7,代码来源:SQLPermission.cs

示例10: Execute

 public void Execute(IRocketPlayer caller, string[] command)
 {
     if (caller is UnturnedPlayer && command.Length != 1)
     {
         UnturnedPlayer player = (UnturnedPlayer)caller;
         player.Heal(100);
         player.Bleeding = false;
         player.Broken = false;
         player.Infection = 0;
         player.Hunger = 0;
         player.Thirst = 0;
         UnturnedChat.Say(player, U.Translate("command_heal_success"));
     }
     else
     {
         UnturnedPlayer otherPlayer = UnturnedPlayer.FromName(command[0]);
         if (otherPlayer != null)
         {
             otherPlayer.Heal(100);
             otherPlayer.Bleeding = false;
             otherPlayer.Broken = false;
             otherPlayer.Infection = 0;
             otherPlayer.Hunger = 0;
             otherPlayer.Thirst = 0;
             UnturnedChat.Say(caller, U.Translate("command_heal_success_me", otherPlayer.CharacterName));
             
             if(caller != null)
                 UnturnedChat.Say(otherPlayer, U.Translate("command_heal_success_other", caller.DisplayName));
         }
         else
         {
             UnturnedChat.Say(caller, U.Translate("command_generic_target_player_not_found"));
         }
     }
 }
开发者ID:Kirollos,项目名称:Rocket.Unturned,代码行数:35,代码来源:CommandHeal.cs

示例11: Execute

 public void Execute(IRocketPlayer caller, params string[] command)
 {
     if (command.Length != 1)
     {
         UnturnedChat.Say(caller, ThePunisher.Instance.Translate("command_generic_invalid_parameter"), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PrivateMessageColor));
         return;
     }
     try
     {
         ThePunisher.Instance.Database.UnbanBanPlayer(command[0]);
         if (!SteamBlacklist.unban(ThePunisher.Instance.Database.GetPlayerSteamId(command[0])) && ThePunisher.Instance.Database.GetPlayerIdAndName(command[0]).Length <=0)
         {
             UnturnedChat.Say(caller, ThePunisher.Instance.Translate("command_generic_player_not_found"), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PrivateMessageColor));
             return;
         }
         else
         {
             UnturnedChat.Say(ThePunisher.Instance.Translate("command_unban_public", ThePunisher.Instance.Database.GetPlayerIdAndName(command[0])[0]), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PublicMessageColor));
         }
     }
     catch
     {
         UnturnedChat.Say(caller, ThePunisher.Instance.Translate("command_unban_player_not_found"), (Color)ThePunisher.Instance.getColor(ThePunisher.Instance.Configuration.Instance.PrivateMessageColor));
         return;
     }
 }
开发者ID:Rawrfuls,项目名称:ThePunisher,代码行数:26,代码来源:CommandUnban.cs

示例12: addPlayerComponents

 private void addPlayerComponents(IRocketPlayer p)
 {
     foreach (Type component in unturnedPlayerComponents)
     {
         ((UnturnedPlayer)p).Player.gameObject.AddComponent(component);
     }
 }
开发者ID:RocketMod,项目名称:Rocket.Unturned,代码行数:7,代码来源:PluginUnturnedPlayerComponentManager.cs

示例13: SetGroup

 public bool SetGroup(IRocketPlayer caller , string group)
 {
     bool Result = false;
     if (LIGHT.Instance.Database.CheckGroup(group))
     {
         UnturnedPlayer target = (UnturnedPlayer)caller;
         if (target != null)
         {
             LIGHT.Instance.Database.AddUserIntoGroup(caller.Id, group);
             UnturnedChat.Say(caller, LIGHT.Instance.DefaultTranslations.Translate("lpx_added_user", target.SteamName, group));
             Result = true;
         }
         else
         {
             UnturnedChat.Say(caller, LIGHT.Instance.DefaultTranslations.Translate("lpx_fail_nouser"));
             Result = false;
         }
     }
     else
     {
         UnturnedChat.Say(caller, LIGHT.Instance.DefaultTranslations.Translate("lpx_fail_nogroup"));
         Result = false;
     }
     return Result;
 }
开发者ID:jorea143,项目名称:LPX,代码行数:25,代码来源:SQLPermission.cs

示例14: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            IRocketPlayer p = (IRocketPlayer)UnturnedPlayer.FromName(command[3]);
            if (p == null)
            {
                UnturnedChat.Say(caller, "player not found!");
                return;
            }

            if (EffectRepeater.Instance.activeThreads.ContainsKey(p.Id))
            {
                UnturnedChat.Say(caller, p.DisplayName + " already has a effect on them!");
                UnturnedChat.Say(caller, "use /killeffect " + "\"" + p.DisplayName + "\" to stop their effect" );
                return;
            }

            //int times;
            //double delay;
            //ushort id;

            effectData eD = new effectData();

            int.TryParse(command[0], out eD.TimeToPlay);
            double.TryParse(command[1], out eD.Delay);
            ushort.TryParse(command[2], out eD.Id);
            eD.IRocketPlayer = p;

            EffectRepeater.Instance.StartThread(eD);
            UnturnedChat.Say(caller, "added effect " + eD.Id.ToString() + " to " + p.DisplayName + " with interval of " + eD.Delay.ToString() + " for " + eD.TimeToPlay.ToString() + " times!");
        }
开发者ID:sharkbound,项目名称:csharp-projects,代码行数:30,代码来源:CommandRepEff.cs

示例15: Execute

        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = (UnturnedPlayer)caller;
            if (player == null)
            {
                Logger.Log("This command cannot be called from the console.");
                return;
            }

            if (!Main.OnCooldown(player) && Main.Connected == true)
            {
                var shorten = Main.ShortenUrl("http://motdgd.com/motd/?user=" + Main.Instance.Configuration.Instance.User_ID + "&gm=minecraft&clt_user=" + player.CSteamID + "&srv_id=" + Main.Server_ID);
                if (shorten != "")
                {
                    UnturnedChat.Say(player, "For getting reward go to: " + shorten);
                }
                else
                {
                UnturnedChat.Say(player, "There was error with shortening URL. Contact your server administrator.");
                }
            }
            else if (Main.OnCooldown(player))
            {
                UnturnedChat.Say(player, "You are on cooldown.");
            }
            else if (Main.Connected == false)
            {
                UnturnedChat.Say(player, "There was error while connecting to HUB. Try again later.");
            }
            else
            {
                UnturnedChat.Say(player, "Error while processing your request.");
            }
        }
开发者ID:LinhyCZ,项目名称:MOTDgd,代码行数:34,代码来源:Commands.cs


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