public override void _Ready() { logo = GetNode <Control>(LogoPath); revolutionaryGames = GetNode <Control>(RevolutionaryGamesPath); supportedBy = GetNode <Control>(SupportedByPath); developersHeading = GetNode <Control>(DevelopersHeadingPath); if (TeamNameFont == null) { throw new InvalidOperationException($"{nameof(TeamNameFont)} not set"); } if (SectionNameFont == null) { throw new InvalidOperationException($"{nameof(SectionNameFont)} not set"); } credits = SimulationParameters.Instance.GetCredits(); steamVersion = SteamHandler.IsTaggedSteamRelease(); if (phase == CreditsPhase.NotRunning && AutoStart) { Setup(); } }
// GET: DrawFive public ActionResult Index(string id) { var db = new DrawFiveEntities(); var user = db.UserCredits.Find(id); if (string.IsNullOrEmpty(id)) { return(View("../UserCredits/Index", db.UserCredits.ToList())); } else { if (GameCredits.GetUserCredits(id) == 0) { //Redirect to Credits view to by more credits return(View("../UserCredits/Index", db.UserCredits.ToList())); } else { var dfl = new DrawFiveList { DrawList = Helper.GetFiveNewCards().OrderBy(x => x.OverAllHierarchyCardValue).ToList(), UserId = id, Credits = user.Credits }; ViewBag.Reset = false; return(View(dfl)); } } }
/// <summary> /// Loads the simulation configuration parameters from JSON files /// </summary> /// <remarks> /// This is now loaded in _Ready as otherwise the <see cref="ModLoader"/>'s _Ready would run after simulation /// parameters are loaded causing some data that might want to be overridden by mods to be loaded too early. /// </remarks> public override void _Ready() { base._Ready(); // Compounds are referenced by the other json files so it is loaded first and instance is assigned here instance = this; // Loading the compounds needs a custom JSON deserializer that can load the Compound objects, but the loader // can't always be active because that breaks saving { var compoundDeserializer = new JsonConverter[] { new CompoundLoader(null) }; compounds = LoadRegistry <Compound>( "res://simulation_parameters/microbe_stage/compounds.json", compoundDeserializer); } membranes = LoadRegistry <MembraneType>( "res://simulation_parameters/microbe_stage/membranes.json"); backgrounds = LoadRegistry <Background>( "res://simulation_parameters/microbe_stage/backgrounds.json"); biomes = LoadRegistry <Biome>( "res://simulation_parameters/microbe_stage/biomes.json"); bioProcesses = LoadRegistry <BioProcess>( "res://simulation_parameters/microbe_stage/bio_processes.json"); organelles = LoadRegistry <OrganelleDefinition>( "res://simulation_parameters/microbe_stage/organelles.json"); NameGenerator = LoadDirectObject <NameGenerator>( "res://simulation_parameters/microbe_stage/species_names.json"); musicCategories = LoadRegistry <MusicCategory>("res://simulation_parameters/common/music_tracks.json"); helpTexts = LoadRegistry <HelpTexts>("res://simulation_parameters/common/help_texts.json"); inputGroups = LoadListRegistry <NamedInputGroup>("res://simulation_parameters/common/input_options.json"); autoEvoConfiguration = LoadDirectObject <AutoEvoConfiguration>("res://simulation_parameters/common/auto-evo_parameters.json"); gallery = LoadRegistry <Gallery>("res://simulation_parameters/common/gallery.json"); translationsInfo = LoadDirectObject <TranslationsInfo>("res://simulation_parameters/common/translations_info.json"); gameCredits = LoadDirectObject <GameCredits>("res://simulation_parameters/common/credits.json"); GD.Print("SimulationParameters loading ended"); CheckForInvalidValues(); ResolveValueRelationships(); // Apply translations here to ensure that initial translations are correct when the game starts. // This is done this way to allow StartupActions to run before SimulationParameters are loaded ApplyTranslations(); GD.Print("SimulationParameters are good"); }
public ActionResult Index(DrawFiveList draw) { var curHand = draw.DrawList; draw.DiscardCount = curHand.Count(x => x.Discard); var returnList = new DrawFiveList(); returnList.DrawList = new List <DrawFiveClass>(); var dfl = Helper.ReplaceDisCards(curHand).ToList(); foreach (var item in dfl) { returnList.DrawList.Add(item); } var sortedList = returnList.DrawList.OrderBy(x => x.OverAllHierarchyCardValue).ToList(); returnList.DrawList = sortedList; returnList.UserId = draw.UserId; returnList.Credits = draw.Credits; ViewBag.Reset = true; ModelState.Clear(); var didYouWin = Helper.DidYouWin(returnList.DrawList); ViewBag.DidYouWin = didYouWin.DidYouWin; ViewBag.Message = didYouWin.Message; ViewBag.WinningHand = didYouWin.WinningHand; ViewBag.CreditsWon = didYouWin.CreditsWon; if (didYouWin.DidYouWin) { GameCredits.UpdateUserCredits((int)ViewBag.CreditsWon, draw.UserId); } else { GameCredits.UpdateUserCredits(-1, draw.UserId); } if (db.UserCredits != null) { var updatedCredits = db.UserCredits.Find(draw.UserId).Credits; ViewBag.RemainingCreditsMessage = $"{draw.UserId} you have {updatedCredits} credits left."; } else { ViewBag.RemainingCreditsMessage = "Error"; } return(View(returnList)); }