public override void OnUpdate(float realTimeDelta, float simulationTimeDelta)
        {
            if (Event.current.alt && Input.GetKeyDown(KeyCode.T))
            {
                var manager = Singleton <InfoManager> .instance;
                UIView.playSoundDelegate(UIView.GetAView().defaultClickSound, 1f);

                if (manager.CurrentMode != InfoManager.InfoMode.TerrainHeight)
                {
                    BuildingTool currentTool = ToolsModifierControl.GetCurrentTool <BuildingTool>();
                    if (currentTool != null && currentTool.m_relocate != 0)
                    {
                        currentTool.CancelRelocate();
                    }
                    Singleton <InfoViewsPanel> .instance.CloseToolbar();

                    WorldInfoPanel.HideAllWorldInfoPanels();
                    if (Singleton <InfoManager> .exists)
                    {
                        m_previousMode        = manager.CurrentMode;
                        m_previousSubInfoMode = manager.CurrentSubMode;
                        Singleton <InfoManager> .instance.SetCurrentMode(InfoManager.InfoMode.TerrainHeight, InfoManager.SubInfoMode.Default);

                        Singleton <GuideManager> .instance.InfoViewUsed();
                    }
                }
                else
                {
                    Singleton <InfoViewsPanel> .instance.CloseToolbar();

                    manager.SetCurrentMode(m_previousMode, m_previousSubInfoMode);
                    Singleton <GuideManager> .instance.InfoViewUsed();
                }
            }
        }
示例#2
0
 public void Update()
 {
     try
     {
         if (ToolsModifierControl.GetCurrentTool <ToolBase>() is NetTool)
         {
             binfo = null;
             if (this.IsMetroTrack(ToolsModifierControl.GetCurrentTool <NetTool>().m_prefab))
             {
                 Debug.Log($"Getting {ToolsModifierControl.GetCurrentTool<NetTool>().m_prefab}");
                 this.showWindow = true;
                 this.SetNetToolPrefab();
                 //var currentTool = ToolsModifierControl.GetCurrentTool<NetTool>();
                 //var paramArgs = new List<object>();
                 //paramArgs.Add(currentTool.m_prefab);
                 //var hi = (float)typeof(NetTool).GetMethod("GetElevation").Invoke(currentTool, paramArgs.ToArray());
             }
             else
             {
                 this.showWindow = false;
             }
         }
         else if (ToolsModifierControl.GetCurrentTool <ToolBase>().GetType().Name == "NetToolFine")
         {
             binfo = null;
             if (this.IsMetroTrack((ToolsModifierControl.GetCurrentTool <ToolBase>() as NetTool).m_prefab))
             {
                 this.showWindow = true;
                 this.SetNetToolPrefab();
             }
             else
             {
                 this.showWindow = false;
             }
         }
         else if (ToolsModifierControl.GetCurrentTool <ToolBase>() is BuildingTool)
         {
             var info = (ToolsModifierControl.GetCurrentTool <ToolBase>() as BuildingTool).m_prefab;
             if (info.IsAbovegroundMetroStation())
             {
                 binfo           = info;
                 this.showWindow = true;
             }
             else
             {
                 binfo           = null;
                 this.showWindow = false;
             }
         }
         else
         {
             binfo           = null;
             this.showWindow = false;
         }
     }
     catch (Exception ex)
     {
         Debug.Log(ex);
     }
 }
示例#3
0
        private static void SetBrush(Texture2D nextBrush)
        {
            var tool       = ToolsModifierControl.GetCurrentTool <ToolBase>();
            var brushField = GetBrushField(tool);

            brushField?.SetValue(tool, nextBrush);
        }
示例#4
0
        private static Texture2D GetCurrentBrush()
        {
            var tool       = ToolsModifierControl.GetCurrentTool <ToolBase>();
            var brushField = GetBrushField(tool);

            return((Texture2D)brushField?.GetValue(tool));
        }
