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


C# MiNET.Player类代码示例

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


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

示例1: PlayerInventory

        public PlayerInventory(Player player)
        {
            Player = player;
            Slots = Enumerable.Repeat(new ItemStack(), 35).ToList();
            //int c = 0;
            //Slots[++c] = new ItemStack(new ItemBow(0), 3);
            //Slots[++c] = new ItemStack(262, 64);
            //Slots[++c] = new ItemStack(new ItemSteak(), 1);
            //Slots[++c] = new ItemStack(new ItemApple(), 1);
            //Slots[++c] = new ItemStack(new ItemBakedPotato(), 1);
            //Slots[++c] = new ItemStack(new ItemBakedPotato(), 1);
            //Slots[++c] = new ItemStack(new ItemBakedPotato(), 1);

            ItemHotbar = new int[6];
            InHandSlot = 0;

            //Boots = new ItemDiamondBoots(0);
            //Leggings = new ItemDiamondLeggings(0);
            //Chest = new ItemDiamondChestplate(0);
            //Helmet = new ItemDiamondHelmet(0);

            Boots = new Item(0, 0);
            Leggings = new Item(0, 0);
            Chest = new Item(0, 0);
            Helmet = new Item(0, 0);

            for (byte i = 0; i < 6; i++)
            {
                ItemHotbar[i] = i;
            }
        }
开发者ID:ruslan81,项目名称:MiNET,代码行数:31,代码来源:PlayerInventory.cs

示例2: Player

 public Player()
 {
     _chunksUsed = new Dictionary<Tuple<int, int>, ChunkColumn>();
     HealthManager = new PCHealthManager(this);
     if (PlayerEntity == null) PlayerEntity = new MiNET.Player(null, null, PluginGlobals.Level[0], null, -1);
     PlayerInventory = new PlayerInventory(this);
 }
开发者ID:EmreTr1,项目名称:MiNET-PC,代码行数:7,代码来源:Player.cs

示例3: RegisterCommand

        public void RegisterCommand(Player player, string password)
        {
            var userManager = Context.Server.UserManager;

            var user = userManager.FindByNameAsync(player.Username).Result;

            if (user == null)
            {
                if (password == null && password.IndexOf(' ') > -1)
                {
                    player.SendMessage($"Do not add any space in your password!");
                    return;
                }
                user = new User(player.Username);
                Context.Server.UserManager.CreateAsync(user, password);
                user.IsAuthenticated = true;
                userManager.UpdateAsync(user);
            }
            else if (user.IsAuthenticated)
            {
                player.SendMessage($"{ChatColors.Red}You has been Login!");
            }
            else if (Context.Server.UserManager.HasPasswordAsync(user.Id).Result)
            {
                player.SendMessage($"You has been register,Plz Type your password to login");
            }
        }
开发者ID:MiNETPlugins,项目名称:MiNetAuth,代码行数:27,代码来源:Register.cs

示例4: PlaceBlock

        public override bool PlaceBlock(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            byte direction = player.GetDirection();

            switch (face)
            {
                case BlockFace.South: // ok
                    Metadata = 0;
                    break;
                case BlockFace.North:
                    Metadata = 1;
                    break;
                case BlockFace.West:
                    Metadata = 2;
                    break;
                case BlockFace.East: // ok
                    Metadata = 3;
                    break;
            }

            Log.Warn($"Direction={direction}, face={face}, metadata={Metadata}");

            world.SetBlock(this);

            return true;
        }
开发者ID:CRBairdUSA,项目名称:MiNET,代码行数:26,代码来源:CustomItemFrame.cs

示例5: PM

		public void PM(Player source, string[] arguments)
		{
			if (arguments.Length >= 2)
			{
				Player target = getPlayer(arguments[0], source);
				if (target != source)
				{
					string message = string.Empty;
					for (int i = 1; i < arguments.Length; i++)
					{
						message += arguments[i];
					}
					target.SendMessage("[MailPE] " + source.Username + ": " + message);
					source.SendMessage("[MailPE] Message to " + target.Username + " was sent!");
				}
				else
				{
					source.SendMessage("[MailPE] Player not found!");
				}
			}
			else
			{
				source.SendMessage("[MailPE] Wrong command usage!");
			}
		}
