internal void OnGotReport(Report report) { currentReport = report; base.ToolCursor = m_cursor; paths.SetReport(report); if (report == null) { ui.SetSelectedData(null); ui.SetHighlightData(null, 0); } else { ui.SetSelectedData(report.CountEntiesTypes()); #if DEBUG report.Save("report.xml"); #endif } }
public void SetReport(Report report) { if (pathsVisualizations != null) { RemoveAllPaths(); currentReport = null; } if (report == null) { Log.debug ("Report NULL"); return; } if (report.allEntities == null) { Log.debug("Report NULL"); return; } pathsVisualizations = new GameObject[report.allEntities.Length]; vehicleIcons = new Billboard[report.allEntities.Length]; for(int i=0; i < report.allEntities.Length; i++) { //if (i != 34) continue; bool visible = Config.instance.IsTypeVisible(report.allEntities[i].serviceType); pathsVisualizations[i] = CreatePathGameobject(report.allEntities[i].serviceType, report.allEntities[i].path); pathsVisualizations[i].name = "Path " + i; pathsVisualizations[i].SetActive(visible); vehicleIcons[i] = Billboard.Create(vehicleIndicator); vehicleIcons[i].gameObject.SetActive(visible); } float alpha = 30.0f / report.allEntities.Length; if (alpha > 1) { alpha = 1; } currentReport = report; SetHighlight(HighlightType.None, 0); }
void HandleLeftClick() { try { Log.debug("You clicked on " + m_hoverInstance.ToString()); Log.debug(m_hoverInstance.Type.ToString()); paths.ActiveSegmentIndicator.gameObject.SetActive(false); paths.SetReport(null); currentReport = null; if (m_hoverInstance.Type == InstanceType.Vehicle) { base.ToolCursor = loadingCursor; analyzer.ReportOnVehicle(m_hoverInstance.Vehicle); } if (m_hoverInstance.Type == InstanceType.NetSegment) { base.ToolCursor = loadingCursor; paths.ActiveSegmentIndicator.gameObject.SetActive(true); Vector3 pos = analyzer.GetSegmentMidPoint(m_hoverInstance.NetSegment) + Vector3.up * 20; Log.debug("Segment pos: " + pos.ToString()); paths.ActiveSegmentIndicator.position = pos; analyzer.ReportOnSegment(m_hoverInstance.NetSegment, NetInfo.Direction.Both); } if (m_hoverInstance.Type == InstanceType.Building) { base.ToolCursor = loadingCursor; analyzer.ReportOnBuilding(m_hoverInstance.Building); } if (m_hoverInstance.Type == InstanceType.CitizenInstance) { base.ToolCursor = loadingCursor; analyzer.ReportOnCitizen(m_hoverInstance.CitizenInstance); } } catch (Exception e) { Log.error(e.ToString()); Log.error(e.StackTrace); } }
protected override void OnToolGUI() { if (Input.GetKeyUp(Config.instance.keyCode)) { Log.info("Toggling tool"); toolActive = !toolActive; } if (toolActive && Input.GetKeyUp(KeyCode.Escape)) { toolActive = false; return; } if (paths != null) { paths.Update(); } else { Log.debug("paths was NULL"); base.OnToolGUI(); return; } if (ToolsModifierControl.toolController.IsInsideUI) return; if (Event.current.type == EventType.MouseDown) { if (m_hoverInstance == null) { currentReport = null; ui.SetSelectedData(null); ui.SetHighlightData(null,0); paths.SetReport(null); } if (Event.current.button == 0) { HandleLeftClick(); } else if (Event.current.button == 1) { HandleRightClick(); } } else { HandleHover(); } }