示例#5
0
        public override void OnUpdate(float realTimeDelta, float simulationTimeDelta)
        {
            base.OnUpdate(realTimeDelta, simulationTimeDelta);

            var newSelectedPrefab = ToolsModifierControl.GetCurrentTool <BuildingTool>()?.m_prefab;

            if (_selectedPrefab == newSelectedPrefab)
            {
                return;
            }

            if (newSelectedPrefab != null)
            {
                SegmentDataManager.Instance.SetAssetMode(true);

                Revert();
                Apply(newSelectedPrefab);
            }
            else
            {
                SegmentDataManager.Instance.SetAssetMode(false);

                Revert();
            }

            _selectedPrefab = newSelectedPrefab;
        }
 private void UpdateHeader()
 {
     if ((UnityEngine.Object)ToolsModifierControl.GetCurrentTool <TreeTool>() != (UnityEngine.Object)null)
     {
         if (!this.m_Header.isVisible)
         {
             this.ShowHeader();
         }
         if (!Singleton <TreeManager> .exists)
         {
             return;
         }
         //begin mod
         this.m_Header.text = string.Format(Locale.Get("CHIRPHEADER_TREESNPROPS"), (object)(Singleton <TreeManager> .instance.m_treeCount + Singleton <PropManager> .instance.m_propCount - SpecialPoints.CountSpecialPoints()), (object)64.ToString());
         //end mod
     }
     else if ((UnityEngine.Object)ToolsModifierControl.GetCurrentTool <PropTool>() != (UnityEngine.Object)null)
     {
         if (!this.m_Header.isVisible)
         {
             this.ShowHeader();
         }
         if (!Singleton <PropManager> .exists)
         {
             return;
         }
         //begin mod
         this.m_Header.text = string.Format(Locale.Get("CHIRPHEADER_TREESNPROPS"), (object)(Singleton <PropManager> .instance.m_propCount + Singleton <TreeManager> .instance.m_treeCount - SpecialPoints.CountSpecialPoints()), (object)64.ToString());
         //end mod
     }
     else
     {
         this.HideHeader();
     }
 }
示例#7
0
        private void ProcessKeyEvent(EventType eventType, KeyCode keyCode, EventModifiers modifiers)
        {
            if (eventType != EventType.KeyDown)
            {
                return;
            }

            var tool = ToolsModifierControl.GetCurrentTool <NodeElevationTool>();

            if (tool == null)
            {
                return;
            }
            var node = tool.m_hoveredNode;

            if (node == 0)
            {
                return;
            }
            var position = NetManager.instance.m_nodes.m_buffer[node].m_position;

            if (this.m_buildElevationUp.IsPressed(eventType, keyCode, modifiers))
            {
                NetManager.instance.m_nodes.m_buffer[node].m_position = new Vector3(position.x, position.y + 0.1f, position.z);
                NetManager.instance.UpdateNode(node, 0, 0);
            }
            else if (this.m_buildElevationDown.IsPressed(eventType, keyCode, modifiers))
            {
                NetManager.instance.m_nodes.m_buffer[node].m_position = new Vector3(position.x, position.y - 0.1f, position.z);
                NetManager.instance.UpdateNode(node, 0, 0);
            }
        }
        public void SetBrush(Texture2D brush)
        {
            var surfaceTool = ToolsModifierControl.GetCurrentTool <InGameSurfaceTool>();

            if (surfaceTool != null)
            {
                surfaceTool.m_brush = brush;
            }
        }
示例#9
0
 public new void OnPoliciesClick()
 {
     if ((Object)ToolsModifierControl.GetTool <DistrictTool>() != (Object)ToolsModifierControl.GetCurrentTool <DistrictTool>())
     {
         ToolsModifierControl.keepThisWorldInfoPanel = true;
     }
     ToolsModifierControl.mainToolbar.ShowPoliciesPanel(this.m_InstanceID.District);
     UIView.Find <UIPanel>("PoliciesPanel").Find <UITabstrip>("Tabstrip").selectedIndex = 0;
 }
