BuCol Setup
This commit is contained in:
@ -85,6 +85,9 @@ public partial class CSVDataLoader : IEnableLogger
|
||||
case "p":
|
||||
var loader = new CSV.PlanetLoader();
|
||||
loader.ImportForRace(Services.Game.Player);
|
||||
|
||||
PlanetManager manager = Locator.Current.GetService<PlanetManager>()!;
|
||||
manager.InitFromDatabase();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -123,11 +123,14 @@ public class Game
|
||||
GameEngine.Game = this;
|
||||
Locator.CurrentMutable.RegisterConstant(new CSVDataLoader(), typeof(CSVDataLoader));
|
||||
Locator.CurrentMutable.Register(() => new StarsDatabase(DatabaseFileName), typeof(StarsDatabase));
|
||||
Locator.CurrentMutable.RegisterConstant(new PlanetManager(), typeof(Services.PlanetManager));
|
||||
PlanetManager PlanetManager = new();
|
||||
Locator.CurrentMutable.RegisterConstant(PlanetManager, typeof(Services.PlanetManager));
|
||||
|
||||
// TESTING HELPER
|
||||
if (__doCreateTestData)
|
||||
__createTestData();
|
||||
|
||||
PlanetManager.InitFromDatabase();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -163,8 +166,8 @@ public class Game
|
||||
PRT = PRT.Other,
|
||||
HasOBRM = true,
|
||||
FactoryCost3 = false,
|
||||
FactoryNumberPer10k = 8,
|
||||
FactoryResCost = 8,
|
||||
FactoryNumberPer10k = 9,
|
||||
FactoryResCost = 9,
|
||||
FactoryResPer10 = 15,
|
||||
MineResCost = 3,
|
||||
MineMineralsPer10 = 10,
|
||||
|
@ -99,6 +99,13 @@ public class GameEngine
|
||||
return (int) tmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Germanium cost for the given number of factories.
|
||||
/// </summary>
|
||||
/// <param name="count">Factory count</param>
|
||||
/// <returns>Germanium cost</returns>
|
||||
public static int FactoryGermaniumCostForPlayer(int count) => count * Game.Player.FactoryGerCost;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the maximum operable mines on a given player planet for a given value.
|
||||
/// </summary>
|
||||
|
@ -25,12 +25,12 @@ public class PlanetManager
|
||||
{
|
||||
}
|
||||
|
||||
public void __test__Init()
|
||||
public void InitFromDatabase()
|
||||
{
|
||||
using var db = Locator.Current.GetService<StarsDatabase>()!;
|
||||
{
|
||||
var playerPlanets = db.Planet.ToList();
|
||||
_planets.AddOrUpdate(playerPlanets);
|
||||
var allPlanets = db.Planet.ToList();
|
||||
_planets.AddOrUpdate(allPlanets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user