public override void Start() { m_netTool = FindObjectOfType <NetTool>(); if (m_netTool == null) { #if DEBUG Next.Debug.Log("NetTool Not Found"); #endif enabled = false; return; } m_bulldozeTool = FindObjectOfType <BulldozeTool>(); if (m_bulldozeTool == null) { #if DEBUG Next.Debug.Log("BulldozeTool Not Found"); #endif enabled = false; return; } m_netTool = FindObjectOfType <NetTool>(); if (m_netTool == null) { #if DEBUG Next.Debug.Log("NetTool Not Found"); #endif enabled = false; return; } try { m_upgradeButtonTemplate = GameObject.Find("RoadsSmallPanel").GetComponent <GeneratedScrollPanel>().m_OptionsBar.Find <UIButton>("Upgrade"); } catch { #if DEBUG Next.Debug.Log("Upgrade button template not found"); #endif } CreateUI(); trackStyle = 0; trackSize = 1; trackDirection = 1; isStation = 1; stationType = 0; fence = false; SetNetToolPrefab(); }
public override void Start() { m_buildingTool = FindObjectOfType <BuildingTool>(); if (m_buildingTool == null) { #if DEBUG Next.Debug.Log("BuildingTool Not Found"); #endif enabled = false; return; } m_bulldozeTool = FindObjectOfType <BulldozeTool>(); if (m_bulldozeTool == null) { #if DEBUG Next.Debug.Log("BulldozeTool Not Found"); #endif enabled = false; return; } m_netTool = FindObjectOfType <NetTool>(); if (m_netTool == null) { #if DEBUG Next.Debug.Log("NetTool Not Found"); #endif enabled = false; return; } try { m_upgradeButtonTemplate = GameObject.Find("RoadsSmallPanel").GetComponent <GeneratedScrollPanel>().m_OptionsBar.Find <UIButton>("Upgrade"); } catch { #if DEBUG Next.Debug.Log("Upgrade button template not found"); #endif } CreateUI(); SetDict[ToggleType.Depth] = SetStationCustomizations.DEF_DEPTH; SetDict[ToggleType.Length] = SetStationCustomizations.DEF_LENGTH; SetDict[ToggleType.Angle] = SetStationCustomizations.DEF_ANGLE; SetDict[ToggleType.Bend] = SetStationCustomizations.DEF_BEND_STRENGTH; m_oldAngle = 0; }
public static bool Prefix(BulldozeTool __instance, ref RenderManager.CameraInfo cameraInfo) { if (ContainerHolder.instance != null) { PropInstance propInstance = ContainerHolder.instance.propInstance; float size = Mathf.Max(propInstance.Info.m_generatedInfo.m_size.x, propInstance.Info.m_generatedInfo.m_size.z) * 1; Vector3 position = propInstance.Position; ++ToolManager.instance.m_drawCallData.m_overlayCalls; RenderManager.instance.OverlayEffect.DrawCircle(cameraInfo, toolColor, position, size, position.y - 100f, position.y + 100f, false, true); return(false); } return(true); }
public static void Postfix(BulldozeTool __instance) { if (__instance != null && __instance.enabled) { Ray currentPosition = Camera.main.ScreenPointToRay(Input.mousePosition); PropUnlimiterManager.instance.RaycastUnlimitedProps(currentPosition, out ContainerHolder.gridKey, out ContainerHolder.instance); // This is probably not needed, since raycast already wipes out the existing values if (ContainerHolder.instance == null) { ContainerHolder.instance = null; ContainerHolder.gridKey = -1; } } }
public override void Start() { m_netTool = GetExactTool <NetTool>(); if (m_netTool == null) { #if DEBUG Next.Debug.Log("NetTool Not Found"); #endif enabled = false; return; } m_buildingTool = GetExactTool <BuildingTool>(); if (m_buildingTool == null) { #if DEBUG Next.Debug.Log("BuildingTool Not Found"); #endif enabled = false; return; } m_bulldozeTool = GetExactTool <BulldozeTool>(); if (m_bulldozeTool == null) { #if DEBUG Next.Debug.Log("BulldozeTool Not Found"); #endif enabled = false; return; } try { m_upgradeButtonTemplate = GameObject.Find("RoadsSmallPanel").GetComponent <GeneratedScrollPanel>().m_OptionsBar.Find <UIButton>("Upgrade"); } catch { #if DEBUG Next.Debug.Log("Upgrade button template not found"); #endif } CreateUI(); SubStart(); }
public override void OnAfterSimulationTick() { if (!V10Bulldoze.active || c++ < V10Bulldoze.ui.data.interval) { return; } c = 0; if (!V10Bulldoze.ui.data.abandoned && !V10Bulldoze.ui.data.burned) { return; } if (simulationManager == null) { simulationManager = SimulationManager.instance; bulldozeTool = GameObject.FindObjectOfType <BulldozeTool> (); method = bulldozeTool.GetType().GetMethod("DeleteBuilding", BindingFlags.NonPublic | BindingFlags.Instance); } if (V10Bulldoze.ui.data.abandoned) { checkBuildings(SkylinesOverwatch.Data.Instance.BuildingsAbandoned); } if (V10Bulldoze.ui.data.burned && c2 <= V10Bulldoze.ui.data.max) { ushort [] toCheck = SkylinesOverwatch.Data.Instance.BuildingsBurnedDown; if (V10Bulldoze.ui.data.service) { toCheck = toCheck.Except(SkylinesOverwatch.Data.Instance.PlayerBuildings).ToArray(); } checkBuildings(toCheck); } c2 = 0; }
public void Start() { NetSkins_Support.Init(); // Getting NetTool m_netTool = GameObject.FindObjectOfType <NetTool>(); if (m_netTool == null) { DebugUtils.Warning("NetTool not found."); enabled = false; return; } // Getting BulldozeTool m_bulldozeTool = GameObject.FindObjectOfType <BulldozeTool>(); if (m_bulldozeTool == null) { DebugUtils.Warning("BulldozeTool not found."); enabled = false; return; } // Getting BuildingTool m_buildingTool = GameObject.FindObjectOfType <BuildingTool>(); if (m_buildingTool == null) { DebugUtils.Warning("BuildingTool not found."); enabled = false; return; } // Getting NetTool private fields m_elevationField = m_netTool.GetType().GetField("m_elevation", BindingFlags.NonPublic | BindingFlags.Instance); m_elevationUpField = m_netTool.GetType().GetField("m_buildElevationUp", BindingFlags.NonPublic | BindingFlags.Instance); m_elevationDownField = m_netTool.GetType().GetField("m_buildElevationDown", BindingFlags.NonPublic | BindingFlags.Instance); m_buildingElevationField = m_buildingTool.GetType().GetField("m_elevation", BindingFlags.NonPublic | BindingFlags.Instance); m_controlPointCountField = m_netTool.GetType().GetField("m_controlPointCount", BindingFlags.NonPublic | BindingFlags.Instance); m_upgradingField = m_netTool.GetType().GetField("m_upgrading", BindingFlags.NonPublic | BindingFlags.Instance); m_placementErrorsField = m_buildingTool.GetType().GetField("m_placementErrors", BindingFlags.NonPublic | BindingFlags.Instance); if (m_elevationField == null || m_elevationUpField == null || m_elevationDownField == null || m_buildingElevationField == null || m_controlPointCountField == null || m_upgradingField == null || m_placementErrorsField == null) { DebugUtils.Warning("NetTool fields not found"); m_netTool = null; enabled = false; return; } // Getting Upgrade button template try { m_upgradeButtonTemplate = GameObject.Find("RoadsSmallPanel").GetComponent <GeneratedScrollPanel>().m_OptionsBar.Find <UIButton>("Upgrade"); } catch { DebugUtils.Warning("Upgrade button template not found"); } // Creating UI CreateToolOptionsButton(); // Store segment count m_segmentCount = NetManager.instance.m_segmentCount; // Getting control points try { m_controlPoints = m_netTool.GetType().GetField("m_controlPoints", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(m_netTool) as NetTool.ControlPoint[]; m_cachedControlPoints = m_netTool.GetType().GetField("m_cachedControlPoints", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(m_netTool) as NetTool.ControlPoint[]; } catch { DebugUtils.Warning("ControlPoints not found"); } // Init dictionary RoadPrefab.Initialize(); m_inEditor = (ToolManager.instance.m_properties.m_mode & ItemClass.Availability.AssetEditor) != ItemClass.Availability.None; RoadPrefab.singleMode = m_inEditor; if (changeMaxTurnAngle.value) { RoadPrefab.SetMaxTurnAngle(maxTurnAngle.value); } // Update Catenary UpdateCatenary(); // Fix nodes FixNodes(); DebugUtils.Log("Initialized"); }
/// <summary> /// The BulldozeTool.DeleteBuilding method signature. /// </summary> /// <param name="bulldozeTool">The bulldoze tool.</param> /// <param name="building">The building.</param> /// <returns>No value.</returns> private static IEnumerator DeleteBuilding_Signature(BulldozeTool bulldozeTool, ushort building) { throw new NotImplementedException("Call to method signature"); }
/// <summary> /// Initializes a new instance of the <see cref="BulldozeToolDeleteBuilding"/> class. /// </summary> public BulldozeToolDeleteBuilding() { this.bulldozeTool = GameObject.FindObjectOfType<BulldozeTool>(); }
//Works BEAUTIFULLY!! :DDD public static void SwitchTools(out bool allNull) { allNull = true; m_wasPLTActive = m_PLTActive; m_wasBulldozeToolActive = m_bulldozeToolActive; ICities.LoadMode _loadMode = PropLineToolMod.GetLoadMode(); PropTool _propTool = ToolsModifierControl.GetCurrentTool <PropTool>(); TreeTool _treeTool = ToolsModifierControl.GetCurrentTool <TreeTool>(); PropLineTool _propLineTool = ToolsModifierControl.GetCurrentTool <PropLineTool>(); BulldozeTool _bulldozeTool = ToolsModifierControl.GetCurrentTool <BulldozeTool>(); if ((_propTool == null) && (_treeTool == null) && (_propLineTool == null)) { allNull = true; if (!m_wasBulldozeToolActive) { m_PLTActive = false; } if (m_wasPLTActive == true) { PropLineTool.m_keepActiveState = true; } if (_bulldozeTool != null) { m_bulldozeToolActive = true; } else { m_bulldozeToolActive = false; } if (m_resetCounterActive && resetCounterElapsedTimeSeconds > RESET_THRESHOLD_SECONDS) { m_resetCounterActive = false; m_resetCounterExpired = true; } else if (!m_resetCounterExpired && !m_resetCounterActive) { m_resetCounterActive = true; m_resetCounterStartTimeSeconds = Time.time; //Debug.Log("[PLTDEBUG]: m_resetCounterStartTimeSeconds = " + m_resetCounterStartTimeSeconds); } return; } else { allNull = false; if (_propLineTool != null) { m_PLTActive = true; } //continue along } //single mode: signal tool switch //not-single mode: signal standby bool _PLTActiveExclusive = ((_propLineTool != null) && (_propTool == null) && (_treeTool == null)); //single mode: signal standby //not-single mode: signal tool switch bool _PLTInactiveButPropOrTreeActive = ((_propLineTool == null) && ((_propTool != null) || (_treeTool != null))); //error checking? bool _multipleActivePropTreeTools = ((_propLineTool != null) && ((_propTool != null) || (_treeTool != null))); if (_multipleActivePropTreeTools) { Debug.LogError("[PLT]: ToolSwitch: More than one active tool!"); return; } //loadmode is in-game bool _inGame = ((_loadMode == ICities.LoadMode.NewGame) || (_loadMode == ICities.LoadMode.LoadGame)); //loadmode is map-editor or asset-editor [EDIT: ACTUALLY JUST MAP EDITOR] //bool flag4 = ( (_loadMode == ICities.LoadMode.LoadMap) || (_loadMode == ICities.LoadMode.LoadAsset) || (_loadMode == ICities.LoadMode.NewAsset) || (_loadMode == ICities.LoadMode.NewMap) ); bool _mapEditor = ((_loadMode == ICities.LoadMode.LoadMap) || (_loadMode == ICities.LoadMode.NewMap)); //test if BrushPanel was found m_brushPanelFound = (m_brushPanel != null); switch (PropLineTool.drawMode) { case PropLineTool.DrawMode.Single: { //reset active state PropLineTool.m_keepActiveState = false; if (_PLTActiveExclusive) { switch (PropLineTool.objectMode) { case PropLineTool.ObjectMode.Undefined: { Debug.LogError("[PLT]: ToolSwitch: Object mode is undefined!"); break; } case PropLineTool.ObjectMode.Props: { PropInfo oldPropInfo = _propLineTool.propPrefab; PropTool newPropTool = ToolsModifierControl.SetTool <PropTool>(); if (oldPropInfo == null) { Debug.LogError("[PLT]: ToolSwitch: PropLineTool prop prefab is null!"); return; } newPropTool.m_prefab = oldPropInfo; //new as of 190809 FindBrushPanel(); if (_mapEditor && m_brushPanelFound) { m_brushPanel.Show(); } break; } case PropLineTool.ObjectMode.Trees: { TreeInfo oldTreeInfo = _propLineTool.treePrefab; TreeTool newTreeTool = ToolsModifierControl.SetTool <TreeTool>(); if (oldTreeInfo == null) { Debug.LogError("[PLT]: ToolSwitch: PropLineTool tree prefab is null!"); return; } newTreeTool.m_prefab = _propLineTool.treePrefab; //new as of 190809 FindBrushPanel(); if ((_mapEditor || (_inGame)) && m_brushPanelFound) { m_brushPanel.Show(); } break; } } return; } else if (_PLTInactiveButPropOrTreeActive) { return; } else { Debug.LogError("[PLT]: ToolSwitch: PropLineTool -> mismatch!"); return; } } case PropLineTool.DrawMode.Straight: case PropLineTool.DrawMode.Curved: case PropLineTool.DrawMode.Freeform: case PropLineTool.DrawMode.Circle: { if (_PLTInactiveButPropOrTreeActive) { if (m_wasPLTActive == true) { PropLineTool.m_keepActiveState = true; } else { if (pendingReset) { PropLineTool.m_keepActiveState = false; } else //do not reset { PropLineTool.m_keepActiveState = true; } } m_resetCounterExpired = false; m_resetCounterActive = false; //continue along (no "return;" on this line) if (_propTool != null) { PropInfo oldPropInfo = _propTool.m_prefab; PropLineTool newPropLineTool = ToolsModifierControl.SetTool <PropLineTool>(); //PropLineTool.objectMode = PropLineTool.ObjectMode.Props; if (oldPropInfo == null) { Debug.LogError("[PLT]: ToolSwitch: PropTool prop prefab is null!"); return; } newPropLineTool.propPrefab = oldPropInfo; //calling after setting prefab PropLineTool.objectMode = PropLineTool.ObjectMode.Props; //new as of 190809 FindBrushPanel(); if (m_brushPanelFound) { m_brushPanel.Hide(); } return; } if (_treeTool != null) { TreeInfo oldTreeInfo = _treeTool.m_prefab; PropLineTool newPropLineTool = ToolsModifierControl.SetTool <PropLineTool>(); //PropLineTool.objectMode = PropLineTool.ObjectMode.Trees; if (oldTreeInfo == null) { Debug.LogError("[PLT]: ToolSwitch: TreeTool tree prefab is null!"); return; } newPropLineTool.treePrefab = oldTreeInfo; //calling after setting prefab PropLineTool.objectMode = PropLineTool.ObjectMode.Trees; //new as of 190809 FindBrushPanel(); if (m_brushPanelFound) { m_brushPanel.Hide(); } return; } } else if (_PLTActiveExclusive) { if ((_propLineTool.propPrefab == null) && (_propLineTool.treePrefab == null)) { Debug.LogError("[PLT]: ToolSwitch: PropLineTool prop and tree prefabs are null!"); } return; } break; } default: { Debug.LogError("[PLT]: ToolSwitch: Draw Mode is out of bounds!"); return; } } //safety-net return Debug.LogError("[PLT]: Reached safety-net return of ToolSwitch.SwitchTools"); return; }
public override void OnAfterSimulationTick() { if (!V10Bulldoze.active || c++ < V10Bulldoze.ui.data.interval) return; c = 0; if (!V10Bulldoze.ui.data.abandoned && !V10Bulldoze.ui.data.burned) return; if (simulationManager == null) { simulationManager = SimulationManager.instance; bulldozeTool = GameObject.FindObjectOfType<BulldozeTool> (); method = bulldozeTool.GetType ().GetMethod ("DeleteBuilding", BindingFlags.NonPublic | BindingFlags.Instance); } if (V10Bulldoze.ui.data.abandoned) checkBuildings (SkylinesOverwatch.Data.Instance.BuildingsAbandoned); if (V10Bulldoze.ui.data.burned && c2 <= V10Bulldoze.ui.data.max) { ushort [] toCheck = SkylinesOverwatch.Data.Instance.BuildingsBurnedDown; if (V10Bulldoze.ui.data.service) toCheck = toCheck.Except (SkylinesOverwatch.Data.Instance.PlayerBuildings).ToArray (); checkBuildings (toCheck); } c2 = 0; }
/// <summary> /// Initializes a new instance of the <see cref="BulldozeToolDeleteBuilding"/> class. /// </summary> public BulldozeToolDeleteBuilding() { this.bulldozeTool = GameObject.FindObjectOfType <BulldozeTool>(); }
/// <summary> /// The BulldozeTool.DeleteBuilding method signature. /// </summary> /// <param name="bulldozeTool">The bulldoze tool.</param> /// <param name="building">The building.</param> /// <returns>No value.</returns> private static IEnumerator DeleteBuilding_Signature(BulldozeTool bulldozeTool, ushort building) { throw new NotImplementedException("Call to method signature"); }