示例#10
0
        void EnableIcons()
        {
            RoadCustomizerTool rct = ToolsModifierControl.GetCurrentTool <RoadCustomizerTool>();

            if (rct != null)
            {
                RoadManager.VehicleType restrictions = rct.GetCurrentVehicleRestrictions();
                float speed = rct.GetCurrentSpeedRestrictions() * 50f;

                for (int i = 0; i < this.m_scrollablePanel.components.Count; i++)
                {
                    UIButton btn = this.m_scrollablePanel.components[i] as UIButton;

                    if (this.m_panelType == Panel.VehicleRestrictions)
                    {
                        RoadManager.VehicleType vehicleType = (RoadManager.VehicleType)btn.objectUserData;

                        if ((vehicleType & restrictions) == vehicleType)
                        {
                            btn.stringUserData  = "Selected";
                            btn.normalFgSprite  = btn.name;
                            btn.focusedFgSprite = btn.name;
                            btn.hoveredFgSprite = btn.name + "90%";
                            btn.pressedFgSprite = btn.name + "80%";
                        }
                        else if (vehicleType == RoadManager.VehicleType.EmergencyVehicles && (restrictions & RoadManager.VehicleType.Emergency) == RoadManager.VehicleType.Emergency)
                        {
                            btn.stringUserData  = "Emergency";
                            btn.hoveredFgSprite = btn.name + "90%";
                            btn.pressedFgSprite = btn.name + "80%";
                            StartCoroutine("EmergencyLights", btn);
                        }
                        else
                        {
                            btn.stringUserData  = null;
                            btn.normalFgSprite  = btn.name + "Deselected";
                            btn.focusedFgSprite = btn.name + "Deselected";
                            btn.hoveredFgSprite = btn.name + "80%";
                            btn.pressedFgSprite = btn.name + "90%";
                        }
                        btn.state = UIButton.ButtonState.Normal;
                    }
                    else if (this.m_panelType == Panel.SpeedRestrictions)
                    {
                        if (Mathf.Approximately((int)btn.objectUserData, speed))
                        {
                            m_selectedIndex = i;
                        }
                    }

                    btn.isEnabled = true;
                }
            }
        }
示例#11
0
        public static T AddTool <T>()
            where T : ToolBase
        {
            var current = ToolsModifierControl.GetCurrentTool <ToolBase>(); //Assert ToolsModifierControl.CollectTools() is called
            var tool    = ToolsModifierControl.toolController.gameObject.GetComponent <T>()
                          ?? ToolsModifierControl.toolController.gameObject.AddComponent <T>();

            ToolsModifierControl.toolController.CurrentTool = current;

            return(tool);
        }
        IEnumerator SetRoadCustomizerTool()
        {
            ToolsModifierControl.SetTool <RoadCustomizerTool>();

            while (ToolsModifierControl.GetCurrentTool <RoadCustomizerTool>() != null)
            {
                yield return(new WaitForEndOfFrame());
            }

            ToolsModifierControl.SetTool <RoadCustomizerTool>();
        }
示例#13
0
        private void RoundButtonClick(UIComponent component, UIMouseEventParameter eventParam)
        {
            var instance = Loader.ToolInstance;

            if (!instance.enabled && ToolsModifierControl.GetCurrentTool <ToolBase>() is NetTool netTool)
            {
                instance.NetInfo = netTool.m_prefab;
            }

            ToolsModifierControl.SetTool <DefaultTool>();
            instance.enabled = !instance.enabled;
        }
        public new static void ForceInfoMode(InfoManager.InfoMode mode, InfoManager.SubInfoMode subMode)
        {
            var currentTool = ToolsModifierControl.GetCurrentTool <ToolBase>();

            switch (currentTool.GetType().Name)
            {
            case "BuildingTool":
            case "TreeTool":
            case "ResourceTool":
            case "DistrictTool":
            case "TransportTool":
            case "CustomTransportTool":
                if (!Util.IsInfoViewsPanelVisible())
                {
                    mode    = InfoManager.InfoMode.None;
                    subMode = InfoManager.SubInfoMode.Default;
                }
                else
                {
                    ApplyForcedMode(ref mode, ref subMode);
                }
                break;

            case "NetTool":
                if (Util.IsInfoViewsPanelVisible())
                {
                    ApplyForcedMode(ref mode, ref subMode);
                    if (mode == InfoManager.InfoMode.None)
                    {
                        mode    = InfoManager.InfoMode.Traffic;
                        subMode = InfoManager.SubInfoMode.Default;
                    }
                }
                else
                {
                    mode    = InfoManager.InfoMode.None;
                    subMode = InfoManager.SubInfoMode.Default;
                }
                break;

            default:
                break;
            }

            if (mode == InfoManager.InfoMode.None &&
                (InfoManager.InfoMode)m_forcedInfoMode.GetValue(null) == InfoManager.InfoMode.None)
            {
                return;
            }

            m_forcedInfoMode.SetValue(null, mode);
            Singleton <InfoManager> .instance.SetCurrentMode(mode, subMode);
        }
