private void OnSelectGeoConstructibleCB(GameObject obj) { if (base.PlayerController != null) { AgeControlButton component = obj.GetComponent <AgeControlButton>(); GeoConstructibleLabel.PointOfInterestPair pointOfInterestPair = component.OnActivateDataObject as GeoConstructibleLabel.PointOfInterestPair; PointOfInterest pointOfInterest = pointOfInterestPair.PointOfInterest; PointOfInterestImprovementDefinition pointOfInterestImprovementDefinition = pointOfInterestPair.PointOfInterestImprovementDefinition; OrderQueueConstruction order = new OrderQueueConstruction(this.City.Empire.Index, this.City.GUID, pointOfInterestImprovementDefinition, pointOfInterest.WorldPosition, string.Empty); base.PlayerController.PostOrder(order); } }
private void OnAutoAssignCB(GameObject obj) { AgeControlButton component = obj.GetComponent <AgeControlButton>(); foreach (ItemDefinition itemDefinition in this.allItems) { if (itemDefinition.Name == component.OnDoubleClickData) { this.DragReceiver.SendMessage("OnAutoAssignItem", itemDefinition, SendMessageOptions.RequireReceiver); break; } } }
public void CancelDrag() { List <AgeControlDragArea> children = this.ForgeItemTable.GetChildren <AgeControlDragArea>(true); for (int i = 0; i < children.Count; i++) { children[i].gameObject.SendMessage("OnResetInteraction"); AgeControlButton componentInChildren = children[i].GetComponentInChildren <AgeControlButton>(); if (componentInChildren != null) { componentInChildren.gameObject.SendMessage("OnResetInteraction"); } } }
private void OnStoreCB(GameObject obj) { AgeControlButton component = obj.GetComponent <AgeControlButton>(); StaticString name = component.OnActivateData; IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); DownloadableContent downloadableContent; if (service != null && service.TryGetValue(name, out downloadableContent) && downloadableContent.SteamAppId != 0u && downloadableContent.SteamAppId != 4294967295u) { Steamworks.SteamFriends steamFriends = Steamworks.SteamAPI.SteamFriends; if (steamFriends != null) { steamFriends.ActivateGameOverlayToStore(downloadableContent.SteamAppId, Steamworks.EOverlayToStoreFlag.k_EOverlayToStoreFlag_None); } } }
protected override IEnumerator OnShow(params object[] parameters) { yield return(base.OnShow(parameters)); CityLine.CurrentCity = null; this.selectionClient = null; if (parameters.Length != 0) { CityLine.CurrentCity = (parameters[0] as City); if (parameters.Length > 1) { this.selectionClient = (parameters[1] as GameObject); } } this.SortsContainer.SetContent(this.CityLinePrefab, "CityLine", null); global::Empire empire = this.playerControllerRepository.ActivePlayerController.Empire as global::Empire; bool flag = empire.SimulationObject.Tags.Contains(DepartmentOfTheInterior.FactionTraitBuyOutPopulation); bool flag2 = empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1); bool flag3 = empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics2); for (int i = 5; i < 10; i++) { AgeControlButton component = this.SortsContainer.SortButtons[i].AgeTransform.GetComponent <AgeControlButton>(); if (i == 5 && flag) { component.OnMiddleClickMethod = string.Empty; } else if (i == 6 && flag3) { component.OnMiddleClickMethod = string.Empty; } else if (i == 7 && flag2) { component.OnMiddleClickMethod = string.Empty; } else { component.OnMiddleClickMethod = "OnMiddleClick"; component.OnMiddleClickObject = base.gameObject; component.OnMiddleClickData = (i - 5).ToString(); } } yield break; }
public void RefreshBuyout(AgeControlButton buyoutButton) { DepartmentOfTheTreasury agency = base.Empire.GetAgency <DepartmentOfTheTreasury>(); ConstructibleElement technology = null; if (this.departmentOfScience.ResearchQueue.Peek() != null) { technology = this.departmentOfScience.ResearchQueue.Peek().ConstructibleElement; } float buyOutTechnologyCost = this.departmentOfScience.GetBuyOutTechnologyCost(technology); float num = -buyOutTechnologyCost; string text = GuiFormater.FormatInstantCost(base.Empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0); string content; if (buyOutTechnologyCost != 3.40282347E+38f) { if (agency.IsTransferOfResourcePossible(base.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num) && this.interactionsAllowed) { buyoutButton.AgeTransform.Enable = true; buyoutButton.AgeTransform.Alpha = 1f; this.ResearchBuyoutCostLabel.Text = text; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutAvailableFormat").Replace("$Cost", text); } else { buyoutButton.AgeTransform.Enable = false; buyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutCostLabel.Text = text; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutUnavailableFormat").Replace("$Cost", text); } } else { buyoutButton.AgeTransform.Enable = false; buyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutCostLabel.Text = "%ResearchVoidSymbol"; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutNoSelection"); } if (buyoutButton.AgeTransform.AgeTooltip != null) { buyoutButton.AgeTransform.AgeTooltip.Content = content; } }
public static void FormatVersionAndModulePlaylist(AgeControlButton buttonLastPlaylist, AgePrimitiveLabel currentModulePlaylistLabel, AgePrimitiveLabel versionLabel) { if (currentModulePlaylistLabel != null) { currentModulePlaylistLabel.Text = "%ModDefaultTitle"; currentModulePlaylistLabel.GetComponentInParent <AgeTooltip>().Content = string.Empty; } if (buttonLastPlaylist != null) { buttonLastPlaylist.AgeTransform.Enable = false; } if (versionLabel != null) { versionLabel.Text = Amplitude.Unity.Framework.Application.Name.ToString() + " " + Amplitude.Unity.Framework.Application.Version.ToString(); string a; if (global::Application.ResolveChineseLanguage(out a)) { if (a == "schinese") { versionLabel.Text = AgeLocalizer.Instance.LocalizeString("%SChineseApplicationName") + " " + Amplitude.Unity.Framework.Application.Version.ToString(); } else if (a == "tchinese") { versionLabel.Text = AgeLocalizer.Instance.LocalizeString("%TChineseApplicationName") + " " + Amplitude.Unity.Framework.Application.Version.ToString(); } } versionLabel.AgeTransform.AgeTooltip.Content = string.Empty; } Amplitude.Unity.Gui.IGuiService service = Services.GetService <Amplitude.Unity.Gui.IGuiService>(); IRuntimeService service2 = Services.GetService <IRuntimeService>(); ModulePlaylist modulePlaylist = Services.GetService <IRuntimeModulePlaylistService>().CurrentModulePlaylist; if (modulePlaylist != null && modulePlaylist.Name == "VanillaModulePlaylist") { modulePlaylist = null; } if (modulePlaylist != null && modulePlaylist.Configuration.Length == 1 && modulePlaylist.Configuration[0].ModuleName == service2.VanillaModuleName) { modulePlaylist = null; } if (modulePlaylist == null) { string empty = string.Empty; string empty2 = string.Empty; if (Amplitude.Unity.Framework.Application.Registry.TryGetValue(global::Application.Registers.LastModulePlaylistActivated, out empty) && Amplitude.Unity.Framework.Application.Registry.TryGetValue(global::Application.Registers.LastModulePlaylistActivatedUrl, out empty2) && empty != "VanillaModulePlaylist") { if (buttonLastPlaylist != null) { buttonLastPlaylist.AgeTransform.Enable = true; } if (currentModulePlaylistLabel != null) { GuiElement guiElement; if (service.GuiPanelHelper.TryGetGuiElement(empty, out guiElement)) { currentModulePlaylistLabel.Text = AgeLocalizer.Instance.LocalizeString("%OutgameLastPlaylistTitle").Replace("$PlaylistName", AgeLocalizer.Instance.LocalizeString(guiElement.Title)); } else { currentModulePlaylistLabel.Text = AgeLocalizer.Instance.LocalizeString("%OutgameLastPlaylistTitle").Replace("$PlaylistName", empty); } ModulePlaylist modulePlaylist2 = new ModulePlaylist(empty, string.Empty, null, ModulePlaylist.ParseConfigurationUrl(empty2)); modulePlaylist2.RepairPlaylistIfInvalid(); string newValue = string.Join("\n - ", MenuMainScreen.GetPlaylistModuleTitles(modulePlaylist2)); currentModulePlaylistLabel.GetComponentInParent <AgeTooltip>().Content = AgeLocalizer.Instance.LocalizeString("%OutgameLastPlaylistDescription").Replace("$ModuleNames", newValue); return; } } } else if (service2 != null && service2.Runtime != null) { modulePlaylist.RepairPlaylistIfInvalid(); string newValue2 = modulePlaylist.Name; if (modulePlaylist.IsAnonymous) { newValue2 = AgeLocalizer.Instance.LocalizeString("%AnonymousActiveModulePlaylist"); } string content = string.Join("\n", MenuMainScreen.GetPlaylistModuleTitles(modulePlaylist)); if (currentModulePlaylistLabel != null) { currentModulePlaylistLabel.Text = AgeLocalizer.Instance.LocalizeString("%ModPlaylistActiveFormat").Replace("$Playlist", newValue2); currentModulePlaylistLabel.GetComponentInParent <AgeTooltip>().Content = content; } if (versionLabel != null) { string text = AgeLocalizer.Instance.LocalizeString("%GameMenuPlaylistFormat").Replace("$Playlist", newValue2); if (!string.IsNullOrEmpty(text)) { versionLabel.Text = versionLabel.Text + "\n" + text; versionLabel.AgeTransform.AgeTooltip.Content = content; } } } }
private void OnOptionSelect(GameObject obj) { AgeControlButton component = obj.GetComponent <AgeControlButton>(); DepartmentOfIndustry.ConstructibleElement constructibleElement = component.OnActivateDataObject as DepartmentOfIndustry.ConstructibleElement; Diagnostics.Assert(constructibleElement != null); bool flag = false; object[] array = constructibleElement.GetType().GetCustomAttributes(typeof(WorldPlacementCursorAttribute), true); if (array != null && array.Length > 0) { flag = true; } else if (constructibleElement.Tags.Contains(DownloadableContent9.TagColossus)) { flag = true; array = new object[] { new ColossusWorldPlacementCursorAttribute() }; } ICursorService service = Services.GetService <ICursorService>(); if (flag) { bool flag2 = true; if (flag2) { if (service != null) { service.Backup(); WorldPlacementCursorAttribute worldPlacementCursorAttribute = array[0] as WorldPlacementCursorAttribute; Type type = worldPlacementCursorAttribute.Type; service.ChangeCursor(type, new object[] { this.City, constructibleElement }); } return; } OrderQueueConstruction order = new OrderQueueConstruction(this.City.Empire.Index, this.City.GUID, constructibleElement, string.Empty); Ticket ticket; this.playerControllerRepository.ActivePlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse)); } else if (this.keyMappingService.GetKeyUp(KeyAction.ControlBindingsQueueOnAll) || this.keyMappingService.GetKeyUp(KeyAction.ControlBindingsQueueOnTopOfAll)) { DepartmentOfTheInterior agency = this.City.Empire.GetAgency <DepartmentOfTheInterior>(); List <City> list = agency.Cities.ToList <City>(); for (int i = 0; i < list.Count; i++) { OrderQueueConstruction order2 = new OrderQueueConstruction(this.City.Empire.Index, list[i].GUID, constructibleElement, string.Empty); Ticket ticket2; this.playerControllerRepository.ActivePlayerController.PostOrder(order2, out ticket2, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse)); } } else { OrderQueueConstruction order3 = new OrderQueueConstruction(this.City.Empire.Index, this.City.GUID, constructibleElement, string.Empty); Ticket ticket3; this.playerControllerRepository.ActivePlayerController.PostOrder(order3, out ticket3, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse)); } }
public void CreateFrame() { DynData <OptionsPanel> d = new DynData <OptionsPanel>(optionsPanel); GameObject oldObj = d.Get <AgeControlToggle>("vSyncToggle").transform.parent.parent.parent.parent.gameObject; // oldObj in this case is the "Frame" object that we would like to duplicate. GameObject frame = (GameObject)GameObject.Instantiate(oldObj); // The frame is a child of the current display. frame.transform.SetParent(transform); frame.name = "ModSettingsFrame"; Rect te = optionsPanel.transform.FindChild("1-Frame").GetComponent <AgeTransform>().Position; frame.GetComponent <AgeTransform>().Position = te; frame.GetComponent <AgeTransform>().PixelOffsetLeft = optionsPanel.transform.FindChild("1-Frame").GetComponent <AgeTransform>().PixelOffsetLeft; frame.GetComponent <AgeTransform>().PixelOffsetTop = optionsPanel.transform.FindChild("1-Frame").GetComponent <AgeTransform>().PixelOffsetTop; // Delete the Frame from the GUI control, there can only be one frame (otherwise weird things happen) GameObject.DestroyImmediate(transform.FindChild("1-Frame").gameObject); GameObject bg = (GameObject)GameObject.Instantiate(optionsPanel.transform.FindChild("0-Bg").gameObject); bg.transform.SetParent(transform); //transform.SetParent(optionsPanel.AgeTransform.GetParent().transform); bg.name = "ModSettingsBackground"; // Destroys the useless RightSide // Instead, we will expand the leftSide to have everything! // We need to delete all of its children too, and its children's children, etc. frame.transform.FindChild("2-LeftPart").name = "CentralPart"; Util.DeleteChildrenExclusive(frame.transform.FindChild("CentralPart").gameObject); AgeTransform left = frame.transform.FindChild("CentralPart").GetComponent <AgeTransform>(); left.Init(); left.Position = optionsPanel.transform.FindChild("1-Frame").FindChild("2-LeftPart").GetComponent <AgeTransform>().Position; left.Width = frame.GetComponent <AgeTransform>().Width; left.PixelMarginTop = 20; left.Height = left.Height + (optionsPanel.transform.FindChild("1-Frame").FindChild("2-LeftPart").GetComponent <AgeTransform>().PixelMarginTop - left.PixelMarginTop); left.Height -= 10; Util.DeleteChildrenInclusive(frame.transform.FindChild("3-RightPart").gameObject); //GameObject.DestroyImmediate(frame.transform.FindChild("3-RightPart")); AgeControlButton cancel = frame.transform.FindChild("7-CancelButton").GetComponent <AgeControlButton>(); cancel.AgeTransform.Position = optionsPanel.transform.FindChild("1-Frame").FindChild("7-CancelButton").GetComponent <AgeControlButton>().AgeTransform.Position; // Fixes a strange bug AgeControlButton confirm = frame.transform.FindChild("9-ConfirmButton").GetComponent <AgeControlButton>(); confirm.AgeTransform.Position = optionsPanel.transform.FindChild("1-Frame").FindChild("9-ConfirmButton").GetComponent <AgeControlButton>().AgeTransform.Position; // Fixes a strange bug AgeControlButton reset = frame.transform.FindChild("8-ResetButton").GetComponent <AgeControlButton>(); reset.AgeTransform.Position = optionsPanel.transform.FindChild("1-Frame").FindChild("8-ResetButton").GetComponent <AgeControlButton>().AgeTransform.Position; // Fixes a strange bug // Sets the buttons to match the OptionsPanel buttons cancel.AgeTransform.PixelMarginBottom = 3; cancel.AgeTransform.PixelMarginLeft = 3; cancel.AgeTransform.PixelMarginRight = 4; confirm.AgeTransform.PixelMarginBottom = 3; confirm.AgeTransform.PixelMarginLeft = 4; confirm.AgeTransform.PixelMarginRight = 3; reset.AgeTransform.PixelMarginBottom = 3; reset.AgeTransform.PixelMarginLeft = 3; reset.AgeTransform.PixelMarginRight = 4; reset.AgeTransform.PixelOffsetLeft = 309; reset.transform.FindChild("2-Label").GetComponent <AgePrimitiveLabel>().Text = "Reset Settings"; cancel.OnActivateObject = gameObject; confirm.OnActivateObject = gameObject; reset.OnActivateObject = gameObject; this.frame = frame; }
private void CreateModSettingsMenu(MainMenuPanel mainMenuPanel) { Debug.Log("Attempting to create ModSettings Menu!"); AgeControlButton oldButton = new DynData <MainMenuPanel>(mainMenuPanel).Get <AgeControlButton>("multiplayerButton"); GameObject newO = (GameObject)GameObject.Instantiate(oldButton.gameObject, oldButton.transform.position, oldButton.transform.localRotation); //GameObject newO = GameObject.CreatePrimitive(PrimitiveType.Cube); //newO.GetComponent<MeshRenderer>().enabled = false; //newO.transform.position = oldButton.transform.position; //AgeControlButton settingsMenuButton = newO.AddComponent<AgeControlButton>(); AgeControlButton settingsMenuButton = newO.GetComponent <AgeControlButton>(); //AgeControlButton settingsMenuButton = oldButton; settingsMenuButton.gameObject.name = "Mod Settings"; settingsMenuButton.AgeTransform.Enable = true; settingsMenuButton.AgeTransform.X = oldButton.AgeTransform.X; settingsMenuButton.AgeTransform.Y = oldButton.AgeTransform.Y; GameObject.Destroy(settingsMenuButton.GetComponent <DestroyerIfNoMultiplayer>()); Component[] c = settingsMenuButton.GetComponents(typeof(Component)); //Mod Settings(UnityEngine.Transform) //Mod Settings(AgeTransform) //Mod Settings(AgeControlButton) //Mod Settings(AgeTooltip) //Mod Settings(AgeAudio) //Mod Settings(AGESelectable) //Child: 0-BG (UnityEngine.GameObject) //Components: //- 0-BG (UnityEngine.Transform) //- 0-BG (AgeTransform) //- 0-BG (AgePrimitiveImage) //- 0-BG (AgeModifierColorSwitch) //Child: 1-Label (UnityEngine.GameObject) //Components: //- 1-Label (UnityEngine.Transform) //- 1-Label (AgeTransform) //- 1-Label (AgePrimitiveLabel) //- 1-Label (AgeModifierColorSwitch) foreach (Component q in c) { Debug.Log(q.ToString()); } newO.GetComponentInChildren <AgePrimitiveLabel>().Text = "Mod Settings"; //foreach (Transform child in oldButton.gameObject.transform) //{ // Debug.Log("Child: " + child.gameObject.ToString()); // Debug.Log("Components:"); // foreach (Component _ in child.gameObject.GetComponents(typeof(Component))) // { // Debug.Log("- " + _.ToString()); // } //} //settingsMenuButton.GetComponent<AgeControlTextArea>().AgePrimitiveLabel.Text = "Mod Settings"; Debug.Log("Old Menu Button Position: " + oldButton.transform.position + " new: " + settingsMenuButton.transform.position); Debug.Log("Old Menu Buttom AgeTransform: (" + oldButton.AgeTransform.X + ", " + oldButton.AgeTransform.Y + ", " + oldButton.AgeTransform.Z + ") new: (" + settingsMenuButton.AgeTransform.X + ", " + settingsMenuButton.AgeTransform.Y + ", " + settingsMenuButton.AgeTransform.Z + ")"); Debug.Log("Old Name: " + oldButton.name + ", new name: " + settingsMenuButton.name); Debug.Log("Old Category: " + oldButton.GetComponent <AGESelectable>().Category); Debug.Log("Old SubCategory: " + oldButton.GetComponent <AGESelectable>().SubCategoryID); Debug.Log("Old Next Category: " + oldButton.GetComponent <AGESelectable>().NextCategory); AGESelectable selectable = newO.GetComponent <AGESelectable>(); // Or Something! // SelectionCategory only goes until 28 Debug.Log("GameObject of oldButton: " + oldButton.gameObject); DynData <AGESelectable> d = new DynData <AGESelectable>(oldButton.GetComponent <AGESelectable>()); //Debug.Log("Old AGE AgeSelectionMarker: " + d.Get<AGESelectionMarker>("marker").ToString()); Debug.Log("Old AGE Position: " + oldButton.GetComponent <AGESelectable>().Get2DPosition()); Debug.Log("Old AGE Prev Category: " + d.Get <SelectionCategoryData>("previousCategory").Category + ", " + d.Get <SelectionCategoryData>("previousCategory").SubCategoryID); Debug.Log("Old AGE AgeControl: " + d.Get <AgeControl>("ageControl").ToString()); DynData <AGESelectable> d2 = new DynData <AGESelectable>(selectable); AgeTransform positionAgeTfm = d2.Get <AgeTransform>("positionAgeTfm"); DynData <AgeTransform> oldPosTfm = new DynData <AgeTransform>(positionAgeTfm); DynData <AgeTransform> newAgeTfm = new DynData <AgeTransform>(selectable.AgeTfm); DynData <AgeTransform> oldBtnPosTfm = new DynData <AgeTransform>(d.Get <AgeTransform>("positionAgeTfm")); //settingsMenuButton.gameObject.AddComponent<AgeTooltip>(); newO.GetComponent <AgeTooltip>().Content = "Mod Settings"; selectable.Register((SelectionCategory)29); Debug.Log("Attempting to set display!"); selectable.SetDisplay(true); Debug.Log("Set Display!"); Debug.Log("Old ActiveData: " + oldButton.GetComponent <AgeControlButton>().OnActivateData); Debug.Log("Old ActiveObject: " + oldButton.GetComponent <AgeControlButton>().OnActivateDataObject); Debug.Log("Old ActiveMethod: " + oldButton.GetComponent <AgeControlButton>().OnActivateMethod); Debug.Log("Old ActiveGameObject: " + oldButton.GetComponent <AgeControlButton>().OnActivateObject.ToString()); newO.AddComponent <ClickHandler>(); newO.GetComponent <AgeControlButton>().OnActivateMethod = "ShowModSettingsMenu"; newO.GetComponent <AgeControlButton>().OnActivateObject = newO; Debug.Log("New ActiveData: " + newO.GetComponent <AgeControlButton>().OnActivateData); Debug.Log("New ActiveObject: " + newO.GetComponent <AgeControlButton>().OnActivateDataObject); Debug.Log("New ActiveMethod: " + newO.GetComponent <AgeControlButton>().OnActivateMethod); Debug.Log("New ActiveGameObject: " + newO.GetComponent <AgeControlButton>().OnActivateObject.ToString()); // Tricks it into thinking position is the same newO.transform.SetParent(oldButton.transform.parent); Rect newRect = oldBtnPosTfm.Get <Rect>("basePosition"); newRect.y += oldButton.AgeTransform.Height / 2.0f + 2; oldPosTfm.Set("basePosition", newRect); newAgeTfm.Set("basePosition", newRect); Debug.Log("Old Transform Parent? " + oldButton.transform.parent); Debug.Log("New Transform Parent? " + newO.transform.parent); Debug.Log("New positionAgeTfm: (" + positionAgeTfm.X + ", " + positionAgeTfm.Y + ")"); Debug.Log("New AgeTfm: (" + selectable.AgeTfm.X + ", " + selectable.AgeTfm.Y + ")"); Debug.Log("Base Positions (Rect ToString): " + oldBtnPosTfm.Get <Rect>("basePosition").ToString()); Debug.Log("New Positions (Rect ToString): " + newAgeTfm.Get <Rect>("basePosition").ToString()); string text = "Parent is null!"; if (d.Get <AgeTransform>("positionAgeTfm").GetParent() != null) { text = d.Get <AgeTransform>("positionAgeTfm").GetParent().X + ", " + d.Get <AgeTransform>("positionAgeTfm").GetParent().Y; } Debug.Log("Old PositionAgeTfm Parent? " + text); text = "Parent is null!"; if (selectable.AgeTfm.GetParent() != null) { text = selectable.AgeTfm.GetParent().X + ", " + selectable.AgeTfm.GetParent().Y; } Debug.Log("New PositionAgeTfm Parent? " + text); Debug.Log("Old Monitor Changes? " + d.Get <bool>("monitorPositionChanges")); Debug.Log("New Monitor Changes? " + d2.Get <bool>("monitorPositionChanges")); Debug.Log("Old 2d offset: " + d.Get <Vector2>("twoDPositionOffset")); Debug.Log("New 2d offset: " + d2.Get <Vector2>("twoDPositionOffset")); Debug.Log("Old Position: " + d.Get <Vector2>("position")); Debug.Log("New Position: " + d2.Get <Vector2>("position")); Debug.Log("Old CenterXPosition: " + d.Get <bool>("centerXPosition")); Debug.Log("New CenterXPosition: " + d2.Get <bool>("centerXPosition")); Debug.Log("Old Transform LocalPosition: " + oldButton.transform.localPosition); Debug.Log("New Transform LocalPosition: " + settingsMenuButton.transform.localPosition); Debug.Log("Old Transform LocalRotation: " + oldButton.transform.localRotation); Debug.Log("New Transform LocalRotation: " + settingsMenuButton.transform.localRotation); //d2.Set("positionAgeTfm", d.Get<AgeTransform>("positionAgeTfm")); //d2.Set("position", d.Get<Vector2>("position")); Debug.Log("New AGE Position: " + selectable.Get2DPosition()); Debug.Log("New AGE Prev Category: " + d2.Get <SelectionCategoryData>("previousCategory").Category + ", " + d2.Get <SelectionCategoryData>("previousCategory").SubCategoryID); Debug.Log("New AGE AgeControl: " + d2.Get <AgeControl>("ageControl").ToString()); //GameObject.Destroy(settingsMenuButton.GetComponent<DestroyerIfNoMultiplayer>()); // Need to add to the enum here: SelectionCategory needs to include ModSettings as an option, and then it needs to be set here Debug.Log("Category: " + selectable.Category); Debug.Log("SubCategory: " + selectable.SubCategoryID); Debug.Log("Next Category: " + selectable.NextCategory); float temp = oldButton.AgeTransform.Height; oldButton.AgeTransform.ForceHeight(temp / 2.0f - 2); settingsMenuButton.AgeTransform.ForceHeight(temp / 2.0f - 2); Debug.Log("Mod Settings Button Text: " + newO.GetComponent <AgeTooltip>().Content); newO.SetActive(true); }
public static void RefreshPopulationBuyoutButton(Amplitude.Unity.Game.Empire observer, City city, AgeControlButton populationBuyoutButton) { if (observer != city.Empire) { populationBuyoutButton.AgeTransform.Enable = false; return; } float propertyValue = city.GetPropertyValue(SimulationProperties.CityGrowthStock); float propertyValue2 = city.GetPropertyValue(SimulationProperties.NetCityGrowth); float propertyValue3 = city.GetPropertyValue(SimulationProperties.Population); DepartmentOfTheInterior agency = city.Empire.GetAgency <DepartmentOfTheInterior>(); float num; float num2; agency.GetGrowthLimits(propertyValue3, out num, out num2); if (propertyValue + propertyValue2 >= num2) { populationBuyoutButton.AgeTransform.Enable = false; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityBuyoutPopulationNotNeededDescription"); return; } float propertyValue4 = city.Empire.GetPropertyValue(SimulationProperties.PopulationBuyoutCooldown); if (propertyValue4 > 0f) { populationBuyoutButton.AgeTransform.Enable = false; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityBuyoutPopulationCooldownDescription").Replace("$Cooldown", propertyValue4.ToString()); return; } float num3 = -DepartmentOfTheTreasury.GetPopulationBuyOutCost(city); ResourceDefinition resourceDefinition = ResourceDefinition.GetResourceDefinition(DepartmentOfTheTreasury.Resources.PopulationBuyout); string newValue = GuiFormater.FormatInstantCost(city.Empire, -num3, resourceDefinition.GetName(city.Empire), true, 0); DepartmentOfTheTreasury agency2 = city.Empire.GetAgency <DepartmentOfTheTreasury>(); if (agency2.IsTransferOfResourcePossible(city.Empire, DepartmentOfTheTreasury.Resources.PopulationBuyout, ref num3)) { populationBuyoutButton.AgeTransform.Enable = CityInfoPanel.interactionsAllowed; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityBuyoutPopulationDescription").Replace("$Cost", newValue); } else { populationBuyoutButton.AgeTransform.Enable = false; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityCannotBuyoutPopulationDescription").Replace("$Cost", newValue); } }
public static void ShowHidePopulationSacrificeButton(Amplitude.Unity.Game.Empire observer, DepartmentOfScience departmentOfScience, AgeControlButton populationSacrificeButton) { if (departmentOfScience.CanSacrificePopulation() && departmentOfScience.Empire == observer) { populationSacrificeButton.AgeTransform.Visible = true; } else { populationSacrificeButton.AgeTransform.Visible = false; } }
public static void RefreshPopulationSacrificeButton(Amplitude.Unity.Game.Empire observer, City city, AgeControlButton populationSacrificeButton) { if (DepartmentOfTheInterior.CanSacrificePopulation(city) && observer == city.Empire) { populationSacrificeButton.AgeTransform.Enable = CityInfoPanel.interactionsAllowed; populationSacrificeButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityPopulationSacrificeDescription"); populationSacrificeButton.AgeTransform.AgeTooltip.Content = populationSacrificeButton.AgeTransform.AgeTooltip.Content.Replace("1 \\7708\\", ((int)(city.Empire.GetPropertyValue(SimulationProperties.GameSpeedMultiplier) * 2f)).ToString() + " \\7708\\"); return; } populationSacrificeButton.AgeTransform.Enable = false; populationSacrificeButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityCannotSacrificePopulationDescription"); }