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


C# Player.Supports方法代码示例

本文整理汇总了C#中fCraft.Player.Supports方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Supports方法的具体用法?C# Player.Supports怎么用?C# Player.Supports使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fCraft.Player的用法示例。


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

示例1: SendGlobalDefinitions

 public static void SendGlobalDefinitions(Player p) {
     for (int i = (int)Map.MaxCustomBlockType + 1; i < GlobalDefinitions.Length; i++) {
         BlockDefinition def = GlobalDefinitions[i];
         if (def == null) continue;
         
         if (p.Supports(CpeExtension.BlockDefinitionsExt) && def.Shape != 0)
             p.SendNow(Packet.MakeDefineBlockExt(def));
         else
             p.SendNow(Packet.MakeDefineBlock(def));
         p.SendNow(Packet.MakeSetBlockPermission(
             (Block)def.BlockID, true, true));
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:13,代码来源:BlockDefinition.cs

示例2: SendGlobalAdd

  public static void SendGlobalAdd(Player p, BlockDefinition def) {
     if (p.Supports(CpeExtension.BlockDefinitionsExt) && def.Shape != 0)
         p.Send(Packet.MakeDefineBlockExt(def));
     else
         p.Send(Packet.MakeDefineBlock(def));
     p.Send(Packet.MakeSetBlockPermission((Block)def.BlockID, true, true));
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:7,代码来源:BlockDefinition.cs

示例3: WeatherHandler

 static void WeatherHandler(Player player, CommandReader cmd) {
     if (cmd.Count == 1) {
         player.Message(Cdweather.Usage);
         return;
     }
     string name = cmd.Next();
     PlayerInfo p = PlayerDB.FindPlayerInfoOrPrintMatches(player, name, SearchOptions.IncludeSelf);
     if (p == null) {
         return;
     }
     string valueText = cmd.Next();
     byte weather;
     if (!byte.TryParse(valueText, out weather)) {
         if (valueText.Equals("sun", StringComparison.OrdinalIgnoreCase)) {
             weather = 0;
         } else if (valueText.Equals("rain", StringComparison.OrdinalIgnoreCase)) {
             weather = 1;
         } else if (valueText.Equals("snow", StringComparison.OrdinalIgnoreCase)) {
             weather = 2;
         }
     }
     if (weather < 0 || weather > 2) {
         player.Message("Please use a valid integer(0,1,2) or string(sun,rain,snow)");
         return;
     }
     if (p != player.Info) {
         if (p.IsOnline) {
             if (p.PlayerObject.Supports(CpeExtension.EnvWeatherType)) {
                 p.PlayerObject.Message("&a{0} set your weather to {1} ({2}&a)", player.Name, weather, weather == 0 ? "&sSun" : (weather == 1 ? "&1Rain" : "&fSnow"));
                 player.Message("&aSet weather for {0} to {1} ({2}&a)", p.Name, weather, weather == 0 ? "&sSun" : (weather == 1 ? "&1Rain" : "&fSnow"));
                 p.PlayerObject.Send(Packet.SetWeather((byte)weather));
             } else {
                 player.Message("That player does not support WeatherType packet");
             }
         } else if (p.IsOnline == false || !player.CanSee(p.PlayerObject)) {
             player.Message("That player is not online!");
         }
     } else {
         if (player.Supports(CpeExtension.EnvWeatherType)) {
             player.Message("&aSet weather to {0} ({1}&a)", weather, weather == 0 ? "&sSun" : (weather == 1 ? "&1Rain" : "&fSnow"));
             player.Send(Packet.SetWeather((byte)weather));
         } else {
             player.Message("You don't support WeatherType packet");
         }
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:46,代码来源:WorldCommands.cs

示例4: GlobalBlockDefineHandler

        static void GlobalBlockDefineHandler(Player player, string args) {
            // print the current step help if no args given
            if (string.IsNullOrWhiteSpace(args)) {
                PrintStepHelp(player); return;
            }

            BlockDefinition def = player.currentGB;
            int step = player.currentGBStep;
            byte value = 0; // as we can't pass properties by reference, make a temp var.
            bool boolVal = true;

            switch (step) {
                case 0:
                    step++; def.Name = args;
                    player.Message("   &bSet name to: " + def.Name);
                    break;
                case 1:
                    if (byte.TryParse(args, out value) && value <= 2) {
                        step++; def.CollideType = value;
                        player.Message("   &bSet solidity to: " + value);
                    }
                    break;
                case 2:
                    float speed;
                    if (float.TryParse(args, out speed)
                        && speed >= 0.25f && value <= 3.96f) {
                        step++; def.Speed = speed;
                        player.Message("   &bSet speed to: " + speed);
                    }
                    break;
                case 3:
                    if (byte.TryParse(args, out value)) {
                        step++; def.TopTex = value;
                        player.Message("   &bSet top texture index to: " + value);
                    }
                    break;
                case 4:
                    if (byte.TryParse(args, out value)) {
                        step++; def.SideTex = value;
                        player.Message("   &bSet sides texture index to: " + value);
                    }
                    break;
                case 5:
                    if (byte.TryParse(args, out value)) {
                        step++; def.BottomTex = value;
                        player.Message("   &bSet bottom texture index to: " + value);
                    }
                    break;
                case 6:
                    if (bool.TryParse(args, out boolVal)) {
                        step++; def.BlocksLight = boolVal;
                        player.Message("   &bSet blocks light to: " + boolVal);
                    }
                    break;
                case 7:
                    if (byte.TryParse(args, out value) && value <= 11) {
                        step++; def.WalkSound = value;
                        player.Message("   &bSet walk sound to: " + value);
                    }
                    break;
                case 8:
                    if (bool.TryParse(args, out boolVal)) {
                        if (player.Supports(CpeExtension.BlockDefinitionsExt)) {
                            step = 16;
                        } else {
                            step++;
                        }
                        def.FullBright = boolVal;
                        player.Message("   &bSet full bright to: " + boolVal);
                    }
                    break;
                case 9:
                    if (byte.TryParse(args, out value) && value <= 16) {
                        step++;
                        def.Shape = value;
                        def.MinX = 0;
                        def.MinY = 0;
                        def.MinZ = 0;
                        def.MaxX = 16;
                        def.MaxY = 16;
                        def.MaxZ = value;
                        player.Message("   &bSet block shape to: " + value);
                    }
                    break;
                case 10:
                    if (byte.TryParse(args, out value) && value <= 4) {
                        step++; def.BlockDraw = value;
                        player.Message("   &bSet block draw type to: " + value);
                    }
                    break;
                case 11:
                    if (byte.TryParse(args, out value)) {
                        def.FogDensity = value;
                        step += value == 0 ? 4 : 1;
                        player.Message("   &bSet density of fog to: " + value);
                    }
                    break;
                case 12:
                    if (WorldCommands.IsValidHex(args)) {
                        System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#" + args.ToUpper().Replace("#", ""));
//.........这里部分代码省略.........
开发者ID:Magi1053,项目名称:ProCraft,代码行数:101,代码来源:CpeCommands.cs

示例5: ClickDistanceHandler

 static void ClickDistanceHandler(Player player, CommandReader cmd) {
     PlayerInfo otherPlayer = InfoCommands.FindPlayerInfo(player, cmd, cmd.Next() ?? player.Name);
     if (otherPlayer == null) return;
     
     if (!player.IsStaff && otherPlayer != player.Info) {
         Rank staffRank = RankManager.GetMinRankWithAnyPermission(Permission.ReadStaffChat);
         if (staffRank != null) {
             player.Message("You must be {0}&s+ to change another players reach distance", staffRank.ClassyName);
         } else {
             player.Message("No ranks have the ReadStaffChat permission so no one can change other players reachdistance, yell at the owner.");
         }
         return;
     }
     if (otherPlayer.Rank.Index < player.Info.Rank.Index) {
         player.Message("Cannot change the Reach Distance of someone higher rank than you.");
         return;
     }
     string second = cmd.Next();
     if (string.IsNullOrEmpty(second)) {
         if (otherPlayer == player.Info) {
             player.Message("Your current ReachDistance: {0} blocks [Units: {1}]", player.Info.ReachDistance / 32, player.Info.ReachDistance);
         } else {
             player.Message("Current ReachDistance for {2}: {0} blocks [Units: {1}]", otherPlayer.ReachDistance / 32, otherPlayer.ReachDistance, otherPlayer.Name);
         }
         return;
     }
     short distance;
     if (!short.TryParse(second, out distance)) {
         if (second != "reset") {
             player.Message("Please try something inbetween 0 and 32767");
             return;
         } else {
             distance = 160;
         }
     }
     if (distance < 0 || distance > 32767) {
         player.Message("Reach distance must be between 0 and 32767");
         return;
     }
     
     if (distance != otherPlayer.ReachDistance) {
         if (otherPlayer != player.Info) {
             if (otherPlayer.IsOnline == true) {
                 if (otherPlayer.PlayerObject.Supports(CpeExtension.ClickDistance)) {
                     otherPlayer.PlayerObject.Message("{0} set your reach distance from {1} to {2} blocks [Units: {3}]", player.Name, otherPlayer.ReachDistance / 32, distance / 32, distance);
                     player.Message("Set reach distance for {0} from {1} to {2} blocks [Units: {3}]", otherPlayer.Name, otherPlayer.ReachDistance / 32, distance / 32, distance);
                     otherPlayer.ReachDistance = distance;
                     otherPlayer.PlayerObject.Send(Packet.MakeSetClickDistance(distance));
                 } else {
                     player.Message("This player does not support ReachDistance packet");
                 }
             } else {
                 player.Message("Set reach distance for {0} from {1} to {2} blocks [Units: {3}]", otherPlayer.Name, otherPlayer.ReachDistance / 32, distance / 32, distance);
                 otherPlayer.ReachDistance = distance;
             }
         } else {
             if (player.Supports(CpeExtension.ClickDistance)) {
                 player.Message("Set own reach distance from {0} to {1} blocks [Units: {2}]", player.Info.ReachDistance / 32, distance / 32, distance);
                 player.Info.ReachDistance = distance;
                 player.Send(Packet.MakeSetClickDistance(distance));
             } else {
                 player.Message("You don't support ReachDistance packet");
             }
         }
     } else {
         if (otherPlayer != player.Info) {
             player.Message("{0}'s reach distance is already set to {1}", otherPlayer.ClassyName, otherPlayer.ReachDistance);
         } else {
             player.Message("Your reach distance is already set to {0}", otherPlayer.ReachDistance);
         }
         return;
     }
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:73,代码来源:WorldCommands.cs

示例6: PrintCtfState

		public static void PrintCtfState(Player player) {
			if (player.IsPlayingCTF && player.Supports(CpeExtension.MessageType)) {
				player.Send(Packet.Message((byte)MessageType.BottomRight1, ""));
				string op = "&d<=>";
				if (CTF.RedTeam.TotalScore > CTF.BlueTeam.TotalScore) {
					op = "&S-->";
				} else if (CTF.RedTeam.TotalScore < CTF.BlueTeam.TotalScore) {
					op = "&S<--";
				}
				player.Message((byte)MessageType.BottomRight3, "{0}{1} &a{2}{0}:&f{3} {4} {5}{6} &a{7}{5}:&f{8}",
				               CTF.RedTeam.Color, CTF.RedTeam.Name, CTF.RedTeam.RoundsWon, CTF.RedTeam.Score, op,
				               CTF.BlueTeam.Color, CTF.BlueTeam.Name, CTF.BlueTeam.RoundsWon, CTF.BlueTeam.Score);
				
				var flagholder = player.World.Players.Where(p => p.IsHoldingFlag);
				if (flagholder.FirstOrDefault() == null) {
					player.Send(Packet.Message((byte)MessageType.BottomRight2, "&sNo one has the flag!"));
				} else if (CTF.RedTeam.HasFlag) {
					player.Message((byte)MessageType.BottomRight2, "{0} &shas the {1}&s flag!",
					               flagholder.First().ClassyName, CTF.BlueTeam.ClassyName);
				} else if (CTF.BlueTeam.HasFlag) {
					player.Message((byte)MessageType.BottomRight2,"{0} &shas the {1}&s flag!",
					               flagholder.First().ClassyName, CTF.RedTeam.ClassyName);
				}
				
				if (player.Team != null) {
					player.Send(Packet.Message((byte)MessageType.Status3,
					                           "&sTeam: " + player.Team.ClassyName));
				} else {
					player.Send(Packet.Message((byte)MessageType.Status3, "&sTeam: &0None"));
				}
			}
			
			if (player.IsPlayingCTF && player.Supports(CpeExtension.EnvColors)) {
				string color = null;
				if (CTF.RedTeam.Score > CTF.BlueTeam.Score) {
					color = CTF.RedTeam.EnvColor;
				} else if (CTF.BlueTeam.Score > CTF.RedTeam.Score) {
					color = CTF.BlueTeam.EnvColor;
				} else {
					color = Mix(CTF.RedTeam.EnvColor, CTF.BlueTeam.EnvColor);
				}
				player.Send(Packet.MakeEnvSetColor((byte)EnvVariable.SkyColor, color));
				player.Send(Packet.MakeEnvSetColor((byte)EnvVariable.FogColor, color));
			}
		}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:45,代码来源:CtfGame.cs

示例7: RemovePlayerFromTeam

		static void RemovePlayerFromTeam(Player p, CtfTeam opposingTeam) {
			p.Team.Players.Remove(p);
			p.Message("&SRemoving you from the game");
			if (p.IsHoldingFlag) {
				world.Players.Message("&cFlag holder " + p.ClassyName + " &cleft CTF, " +
				                      "thus dropping the flag for the " + p.Team.ClassyName + " team!");
				p.Team.HasFlag = false;
				p.IsHoldingFlag = false;
				world.Map.QueueUpdate(new BlockUpdate(Player.Console, opposingTeam.FlagPos,
				                                      opposingTeam.FlagBlock));
			}	
			
			p.IsPlayingCTF = false;
			p.Team = null;		
			if (p.Supports(CpeExtension.HeldBlock))
				p.Send(Packet.MakeHoldThis(Block.Stone, false));
		}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:17,代码来源:CtfGame.cs

示例8: RemovePlayer

		public static void RemovePlayer(Player player, World world) {
			if (player.Supports(CpeExtension.MessageType))
				player.Send(Packet.Message((byte)MessageType.Status3, ""));
			
			if (BlueTeam.Has(player))
				RemovePlayerFromTeam(player, RedTeam);
			else if (RedTeam.Has(player))
				RemovePlayerFromTeam(player, BlueTeam);
			
			foreach (Player p in world.Players) {
				if (!p.Supports(CpeExtension.ExtPlayerList) && !p.Supports(CpeExtension.ExtPlayerList2))
					continue;
				p.Send(Packet.MakeExtRemovePlayerName(player.NameID));
			}
		}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:15,代码来源:CtfGame.cs

示例9: AddPlayerToTeam

		static void AddPlayerToTeam(CtfTeam team, Player p) {
			team.Players.Add(p);
			p.Message("&SAdding you to the " + team.ClassyName + " team");
			p.TeleportTo(team.Spawn);
			p.Team = team;
			
			p.IsPlayingCTF = true;
			if (p.Supports(CpeExtension.HeldBlock))
				p.Send(Packet.MakeHoldThis(Block.TNT, false));
		}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:10,代码来源:CtfGame.cs

示例10: textHotKeyHandler

        private static void textHotKeyHandler(Player player, CommandReader cmd) {
            string Label = cmd.Next();
            string Action = cmd.Next();
            string third = cmd.Next();
            string fourth = cmd.Next();
            if (Label == null || Action == null || third == null || fourth == null) {
                CdtextHotKey.PrintUsage(player);
                return;
            }

            int KeyCode;
            if (!int.TryParse(third, out KeyCode)) {
                player.Message("Error: Invalid Integer ({0})", third);
                return;
            }
            byte KeyMod = 0;
            if (null != fourth) {
                if (!Byte.TryParse(fourth, out KeyMod)) {
                    player.Message("Error: Invalid Byte ({0})", fourth);
                    return;
                }
            }
            if (player.Supports(CpeExtension.TextHotKey)) {
                player.Send(Packet.MakeSetTextHotKey(Label, Action, KeyCode, KeyMod));
            } else {
                player.Message("You do not support TextHotKey");
                return;
            }
        }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:29,代码来源:ChatCommands.cs


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