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


C# IPlayer.Send方法代码示例

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


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

示例1: SendTo

        public override void SendTo(IPlayer player, ObjectVisibility visibility)
        {
            Debug.Assert(visibility != ObjectVisibility.None);

            var data = new ItemData();

            CollectObjectData(data, visibility);

            player.Send(new Messages.ObjectDataMessage(data));

            base.SendTo(player, visibility);

            player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID });
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:14,代码来源:ItemObject.cs

示例2: EditHouse

 public void EditHouse(IPlayer builder)
 {
     if (houses.ContainsKey(builder.Name))
     {
         House house = houses[builder.Name];
         if (!buildingHouses.ContainsKey(builder))
         {
             buildingHouses.Add(builder, house);
             builder.Send("You are now editing your house.");
         }
         else builder.Send("You are already editing your house.");
     }
     else
         builder.Send("You have no house to edit.");
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:15,代码来源:HouseManager.cs

示例3: SendWorldData

        public void SendWorldData(IPlayer player)
        {
            var data = new WorldData()
            {
                Tick = this.TickNumber,
                Year = this.Year,
                Season = this.Season,
                LivingVisionMode = this.LivingVisionMode,
            };

            player.Send(new Messages.WorldDataMessage(data));
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:12,代码来源:World.cs

示例4: DestroyHouse

        public void DestroyHouse(IPlayer builder)
        {
            if (houses.ContainsKey(builder.Name))
            {
                House house = houses[builder.Name];
                if (buildingHouses.ContainsKey(builder))
                    buildingHouses.Remove(builder);

                for (int x = house.x; x < house.x + house.width; x++)
                {
                    for (int y = house.y; y < house.y + house.height; y++)
                    {
                        bot.Room.setBlock(x, y, new NormalBlock(142, 0));
                        bot.Room.setBlock(x, y, new NormalBlock(0, 1));
                    }
                }

                houses.Remove(builder.Name);
                Save();

                builder.Send("House destroyed!");
            }
            else
                builder.Send("You have no house to destroy.");
        }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:25,代码来源:HouseManager.cs

示例5: EditHouse

 public void EditHouse(IPlayer builder)
 {
     bool editSuccess = false;
     foreach (House house in houses)
     {
         if (house.builder.Name.Equals(builder.Name))
         {
             buildingHouses.Add(builder, house);
             editSuccess = true;
         }
     }
     if (editSuccess)
         builder.Send("You are now able to edit your houses.");
     else
         builder.Send("You have no houses to edit.");
 }
开发者ID:CheeseSoftware,项目名称:MasterBot,代码行数:16,代码来源:HouseManager.cs

示例6: SendMapTiles

        void SendMapTiles(IPlayer player)
        {
            var visionTracker = player.GetVisionTracker(this);

            int w = this.Width;
            int h = this.Height;
            int d = this.Depth;

            var size = new IntSize3(w, h, 1);

            var arr = new ulong[w * h];

            for (int z = 0; z < d; ++z)
            {
                var bounds = new IntGrid3(new IntVector3(0, 0, z), size);

                Parallel.For(0, h, y =>
                {
                    for (int x = 0; x < w; ++x)
                    {
                        var p = new IntVector3(x, y, z);

                        ulong v;

                        if (!visionTracker.Sees(p))
                            v = 0;
                        else
                            v = GetTileData(p).Raw;

                        arr[y * w + x] = v;
                    }
                });

                var msg = new Messages.MapDataTerrainsMessage()
                {
                    Environment = this.ObjectID,
                    Bounds = bounds,
                    TerrainData = arr,
                };

                player.Send(msg);
                //Trace.TraceError("Sent {0}", z);
            }
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:44,代码来源:EnvironmentObject.cs

示例7: SendTo

        public override void SendTo(IPlayer player, ObjectVisibility visibility)
        {
            Debug.Assert(visibility != ObjectVisibility.None);

            var data = new EnvironmentObjectData();
            CollectObjectData(data, visibility);
            player.Send(new Messages.ObjectDataMessage(data));

            var sw = Stopwatch.StartNew();
            SendMapTiles(player);
            sw.Stop();
            Trace.TraceInformation("Sending MapTiles took {0} ms", sw.ElapsedMilliseconds);

            foreach (var ob in this.Contents)
            {
                var vis = player.GetObjectVisibility(ob);

                if (vis != ObjectVisibility.None)
                    ob.SendTo(player, vis);
            }

            player.Send(new Messages.ObjectDataEndMessage() { ObjectID = this.ObjectID });
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:23,代码来源:EnvironmentObject.cs

示例8: SendIntroTo

 public void SendIntroTo(IPlayer player)
 {
     var data = new EnvironmentObjectData();
     CollectObjectData(data, ObjectVisibility.Public);
     player.Send(new Messages.ObjectDataMessage(data));
 }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:6,代码来源:EnvironmentObject.cs


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