示例#15
0
        public void Update()
        {
            var tool = ToolsModifierControl.GetCurrentTool <BuildingTool>();

            if (tool?.m_prefab == null)
            {
                ModUI.Hide();
                return;
            }
            if (tool.m_prefab.name.Contains("Wild"))
            {
                ModUI.Show();
            }
        }
示例#16
0
        public void OnGUI()
        {
            var isNetTool = ToolsModifierControl.GetCurrentTool <ToolBase>() is NetTool;

            if (!isVisible && isNetTool)
            {
                Show();
                Debug.LogWarning($"{nameof(RoundButton)} - Show");
            }
            else if (isVisible && !isNetTool)
            {
                Hide();
                Debug.LogWarning($"{nameof(RoundButton)} - Hide");
            }
        }
        public override void Start()
        {
            name = "ThreeRoundButton";
            //text = "T";
            Vector2 resolution = UIView.GetAView().GetScreenResolution();
            var     pos        = new Vector2((145f), (resolution.y * 4f / 5f));
            Rect    rect       = new Rect(pos.x, pos.y, 30, 30);

            SpriteUtilities.ClampRectToScreen(ref rect, resolution);
            DebugLog.LogToFileOnly($"Setting ThreeRoundButton position to [{pos.x},{pos.y}]");
            absolutePosition = rect.position;
            Invalidate();
            //relativePosition = new Vector3((Loader.parentGuiView.fixedWidth / 2f - 450f), (Loader.parentGuiView.fixedHeight / 2f + 370f));
            //relativePosition = new Vector3((Loader.parentGuiView.fixedWidth - 70f), (Loader.parentGuiView.fixedHeight / 2 + 100f));
            atlas           = SpriteUtilities.GetAtlas(Loader.m_atlasName);
            normalBgSprite  = "3Round";
            hoveredBgSprite = "3Round_S";
            size            = new Vector2(30f, 30f);
            zOrder          = 11;
            eventClick     += delegate(UIComponent component, UIMouseEventParameter eventParam)
            {
                if (AdvancedTools.instance.enabled == false)
                {
                    //base.Hide();
                    ToolBase currentTool = ToolsModifierControl.GetCurrentTool <ToolBase>();
                    if (currentTool != null)
                    {
                        NetTool netTool = currentTool as NetTool;
                        if (netTool.m_prefab != null)
                        {
                            AdvancedTools.m_netInfo = netTool.m_prefab;
                        }
                    }
                    ToolsModifierControl.SetTool <DefaultTool>();
                    AdvancedTools.instance.enabled = true;
                    AdvancedTools.m_step           = 0;
                    AdvancedTools.rampMode         = 0;
                    AdvancedTools.height           = 0;
                }
                else
                {
                    ToolsModifierControl.SetTool <DefaultTool>();
                    AdvancedTools.instance.enabled = false;
                    AdvancedTools.m_step           = 0;
                    AdvancedTools.height           = 0;
                }
            };
        }
        public static void ToggleUI()
        {
            if (CameraPath.playBack)
            {
                DebugUtils.Log("Stopping playback");
                cameraPath.Stop();
            }
            else
            {
                CameraTool cameraTool = ToolsModifierControl.GetCurrentTool <CameraTool>();
                if (cameraTool != null)
                {
                    DebugUtils.Log("Exiting Free Camera Mode");
                    UIView.GetAView().FindUIComponent <UIButton>("Freecamera").SimulateClick();
                    mainWindow.isVisible = true;
                }
                else
                {
                    mainWindow.isVisible = !mainWindow.isVisible;
                }

                if (mainWindow.isVisible)
                {
                    DebugUtils.Log("Showing main window");
                    camera.fieldOfView = mainWindow.fovSlider.value / 2f;
                    cameraController.m_unlimitedCamera = true;
                    cameraController.m_minDistance     = 5;

                    if (EZC_fovSmoothing != null)
                    {
                        EZC_originalFovSmoothing = (bool)EZC_fovSmoothing.GetValue(EZC_config);
                        EZC_fovSmoothing.SetValue(EZC_config, false);
                    }
                }
                else
                {
                    DebugUtils.Log("Hiding main window");
                    camera.fieldOfView = originalFov;
                    cameraController.m_unlimitedCamera = unlimitedCamera;
                    cameraController.m_minDistance     = 40;

                    if (EZC_fovSmoothing != null)
                    {
                        EZC_fovSmoothing.SetValue(EZC_config, EZC_originalFovSmoothing);
                    }
                }
            }
        }
