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

C# NetUser类代码示例

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

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



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

示例1: cmdChatProd

 void cmdChatProd(NetUser netuser, string command, string[] args)
 {
     if (!hasAccess(netuser)) { SendReply(netuser, "You don't have access to this command"); return; }
     cachedCharacter = netuser.playerClient.rootControllable.idMain.GetComponent<Character>();
     if (!MeshBatchPhysics.Raycast(cachedCharacter.eyesRay, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { SendReply(netuser, "Are you looking at the sky?"); return; }
     if (cachedhitInstance != null)
     {
         cachedCollider = cachedhitInstance.physicalColliderReferenceOnly;
         if (cachedCollider == null) { SendReply(netuser, "Can't prod what you are looking at"); return; }
         cachedStructure = cachedCollider.GetComponent<StructureComponent>();
         if (cachedStructure != null && cachedStructure._master != null)
         {
             cachedMaster = cachedStructure._master;
             var name = PlayerDatabase?.Call("GetPlayerData", cachedMaster.ownerID.ToString(), "name");
             SendReply(netuser, string.Format("{0} - {1} - {2}", cachedStructure.gameObject.name, cachedMaster.ownerID.ToString(), name == null ? "UnknownPlayer" : name.ToString()));
             return;
         }
     }
     else
     {
         cachedDeployable = cachedRaycast.collider.GetComponent<DeployableObject>();
         if (cachedDeployable != null)
         {
             var name = PlayerDatabase?.Call("GetPlayerData", cachedDeployable.ownerID.ToString(), "name");
             SendReply(netuser, string.Format("{0} - {1} - {2}", cachedDeployable.gameObject.name, cachedDeployable.ownerID.ToString(), name == null ? cachedDeployable.ownerName.ToString() : name.ToString()));
             return;
         }
     }
     SendReply(netuser, string.Format("Can't prod what you are looking at: {0}",cachedRaycast.collider.gameObject.name));
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:30,代码来源:Prod.cs


示例2: cmdSpawnOpen

 void cmdSpawnOpen(NetUser player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     if (SpawnsData.ContainsKey(player))
     {
         SendReply(player, "You must save/close your current spawns first. /spawns_help for more informations");
         return;
     }
     if (args == null || args.Length == 0)
     {
         SendReply(player, "/spawns_remove SPAWN_NUMBER");
         return;
     }
     var NewSpawnFile = Interface.GetMod().DataFileSystem.GetDatafile(args[0].ToString());
     if (NewSpawnFile["1"] == null)
     {
         SendReply(player, "This spawnfile is empty or not valid");
         return;
     }
     SpawnsData.Add(player, new List<Vector3>());
     foreach (KeyValuePair<string, object> pair in NewSpawnFile)
     {
         var currentvalue = pair.Value as Dictionary<string, object>;
         ((List<Vector3>)SpawnsData[player]).Add(new Vector3(Convert.ToInt32(currentvalue["x"]), Convert.ToInt32(currentvalue["y"]), Convert.ToInt32(currentvalue["z"])));
     }
     SendReply(player, string.Format("Opened spawnfile with {0} spawns", ((List<Vector3>)SpawnsData[player]).Count.ToString()));
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:27,代码来源:Spawns.cs


示例3: cmdChatClean

 void cmdChatClean(NetUser netuser, string command, string[] args)
 {
     if (!hasAccess(netuser)) { SendReply(netuser, "You dont have access to this command."); return; }
     if(args.Length == 0)
     {
         SendReply(netuser, "You must enter deployed item name that you want to clean.");
         SendReply(netuser, "Not using the option: \"all\" will only clean items that are not on a structure.");
         SendReply(netuser, "using the option: \"all\" will only clean all the items.");
         SendReply(netuser, "/clean DEPLOYNAME optional:all");
         return;
     }
     cachedName = args[0].ToLower();
     int totalCleaned = 0;
     bool all = (args.Length > 1 && args[1] == "all") ? true : false;
     switch (args[0].ToLower())
     {
         case "lootsack":
         case "bag":
         case "lootsacks":
         case "bags":
             totalCleaned = CleanAllSacks(all);
         break;
         default:
             var getvalidname = ValidDeploy(cachedName);
             if (getvalidname == null)
             {
                 SendReply(netuser, string.Format("{0} is not a valid deploy name.", args[0]));
                 return;
             }
             cachedName = (string)getvalidname;
             totalCleaned = CleanAllDeployables(cachedName, all);
         break;
     }
     SendReply(netuser, string.Format("You've successfully cleaned {0} {1}.", totalCleaned.ToString(), args[0]));
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:35,代码来源:CleanDeployables.cs


示例4: RustLegacyLivePlayer

 internal RustLegacyLivePlayer(NetUser netUser)
 {
     this.netUser = netUser;
     steamid = netUser.userID;
     Character = this;
     Object = netUser.playerClient;
 }
开发者ID:906507516,项目名称:Oxide,代码行数:7,代码来源:RustLegacyLivePlayer.cs


示例5: uLink_OnPlayerConnected

        public void uLink_OnPlayerConnected(uLink.NetworkPlayer player)
        {
            connectingPlayer = (NetUser)player.localData;
            String playerSteamURL = "http://steamcommunity.com/profiles/" + connectingPlayer.userID.ToString();

            WebClient wc = new WebClient ();
            wc.DownloadStringCompleted += (sender, e) =>
            {
                userProfilePage = e.Result;

                if (lockGroup != "none")
                {
                    if (userProfilePage.IndexOf("http://steamcommunity.com/groups/" + lockGroup) == -1)
                    {
                        connectingPlayer.Kick(NetError.Facepunch_Kick_Ban, true);
                    }
                }

                Match vacMatch = Regex.Match(userProfilePage, @"^([0-9]{1,5}) day\(s\) since last ban$");
                if (vacMatch.Success)
                {
                    int daysSinceBan = Convert.ToInt32(vacMatch.Groups[1].Value);
                    if (daysSinceBan < minVacDays)
                    {
                        connectingPlayer.Kick(NetError.Facepunch_Kick_Ban, true);
                    }
                }
            };

            wc.DownloadStringAsync(new Uri(playerSteamURL));
        }
开发者ID:BARKx4,项目名称:GroupGate,代码行数:31,代码来源:GroupGateBootstrap.cs


示例6: cmdChatHouse

 void cmdChatHouse(NetUser player, string command, string[] args)
 {
     if (!hasAccess(player)) { SendReply(player, "You don't have access to this command"); return; }
     if (args.Length == 0) { SendReply(player, "/house STEAMID/name"); return; }
     string[] steamids;
     ulong teststeam;
     if(args.Length == 1 && args[0].Length == 17 && ulong.TryParse(args[0],out teststeam))
     {
         steamids = new string[] { teststeam.ToString() };
     }
     else
     {
         var tempsteamids = PlayerDatabase.Call("FindAllPlayers", args[0]);
         if(tempsteamids == null)
         {
             SendReply(player, "You must have the Player Database plugin to use this plugin.");
             return;
         }
         steamids = (string[])tempsteamids;
         if(steamids.Length == 0)
         {
             SendReply(player, "No Players found.");
             return;
         }
     }
     userIDToStructure.Clear();
     foreach (StructureMaster master in (List<StructureMaster>)StructureMaster.AllStructures)
     {
         if (userIDToStructure[master.ownerID] == null)
             userIDToStructure[master.ownerID] = new List<StructureMaster>();
         userIDToStructure[master.ownerID].Add(master);
     }
     if (userTeleports[player] == null)
         userTeleports[player] = new List<Vector3>();
     userTeleports[player].Clear();
     int currentid = 0;
     for (int i = 0; i < steamids.Length; i++)
     {
         cachedSteamID = steamids[i];
         cachedsteamid = Convert.ToUInt64(cachedSteamID);
         cachedName = "Unknown";
         var tempname = PlayerDatabase?.Call("GetPlayerData", cachedSteamID, "name");
         if (tempname != null)
             cachedName = tempname.ToString();
         if(userIDToStructure[cachedsteamid] == null)
         {
             SendReply(player, string.Format("{0} - {1}: No Structures Found.",cachedSteamID,cachedName));
             continue;
         }
         foreach(StructureMaster master in userIDToStructure[cachedsteamid])
         {
             cachedVector3 = FindFirstComponent(master);
             userTeleports[player].Add(cachedVector3);
             SendReply(player, string.Format("{3} - {0} - {1}: {2}", cachedSteamID, cachedName, cachedVector3.ToString(), currentid.ToString()));
             currentid++;
         }
     }
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:58,代码来源:HouseLocations.cs


示例7: SendChatMessage

 public void SendChatMessage(NetUser netUser, string name, string message = null)
 {
     if (message == null)
     {
         message = name;
         name = "Server";
     }
     ConsoleNetworker.SendClientCommand(netUser.networkPlayer, $"chat.add {QuoteSafe(name)} {QuoteSafe(message)}");
 }
开发者ID:romgerman,项目名称:Oxide,代码行数:9,代码来源:RustLegacy.cs


示例8: cmdSpawnshelp

 void cmdSpawnshelp(NetUser player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     SendReply(player, "Start by making a new data with: /spawns_new");
     SendReply(player, "Add new spawn points where you are standing with /spawns_add");
     SendReply(player, "Remove a spawn point that you didn't like with /spawns_remove NUMBER");
     SendReply(player, "Save the spawn points into a file with: /spawns_save FILENAME");
     SendReply(player, "Use /spawns_open later on to open it back and edit it");
     SendReply(player, "Use /spawns_close to stop setting points without saving");
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:10,代码来源:Spawns.cs


示例9: cmdSpawnsClose

 void cmdSpawnsClose(NetUser player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     if (!(SpawnsData.ContainsKey(player)))
     {
         SendReply(player, "You must create a new Spawn file first /spawns_help for more informations");
         return;
     }
     SpawnsData.Remove(player);
     SendReply(player, "Spawns file closed without saving");
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:11,代码来源:Spawns.cs


示例10: cmdSpawnAdd

 void cmdSpawnAdd(NetUser player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     if (!(SpawnsData.ContainsKey(player)))
     {
         SendReply(player, "You must create/open a new Spawn file first /spawns_help for more informations");
         return;
     }
     ((List<Vector3>)SpawnsData[player]).Add(player.playerClient.lastKnownPosition);
     SendReply(player, string.Format("Added Spawn n°{0}", ((List<Vector3>)SpawnsData[player]).Count));
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:11,代码来源:Spawns.cs


示例11: cmdAddKit

 void cmdAddKit(NetUser netuser, string[] args)
 {
     if (args.Length < 3)
     {
         SendReply(netuser, "/kit add \"KITNAME\" \"DESCRIPTION\" -option1 -option2 etc, Everything you have in your inventory will be used in the kit");
         SendReply(netuser, "Options avaible:");
         SendReply(netuser, "-maxXX => max times someone can use this kit. Default is infinite.");
         SendReply(netuser, "-cooldownXX => cooldown of the kit. Default is none.");
         SendReply(netuser, "-vip => Allow to give this kit only to vip & admins");
         SendReply(netuser, "-admin => Allow to give this kit only to admins (set this for the autokit!!!!)");
         return;
     }
     string kitname = args[1].ToString();
     string description = args[2].ToString();
     bool vip = false;
     bool vipp = false;
     bool vippp = false;
     bool admin = false;
     int max = -1;
     double cooldown = 0.0;
     if (KitsConfig[kitname] != null)
     {
         SendReply(netuser, string.Format("The kit {0} already exists. Delete it first or change the name.", kitname));
         return;
     }
     if (args.Length > 3)
     {
         object validoptions = VerifyOptions(args, out admin, out vip, out vipp, out vippp, out max, out cooldown);
         if (validoptions is string)
         {
             SendReply(netuser, (string)validoptions);
             return;
         }
     }
     Dictionary<string, object> kitsitems = GetNewKitFromPlayer(netuser);
     Dictionary<string, object> newkit = new Dictionary<string, object>();
     newkit.Add("items", kitsitems);
     if (admin)
         newkit.Add("admin", true);
     if (vip)
         newkit.Add("vip", true);
     if (vipp)
         newkit.Add("vip+", true);
     if (vippp)
         newkit.Add("vip++", true);
     if (max >= 0)
         newkit.Add("max", max);
     if (cooldown > 0.0)
         newkit.Add("cooldown", cooldown);
     newkit.Add("description", description);
     KitsConfig[kitname] = newkit;
     SaveKits();
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:53,代码来源:Kits.cs


示例12: cmdChatFly

 void cmdChatFly(NetUser netuser, string command, string[] args)
 {
     if(!hasAccess(netuser)) { SendReply(netuser, "You dont have access to this command."); return; }
     if (args.Length == 0 && netuser.playerClient.GetComponent<FlyPlayer>())
     {
         GameObject.Destroy(netuser.playerClient.GetComponent<FlyPlayer>());
         return;
     }
     float speed = 1f;
     if (args.Length > 0) float.TryParse(args[0], out speed);
     FlyPlayer newfly = netuser.playerClient.GetComponent<FlyPlayer>();
     if(newfly == null) newfly = netuser.playerClient.gameObject.AddComponent<FlyPlayer>();
     newfly.Refresh();
     newfly.speed = speed;
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:15,代码来源:Fly.cs


示例13: proccessKitGiven

        void proccessKitGiven(NetUser netuser, string kitname, Dictionary<string, object> kitdata, int kitleft)
        {
            string userid = netuser.playerClient.userID.ToString();
            if (KitsData[userid] == null)
            {
                (KitsData[userid]) = new Dictionary<string, object>();
            }
            var playerData = (KitsData[userid]) as Dictionary<string, object>;
            var currentKitData = new Dictionary<string, object>();
            bool write = false;
            if (kitdata.ContainsKey("max"))
            {
                currentKitData.Add("used", (((int)kitdata["max"] - kitleft) + 1));
                write = true;
            }
            if (kitdata.ContainsKey("cooldown"))
            {
                currentKitData.Add("cooldown", ((double)kitdata["cooldown"] + CurrentTime()));
                write = true;
            }
            if (write)
            {
                if (playerData.ContainsKey(kitname))
                    playerData[kitname] = currentKitData;
                else
                    playerData.Add(kitname, currentKitData);
                KitsData[userid] = playerData;

            }
        }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:30,代码来源:Kits.cs


示例14: hasVip

 bool hasVip(NetUser netuser, string vipname)
 {
     if (netuser.CanAdmin()) return true;
     return permission.UserHasPermission(netuser.playerClient.userID.ToString(), vipname);
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:5,代码来源:Kits.cs


示例15: hasAccess

 bool hasAccess(NetUser netuser)
 {
     if (netuser.CanAdmin())
         return true;
     return false;
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:6,代码来源:Kits.cs


示例16: GiveKit

        object GiveKit(NetUser netuser, string kitname)
        {
            if (KitsConfig[kitname] == null)
            {
                SendReply(netuser, unknownKit);
                return false;
            }

            if (netuser.playerClient == null || netuser.playerClient.rootControllable == null) return false;

            var inv = netuser.playerClient.rootControllable.idMain.GetComponent<Inventory>();
            var kitdata = (KitsConfig[kitname]) as Dictionary<string, object>;
            var kitsitems = kitdata["items"] as Dictionary<string, object>;
            List<object> wearList = kitsitems["wear"] as List<object>;
            List<object> mainList = kitsitems["main"] as List<object>;
            List<object> beltList = kitsitems["belt"] as List<object>;
            Inventory.Slot.Preference pref = Inventory.Slot.Preference.Define(Inventory.Slot.Kind.Armor,false,Inventory.Slot.KindFlags.Belt);

            if (wearList.Count > 0)
            {
                pref = Inventory.Slot.Preference.Define(Inventory.Slot.Kind.Armor, false, Inventory.Slot.KindFlags.Belt);
                foreach (object items in wearList)
                {
                    foreach (KeyValuePair<string, object> pair in items as Dictionary<string, object>)
                    {
                        GiveItem(inv, (string)pair.Key, (int)pair.Value, pref);
                    }
                }
            }

            if (mainList.Count > 0)
            {
                pref = Inventory.Slot.Preference.Define(Inventory.Slot.Kind.Default, false, Inventory.Slot.KindFlags.Belt);
                foreach (object items in mainList)
                {
                    foreach (KeyValuePair<string, object> pair in items as Dictionary<string, object>)
                    {
                        GiveItem(inv, (string)pair.Key, (int)pair.Value, pref);
                    }
                }
            }
            if (beltList.Count > 0)
            {
                pref = Inventory.Slot.Preference.Define(Inventory.Slot.Kind.Belt, false, Inventory.Slot.KindFlags.Belt);
                foreach (object items in beltList)
                {
                    foreach (KeyValuePair<string, object> pair in items as Dictionary<string, object>)
                    {
                        GiveItem(inv, (string)pair.Key, (int)pair.Value, pref);
                    }
                }
            }
            SendReply(netuser, kitredeemed);
            return true;
        }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:55,代码来源:Kits.cs


示例17: GetNewKitFromPlayer

        Dictionary<string, object> GetNewKitFromPlayer(NetUser netuser)
        {
            Dictionary<string, object> kitsitems = new Dictionary<string, object>();
            List<object> wearList = new List<object>();
            List<object> mainList = new List<object>();
            List<object> beltList = new List<object>();

            IInventoryItem item;
            var inv = netuser.playerClient.rootControllable.idMain.GetComponent<Inventory>();
            for (int i = 0; i < 40; i++)
            {
                if(inv.GetItem(i, out item))
                {
                    Dictionary<string, object> newObject = new Dictionary<string, object>();
                    newObject.Add(item.datablock.name.ToString().ToLower(), item.datablock._splittable?(int)item.uses :1);
                    if (i>=0 && i<30)
                        mainList.Add(newObject);
                    else if(i>=30 && i < 36)
                        beltList.Add(newObject);
                    else
                        wearList.Add(newObject);
                }
            }
            inv.Clear();
            kitsitems.Add("wear", wearList);
            kitsitems.Add("main", mainList);
            kitsitems.Add("belt", beltList);
            return kitsitems;
        }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:29,代码来源:Kits.cs


示例18: GetInventory

 public static PlayerInventory GetInventory(NetUser netUser) => playerData[netUser].inventory;
开发者ID:906507516,项目名称:Oxide,代码行数:1,代码来源:RustLegacyCore.cs


示例19: TryGiveKit

        void TryGiveKit(NetUser netuser, string kitname)
        {
            if (KitsConfig[kitname] == null)
            {
                SendReply(netuser, unknownKit);
                return;
            }
            object thereturn = Interface.GetMod().CallHook("canRedeemKit", netuser );
            if (thereturn != null)
            {
                if (thereturn is string)
                {
                    SendReply(netuser, (string)thereturn);
                }
                return;
            }

            Dictionary<string, object> kitdata = (KitsConfig[kitname]) as Dictionary<string, object>;
            double cooldown = 0.0;
            int kitleft = 1;
            if (kitdata.ContainsKey("max"))
                kitleft = GetKitLeft(netuser, kitname, (int)(kitdata["max"]));
            if (kitdata.ContainsKey("admin"))
                if(!hasAccess(netuser))
                {
                    SendReply(netuser, cantUseKit);
                    return;
                }
            if (kitdata.ContainsKey("vip"))
                if (!hasVip(netuser,"vip"))
                {
                    SendReply(netuser, cantUseKit);
                    return;
                }
            if (kitdata.ContainsKey("vip+"))
                if (!hasVip(netuser, "vip+"))
                {
                    SendReply(netuser, cantUseKit);
                    return;
                }
            if (kitdata.ContainsKey("vip++"))
                if (!hasVip(netuser, "vip++"))
                {
                    SendReply(netuser, cantUseKit);
                    return;
                }
            if (kitleft <= 0)
            {
                SendReply(netuser, maxKitReached);
                return;
            }
            if (kitdata.ContainsKey("cooldown"))
                cooldown = GetKitTimeleft(netuser, kitname, (double)(kitdata["cooldown"]));
            if (cooldown > 0.0)
            {
                SendReply(netuser, string.Format("You must wait {0}s before using this kit again", cooldown.ToString()));
                return;
            }
            object wasGiven = GiveKit(netuser, kitname);
            if ((wasGiven is bool) && !((bool)wasGiven))
            {
                Puts(string.Format("An error occurred while giving the kit {0} to {1}", kitname, netuser.playerClient.userName.ToString()));
                return;
            }
            proccessKitGiven(netuser, kitname, kitdata, kitleft);
        }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:66,代码来源:Kits.cs


示例20: cmdResetKits

 void cmdResetKits(NetUser netuser, string[] args)
 {
     KitsData.Clear();
     SendReply(netuser, "All kits data from players were deleted");
     SaveKitsData();
 }
开发者ID:LouisTakePILLz,项目名称:Oxide2Plugins,代码行数:6,代码来源:Kits.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Nettiers类代码示例发布时间:2022-05-24
下一篇:
C# NetState类代码示例发布时间: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