private void ButtonClick(UIComponent uiComponent, UIMouseEventParameter eventParam) { if (!_uiShown) { Show(); } else { Close(); } }
public void CheckBoxChanged(UIComponent c, UIMouseEventParameter p) { UICheckBox cb = c as UICheckBox; bAutosaveEnabled = cb.isChecked; timer = autoSaveInterval * 60; updateLabel(bAutosaveEnabled, autoSaveInterval); }
private void ButtonWhatsNew_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { if(whatsNewPanel != null) { whatsNewPanel.Show(); whatsNewPanel.BringToFront(); } }
protected void OnClick(UIComponent comp, UIMouseEventParameter p) { p.Use(); UIButton uIButton = comp as UIButton; if (uIButton != null && uIButton.parent == this.m_strip) { } }
private void clickSwitchTraffic(UIComponent component, UIMouseEventParameter eventParam) { if (TrafficLightTool.getToolMode() != ToolMode.SwitchTrafficLight) { _buttonSwitchTraffic.focusedBgSprite = "ButtonMenuFocused"; TrafficLightTool.SetToolMode(ToolMode.SwitchTrafficLight); } else { _buttonSwitchTraffic.focusedBgSprite = "ButtonMenu"; TrafficLightTool.SetToolMode(ToolMode.None); } }
private void BottomLabel_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { if (RoadNamerManager.Instance().HaveMod()) { bool blah = RoadNamerManager.Instance().populateObjects(); DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, string.Format("stuff. {0}",blah )); } //Steam.ActivateGameOverlayToWebPage("https://www.reddit.com/r/Cimtographer"); }
private void ButtonGenerate_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { try { OSMExportNew osmExporter = new OSMExportNew(); osmExporter.Export(); buttonGenerate.text = "Generate OSM map"; } catch { buttonGenerate.text = "Export failed!"; } }
private void uiButton_eventClick(UIComponent component, UIMouseEventParameter eventParam) { if (!this.buildingWindow.isVisible) { this.buildingWindow.isVisible = true; this.buildingWindow.BringToFront(); this.buildingWindow.Show(); } else { this.buildingWindow.isVisible = false; this.buildingWindow.Hide(); } }
public new void OnClick(UIComponent comp, UIMouseEventParameter p) { UIButton uiButton = p.source as UIButton; int byIndex = this.GetByIndex((UIComponent)uiButton); if (byIndex == -1) return; this.SelectByIndex(byIndex); Texture2D texture2D = uiButton.objectUserData as Texture2D; var brushesContainer = (UIScrollablePanel)typeof(BrushOptionPanel).GetField("m_BrushesContainer", BindingFlags.NonPublic | BindingFlags.Instance) .GetValue(this); if (!((UnityEngine.Object)uiButton.parent == (UnityEngine.Object)brushesContainer) || !((UnityEngine.Object)texture2D != (UnityEngine.Object)null)) return; TerrainTool tool1 = ToolsModifierControl.GetTool<TerrainTool>(); if ((UnityEngine.Object)tool1 != (UnityEngine.Object)null) tool1.m_brush = texture2D; TreeTool tool2 = ToolsModifierControl.GetTool<TreeTool>(); if ((UnityEngine.Object)tool2 != (UnityEngine.Object)null) tool2.m_brush = texture2D; ResourceTool tool3 = ToolsModifierControl.GetTool<ResourceTool>(); if ((UnityEngine.Object)tool3 != (UnityEngine.Object)null) tool3.m_brush = texture2D; PropTool tool4 = ToolsModifierControl.GetTool<PropTool>(); if ((UnityEngine.Object)tool4 == (UnityEngine.Object)null) { tool4.m_brush = texture2D; } //begin mod try { Plugins.SetBrush(texture2D); } catch (Exception e) { UnityEngine.Debug.LogException(e); } //end mod }
private void OnUploadPressed(UIComponent component, UIMouseEventParameter eventParam) { component.Disable(); publisher.SaveGame(); }
private void DoDoubleClick(UIComponent component, UIMouseEventParameter eventParam) { }
private void OnLoadWeatherFromTheme(UIComponent component, UIMouseEventParameter eventParam) { Controller.OnLoadFromTheme(ThemeCategory.Atmosphere, ThemeCategory.Atmosphere); }
private void OnButtonClicked(UIComponent component, UIMouseEventParameter eventParam) { EventButtonClicked?.Invoke(); }
void toggleVisibility(UIComponent component, UIMouseEventParameter eventParam) { Log.debug("Click"); Config.instance.ToggleVisibility(type); parent.Invalidate(); }
private void clickClearTraffic(UIComponent component, UIMouseEventParameter eventParam) { var vehicleList = TrafficPriority.VehicleList.Keys.ToList(); lock (Singleton<VehicleManager>.instance) { foreach (var vehicle in from vehicle in vehicleList let vehicleData = Singleton<VehicleManager>.instance.m_vehicles.m_buffer[vehicle] where vehicleData.Info.m_vehicleType == VehicleInfo.VehicleType.Car select vehicle) { Singleton<VehicleManager>.instance.ReleaseVehicle(vehicle); } } }
/// <summary>Handles click. NOTE: When overriding, call base.OnClick() last!</summary> /// <param name="p">Event.</param> protected override void OnClick(UIMouseEventParameter p) { ModUI.Instance.MainMenu.UpdateButtons(); }
private void OnToggleClick(UIComponent component, UIMouseEventParameter eventParam) { ForestBrushPanel.BringToFront(); ForestBrushPanel.isVisible = !ForestBrushPanel.isVisible; }
private void ProbabilitySlider_eventMouseUp(UIComponent component, UIMouseEventParameter eventParam) { SetProbability(probabilitySlider.value, Prefab); UserMod.SaveSettings(); }
private void TreeItem_eventTooltipEnter(UIComponent component, UIMouseEventParameter eventParam) { GenerateTooltip(Prefab); }
private void TreeItem_eventMouseLeave(UIComponent component, UIMouseEventParameter eventParam) { tooltipBox.isVisible = false; }
/// <summary> /// Called when the close button is clicked, making the panel invisible. /// </summary> /// <param name="component">The close button component.</param> /// <param name="eventParam">The event parameters.</param> private void OnCloseButtonClick(UIComponent component, UIMouseEventParameter eventParam) { this.isVisible = false; }
/// <summary> /// Called when the settings button is clicked, toggling settings panel visibility. /// </summary> /// <param name="component">The settings button component.</param> /// <param name="eventParam">The event parameters.</param> private void OnOptionsButtonClick(UIComponent component, UIMouseEventParameter eventParam) { this.settingsPanel.relativePosition = this.relativePosition; this.settingsPanel.isVisible = true; this.settingsPanel.BringToFront(); }
/// <summary> /// Called when the toggle button in the main UI is clicked, toggling panel visibility. /// </summary> /// <param name="component">The toggle button component.</param> /// <param name="eventParam">The event parameters.</param> private void OnToggleButtonClick(UIComponent component, UIMouseEventParameter eventParam) { this.isVisible = !this.isVisible; }
private void OnClickExit(UIComponent component, UIMouseEventParameter eventparam) { Application.Quit(); }
protected override void OnMouseUp(UIMouseEventParameter p) { IsDragged = false; base.OnMouseUp(p); }
private void OnDragEnd(UIComponent component, UIMouseEventParameter eventParam) { EventDragEnd?.Invoke(); }
private void clickAddPrioritySigns(UIComponent component, UIMouseEventParameter eventParam) { if (_uiState != UIState.AddStopSign) { _uiState = UIState.AddStopSign; _buttonPrioritySigns.focusedBgSprite = "ButtonMenuFocused"; TrafficLightTool.SetToolMode(ToolMode.AddPrioritySigns); } else { _uiState = UIState.None; _buttonPrioritySigns.focusedBgSprite = "ButtonMenu"; TrafficLightTool.SetToolMode(ToolMode.None); } }
private void clickReloadConfig(UIComponent component, UIMouseEventParameter eventParam) { GlobalConfig.Reload(); }
private void clickManualControl(UIComponent component, UIMouseEventParameter eventParam) { if (_uiState != UIState.ManualSwitch) { _uiState = UIState.ManualSwitch; _buttonManualControl.focusedBgSprite = "ButtonMenuFocused"; TrafficLightTool.SetToolMode(ToolMode.ManualSwitch); } else { _uiState = UIState.None; _buttonManualControl.focusedBgSprite = "ButtonMenu"; TrafficLightTool.SetToolMode(ToolMode.None); } }
private void clickTogglePathFindStats(UIComponent component, UIMouseEventParameter eventParam) { Update(); showPathFindStats = !showPathFindStats; }
private void NameRoadButton_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { SetRoadData(); }
private void clickPrintFlagsDebugInfo(UIComponent component, UIMouseEventParameter eventParam) { Flags.PrintDebugInfo(); }
public override void OnClickInternal(UIMouseEventParameter p) { UIBase.GetTrafficManagerTool().SetToolMode(Active ? ToolMode.None : ToolMode); }
private void clickPrintBenchmarkReport(UIComponent component, UIMouseEventParameter eventParam) { Constants.ServiceFactory.SimulationService.AddAction(() => { Log.Info(BenchmarkProfileProvider.Instance.CreateReport()); }); }
protected override void OnMouseWheel(UIMouseEventParameter p) { base.OnMouseWheel(p); if (enabled) UIThemeManager.instance.UpdateBuildingInfo(m_building); }
private void descriptionButton_eventClick(UIComponent component, UIMouseEventParameter eventParam) { showDescription = !showDescription; }
private void UICustomButton_eventClick(UIComponent component, UIMouseEventParameter eventParam) { ModLogger.Debug("Triggering command '{0}' from clickhandler", _command.GetType().Name); if (_command != null) _command.Execute(); }
private void BottomLabel_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { Steam.ActivateGameOverlayToWebPage("https://www.reddit.com/r/Cimtographer"); }
private void OnClickCancel(UIComponent component, UIMouseEventParameter eventparam) { this.Hide(); UIView.PopModal(); }
private void OnButtonClick (UIComponent uiComponent, UIMouseEventParameter mouseEventParam) { // Get the global TreeManager singleton. if (!Singleton<TreeManager>.exists) { Util.Log("TreeManager doesn't exist for some reason."); return; } var tm = Singleton<TreeManager>.instance; Util.Log("TreeManager count: " + tm.m_treeCount.ToString()); /* So here's how trees in Cities: Skylines are stored. First, take a look at these three bare-bones "documentation" pages: - https://github.com/cities-skylines/Assembly-CSharp/wiki/TreeManager - https://github.com/cities-skylines/Assembly-CSharp/wiki/TreeInstance - https://github.com/cities-skylines/Assembly-CSharp/wiki/Array32%601 TreeManager - or rather Singleton<TreeManager>.instance - keeps an Array32 of TreeInstance objects (m_trees). Each tree is referred to by its index number in this Array32, with 0 meaning it doesn't exist. Unfortunately, Array32 is a sparse array that doesn't let us iterate over its items. Fortunately, looping over each possible index and checking the x/z coords against 0 does find all the trees with little to no problem. TreeManager also stores a 540x540 grid of tree indices (m_treeGrid), and each TreeInstance seems to hold an index to the "next" tree in its grid position (m_nextGridTree), but this isn't really useful for what I'm doing. */ var trees = tm.m_trees; var treeEntries = new TreeEntry[tm.m_treeCount]; var toRemove = new uint[tm.m_treeCount]; uint treeEntryCount = 0; uint toRemoveCount = 0; for (uint i=1; i < trees.m_size; i++) { short x = trees.m_buffer[i].m_posX; short z = trees.m_buffer[i].m_posZ; if (x != 0 || z != 0) { // Search through treeEntries for an entry with the same // x and z values. bool treeEntryMatched = false; for (uint j=0; j < treeEntryCount; j++) { if (treeEntries[j].x == x && treeEntries[j].z == z) { treeEntryMatched = true; break; } } // If the tree does overlap with one we've already found, // queue it up for removal. If not, add it to treeEntries. if (treeEntryMatched) { toRemove[toRemoveCount] = i; toRemoveCount++; } else { treeEntries[treeEntryCount].id = i; treeEntries[treeEntryCount].x = x; treeEntries[treeEntryCount].z = z; treeEntryCount++; } } } Util.Log(treeEntryCount.ToString() + " single trees found."); Util.Log(toRemoveCount.ToString() + " duplicate trees found."); if (toRemoveCount > 0) { var oldCount = tm.m_treeCount; for (uint i=0; i < toRemoveCount; i++) { tm.ReleaseTree(toRemove[i]); } var newCount = tm.m_treeCount; if (oldCount == newCount) { Util.Log("Failed to remove the duplicate trees."); } else { if (newCount == treeEntryCount) { Util.Log(toRemoveCount.ToString() + " trees removed successfully."); } else { Util.Log("Something went wrong."); Util.Log("oldCount = " + oldCount.ToString()); Util.Log("newCount = " + newCount.ToString()); } } } }
protected virtual void ClickLaneRestrictions(UIComponent component, UIMouseEventParameter eventParam) { if (_uiState != UIState.LaneRestrictions) { _uiState = UIState.LaneRestrictions; _buttonLaneRestrictions.focusedBgSprite = "ButtonMenuFocused"; TrafficLightTool.SetToolMode(ToolMode.LaneRestrictions); } else { _uiState = UIState.None; _buttonLaneRestrictions.focusedBgSprite = "ButtonMenu"; TrafficLightTool.SetToolMode(ToolMode.None); } }
private void clickResetBenchmarks(UIComponent component, UIMouseEventParameter eventParam) { Constants.ServiceFactory.SimulationService.AddAction(() => { BenchmarkProfileProvider.Instance.ClearProfiles(); }); }
private void RotateCamera(UIComponent c, UIMouseEventParameter p) { m_previewRenderer.cameraRotation -= p.moveDelta.x / m_preview.width * 360f; RenderPreview(); }
private void TopLabel_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { Steam.ActivateGameOverlayToWorkshopItem(new PublishedFileId(549792340)); }
public override void HandleClick(UIMouseEventParameter p) { }
private void ButtonGenerate_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { try { RoadManager.ClearRoadTypes(); OSMExportNew osmExporter = new OSMExportNew(); osmExporter.Export(); buttonGenerate.text = "Generate OSM map"; } catch(Exception ex) { UnityEngine.Debug.LogException(ex); buttonGenerate.text = "Export failed!"; } try { string _osmName = Singleton<SimulationManager>.instance.m_metaData.m_CityName + ".osm"; string _fullOSMPath = Path.GetFullPath(_osmName); string _modPath = CimTools.CimToolsHandler.CimToolBase.Path.GetModPath(); if (_modPath != null && _modPath != "" && _fullOSMPath != null && _fullOSMPath != "") { string _mscriptPath = _modPath + Path.DirectorySeparatorChar + "MaperitiveScript.mscript"; string _mrulesPath = _modPath + Path.DirectorySeparatorChar + "Cimtographer.mrules"; string _zippedMaperitivePath = _modPath + Path.DirectorySeparatorChar + "Maperitive"; string _citiesPath = Path.GetDirectoryName(_fullOSMPath); string _extractedMaperitivePath = _citiesPath + Path.DirectorySeparatorChar + "Maperitive"; string _mscript = string.Format( "use-ruleset location=\"{0}\"" + "\r\napply-ruleset" + "\r\nload-source \"{1}\"" , _mrulesPath, _fullOSMPath); File.Delete(_mscriptPath); StreamWriter _writer = File.CreateText(_mscriptPath); _writer.Write(_mscript); _writer.Flush(); _writer.Close(); if (_extractedMaperitivePath != null && _extractedMaperitivePath != "" && GzipExtractor.RemoveAllChangedNames(_zippedMaperitivePath, _extractedMaperitivePath, ".mapper")) { Process _maperitiveProcess = Process.Start(new ProcessStartInfo( _extractedMaperitivePath + Path.DirectorySeparatorChar + "Maperitive", "\"" + _mscriptPath + "\"") { UseShellExecute = false }); if(_maperitiveProcess != null) { UIView.library.ShowModal("PauseMenu"); } } else { UnityEngine.Debug.Log("Couldn't decrypt the gzipped files from " + _zippedMaperitivePath + " to " + _extractedMaperitivePath); } } else { UnityEngine.Debug.Log("Could not find OSM at " + _fullOSMPath + " or mod path at " + _modPath); } } catch(Exception ex) { UnityEngine.Debug.LogException(ex); } }
public abstract void OnClickInternal(UIMouseEventParameter p);
private void TabButton_eventClicked(UIComponent component, UIMouseEventParameter eventParam) { ToolController toolController = ToolsModifierControl.toolController; if (toolController != null) { if (toolController.GetComponent<RoadSelectTool>() == null) { ToolsModifierControl.toolController.gameObject.AddComponent<RoadSelectTool>(); //I stole this from Traffic++ for now, until I can figure some things out. Quick fix! FieldInfo toolControllerField = typeof(ToolController).GetField("m_tools", BindingFlags.Instance | BindingFlags.NonPublic); if (toolControllerField != null) toolControllerField.SetValue(toolController, toolController.GetComponents<ToolBase>()); FieldInfo toolModifierDictionary = typeof(ToolsModifierControl).GetField("m_Tools", BindingFlags.Static | BindingFlags.NonPublic); if (toolModifierDictionary != null) toolModifierDictionary.SetValue(null, null); // to force a refresh } RoadSelectTool roadSelectTool = ToolsModifierControl.SetTool<RoadSelectTool>(); if (roadSelectTool == null) { LoggerUtilities.Log("Tool failed to initialise!"); } else { roadSelectTool.m_roadNamePanel = m_roadNamePanel; } } }
private void OnResetColor(UIComponent component, UIMouseEventParameter eventParam) { m_prefixColor.selectedColor = Color.clear; Extension.SetColor(SelectedPrefix, Color.clear); }
void MouseMoved(UIComponent component, UIMouseEventParameter eventParam) { Vector2 pos; component.GetHitPosition(eventParam.ray, out pos); Vector2 center = new Vector2(30, 30); float angle = Vector2.Angle(new Vector3(0, 30), pos - center); if (pos.x > center.x) angle = 360.0f - angle; float time = (angle * 12.0f) / 180.0f; //Debug.Log("Mouse moved on zoom button"); //Debug.Log("Angle =" + angle); //Debug.Log("Time = " + time); //Debug.Log("Button: " + eventParam.buttons); if (eventParam.buttons == UIMouseButton.Right) sunControl.TimeOfDay = time; }
private void OnCancelButtonClick(UIComponent uiComponent, UIMouseEventParameter eventParam) { isVisible = false; MultiplayerManager.Instance.CurrentClient.Disconnect(); MultiplayerManager.Instance.CurrentClient.StopMainMenuEventProcessor(); }
private static void ClickToggleDespawn(UIComponent component, UIMouseEventParameter eventParam) { LoadingExtension.Instance.DespawnEnabled = !LoadingExtension.Instance.DespawnEnabled; if (!LoadingExtension.PathfinderIncompatibility) { _buttonToggleDespawn.text = LoadingExtension.Instance.DespawnEnabled ? "Disable despawning" : "Enable despawning"; } }
private void OnCloseButtonClick(UIComponent component, UIMouseEventParameter eventParam) { this.Hide(); }
private void clickChangeLanes(UIComponent component, UIMouseEventParameter eventParam) { if (_uiState != UIState.LaneChange) { _uiState = UIState.LaneChange; if (!LoadingExtension.PathfinderIncompatibility) { _buttonLaneChange.focusedBgSprite = "ButtonMenuFocused"; } TrafficLightTool.SetToolMode(ToolMode.LaneChange); } else { _uiState = UIState.None; if (!LoadingExtension.PathfinderIncompatibility) { _buttonLaneChange.focusedBgSprite = "ButtonMenu"; } TrafficLightTool.SetToolMode(ToolMode.None); } }
private void OnNextStopButtonClick(UIComponent component, UIMouseEventParameter eventParam) { this.MoveToNextStop(); }
private void clickCrosswalk(UIComponent component, UIMouseEventParameter eventParam) { if (_uiState != UIState.Crosswalk) { _uiState = UIState.Crosswalk; _buttonCrosswalk.focusedBgSprite = "ButtonMenuFocused"; TrafficLightTool.SetToolMode(ToolMode.Crosswalk); } else { _uiState = UIState.None; _buttonCrosswalk.focusedBgSprite = "ButtonMenu"; TrafficLightTool.SetToolMode(ToolMode.None); } }
private void OnLoadTerrainFromTheme(UIComponent component, UIMouseEventParameter eventParam) { Controller.OnLoadFromTheme(ThemeCategory.Terrain, ThemeCategory.Terrain); }
private void clickTimedAdd(UIComponent component, UIMouseEventParameter eventParam) { if (_uiState != UIState.TimedControlNodes) { _uiState = UIState.TimedControlNodes; _buttonTimedMain.focusedBgSprite = "ButtonMenuFocused"; TrafficLightTool.SetToolMode(ToolMode.TimedLightsSelectNode); } else { _uiState = UIState.None; _buttonTimedMain.focusedBgSprite = "ButtonMenu"; TrafficLightTool.SetToolMode(ToolMode.None); } }
private void OnConnectButtonClick(UIComponent uiComponent, UIMouseEventParameter eventParam) { // TEMP return; }/* SAVEFROMTEMPCODE