//------------------------------------------------- #region KingdomSelection Region /// <summary> /// Use this method when player has already selected his /// Element and he wants to select the kingdom or he just /// logged in to the game and you want him /// to select the Kingdom. /// </summary> public void ShowKojiTerritoryIn(bool justLogin = false) { if (justLogin) { //--------------------------------------------------- this.GameCurrentMusic.Next(Album.GenerateAlbum(new wotoMusic[] { wotoMusic.GenerateWotoMusic(Musics.FirstGameEnterMusic), }), true); //this.GameCurrentMusic.PlayLooping(); this.BackgroundImage = Image.FromFile(ThereIsConstants.Path.Datas_Path + "\\" + MyRes.GetString(KojiMapFileNameInRes)); //----------------------------------------------------- } DialogContext myCon = new DialogContext(Dialogs.Dialog1_1_3); this.IsShowingDialogBox = true; this.DialogBoxProvider = new DialogBoxProvider(this.Controls, ref myCon); this.DialogBoxProvider.AfterDialogEndedEvent += ShowKingdoms_AfterDialogEndedEvent; this.DialogBoxProvider.SettingUpDialogWorks(); //------------------------------------------------ //----------------------------- //News: this.TheMap = Map.GenerateMap(this, MapMode.KojiKingdoms, false); this.TheMap.MapSigners = new GameControls.MapSigner[] { new GameControls.MapSigner(this), new GameControls.MapSigner(this), new GameControls.MapSigner(this), new GameControls.MapSigner(this), new GameControls.MapSigner(this) { CurrentStatus = 2, }, }; this.TheMap.MapElements = new MapElement[] { MapElement.GetMapElement(TheMap, CharacterInfo.GetCharacterInfo(GameCharacters.Dark_Lord, 1), TheMap), // E1 MapElement.GetMapElement(TheMap, ElementsInMap.Ruined_House1, TheMap, false), // E2 MapElement.GetMapElement(TheMap, ElementsInMap.CastleInKojiEmpire1, TheMap, false), // E3 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E4 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E5 MapElement.GetMapElement(TheMap, ElementsInMap.CastleInKojiEmpire2, TheMap, false), // E6 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E7 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E8 MapElement.GetMapElement(TheMap, ElementsInMap.CastleInKojiEmpire3, TheMap, false), // E9 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E10 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E11 MapElement.GetMapElement(TheMap, ElementsInMap.CastleInKojiEmpire4, TheMap, false), // E12 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E13 MapElement.GetMapElement(TheMap, ElementsInMap.Village_House1, TheMap, false), // E14 }; this.TheMap.MapElements[0].GenerateFakeSurface(); this.TheMap.AdvancedMapElements = new GameControls.MapElement[] { GameControls.MapElement.GetMapElement(TheMap, ElementsInMap.Fire1), }; //----------------------------- //Names: this.TheMap.MapSigners[0].SetLabelName(MessageLabel1NameInRes); this.TheMap.MapSigners[1].SetLabelName(MessageLabel2NameInRes); this.TheMap.MapSigners[2].SetLabelName(MessageLabel3NameInRes); this.TheMap.MapSigners[3].SetLabelName(MessageLabel4NameInRes); this.TheMap.MapSigners[4].SetLabelName(MessageLabel4NameInRes); //TabIndexes: this.TheMap.MapSigners[0].CurrentStatus = 1; // North this.TheMap.MapSigners[1].CurrentStatus = 2; // South this.TheMap.MapSigners[2].CurrentStatus = 3; // West this.TheMap.MapSigners[3].CurrentStatus = 4; // East this.TheMap.MapSigners[4].CurrentStatus = 5; // Central Kingdom //FontsAndTextAligns: //Sizes: this.TheMap.MapSigners[4].Size = new Size(TheMap.MapSigners[4].Width / 2, TheMap.MapSigners[4].Height / 2); this.TheMap.MapElements[0].SetElementSize( new SizeF(this.Width / 10, this.Height / 9)); // This is Dark-Lord. this.TheMap.MapElements[0].SurfaceControl.Size = Size.Round(TheMap.MapElements[0].ElementSizeF); this.TheMap.AdvancedMapElements[0].Size = new Size(this.Width / 10, this.Height / 20); // This is fire. SizeF size = new SizeF(this.Width / 30, this.Height / 24); for (int i = 1; i < TheMap.MapElements.Length; i++) { this.TheMap.MapElements[i].SetElementSize(size); } //Locations: this.TheMap.MapSigners[0].Location = new Point((int)(Width * MapRates.RateOfNorthKingdomX), (int)(Height * MapRates.RateOfNorthKingdomY)); // North this.TheMap.MapSigners[1].Location = new Point((int)(Width * MapRates.RateOfSouthKingdomX), (int)(Height * MapRates.RateOfSouthKingdomY)); // South this.TheMap.MapSigners[2].Location = new Point((int)(Width * MapRates.RateOfWestKingdomX), (int)(Height * MapRates.RateOfWestKingdomY)); // West this.TheMap.MapSigners[3].Location = new Point((int)(Width * MapRates.RateOfEastKingdomX), (int)(Height * MapRates.RateOfEastKingdomY)); // East this.TheMap.MapElements[0].SetElementLocation( new PointF((float)(this.Width * MapRates.RateOfDarkLordCKX), (float)(this.Height * MapRates.RateOfDarkLordCKY))); // E1 this.TheMap.MapElements[0].SurfaceControl.Location = Point.Round(this.TheMap.MapElements[0].ElementLocationF); this.TheMap.MapSigners[4].Location = new Point((int)(TheMap.MapElements[0].ElementLocationF.X + (TheMap.MapElements[0].Width / 2) - (TheMap.MapSigners[4].Width / 2)), (int)(TheMap.MapElements[0].ElementLocationF.Y + TheMap.MapElements[0].Height)); this.TheMap.AdvancedMapElements[0].Location = new Point((((int)TheMap.MapElements[0].Width / 2) - (TheMap.AdvancedMapElements[0].Width / 2)), ((int)TheMap.MapElements[0].Height - (int)TheMap.AdvancedMapElements[0].Height)); // Fire should be added to the dark-Lord. this.TheMap.MapElements[1].SetElementLocation( // E2 TheMap.MapElements[0].ElementLocationF.X - (TheMap.MapElements[1].Width / 2), TheMap.MapElements[0].ElementLocationF.Y + (TheMap.MapElements[0].Height / 2)); // E2 -- end this.TheMap.MapElements[2].SetElementLocation( TheMap.MapSigners[0].Location.X - (TheMap.MapElements[2].Width / 2), TheMap.MapSigners[0].Location.Y + (TheMap.MapSigners[0].Height / 2)); // E3 this.TheMap.MapElements[3].SetElementLocation( TheMap.MapElements[2].ElementLocationF.X - (TheMap.MapElements[3].Width / 2), TheMap.MapElements[2].ElementLocationF.Y + (TheMap.MapElements[2].Height / 2)); // E4 this.TheMap.MapElements[4].SetElementLocation( TheMap.MapElements[2].ElementLocationF.X + (TheMap.MapElements[2].Width / 2), TheMap.MapElements[2].ElementLocationF.Y + (TheMap.MapElements[2].Height / 2)); // E5 this.TheMap.MapElements[5].SetElementLocation( TheMap.MapSigners[2].Location.X - (TheMap.MapElements[5].Width / 2), TheMap.MapSigners[2].Location.Y + (TheMap.MapSigners[2].Height / 2)); // E6 this.TheMap.MapElements[6].SetElementLocation( TheMap.MapElements[5].ElementLocationF.X - (TheMap.MapElements[6].Width / 2), TheMap.MapElements[5].ElementLocationF.Y + (TheMap.MapElements[5].Height / 2)); // E7 this.TheMap.MapElements[7].SetElementLocation( TheMap.MapElements[5].ElementLocationF.X + (TheMap.MapElements[7].Width / 2), TheMap.MapElements[5].ElementLocationF.Y + (TheMap.MapElements[5].Height / 2)); // E8 this.TheMap.MapElements[8].SetElementLocation( TheMap.MapSigners[1].Location.X - (TheMap.MapElements[8].Width / 2), TheMap.MapSigners[1].Location.Y + (TheMap.MapSigners[1].Height / 2)); // E9 this.TheMap.MapElements[9].SetElementLocation( TheMap.MapElements[8].ElementLocationF.X - (TheMap.MapElements[9].Width / 2), TheMap.MapElements[8].ElementLocationF.Y + (TheMap.MapElements[8].Height / 2)); // E10 this.TheMap.MapElements[10].SetElementLocation( TheMap.MapElements[8].ElementLocationF.X + (TheMap.MapElements[10].Width / 2), TheMap.MapElements[8].ElementLocationF.Y + (TheMap.MapElements[8].Height / 2)); // E11 this.TheMap.MapElements[11].SetElementLocation( TheMap.MapSigners[3].Location.X - (TheMap.MapElements[11].Width / 2), TheMap.MapSigners[3].Location.Y + (TheMap.MapSigners[3].Height / 2)); // E12 this.TheMap.MapElements[12].SetElementLocation( TheMap.MapElements[11].ElementLocationF.X - (TheMap.MapElements[12].Width / 2), TheMap.MapElements[11].ElementLocationF.Y + (TheMap.MapElements[11].Height / 2)); // E13 this.TheMap.MapElements[13].SetElementLocation( TheMap.MapElements[11].ElementLocationF.X + (TheMap.MapElements[13].Width / 2), TheMap.MapElements[11].ElementLocationF.Y + (TheMap.MapElements[11].Height / 2)); //Rectangles: //Colors: this.TheMap.MapSigners[0].ForeColor = this.TheMap.MapSigners[1].ForeColor = this.TheMap.MapSigners[2].ForeColor = this.TheMap.MapSigners[3].ForeColor = Color.GhostWhite; this.TheMap.MapSigners[4].ForeColor = Color.Black; //ComboBoxes: //Enableds: //Texts: //AddRanges: //ToolTipSettings: //Events: //Final Blows: this.TheMap.MapSigners[4].ReLoadUPW(); //----------------------------- this.TheMap.MapElements[0].SurfaceControl.Controls.Add( this.TheMap.AdvancedMapElements[0]); //this.TheMap.MapElements[0].Controls.Add(TheMap.MapElements[1]); // Fire to dark-lord. this.Controls.AddRange(new Control[] { this.TheMap.MapElements[0].SurfaceControl, this.TheMap.MapSigners[0], this.TheMap.MapSigners[1], this.TheMap.MapSigners[2], this.TheMap.MapSigners[3], this.TheMap.MapSigners[4], //this.TheMap.MapElements[2], // Village House of North //this.TheMap.MapElements[3], // Village House of South //this.TheMap.MapElements[4], // Village House of West //this.TheMap.MapElements[5], // Village House of East }); this.TheMap.ApplyAllElements(); //Cursor.Position = this.TheMap.MapElements[0].SurfaceControl.Location; }
//------------------------------------------------- #region Initialize Region private void InitializeComponent() { UnlimitedRandomicWorks = new Randomic[2]; if (DreamWorksInNight) { UnlimitedRandomicWorks[0] = new Randomic( new Range[] { new Range(3, 8), }, new float[] { 1 }, Chance_Error.One_Percent); // Day Cloud's count } else { UnlimitedRandomicWorks[0] = new Randomic( new Range[] { new Range(2, 5) }, new float[] { 1 }, Chance_Error.One_Percent); // Night Cloud' count } //--------------------------------------------- //--------------------------------------------- // News: this.AnimationFactories = new Trigger[] { new Trigger() { Index = 0, Enabled = false, SingleLineWorker = true, Interval = 600, Name = AnimationFactoriesFirstName + 1, }, }; this.TheMap = Map.GenerateMap(Father, MapMode.CustomMap, false); this.TheMap.MapElements = new MapElement[UnlimitedRandomicWorks[0].GetNumber()]; // Count of clouds for (int i = 0; i < TheMap.MapElements.Length; i++) { this.TheMap.MapElements[i] = MapElement.GetMapElement(TheMap, (ElementsInMap)(14 + UnlimitedRandomicWorks[0].Next(0, 2)), TheMap); } //--------------------------------------------- //Names: this.Name = DefaultDreamWorksName; //TabIndexes //FontAndTextAligns: //Sizes: for (int i = 0; i < TheMap.MapElements.Length; i++) { TheMap.MapElements[i].SetElementSize(); } // UnlimitedRandomicWorks: UnlimitedRandomicWorks[1] = new Randomic( new Range[] { new Range(0 - (TheMap.MapElements[0].Height / 2), Father.Height / 6), new Range(2 * (Father.Height / 3), Father.Height - (TheMap.MapElements[0].Height / 2)) }, new float[] { 0.50f, 0.50f, }, Chance_Error.One_Percent); //Locations: for (int i = 0; i < TheMap.MapElements.Length; i++) { TheMap.MapElements[i].SetElementLocation( (float)UnlimitedRandomicWorks[1].Next((int)-TheMap.MapElements[i].Width, (int)(Father.Width - (TheMap.MapElements[i].Width / 2))), (float)UnlimitedRandomicWorks[1].GetNumber()); /* * TheMap.MapElements[i].SetElementLocation(random.Next(0, Father.Width), * (float)random.Next((int)(0 - TheMap.MapElements[i].Width), * (int)(Father.Height - * TheMap.MapElements[i].Height + (2 * NoInternetConnectionSandBox.from_the_edge)))); */ } //Colors: //ComboBoxes: //Enableds: //Texts: //AddRanges: //ToolTipSettings: //GraphicWorks: //--------------------------------------------- //Events: this.AnimationFactories[0].Tick -= AnimationFactoryWorker; this.Father.EnabledChanged -= Father_EnabledChanged; this.AnimationFactories[0].Tick += AnimationFactoryWorker; this.Father.EnabledChanged += Father_EnabledChanged; //--------------------------------------------- //--------------------------------------------- //Final Blows: }
//------------------------------------------------- #region Home Designing Region private void DesignForHome(bool justLogin = true) { if (justLogin) { ; // nothing for now... } else { if (this.GameCurrentMusic != null) { this.GameCurrentMusic.Dispose(); } if (this.BackgroundImage != null) { //this.BackgroundImage.Dispose(); Do NOT use .Dispose() var image = this.BackgroundImage; this.BackgroundImage = null; image.Dispose(); } } this.KeyPreview = true; //------------------------------------------------ //----------------------------- //News: this.TheMap = Map.GenerateMap(this, MapMode.HomejunglenMap, true); this.TheMap.MapElements = new MapElement[] { MapElement.GetMapElement(TheMap, ElementsInMap.HomeJungleBack, TheMap, false, ElementMovements.VerticalHorizontalMovements, HomeMapWorker, true), MapElement.GetMapElement(TheMap, ElementsInMap.MineInHomeJungle, TheMap, false, ElementMovements.VerticalHorizontalMovements, HomeMapWorker), MapElement.GetMapElement(TheMap, ElementsInMap.FarmInHomeJungle, TheMap, false, ElementMovements.VerticalHorizontalMovements, HomeMapWorker), MapElement.GetMapElement(TheMap, ElementsInMap.HouseInHomeJungle, TheMap, false, ElementMovements.VerticalHorizontalMovements, HomeMapWorker), MapElement.GetMapElement(TheMap, ElementsInMap.GardenInHomeJungle, TheMap, false, ElementMovements.VerticalHorizontalMovements, HomeMapWorker), MapElement.GetMapElement(TheMap, ElementsInMap.BoatInHomeJungle, TheMap, false, ElementMovements.VerticalHorizontalMovements, HomeMapWorker), }; this.HomeBarLabelControl = new GameControls.HomeBarLabelControl(this, this, ProfileIcon_Click); this.ChatLabelControl = GameControls.ChatLabelControl.GenerateChatLabel(this, this, this.HomeBarLabelControl); //----------------------------- //Names: //TabIndexes: //FontsAndTextAligns: //Sizes: for (int i = 0; i < TheMap.MapElements.Length; i++) { this.TheMap.MapElements[i].SetElementSize(); } //Locations: this.TheMap.MapElements[0].SetElementLocation(0, 0); // HomeJungle this.TheMap.MapElements[1].SetElementLocation( (int)(MapRates.RateOfMineInHomeX * Width), (int)(MapRates.RateOfMineInHomeY * Height)); // Mine in HomeJungle this.TheMap.MapElements[2].SetElementLocation( (int)(MapRates.RateOfFarmInHomeX * Width), (int)(MapRates.RateOfFarmInHomeY * Height)); // Farm in HomeJungle this.TheMap.MapElements[3].SetElementLocation( (int)(MapRates.RateOfHouseInHomeX * Width), (int)(MapRates.RateOfHouseInHomeY * Height)); // House in HomeJungle this.TheMap.MapElements[4].SetElementLocation( (int)(MapRates.RateOfGardenInHomeX * Width), (int)(MapRates.RateOfGardenInHomeY * Height)); // Garden in HomeJungle this.TheMap.MapElements[5].SetElementLocation( (int)(MapRates.RateOfBoatInHomeX * Width), (int)(MapRates.RateOfBoatInHomeY * Height)); // Boat in HomeJungle this.HomeBarLabelControl.Location = new Point(0, this.Height - this.HomeBarLabelControl.Height); //Rectangles: //Colors: //ComboBoxes: //Enableds: //Texts: //AddRanges: //ToolTipSettings: //Events: this.KeyDown -= HomeKeyManager_Down; this.KeyDown -= HomeKeyManager; this.KeyUp -= HomeKeyManager_Up; this.KeyDown += HomeKeyManager_Down; this.KeyDown += HomeKeyManager; this.KeyUp += HomeKeyManager_Up; this.HomeBarLabelControl.SurfaceLabels[0].Click += MapIconInHomeBar_Click; this.HomeBarLabelControl.SurfaceLabels[1].Click += MapIconInHomeBar_Click; this.HomeBarLabelControl.SurfaceLabels[2].Click += MapIconInHomeBar_Click; this.HomeBarLabelControl.SurfaceLabels[3].Click += MapIconInHomeBar_Click; this.HomeBarLabelControl.SurfaceLabels[4].Click += MapIconInHomeBar_Click; this.HomeBarLabelControl.SurfaceLabels[5].Click += MapIconInHomeBar_Click; this.HomeBarLabelControl.SurfaceLabels[6].Click += MapIconInHomeBar_Click; //Final Blows: //--------------------------------------------- this.TheMap.ApplyAllElements(); this.Controls.AddRange(new Control[] { this.HomeBarLabelControl, }); this.HomeBarLabelControl.BringToFront(); this.ChatLabelControl.ApplyChatIcon(); //--------------------------------------------- }