コード例 #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"));
        }
コード例 #2
0
 public GodGameClient(UserInputProcessingService userInputProcessingService,
                      UIRenderingService uiRenderingService,
                      DeveloperConsoleService developerConsoleService,
                      ClearGameStateChangesService clearStateChangesSimulator,
                      WorldRenderingSimulator worldRenderingSimulator,
                      WorldRenderingService simpleWorldRenderer,
                      INetworkConnectorClient networkConnectorClient,
                      GameStateDeltaPacketBuilder gameStateDeltaPacketBuilder,
                      LocalPlayerService localPlayerService,
                      UserInputService userInputService)
 {
     this.userInputProcessingService  = userInputProcessingService;
     this.uiRenderingService          = uiRenderingService;
     this.developerConsoleService     = developerConsoleService;
     this.clearStateChangesSimulator  = clearStateChangesSimulator;
     this.worldRenderingSimulator     = worldRenderingSimulator;
     this.simpleWorldRenderer         = simpleWorldRenderer;
     this.networkConnectorClient      = networkConnectorClient;
     this.gameStateDeltaPacketBuilder = gameStateDeltaPacketBuilder;
     this.localPlayerService          = localPlayerService;
     this.userInputService            = userInputService;
 }
コード例 #3
0
        public AllCommandProvider(WorldPersisterService persister,
                                  Internal.Model.World world,
                                  VoxelTypesFactory typesFactory,
                                  ItemTypesFactory itemTypesFactory,
                                  UserInputProcessingService userInputProcessingService,
                                  GenericDatastore genericDatastore)
        {
            this.typesFactory     = typesFactory;
            this.itemTypesFactory = itemTypesFactory;
            this.genericDatastore = genericDatastore;
            addDummy();

            addPersistence(persister, world);

            addCommand("clearinfestation", () =>
            {
                world.ForEach((v, _) =>
                {
                    if (v.Type != typesFactory.Get <InfestationVoxelType>())
                    {
                        return;
                    }
                    typesFactory.Get <InfestationVoxelType>().CureInfestation(v);
                });

                return("Cleared all infestation!");
            });

            addCommand("helpall", () =>
            {
                return("All Commands: " + string.Join(", ", CommandNames.ToArray()));
            });
            addCommand("help", partialCommand =>
            {
                return("Commands containing '" + partialCommand + "': " + string.Join(", ", CommandNames.Where(c => c.Contains(partialCommand)).ToArray()));
            });
            addCommand("clearWorld", () =>
            {
                genericDatastore.ClearAll();
                world.ForEach((v, _) =>
                {
                    v.Data.Type = typesFactory.Get <LandType>();
                });
                return("World cleared!");
            });
            addCommand("listsaves", () =>
            {
                var saves        = TWDir.GameData.CreateChild("Saves\\GodGame").GetFiles().ToList();
                var outputstring = String.Join(", ", saves.Select(e => e.Name.Substring(0, e.Name.Length - 4)));     // Drop extension
                return("Saved games: \n" + outputstring);
            });

            addCommand("addresource", (typeStr, amountStr) =>
            {
                var itemType = itemTypesFactory.AllTypes.FirstOrDefault(t => t.Name.ToLower() == typeStr.ToLower());
                if (itemType == null)
                {
                    return("Item type not found: " + typeStr);
                }
                var amount = 0;
                if (!int.TryParse(amountStr, out amount))
                {
                    return("Invalid item amount: " + amountStr);
                }

                var target = userInputProcessingService.GetTargetedVoxel();
                if (target == null || target.Type != typesFactory.Get <WarehouseType>())
                {
                    return("Not targeting a warehouse");
                }

                target.Data.Inventory.AddNewItems(itemType, amount);

                return("Added items!");
            });
        }
コード例 #4
0
 public DeveloperConsoleService(UserInputProcessingService inputProcessingService, ICommandProvider provider)
 {
     this.inputProcessingService = inputProcessingService;
     console = new DeveloperConsoleUI(provider);
 }