コード例 #1
0
        public void Close()
        {
            if (LoadingExtension.Instance != null)
            {
                var uiView         = UIView.GetAView();
                var trafficManager = uiView.FindUIComponent("UITrafficManager");
                if (trafficManager != null)
                {
                    Log._Debug("Hiding TM UI");
                    trafficManager.Hide();
                }
                else
                {
                    Log._Debug("Hiding TM UI: null!");
                }

                UITrafficManager.deactivateButtons();
                TrafficManagerTool.SetToolMode(ToolMode.None);
                LoadingExtension.Instance.SetToolMode(TrafficManagerMode.None);

                _uiShown = false;
            }
            else
            {
                Log._Debug("TM UI Close: LoadingExtension.Instance is null!");
            }
        }
        internal void RebuildMenu()
        {
            Close();
            if (menu != null)
            {
                UnityEngine.Object.Destroy(menu);
            }
            var uiView = UIView.GetAView();

            menu = (UITrafficManager)uiView.AddUIComponent(typeof(UITrafficManager));
        }
        public void Close()
        {
            var uiView = UIView.GetAView();

            GetMenu().Hide();

            UITrafficManager.deactivateButtons();
            TrafficManagerTool.SetToolMode(ToolMode.None);
            LoadingExtension.SetToolMode(TrafficManagerMode.None);
            _uiShown = false;
            button.UpdateSprites();
        }
        public UIBase()
        {
            Log._Debug("##### Initializing UIBase.");

            // Get the UIView object. This seems to be the top-level object for most
            // of the UI.
            var uiView = UIView.GetAView();

            // Add a new button to the view.
            button = (UIMainMenuButton)uiView.AddUIComponent(typeof(UIMainMenuButton));

            // add the menu
            menu = (UITrafficManager)uiView.AddUIComponent(typeof(UITrafficManager));
        }
コード例 #5
0
        public void Close()
        {
            if (LoadingExtension.Instance != null)
            {
                var uiView         = UIView.GetAView();
                var trafficManager = uiView.FindUIComponent("UITrafficManager");

                if (trafficManager != null)
                {
                    Destroy(trafficManager);
                }

                UITrafficManager.deactivateButtons();
                TrafficLightTool.SetToolMode(ToolMode.None);
                LoadingExtension.Instance.SetToolMode(TrafficManagerMode.None);

                _uiShown = false;
            }
        }
        public static void SetToolMode(ToolMode mode)
        {
            //Log._Debug($"SetToolMode: {mode}");

            if (mode == ToolMode.None)
            {
#if !TAM
                UITrafficManager.deactivateButtons();
#endif
            }

            bool toolModeChanged = (mode != _toolMode);
            if (toolModeChanged && activeSubTool != null)
            {
                if ((_toolMode == ToolMode.TimedLightsSelectNode || _toolMode == ToolMode.TimedLightsShowLights || _toolMode == ToolMode.TimedLightsAddNode || _toolMode == ToolMode.TimedLightsRemoveNode))                   // TODO refactor to SubToolMode
                {
                    if (mode != ToolMode.TimedLightsSelectNode && mode != ToolMode.TimedLightsShowLights && mode != ToolMode.TimedLightsAddNode && mode != ToolMode.TimedLightsRemoveNode)
                    {
                        activeSubTool.Cleanup();
                    }
                }
                else
                {
                    activeSubTool.Cleanup();
                }
            }
            _toolMode = mode;

            SelectedNodeId    = 0;
            SelectedSegmentId = 0;

            activeSubTool = null;
            //Log._Debug($"Getting activeSubTool for mode {_toolMode} {subTools.Count}");
            activeSubTool = subTools[(int)_toolMode];
            //subTools.TryGetValue((int)_toolMode, out activeSubTool);
            //Log._Debug($"activeSubTool is now {activeSubTool}");

            if (toolModeChanged && activeSubTool != null)
            {
                activeSubTool.OnActivate();
            }
        }