Exemplo n.º 1
0
        public GodGameOffline(WorldSimulationService worldSimulationService,
                              Model.World world,
                              WorldPersisterService persisterService,
                              UserInputProcessingService userInputProcessingService,
                              UIRenderingService uiRenderingService,
                              DeveloperConsoleService developerConsoleService,
                              ClearGameStateChangesService clearStateChangesSimulator,
                              WorldRenderingSimulator worldRenderingSimulator,
                              WorldRenderingService simpleWorldRenderer
                              )
        {
            World = world;
            this.WorldSimulationService     = worldSimulationService;
            this.clearStateChangesSimulator = clearStateChangesSimulator;



            this.userInputProcessingService = userInputProcessingService;
            this.uiRenderingService         = uiRenderingService;
            this.developerConsoleService    = developerConsoleService;
            this.clearStateChangesSimulator = clearStateChangesSimulator;
            this.worldRenderingSimulator    = worldRenderingSimulator;
            this.simpleWorldRenderer        = simpleWorldRenderer;



            persisterService.Load(world, TWDir.GameData.GetChild("Saves/GodGame").CreateFile("auto.xml"));
        }
Exemplo n.º 2
0
        public void Load(Model.World world, FileInfo file)
        {
            SerializedWorld sWorld;

            try
            {
                using (var fs = file.OpenRead())
                    sWorld = (SerializedWorld)createXmlSerializer().Deserialize(fs);

                try
                {
                    var doc = XDocument.Load(Path.ChangeExtension(file.FullName, "data.xml"));
                    genericDatastore.Deserialize(doc.Elements().First());
                }
                catch (Exception ex2)
                {
                    DI.Get <IErrorLogger>().Log(ex2, "Genericdatastore");
                }
            }
            catch (Exception ex)
            {
                DI.Get <IErrorLogger>().Log(ex, "WorldPersister");
                return;
            }


            sWorld.ToWorld(world, gameplayObjectsSerializer);
        }
 public ActiveToolInputHandler(Internal.Model.World world, WorldPersisterService worldPersister, PlayerState player, NullPlayerTool nullPlayerTool)
 {
     this.world          = world;
     this.worldPersister = worldPersister;
     this.player         = player;
     ActivePlayerTool    = nullPlayerTool;
 }
Exemplo n.º 4
0
 public UserInputProcessingService(Internal.Model.World world, IPlayerInputHandler inputHandler, WorldRenderingService renderer, ToolSelectionMenu toolSelectionMenu)
 {
     this.world             = world;
     this.inputHandler      = inputHandler;
     this.renderer          = renderer;
     this.toolSelectionMenu = toolSelectionMenu;
 }
 public static MHGameWork.TheWizards.GodGame.Internal.Model.World createTestWorld(int voxelSize, int size)
 {
     Internal.Model.World world = null;
     world = new MHGameWork.TheWizards.GodGame.Internal.Model.World((w, p) => new GameVoxel(w, p), new ProxyGenerator());
     world.Initialize(size, voxelSize);
     return(world);
 }
 public ChangeHeightToolPerPlayer(Internal.Model.World world, PlayerState player)
 {
     this.world        = world;
     this.player       = player;
     State             = HeightToolState.DEFAULT;
     StandardDeviation = 2;
     Amplitude         = 1;
 }
        //private HashSet<IVoxel> changedVoxels = new HashSet<IVoxel>();
        //private List<>

        public WorldSimulationService(Model.World world, VoxelTypesFactory voxelTypesFactory)
        {
            this.world             = world;
            this.voxelTypesFactory = voxelTypesFactory;


            nextTick = TW.Graphics.TotalRunTime + TickInterval;

            //world.VoxelChanged.Subscribe(v => changedVoxels.Add(v));
        }
Exemplo n.º 8
0
        public void Save(Model.World world, FileInfo file)
        {
            var serializer = createXmlSerializer();

            using (var fs = file.Create())
                serializer.Serialize(fs, SerializedWorld.FromWorld(world));

            var doc = new XDocument(genericDatastore.Serialize());

            doc.Save(Path.ChangeExtension(file.FullName, "data.xml"));
        }
Exemplo n.º 9
0
 public void ApplyInputs(Model.World world, Inputs inputs)
 {
     foreach (var m in inputs.MonumentRangeInputs)
     {
         var v = world.GetVoxel(m.Coord);
         if (!(v.Type is MonumentType))
         {
             continue; // Ignore input because it arrived to late or is invalid
         }
         ((MonumentType)v.Type).ApplyMonumentRangeInput(v, m.Value);
     }
 }
Exemplo n.º 10
0
 public ToolMenuBuilder(VoxelTypesFactory typesFactory,
                        Internal.Model.World world,
                        Func <string, ToolSelectionCategory> createCategory,
                        ToolSelectionTool.Factory createToolItem,
                        IIndex <Type, PlayerTool> getPlayerTool,
                        ItemTypesFactory itemTypesFactory)
 {
     this.typesFactory     = typesFactory;
     this.world            = world;
     this.createCategory   = createCategory;
     this.createToolItem   = createToolItem;
     this.getPlayerTool    = getPlayerTool;
     this.itemTypesFactory = itemTypesFactory;
 }
        public UIRenderingService(Internal.Model.World world, LocalPlayerService localPlayerService, UserInputProcessingService inputSim)
        {
            this.world            = world;
            this.localPlayerState = localPlayerService.Player;
            this.inputSim         = inputSim;

            reticle = new TargetingReticle();

            textarea          = new Textarea();
            textarea.Position = new Vector2(TW.Graphics.Form.Form.ClientSize.Width - 120, 20);
            textarea.Size     = new Vector2(100, 50);

            debugTextarea          = new Textarea();
            debugTextarea.Position = new Vector2(TW.Graphics.Form.Form.ClientSize.Width - 200, 150);
            debugTextarea.Size     = new Vector2(180, 400);
        }
Exemplo n.º 12
0
        public GodGameServer(WorldSimulationService worldSimulationService,
                             NetworkedPlayerFactory networkedPlayerFactory,
                             ClearGameStateChangesService clearStateChangesSimulator,
                             INetworkConnectorServer networkConnectorServer,
                             GameStateDeltaPacketBuilder deltaPacketBuilder,
                             Model.World world,
                             WorldPersisterService persisterService,
                             UserInputService userInputService)
        {
            World = world;
            this.WorldSimulationService     = worldSimulationService;
            this.clearStateChangesSimulator = clearStateChangesSimulator;
            this.networkConnectorServer     = networkConnectorServer;
            this.deltaPacketBuilder         = deltaPacketBuilder;
            this.userInputService           = userInputService;

            serverPlayerListener = new ServerPlayerListener(networkConnectorServer, networkedPlayerFactory);
            persisterService.Load(world, TWDir.GameData.GetChild("Saves/GodGame").CreateFile("auto.xml"));
        }
Exemplo n.º 13
0
 public CreateLandTool(Internal.Model.World world, AirType air, LandType land) : base("CreateLand")
 {
     this.world = world;
     this.air   = air;
     this.land  = land;
 }
 public GameStateDeltaPacketBuilder(GameState state, Model.World world, GameplayObjectsSerializer gameplayObjectsSerializer)
 {
     this.state = state;
     this.world = world;
     this.gameplayObjectsSerializer = gameplayObjectsSerializer;
 }
 public ChangeHeightTool(Internal.Model.World world)
     : base("ChangeHeight", p => new ChangeHeightToolPerPlayer(world, p))
 {
 }