Ejemplo n.º 1
0
        private void NewMap()
        {
            suppressNetworkUpdatesOnTileChanged = true;
            try
            {
                LogManager.Log("Cannot find map. Generating blank map.", LogLevel.Warning);
                ushort floor = IoCManager.Resolve<ITileDefinitionManager>()["Floor"].TileId;
                ushort wall = IoCManager.Resolve<ITileDefinitionManager>()["Wall"].TileId;

                Debug.Assert(floor > 0); // This whole method should be removed once tiles become data driven.
                Debug.Assert(wall > 0);

                for (int y = -32; y <= 32; ++y)
                    for (int x = -32; x <= 32; ++x)
                        if (Math.Abs(x) == 32 || Math.Abs(y) == 32)
                            Tiles[x, y] = new Tile(wall);
                        else
                            Tiles[x, y] = new Tile(floor);
            }
            finally
            {
                suppressNetworkUpdatesOnTileChanged = false;
            }
        }
Ejemplo n.º 2
0
 public void SendChangeTile(int x, int y, Tile newTile)
 {
     NetOutgoingMessage tileMessage = IoCManager.Resolve<ISS14NetServer>().CreateMessage();
     var mapMgr = (MapManager) IoCManager.Resolve<IMapManager>();
     //tileMessage.Write((byte)NetMessage.ChangeTile);
     tileMessage.Write(x);
     tileMessage.Write(y);
     tileMessage.Write((uint)newTile);
     foreach (NetConnection connection in ClientList.Keys)
     {
         IoCManager.Resolve<ISS14NetServer>().SendMessage(tileMessage, connection,
                                                          NetDeliveryMethod.ReliableOrdered);
         LogManager.Log(connection.RemoteEndPoint.Address + ": Tile Change Being Sent", LogLevel.Debug);
     }
 }