开发者ID:PocketRealms,项目名称:MailPE,代码行数:25,代码来源:Class1.cs

示例6: BroadCastMovement

        protected override void BroadCastMovement(Player[] players, Player[] updatedPlayers)
        {
            if (updatedPlayers.Length == 0) return;

            var moveEntity = McpeMoveEntity.CreateObject(players.Count());
            moveEntity.entities = new EntityLocations();

            //var rotateHead = McpeRotateHead.CreateObject(players.Count());
            //rotateHead.entities = new EntityHeadRotations();

            foreach (var player in updatedPlayers)
            {
                Entity entity;
                if (!_playerEntities.TryGetValue(player, out entity)) continue;

                entity.KnownPosition = (PlayerLocation) player.KnownPosition.Clone();
                if (entity.EntityTypeId == 10)
                {
                    //BUG: Duck has it's value reversed
                    entity.KnownPosition.Pitch = -player.KnownPosition.Pitch;
                }
                moveEntity.entities.Add(entity.EntityId, entity.KnownPosition);
                //rotateHead.entities.Add(entity.EntityId, entity.KnownPosition);
            }

            moveEntity.Encode();
            //rotateHead.Encode();

            new Task(() => RelayBroadcast(moveEntity)).Start();
            //new Task(() => RelayBroadcast(rotateHead)).Start();
        }
开发者ID:WilliamGao1,项目名称:MiNET,代码行数:31,代码来源:MobHuntLevel.cs

示例7: PlayerJoin

 public Package PlayerJoin(McpeLogin package, Player player)
 {
     if (!_notdefaultlevel)
     {
         player.Level.BlockBreak += OnBreak;
         player.Level.BlockPlace += OnPlace;
         _notdefaultlevel = true;
     }
     if (!(_registerlist.Contains(player.User)))
     {
         player.AddPopup(new Popup()
         {
             Message = "Используй /reg [пароль] для регистрации",
             MessageType = MessageType.Popup
         });
     }
     else
     {
         player.User = _registerlist.Find(t => t.UserName == player.Username);
         if (!player.User.IsAuthenticated)
             player.AddPopup(new Popup()
             {
                 Message = "Используй /auth [пароль] чтобы войти",
                 MessageType = MessageType.Popup
             });
     }
     return package;
 }
开发者ID:xpyctum,项目名称:MiNetAuth,代码行数:28,代码来源:MiNetAuth.cs

示例8: Interact

        public override bool Interact(Level currentLevel, Player player, BlockCoordinates blockCoordinates, BlockFace face)
        {
            Sign signEntity = currentLevel.GetBlockEntity(blockCoordinates) as Sign;
            if (signEntity == null) return false;

            string world = signEntity.Text1;

            if (player.Level.LevelId.Equals(world)) return true;

            if (!Worlds.ContainsKey(player.Level.LevelId))
            {
                Worlds.Add(player.Level.LevelId, player.Level);
            }

            if (!Worlds.ContainsKey(world))
            {
                var mobHuntLevel = new MobHuntLevel(world, new FlatlandWorldProvider());
                mobHuntLevel.Initialize();
                Worlds.Add(world, mobHuntLevel);
            }

            Level level = Worlds[world];
            player.SpawnLevel(level);
            level.BroadcastTextMessage(string.Format("{0} teleported to world <{1}>.", player.Username, level.LevelId));

            return true;
        }
开发者ID:WilliamGao1,项目名称:MiNET,代码行数:27,代码来源:CustomStandingSign.cs

示例9: RemovePlayer

        public override void RemovePlayer(Player player, bool despawn = true)
        {
            base.RemovePlayer(player, despawn);

            Entity entity;
            if (!_playerEntities.TryGetValue(player, out entity)) return;
            entity.DespawnEntity();
        }
开发者ID:WilliamGao1,项目名称:MiNET,代码行数:8,代码来源:MobHuntLevel.cs

示例10: Pet

		public Pet(Player owner, Level level, int id = 12) : base(id, level)
		{
			IsBaby = true;
			IsInRage = false;
			Owner = owner;
			HealthManager = new PetHealthManager(this);
			Age = 0;
		}