示例#19
0
        public static bool IsCrossingLineProhibited()
        {
            var currentTool = ToolsModifierControl.GetCurrentTool <ToolBase>();

            if (currentTool == null)
            {
                return(true);
            }
            var result  = true;
            var netTool = currentTool as NetTool;

            if (netTool != null)
            {
                if (!CheckNetInfo(ref netTool.m_prefab))
                {
                    result = false;
                }
            }
            else
            {
                var buildingTool = currentTool as BuildingTool;
                if (buildingTool != null)
                {
                    BuildingInfo building;
                    if (buildingTool.m_relocate == 0)
                    {
                        building = buildingTool.m_prefab;
                    }
                    else
                    {
                        building = Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingTool.m_relocate].Info;
                    }
                    if (building != null && building.m_placementMode != BuildingInfo.PlacementMode.Roadside)
                    {
                        result = CheckBuildingForZoneableRoads(building);
                    }
                }
                else
                {
                    if (currentTool is TreeTool || currentTool is DefaultTool || currentTool is DisasterTool ||
                        currentTool is PropTool || currentTool is WaterTool || currentTool is DistrictTool || currentTool is TerrainTool)
                    {
                        result = false;
                    }
                }
            }
            return(result);
        }
 private bool SupportsSingle()
 {
     //begin mod
     try
     {
         if (Plugins.SupportsSingle(ToolsModifierControl.GetCurrentTool <ToolBase>()))
         {
             return(true);
         }
     }
     catch (Exception e)
     {
         UnityEngine.Debug.LogException(e);
     }
     return(ToolsModifierControl.GetCurrentTool <PropTool>() != null || ToolsModifierControl.GetCurrentTool <TreeTool>() != null || ToolsModifierControl.GetCurrentTool <TerrainTool>() != null);
     //end mod
 }
        public void SetSize(float size, bool minSliderValue)
        {
            var surfaceTool = ToolsModifierControl.GetCurrentTool <InGameSurfaceTool>();

            if (surfaceTool != null)
            {
                surfaceTool.m_brushSize = size;
                if (minSliderValue)
                {
                    surfaceTool.m_mode = InGameSurfaceTool.Mode.Single;
                }
                else
                {
                    surfaceTool.m_mode = InGameSurfaceTool.Mode.Brush;
                }
            }
        }
        private void SetBrushSize(float val)
        {
            var brushSizeSlider =
                (UISlider)typeof(BrushOptionPanel).GetField("m_BrushSizeSlider", BindingFlags.NonPublic | BindingFlags.Instance)
                .GetValue(this);

            PropTool currentTool1 = ToolsModifierControl.GetCurrentTool <PropTool>();

            if ((UnityEngine.Object)currentTool1 != (UnityEngine.Object)null)
            {
                currentTool1.m_brushSize = val;
                currentTool1.m_mode      = (double)currentTool1.m_brushSize != (double)brushSizeSlider.minValue ? PropTool.Mode.Brush : PropTool.Mode.Single;
            }
            TerrainTool currentTool2 = ToolsModifierControl.GetCurrentTool <TerrainTool>();

            //begin mod
            if ((UnityEngine.Object)currentTool2 != (UnityEngine.Object)null)
            {
                currentTool2.m_brushSize     = val;
                TerrainToolDetour.m_sizeMode = (double)currentTool2.m_brushSize != (double)brushSizeSlider.minValue ? TerrainToolDetour.SizeMode.Brush : TerrainToolDetour.SizeMode.Single;
            }
            //end mod
            TreeTool currentTool3 = ToolsModifierControl.GetCurrentTool <TreeTool>();

            if ((UnityEngine.Object)currentTool3 != (UnityEngine.Object)null)
            {
                currentTool3.m_brushSize = val;
                currentTool3.m_mode      = (double)currentTool3.m_brushSize != (double)brushSizeSlider.minValue ? TreeTool.Mode.Brush : TreeTool.Mode.Single;
            }
            ResourceTool currentTool4 = ToolsModifierControl.GetCurrentTool <ResourceTool>();

            if ((UnityEngine.Object)currentTool4 != (UnityEngine.Object)null)
            {
                currentTool4.m_brushSize = val;
            }
            //begin mod
            try
            {
                Plugins.SetSize(val, val == (double)brushSizeSlider.minValue);
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogException(e);
            }
            //end mod
        }
