void Awake() { m_UpgradeIcon = GetComponentInChildren <UpgradeIcon>(); m_SellIcon = GetComponentInChildren <SellIcon>(); }
public static void IconsBitmapsImportFromFile(string path) { // Read file in local directory. If it doesn't exist there, read it in root civ2 directory. var icons = new Bitmap(640, 480, PixelFormat.Format32bppRgba); string FilePath_local = path + Path.DirectorySeparatorChar + "ICONS.GIF"; string FilePath_root = Settings.Civ2Path + "ICONS.GIF"; if (File.Exists(FilePath_local)) { icons = new Bitmap(FilePath_local); } else if (File.Exists(FilePath_root)) { icons = new Bitmap(FilePath_root); } else { Debug.WriteLine("ICONS.GIF not found!"); } // Initialize objects Improvements = new Bitmap[67]; ResearchIcons = new Bitmap[5, 4]; // Define transparent colors Color transparentLightPink = Color.FromArgb(255, 159, 163); //define transparent back color (light pink) Color transparentPink = Color.FromArgb(255, 0, 255); //define transparent back color (pink) //Color transparentGray = Color.FromArgb(135, 83, 135); //define transparent back color (gray) // Improvement icons int count = 1; //start at 1. 0 is for no improvement. for (int row = 0; row < 5; row++) { for (int col = 0; col < 8; col++) { Improvements[count] = icons.Clone(new Rectangle((36 * col) + 343 + col, (20 * row) + 1 + row, 36, 20)); count++; if (count == 39) { break; } } } // WondersIcons for (int row = 0; row < 4; row++) { for (int col = 0; col < 7; col++) { Improvements[count] = icons.Clone(new Rectangle((36 * col) + 343 + col, (20 * row) + 106 + row, 36, 20)); count++; } } // Research icons for (int row = 0; row < 4; row++) { for (int col = 0; col < 5; col++) { ResearchIcons[col, row] = icons.Clone(new Rectangle((36 * col) + 343 + col, (20 * row) + 211 + row, 36, 20)); } } SellIcon = icons.Clone(new Rectangle(16, 320, 14, 14)); SellIcon.ReplaceColors(transparentLightPink, Colors.Transparent); ViewPiece = icons.Clone(new Rectangle(199, 256, 64, 32)); ViewPiece.ReplaceColors(transparentLightPink, Colors.Transparent); ViewPiece.ReplaceColors(transparentPink, Colors.Transparent); GridLines = icons.Clone(new Rectangle(183, 430, 64, 32)); GridLines.ReplaceColors(transparentLightPink, Colors.Transparent); GridLines.ReplaceColors(transparentPink, Colors.Transparent); GridLinesVisible = icons.Clone(new Rectangle(248, 430, 64, 32)); GridLinesVisible.ReplaceColors(transparentLightPink, Colors.Transparent); GridLinesVisible.ReplaceColors(transparentPink, Colors.Transparent); // Big icons in city resources CityHungerBig = icons.Clone(new Rectangle(1, 290, 14, 14)); CityHungerBig.ReplaceColors(transparentLightPink, Colors.Transparent); CityShortageBig = icons.Clone(new Rectangle(16, 290, 14, 14)); CityShortageBig.ReplaceColors(transparentLightPink, Colors.Transparent); CityCorruptBig = icons.Clone(new Rectangle(31, 290, 14, 14)); CityCorruptBig.ReplaceColors(transparentLightPink, Colors.Transparent); CityFoodBig = icons.Clone(new Rectangle(1, 305, 14, 14)); CityFoodBig.ReplaceColors(transparentLightPink, Colors.Transparent); CitySupportBig = icons.Clone(new Rectangle(16, 305, 14, 14)); CitySupportBig.ReplaceColors(transparentLightPink, Colors.Transparent); CityTradeBig = icons.Clone(new Rectangle(31, 305, 14, 14)); CityTradeBig.ReplaceColors(transparentLightPink, Colors.Transparent); CityLuxBig = icons.Clone(new Rectangle(1, 320, 14, 14)); CityLuxBig.ReplaceColors(transparentLightPink, Colors.Transparent); CityTaxBig = icons.Clone(new Rectangle(16, 320, 14, 14)); CityTaxBig.ReplaceColors(transparentLightPink, Colors.Transparent); CitySciBig = icons.Clone(new Rectangle(31, 320, 14, 14)); CitySciBig.ReplaceColors(transparentLightPink, Colors.Transparent); // Small icons in city resources CityFoodSmall = icons.Clone(new Rectangle(49, 334, 10, 10)); CityFoodSmall.ReplaceColors(transparentLightPink, Colors.Transparent); CitySupportSmall = icons.Clone(new Rectangle(60, 334, 10, 10)); CitySupportSmall.ReplaceColors(transparentLightPink, Colors.Transparent); CityTradeSmall = icons.Clone(new Rectangle(71, 334, 10, 10)); CityTradeSmall.ReplaceColors(transparentLightPink, Colors.Transparent); // Wallpaper icons PanelOuterWallpaper = icons.Clone(new Rectangle(199, 322, 64, 32)); PanelInnerWallpaper = icons.Clone(new Rectangle(299, 190, 31, 31)); // Icon for next/previous city (black arrow) NextCity = icons.Clone(new Rectangle(227, 389, 18, 24)); NextCity.ReplaceColors(transparentLightPink, Colors.Transparent); PrevCity = icons.Clone(new Rectangle(246, 389, 18, 24)); PrevCity.ReplaceColors(transparentLightPink, Colors.Transparent); //NextCityLarge = ModifyImage.Resize(NextCity, 27, 36); //50% larger NextCityLarge = NextCity; //PrevCityLarge = ModifyImage.Resize(PrevCity, 27, 36); //50% larger PrevCityLarge = PrevCity; // Zoom icons ZoomIN = icons.Clone(new Rectangle(18, 389, 16, 16)); ZoomOUT = icons.Clone(new Rectangle(35, 389, 16, 16)); // Battle sprites BattleAnim = new Bitmap[8]; for (int i = 0; i < 8; i++) { BattleAnim[i] = icons.Clone(new Rectangle(1 + 33 * i, 356, 32, 32)); BattleAnim[i].ReplaceColors(transparentLightPink, Colors.Transparent); } icons.Dispose(); }
private void Awake() { _upgradeIcon = GetComponentInChildren <UpgradeIcon>(); _sellIcon = GetComponentInChildren <SellIcon>(); }