开发者ID:TheDiamondYT2,项目名称:MiNET,代码行数:8,代码来源:Pet.cs

示例11: PlayerDisconnect

 public Package PlayerDisconnect(McpeDisconnect package, Player player)
 {
     if (_registerlist.Contains(player.User))
     {
         player.User.IsAuthenticated = false;
     }
     return package;
 }
开发者ID:xpyctum,项目名称:MiNetAuth,代码行数:8,代码来源:MiNetAuth.cs

示例12: Fuck

 public void Fuck(Player player)
 {
     //player.SendSetHealth();
     player.Level.BroadcastMessage(string.Format("{0} current health is {1} with {2} hearts!", player.Username, player.HealthManager.Health, player.HealthManager.Hearts), type: MessageType.Raw);
     player.HealthManager.Health -= 5;
     player.SendSetHealth();
     player.Level.BroadcastMessage(string.Format("{0} health after reset is {1} with {2} hearts!", player.Username, player.HealthManager.Health, player.HealthManager.Hearts), type: MessageType.Raw);
 }
开发者ID:HungerBoatz,项目名称:MiNET,代码行数:8,代码来源:NiceLobbyPlugin.cs

示例13: PlayerInventory

		public PlayerInventory(Player player)
		{
			Player = player;

			Slots = Enumerable.Repeat(new ItemStack(), InventorySize).ToList();
			//Slots = Enumerable.Repeat(new ItemStack(new ItemIronSword(0), 1), InventorySize).ToList();
			//Slots[Slots.Count-10] = new ItemStack(new ItemDiamondAxe(0), 1);
			//Slots[Slots.Count-9] = new ItemStack(new ItemDiamondAxe(0), 1);
			//int c = -1;
			//Slots[++c] = new ItemStack(new ItemIronSword(0), 1);
			//Slots[++c] = new ItemStack(new ItemBow(0), 1);
			//Slots[++c] = new ItemStack(new ItemSnowball(0), 64);
			//Slots[++c] = new ItemStack(new ItemEgg(0), 64);
			//Slots[++c] = new ItemStack(262, 32);
			//Slots[++c] = new ItemStack(new ItemBucket(10), 1);
			//Slots[++c] = new ItemStack(new ItemChest(0), 1);
			////Slots[++c] = new ItemStack(new ItemBlock(new DiamondOre(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new GoldBlock(), 0), 64);
			//Slots[++c] = new ItemStack(new ItemBlock(new CoalBlock(), 0), 64);

			//Slots = new List<ItemStack>();
			//for (int i = 0; i < 100; i++)
			//{
			//	Slots.Add(new ItemStack(ItemFactory.GetItem(i, 0), 1));
			//}

			ItemHotbar = new int[HotbarSize];
			InHandSlot = 0;

			for (byte i = 0; i < ItemHotbar.Length; i++)
			{
				ItemHotbar[i] = i;
			}

			Boots = new Item(0, 0);
			Leggings = new Item(0, 0);
			Chest = new Item(0, 0);
			Helmet = new Item(0, 0);

			//Boots = new ItemDiamondBoots(0);
			//Leggings = new ItemDiamondLeggings(0);
			//Chest = new ItemDiamondChestplate(0);
			//Helmet = new ItemDiamondHelmet(0);
		}
开发者ID:TheDiamondYT2,项目名称:MiNET,代码行数:58,代码来源:PlayerInventory.cs

示例14: AddPlayerHandler

        public Package AddPlayerHandler(McpeAddPlayer packet, Player player)
        {
            if (_playerEntities.Keys.FirstOrDefault(p => p.EntityId == packet.entityId) != null)
            {
                return null;
            }

            return packet;
        }
开发者ID:GoldishKirby,项目名称:MiNET,代码行数:9,代码来源:NiceLobbyPlugin.cs

示例15: SetSlot

		public void SetSlot(Player player, byte slot, ItemStack itemStack)
		{
			Slots[slot] = new MetadataSlot(itemStack);

			NbtCompound compound = BlockEntity.GetCompound();
			compound["Items"] = GetSlots();

			OnInventoryChange(player, slot, itemStack);
		}
开发者ID:TheDiamondYT2,项目名称:MiNET,代码行数:9,代码来源:Inventory.cs


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