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


C# TSPlayer.SendTileSquareEx方法代码示例

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


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

示例1: CheckTilePermission

        private bool CheckTilePermission(TSPlayer player, DPoint location, BlockType blockType, int objectStyle, PaintColor paint, bool dropItem = false)
        {
            switch (blockType) {
            case BlockType.Statue: {
              DPoint originTileLocation = new DPoint(location.X, location.Y - 2);
              if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(2, 3)))
            break;
              StatueStyle statueStyle = TerrariaUtils.Tiles.GetStatueStyle(objectStyle);
              StatueConfig statueConfig;
              if (!this.Config.StatueConfigs.TryGetValue(statueStyle, out statueConfig) || statueConfig == null)
            break;

              if (!player.Group.HasPermission(statueConfig.WirePermission)) {
            player.SendTileSquareEx(location, 10);

            if (dropItem) {
              ItemType itemTypeToDrop;
              itemTypeToDrop = TerrariaUtils.Tiles.GetItemTypeFromStatueStyle(statueStyle);

              Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)itemTypeToDrop);
            }

            this.TellNoStatueWiringPermission(player, statueStyle);
            return false;
              }

              break;
            }
            case BlockType.DartTrap: {
              Tile destTile = TerrariaUtils.Tiles[location];
              if (!destTile.HasWire())
            break;
              TrapConfig trapConfig;
              TrapStyle trapStyle = TerrariaUtils.Tiles.GetTrapStyle(destTile.frameY / 18);
              TrapConfigKey configKey = new TrapConfigKey(trapStyle, paint);
              if (!this.Config.TrapConfigs.TryGetValue(configKey, out trapConfig))
            break;

              if (!player.Group.HasPermission(trapConfig.WirePermission)) {
            player.SendTileSquareEx(location, 10);

            if (dropItem) {
              ItemType itemTypeToDrop = TerrariaUtils.Tiles.GetItemTypeFromTrapStyle(trapStyle);
              Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)itemTypeToDrop);
            }

            this.TellMissingComponentWiringPermission(player, blockType);
            return false;
              }

              break;
            }
            case BlockType.Boulder: {
              DPoint originTileLocation = new DPoint(location.X - 1, location.Y - 1);
              if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(2, 2)))
            break;

              if (!player.Group.HasPermission(AdvancedCircuitsPlugin.WireBoulder_Permission)) {
            player.SendTileSquareEx(location, 10);

            if (dropItem)
              Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)ItemType.Boulder);

            this.TellMissingComponentWiringPermission(player, blockType);
            return false;
              }

              break;
            }
            case BlockType.Sign: {
              if (!TerrariaUtils.Tiles.IsObjectWired(location, new DPoint(2, 2)))
            break;

              if (!player.Group.HasPermission(AdvancedCircuitsPlugin.WireSign_Permission)) {
            player.SendTileSquareEx(location, 10);

            if (dropItem)
              Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)ItemType.Sign);

            this.TellMissingComponentWiringPermission(player, blockType);
            return false;
              }

              break;
            }
            case BlockType.InletPump:
            case BlockType.OutletPump: {
              DPoint originTileLocation = new DPoint(location.X - 1, location.Y - 1);
              if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(2, 2)))
            break;
              PumpConfig pumpConfig;
              if (!this.Config.PumpConfigs.TryGetValue(paint, out pumpConfig))
            break;
              if (string.IsNullOrEmpty(pumpConfig.WirePermission))
            break;

              if (!player.Group.HasPermission(pumpConfig.WirePermission)) {
            player.SendTileSquareEx(location, 10);

            if (dropItem) {
//.........这里部分代码省略.........
开发者ID:CoderCow,项目名称:AdvancedCircuits-Plugin,代码行数:101,代码来源:UserInteractionHandler.cs


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