public ActionResult DodajJadlospis(NowyJadlospis nowyJadlospis) { if (ModelState.IsValid) { Diety diety = new Diety(); diety.DodajDiete(nowyJadlospis.Pacjent, nowyJadlospis.DataPoczatkowa, nowyJadlospis.IloscTygodni, nowyJadlospis.Kalorycznosc); } return(RedirectToAction("Panel", new { data = nowyJadlospis.WybranaDataURL })); }
void OnEnable() { // First thing is to se the singleton reference, many things will use this, and this object spawns pretty much everything instance = this; if(textureManager == null) { Debug.LogError("WorldManager Does not have a texture manager assigned! Please add one as a child and assign it to the world manager in the inspector!"); } // Start by loading all data craftingItemState = ItemUtility.LoadCraftingItems(craftingItemFile); if(craftingItemState == null) { Debug.Log("ERROR! No crafting items found at " + craftingItemFile); } wearableItemState = ItemUtility.LoadWearableItems(wearableItemFile); if(wearableItemState == null) { Debug.Log("ERROR! No wearable items found at " + wearableItemFile); } textUtility = ProceduralTextUtility.LoadTextTypes(textSourceFile); if(textUtility == null) { Debug.Log("ERROR! No procedural text source file found at " + textSourceFile); } dieties = new Diety[NUM_DIETIES]; for(int i = 0; i < NUM_DIETIES; i++) { string prefix = ""; string title = ""; string suffix = ""; textUtility.GenerateCompleteName(ref prefix, ref title, ref suffix); Diety d = new Diety(prefix, title, suffix); dieties[i] = d; } // Next grabs the world generator, which should be attached to the world manager object worldGenerator = GetComponent<WorldGenerator>(); if(worldGenerator == null) { Debug.LogWarning("WARNING! No world generator found on "+name+". No terrain will be created!"); } // Grab the gramlin manager: this isnt suuuuper critical, but the game really doesnt work without it lootGremlinSpawnManager = GetComponent<LootGremlinSpawner>(); if(worldGenerator == null) { Debug.LogWarning("WARNING! No LootGremlinSpawner found on " + name + ". No Loot gremlins will be spawned!"); } uiManager = new UI_Manager(); objectPool = new ObjectPool(); sunLight = (Light)Instantiate(sunPrototype, new Vector3(0.0f, 0.0f, -10.0f), Quaternion.identity); maxSunIntensity = sunLight.intensity; // attempt to load game state, if it exists, otherwise create a new one gameState = GameStateUtility.LoadGameState(saveLocation); if(gameState == null) { gameState = new GameStateUtility(); GameStateUtility.SaveGameState(saveLocation, gameState); } if(playerPrototype == null) { Debug.LogError("Player prototype is not set, cannot initialize game!"); return; } playerStartLocation = worldGenerator.GeneratorOrigin(); playerCharacter = (Player)Instantiate(playerPrototype, playerStartLocation, Quaternion.identity); // Assign the state that was loaded if(gameState.playerState != null) { playerCharacter.SetState(gameState.playerState); } else { Debug.Log("ERROR! Player state was not loaded / created in the game state!"); } if(worldGenerator != null) { worldGenerator.StartGeneratingWorld(playerCharacter); } // Instaniate all of the background layers from prototypes: they are self managing foreach(ParallaxBackground bg in backGroundSet) { Instantiate(bg.gameObject); } // Fill out the ability object map with the editor assigned objects, mapped to names abilityObjectMap = new Dictionary<string, GameObject>(); foreach(GameObject obj in spawnableObjects) { if(obj != null) { abilityObjectMap.Add(obj.name, obj); } } pawnsOnScreen = new List<Pawn>(); }
void OnEnable() { // First thing is to se the singleton reference, many things will use this, and this object spawns pretty much everything instance = this; if (textureManager == null) { Debug.LogError("WorldManager Does not have a texture manager assigned! Please add one as a child and assign it to the world manager in the inspector!"); } // Start by loading all data craftingItemState = ItemUtility.LoadCraftingItems(craftingItemFile); if (craftingItemState == null) { Debug.Log("ERROR! No crafting items found at " + craftingItemFile); } wearableItemState = ItemUtility.LoadWearableItems(wearableItemFile); if (wearableItemState == null) { Debug.Log("ERROR! No wearable items found at " + wearableItemFile); } textUtility = ProceduralTextUtility.LoadTextTypes(textSourceFile); if (textUtility == null) { Debug.Log("ERROR! No procedural text source file found at " + textSourceFile); } dieties = new Diety[NUM_DIETIES]; for (int i = 0; i < NUM_DIETIES; i++) { string prefix = ""; string title = ""; string suffix = ""; textUtility.GenerateCompleteName(ref prefix, ref title, ref suffix); Diety d = new Diety(prefix, title, suffix); dieties[i] = d; } // Next grabs the world generator, which should be attached to the world manager object worldGenerator = GetComponent <WorldGenerator>(); if (worldGenerator == null) { Debug.LogWarning("WARNING! No world generator found on " + name + ". No terrain will be created!"); } // Grab the gramlin manager: this isnt suuuuper critical, but the game really doesnt work without it lootGremlinSpawnManager = GetComponent <LootGremlinSpawner>(); if (worldGenerator == null) { Debug.LogWarning("WARNING! No LootGremlinSpawner found on " + name + ". No Loot gremlins will be spawned!"); } uiManager = new UI_Manager(); objectPool = new ObjectPool(); sunLight = (Light)Instantiate(sunPrototype, new Vector3(0.0f, 0.0f, -10.0f), Quaternion.identity); maxSunIntensity = sunLight.intensity; // attempt to load game state, if it exists, otherwise create a new one gameState = GameStateUtility.LoadGameState(saveLocation); if (gameState == null) { gameState = new GameStateUtility(); GameStateUtility.SaveGameState(saveLocation, gameState); } if (playerPrototype == null) { Debug.LogError("Player prototype is not set, cannot initialize game!"); return; } playerStartLocation = worldGenerator.GeneratorOrigin(); playerCharacter = (Player)Instantiate(playerPrototype, playerStartLocation, Quaternion.identity); // Assign the state that was loaded if (gameState.playerState != null) { playerCharacter.SetState(gameState.playerState); } else { Debug.Log("ERROR! Player state was not loaded / created in the game state!"); } if (worldGenerator != null) { worldGenerator.StartGeneratingWorld(playerCharacter); } // Instaniate all of the background layers from prototypes: they are self managing foreach (ParallaxBackground bg in backGroundSet) { Instantiate(bg.gameObject); } // Fill out the ability object map with the editor assigned objects, mapped to names abilityObjectMap = new Dictionary <string, GameObject>(); foreach (GameObject obj in spawnableObjects) { if (obj != null) { abilityObjectMap.Add(obj.name, obj); } } pawnsOnScreen = new List <Pawn>(); }