示例#23
0
        public new float SampleDetailHeight(Vector3 worldPos, out float slopeX, out float slopeZ)
        {
            var num = (float)(SampleDetailHeight((float)(worldPos.x / 4.0 + 2160.0), (float)(worldPos.z / 4.0 + 2160.0), out slopeX, out slopeZ) * (1.0 / 64.0));

            if (ToolsModifierControl.GetCurrentTool <TreeTool>() != null ||
                ToolsModifierControl.GetCurrentTool <PropTool>() != null)
            {
                slopeX = 0;
                slopeZ = 0;
            }
            else
            {
                slopeX = (float)(slopeX * (1.0 / 256.0));
                slopeZ = (float)(slopeZ * (1.0 / 256.0));
            }
            return(num);
        }
        public new bool CheckLimits()
        {
            //begin mod
            if (BuildingDecorationDetour.DisableLimits)
            {
                return(true);
            }
            var propTool = ToolsModifierControl.GetCurrentTool <PropTool>();

            if (propTool != null)
            {
                var pointType = SpecialPoints.GetSpecialPointType(propTool.m_prefab);
                if (pointType != SpecialPointType.Unknown)
                {
                    if (!Panel.specialPointTypeCount.TryGetValue(pointType, out var pointTypeCount))
                    {
                        pointTypeCount = 9999;
                    }
                    return(pointTypeCount < SpecialPoints.GetMaxNumberOfPoints(ToolsModifierControl.toolController.m_editPrefabInfo as BuildingInfo, pointType));
                }
            }
            //end mod
            ItemClass.Availability availability = Singleton <ToolManager> .instance.m_properties.m_mode;
            if ((availability & ItemClass.Availability.MapEditor) != ItemClass.Availability.None)
            {
                if (this.m_propCount >= 50000)
                {
                    return(false);
                }
            }
            else if ((availability & ItemClass.Availability.AssetEditor) != ItemClass.Availability.None)
            {
                //begin mod
                if (this.m_propCount + Singleton <TreeManager> .instance.m_treeCount >= 64 + SpecialPoints.CountSpecialPoints())
                {
                    return(false);
                }
                //end mod
            }
            else if (this.m_propCount >= 65531)
            {
                return(false);
            }
            return(true);
        }
示例#25
0
        public static void AfterTerrainUpdated(ref PropInstance prop, ushort propID, float minX, float minZ, float maxX, float maxZ)
        {
            if (((int)prop.m_flags & 3) != 1 || ((int)prop.m_flags & 32) != 0)
            {
                return;
            }
            Vector3 position = prop.Position;

            position.y = Singleton <TerrainManager> .instance.SampleDetailHeight(position);

            ushort num = (ushort)Mathf.Clamp(Mathf.RoundToInt(position.y * 64f), 0, (int)ushort.MaxValue);

            if ((int)num == (int)prop.m_posY)
            {
                return;
            }
            bool blocked1 = prop.Blocked;

            //begin mod
            if (ToolsModifierControl.GetCurrentTool <TerrainTool>() == null || OptionsWrapper <Options> .Options.dontUpdateYOnTerrainModification)
            {
                prop.m_posY = (OptionsWrapper <Options> .Options.allowToSubmerge || prop.m_posY > num) ? prop.m_posY : num;
            }
            else
            {
                prop.m_posY = num;
            }
            //end mod
            bool blocked2 = prop.Blocked;

            if (blocked2 != blocked1)
            {
                Singleton <PropManager> .instance.UpdateProp(propID);
            }
            else
            {
                if (blocked2)
                {
                    return;
                }
                Singleton <PropManager> .instance.UpdatePropRenderer(propID, true);
            }
        }
