public GameData(string name, string serverName, string tutorialTexture, Type screenType, int gameIconIndex, int[] starMap, string[] upgradeNames) { Name = name; ServerName = serverName; TutorialTexture = "Tutorials/" + tutorialTexture; ScreenType = screenType; GameIconIndex = gameIconIndex; GameIndex = CurrentGameIndex; StarMap = starMap; GameUpgrades = new GameUpgrade[upgradeNames.Length]; for (int i = 0; i < upgradeNames.Length; i++) { GameUpgrades[i] = new GameUpgrade(upgradeNames[i], 0, this, i); } CurrentGameIndex++; int space = Name.IndexOf(' '); // replace the space with a newline char if (Name.IndexOf(' ') != 0) { NameLine1 = Name.Substring(0, space); NameLine2 = Name.Substring(space + 1); } else { NameLine1 = Name; NameLine2 = ""; } }
public GameUpgradeStoreItem(GameUpgrade gameUpgrade) : base(gameUpgrade.Name, 0) { Level = gameUpgrade.Level; MyGameUpgrade = gameUpgrade; if (Level < 5) { // 4 is the max level since levels are from 0-4 (5 levels max) Price = StoreData.GameUpgradePrices[gameUpgrade.Level]; } else { // level already reached the max // we don't have an array entry for the level so just put 0 for the price Price = 0; } }