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


C# IPlayer.HasMetadata方法代码示例

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


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

示例1: Get

        public static HousePlayer Get(IPlayer player)
        {
            if (player.HasMetadata("HousePlayer"))
                return player.GetMetadata("HousePlayer") as HousePlayer;

            HousePlayer housePlayer = new HousePlayer(player);
            player.SetMetadata("HousePlayer", housePlayer);

            return housePlayer;
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:10,代码来源:HousePlayer.cs

示例2: DigBlock

        private void DigBlock(int x, int y, IPlayer player, float digStrength, bool mining, bool explosion = false)
        {
            if (digHardness == null)
                resetDigHardness();

            if (!(x > 0 && y > 0 && x < bot.Room.Width && y < bot.Room.Height))
                return;

            if (digHardness[x, y] <= 0)
                return;

            IBlock block = bot.Room.getBlock(0, x, y);
            int blockId = -1;
            float blockXp = 0;

            DigPlayer digPlayer = null;
            if (player != null)
            {
                if (!player.HasMetadata("digplayer"))
                    player.SetMetadata("digplayer", new DigPlayer(player));

                 digPlayer = (DigPlayer)player.GetMetadata("digplayer");
            }

            if (mining)
            {
                InventoryItem temp = ItemManager.GetItemFromOreId(block.Id);
                if (temp != null)
                {
                    Ore ore = ItemManager.GetOreByName(temp.Name);
                    blockId = 414;

                    if (digPlayer.digLevel >= Convert.ToInt32(ore.LevelRequired))
                    {
                        if (digHardness[x, y] <= digStrength)
                        {
                            digHardness[x, y] = 0F;

                            InventoryItem newsak = new InventoryItem(temp);

                            digPlayer.Inventory.AddItem(newsak, 1);
                            int oldLevel = digPlayer.digLevel;
                            digPlayer.digXp += Convert.ToInt32(ore.XPGain);
                            int newLevel = digPlayer.digLevel;
                            if (newLevel > oldLevel)
                                player.Reply("You have leveled up to level " + newLevel + "!");
                        }
                    }
                    else
                    {
                        return;
                    }

                }
            }

            if (explosion)
                blockId = 414;

            switch (block.Id)
            {
                case BlockIds.Blocks.Sand.BROWN:
                    blockId = 414;
                    blockXp = 0.08f;
                    break;

                case BlockIds.Blocks.Sand.GRAY:
                    blockId = 414;
                    blockXp = 0.1f;
                    break;

                case 1022: // gray bricks
                    blockId = 414;
                    blockXp = 0.2f;
                    break;

                case BlockIds.Blocks.JungleRuins.BLUE:
                    blockId = BlockIds.Action.Liquids.WATER;
                    blockXp = 0.1f;
                    break;

                case 21:
                    blockId = 369; //BlockIds.Action.Liquids.MUD;
                    blockXp = 0.1f;
                    break;

                default:
                    if (blockId == -1)
                        return;
                    else
                        break;
            }

            digHardness[x, y] -= digStrength;

            if (digHardness[x, y] <= 0)
            {
                digHardness[x, y] = 0f;

                bot.Room.setBlock(x, y, new NormalBlock(blockId));
//.........这里部分代码省略.........
开发者ID:CheeseSoftware,项目名称:MasterDig,代码行数:101,代码来源:MasterDig.cs

示例3: EndRecord

 private void EndRecord(IPlayer player)
 {
     List<IEditChange> record = (List<IEditChange>)recordingPlayer.GetMetadata("worldeditrecord");
     if (record.Count > 0)
     {
         if (!player.HasMetadata("worldedithistory"))
             player.SetMetadata("worldedithistory", new List<IEditChange>());
         List<IEditChange> history = (List<IEditChange>)player.GetMetadata("worldedithistory");
         history.Add(new EditChangeList((List<IEditChange>)record));
         if (!player.HasMetadata("worldedithistoryindex"))
             player.SetMetadata("worldedithistoryindex", 0);
         else
             player.SetMetadata("worldedithistoryindex", ((int)player.GetMetadata("worldedithistoryindex")) + 1);
     }
     player.RemoveMetadata("worldeditrecord");
     recordingPlayer = null;
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:17,代码来源:WorldEdit.cs

示例4: FromPlayer

 public static DigPlayer FromPlayer(IPlayer player)
 {
     if (!player.HasMetadata("digplayer"))
         player.SetMetadata("digplayer", new DigPlayer(player));
     return (DigPlayer)player.GetMetadata("digplayer");
 }
开发者ID:CheeseSoftware,项目名称:MasterDig,代码行数:6,代码来源:DigPlayer.cs

示例5: getPlayerData

        private GodRunPlayer getPlayerData(IPlayer player)
        {
            if (!player.HasMetadata("GodRunPlayer"))
                player.SetMetadata("GodRunPlayer", new GodRunPlayer(player));

            return player.GetMetadata("GodRunPlayer") as GodRunPlayer;
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:7,代码来源:RunFromGods.cs


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