示例#26
0
        protected override void OnButtonClicked(int index)
        {
            if (index >= 0 && index < this.m_buttonToResource.Length)
            {
                index = this.m_buttonToResource[index];
            }
            if (index >= 0 && index < kResources.Length)
            {
                var currentTool = ToolsModifierControl.GetCurrentTool <ToolBase>();
                if (currentTool != null && (currentTool is NetTool || currentTool is BuildingTool || currentTool is DistrictTool ||
                                            currentTool is TreeTool || currentTool is ResourceTool))
                {
                    ToolBaseDetour.ForceMode(kResources[index].enumValue, InfoManager.SubInfoMode.Default);
                }
                else
                {
                    ToolBaseDetour.ResetForceMode();
                    this.CloseToolbar();
                    WorldInfoPanel.HideAllWorldInfoPanels();
                    if (!Singleton <InfoManager> .exists)
                    {
                        return;
                    }
                    Singleton <InfoManager> .instance.SetCurrentMode(kResources[index].enumValue, InfoManager.SubInfoMode.Default);

                    Singleton <GuideManager> .instance.InfoViewUsed();
                }
            }
            else
            {
                ToolBaseDetour.ResetForceMode();
                this.CloseToolbar();
                if (!Singleton <InfoManager> .exists)
                {
                    return;
                }
                Singleton <InfoManager> .instance.SetCurrentMode(InfoManager.InfoMode.None, InfoManager.SubInfoMode.Default);

                Singleton <GuideManager> .instance.InfoViewUsed();
            }
        }
        public new FastList <ushort> GetServiceBuildings(ItemClass.Service service)
        {
            int publicServiceIndex = ItemClass.GetPublicServiceIndex(service);
            //begin mod
            var tool       = ToolsModifierControl.GetCurrentTool <BuildingTool>();
            var buildingAi = tool?.m_prefab?.m_buildingAI;

            if (buildingAi != null && (buildingAi is MonumentAI || buildingAi.IsWonder() || buildingAi is IndustryBuildingAI))
            {
                if (buildingAi.IsWonder() || service == ItemClass.Service.Monument || buildingAi is IndustryBuildingAI)
                {
                    return(new FastList <ushort>());
                }
            }
            //end mod
            if (publicServiceIndex != -1)
            {
                return(this.m_serviceBuildings[publicServiceIndex]);
            }
            return((FastList <ushort>)null);
        }
示例#28
0
        void Update()
        {
            //FineRoadHeightsLoadingExtension.ReplacePanels();
            NetTool netTool = ToolsModifierControl.GetCurrentTool <NetTool>();

            if (netTool == null)
            {
                return;
            }
            NetToolFine netToolFine = ToolsModifierControl.SetTool <NetToolFine>();

            if (netToolFine == null)
            {
                return;
            }
            netToolFine.m_mode            = netTool.m_mode;
            netToolFine.m_placementCursor = netTool.m_placementCursor;
            netToolFine.m_prefab          = netTool.m_prefab;
            netToolFine.m_snap            = netTool.m_snap;
            netToolFine.m_upgradeCursor   = netTool.m_upgradeCursor;
        }
示例#29
0
 public void OnGUI()
 {
     //base.Update();
     if (!isVisible)
     {
         ToolBase currentTool = ToolsModifierControl.GetCurrentTool <ToolBase>();
         if ((currentTool != null) && (currentTool is NetTool))
         {
             //DebugLog.LogToFileOnly("try show");
             Show();
         }
     }
     else
     {
         ToolBase currentTool = ToolsModifierControl.GetCurrentTool <ToolBase>();
         if (!((currentTool != null) && (currentTool is NetTool)))
         {
             Hide();
         }
     }
 }
示例#30
0
        void Update()
        {
            if (!m_initialized)
            {
                TryReplacePrefabs();
                return;
            }

            // contributed by Japa
            if (CustomTransportTool.sm_initialized && Singleton <LoadingManager> .instance.m_loadingComplete)
            {
                TransportTool transportTool = ToolsModifierControl.GetCurrentTool <TransportTool>();
                if (transportTool != null)
                {
                    CustomTransportTool customTransportTool = ToolsModifierControl.SetTool <CustomTransportTool>();
                    if (customTransportTool != null)
                    {
                        customTransportTool.m_prefab = transportTool.m_prefab;
                    }
                }
            }
        }