private void Start()
        {
            EnsureUIComponentsLayout();

            cameraPath       = gameObject.AddComponent <CameraPath>();
            camera           = GameObject.Find("Main Camera").GetComponent <Camera>();
            cameraController = camera.GetComponent <CameraController>();

            unlimitedCamera = cameraController.m_unlimitedCamera;

            m_notificationAlpha = typeof(NotificationManager).GetField("m_notificationAlpha", BindingFlags.NonPublic | BindingFlags.Instance);


            if (mainButton == null)
            {
                UIView view = UIView.GetAView();
                mainButton = view.AddUIComponent(typeof(UIMainButton)) as UIMainButton;
                mainWindow = view.AddUIComponent(typeof(UIMainWindow)) as UIMainWindow;
            }

            try
            {
                EZC_config       = Type.GetType("EnhancedZoomContinued.EnhancedZoom, EnhancedZoom").GetField("config", BindingFlags.Public | BindingFlags.Static).GetValue(null);
                EZC_fovSmoothing = EZC_config.GetType().GetField("fovSmoothing");
            }
            catch { }
        }
 public static void SetupThreeRoundButton()
 {
     if (threeRoundButton == null)
     {
         threeRoundButton = (parentGuiView.AddUIComponent(typeof(ThreeRoundButton)) as ThreeRoundButton);
     }
 }
Beispiel #3
0
        public MainPanel()
        {
            UIView uiView = UIView.GetAView();

            dialog = uiView.AddUIComponent(typeof(DropdownDialog)) as DropdownDialog;
            dialog.Hide();

            placeSignBtn = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            placeSignBtn.text              = "DB";
            placeSignBtn.width             = 75;
            placeSignBtn.height            = 30;
            placeSignBtn.normalBgSprite    = "ButtonMenu";
            placeSignBtn.disabledBgSprite  = "ButtonMenuDisabled";
            placeSignBtn.hoveredBgSprite   = "ButtonMenuHovered";
            placeSignBtn.focusedBgSprite   = "ButtonMenuFocused";
            placeSignBtn.pressedBgSprite   = "ButtonMenuPressed";
            placeSignBtn.textColor         = new Color32(255, 255, 255, 255);
            placeSignBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            placeSignBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            placeSignBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            placeSignBtn.pressedTextColor  = new Color32(30, 30, 44, 255);
            placeSignBtn.eventClick       += propSelectorToolBtn_eventClick;
            placeSignBtn.relativePosition  = new Vector3(30, 60);

            propSelectorTool = ToolsModifierControl.toolController.gameObject.AddComponent <PropSelectorTool>();

            ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>();
            ToolsModifierControl.SetTool <DefaultTool>();

            propSelectorTool.dialog = dialog;
        }
Beispiel #4
0
        internal void RebuildMenu()
        {
            Close();

            if (MainMenu != null)
            {
                CustomKeyHandler keyHandler = MainMenu.GetComponent <CustomKeyHandler>();
                if (keyHandler != null)
                {
                    UnityEngine.Object.Destroy(keyHandler);
                }

                UnityEngine.Object.Destroy(MainMenu);
#if DEBUG
                UnityEngine.Object.Destroy(DebugMenu);
#endif
            }

            UIView uiView = UIView.GetAView();
            MainMenu = (MainMenuPanel)uiView.AddUIComponent(typeof(MainMenuPanel));
            MainMenu.gameObject.AddComponent <CustomKeyHandler>();
#if DEBUG
            DebugMenu = (DebugMenuPanel)uiView.AddUIComponent(typeof(DebugMenuPanel));
#endif
        }
Beispiel #5
0
 public static void SetupEcnomicButton()
 {
     if (EcButton == null)
     {
         EcButton = (parentGuiView.AddUIComponent(typeof(EcnomicButton)) as EcnomicButton);
     }
     EcButton.Show();
 }
Beispiel #6
0
        public void CreateDebugUI()
        {
            if (_rootView == null)
            {
                Load();
            }

            _debugUi = _rootView.AddUIComponent(typeof(DebugUI)) as DebugUI;
        }
Beispiel #7
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            base.OnLevelLoaded(mode);

            if (MultiplayerManager.Instance.CurrentRole == MultiplayerRole.Client)
            {
                MultiplayerManager.Instance.CurrentClient.Status = ClientStatus.Connected;
                Command.SendToServer(new ClientLevelLoadedCommand());
            }

            UIView uiView = UIView.GetAView();

            // Add the chat log
            uiView.AddUIComponent(typeof(ChatLogPanel));

            _multiplayerButton = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            _multiplayerButton.text   = "Multiplayer";
            _multiplayerButton.width  = 150;
            _multiplayerButton.height = 40;

            _multiplayerButton.normalBgSprite    = "ButtonMenu";
            _multiplayerButton.disabledBgSprite  = "ButtonMenuDisabled";
            _multiplayerButton.hoveredBgSprite   = "ButtonMenuHovered";
            _multiplayerButton.focusedBgSprite   = "ButtonMenuFocused";
            _multiplayerButton.pressedBgSprite   = "ButtonMenuPressed";
            _multiplayerButton.textColor         = new Color32(255, 255, 255, 255);
            _multiplayerButton.disabledTextColor = new Color32(7, 7, 7, 255);
            _multiplayerButton.hoveredTextColor  = new Color32(7, 132, 255, 255);
            _multiplayerButton.focusedTextColor  = new Color32(255, 255, 255, 255);
            _multiplayerButton.pressedTextColor  = new Color32(30, 30, 44, 255);

            // Enable button sounds.
            _multiplayerButton.playAudioEvents = true;

            // Place the button.
            _multiplayerButton.transformPosition = new Vector3(-1.45f, 0.97f);

            // Respond to button click.
            _multiplayerButton.eventClick += (component, param) =>
            {
                ConnectionPanel panel = uiView.FindUIComponent <ConnectionPanel>("MPConnectionPanel");

                if (panel != null)
                {
                    panel.isVisible = !panel.isVisible;
                }
                else
                {
                    uiView.AddUIComponent(typeof(ConnectionPanel));
                }

                _multiplayerButton.Unfocus();
            };
        }
        void CreateButtons()
        {
            UIView uiView = UIView.GetAView();

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

            // Set the text to show on the button.
            button.text = "Level";
            // Set the button dimensions.
            button.width  = 150;
            button.height = 40;
            // Style the button to look like a menu button.
            button.normalBgSprite    = "ButtonMenu";
            button.disabledBgSprite  = "ButtonMenuDisabled";
            button.hoveredBgSprite   = "ButtonMenuHovered";
            button.focusedBgSprite   = "ButtonMenuFocused";
            button.pressedBgSprite   = "ButtonMenuPressed";
            button.textColor         = new Color32(255, 255, 255, 255);
            button.disabledTextColor = new Color32(7, 7, 7, 255);
            button.hoveredTextColor  = new Color32(7, 132, 255, 255);
            button.focusedTextColor  = new Color32(255, 255, 255, 255);
            button.pressedTextColor  = new Color32(30, 30, 44, 255);
            // Place the button.
            button.transformPosition = new Vector3(-1.65f, 0.97f);
            button.eventClick       += toggleQueryTool;

            UIButton button2 = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            // Set the text to show on the button.
            button2.text = "Shift";
            // Set the button2 dimensions.
            button2.width  = 150;
            button2.height = 40;
            // Style the button2 to look like a menu button2.
            button2.normalBgSprite    = "ButtonMenu";
            button2.disabledBgSprite  = "ButtonMenuDisabled";
            button2.hoveredBgSprite   = "ButtonMenuHovered";
            button2.focusedBgSprite   = "ButtonMenuFocused";
            button2.pressedBgSprite   = "ButtonMenuPressed";
            button2.textColor         = new Color32(255, 255, 255, 255);
            button2.disabledTextColor = new Color32(7, 7, 7, 255);
            button2.hoveredTextColor  = new Color32(7, 132, 255, 255);
            button2.focusedTextColor  = new Color32(255, 255, 255, 255);
            button2.pressedTextColor  = new Color32(30, 30, 44, 255);
            // Place the button2.
            button2.transformPosition = new Vector3(-1.45f, 0.97f);
            button2.eventClick       += toggleQueryTool2;
        }
Beispiel #9
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            // do base processing
            base.OnLevelLoaded(mode);

            try
            {
                // check for new or loaded game
                if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame || mode == LoadMode.NewGameFromScenario)
                {
                    // destroy the panel if a previous instance exists
                    if (GameDayTimer.Panel != null)
                    {
                        UnityEngine.Object.Destroy(GameDayTimer.Panel);
                    }

                    // create a new GameDayTimerPanel which will trigger the panel's Start event
                    UIView v = UIView.GetAView();
                    GameDayTimer.Panel = (GameDayTimerPanel)v.AddUIComponent(typeof(GameDayTimerPanel));
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
        public override void OnLevelLoaded(LoadMode mode)
        {
            //only start loading in asset editor
            if (mode == LoadMode.LoadAsset || mode == LoadMode.NewAsset)
            {
                inAssetEditor = true;
                UIView      v   = UIView.GetAView();
                UIComponent uic = v.AddUIComponent(typeof(NetDumpPanel));

                NetDumpPanel.instance.Show();    //extra needed to intialize
                RoadExtrasAlert.instance.Show(); //init

                GameObject.FindObjectOfType <ToolController>().eventEditPrefabChanged += (info) =>
                {
                    if (info.GetType().ToString() == "NetInfo")
                    {
                        var texQual = typeof(OptionsGraphicsPanel).GetField("m_TexturesQuality", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(Singleton <OptionsGraphicsPanel> .instance) as SavedInt;
                        if (texQual.value != 2)
                        {
                            Lib.ExtraUtils.ShowAlertWindow("Network Dump Tools", "Warning: \"Texture Quality\" in the vanilla options is not set to high, change to dump textures at full resolution");
                        }
                        NetDumpPanel.instance.Show();
                    }
                    else
                    {
                        NetDumpPanel.instance.Hide();
                        Debug.Log("not NetInfo");
                    }
                };
            }
            else
            {
                inAssetEditor = false;
            }
        }
Beispiel #11
0
        private void BtnClickedEcoStats(UIComponent component, UIMouseEventParameter eventParam)
        {
            statsShown = !statsShown;

            if (statsShown)
            {
                lblCityStats = (UILabel)boxUIView.AddUIComponent(typeof(UILabel));

                stats = new Stats();
                //DebugOutputPanel.AddMessage(ColossalFramework.Plugins.PluginManager.MessageType.Message, "Eco Stats: \n" + stats);

                var uiView = GameObject.FindObjectOfType <UIView>();
                if (uiView == null)
                {
                    return;
                }

                lblCityStats.text = stats.ToString();
                lblCityStats.transformPosition = new Vector3(1f, 0.88f);
                lblCityStats.SendToBack();
            }
            else
            {
                UIView.DestroyImmediate(lblCityStats);
            }
        }
        private void CreateBannerUI()
        {
            // create UI using ColossalFramework UI classes
            UIView uiv = UIView.GetAView();

            if (uiv == null)
            {
                return;
            }

            theBannerPanel = (BannerPanel)uiv.AddUIComponent(typeof(BannerPanel));

            if (theBannerPanel != null)
            {
                //theBannerPanel.ScrollSpeed = CurrentConfig.ScrollSpeed;
                //byte bAlpha = (byte)(ushort)(255f * CurrentConfig.BackgroundAlpha);

                //theBannerPanel.BackgroundColor = new Color32(0, 0, 0, bAlpha);
                //theBannerPanel.FontSize = CurrentConfig.TextSize;
                theBannerPanel.Initialize();

                // add mouse click handler to us here
                //theBannerPanel.eventClick += BannerPanel_eventClick;
                theBannerPanel.eventMouseUp += BannerPanel_eventMouseUp;
            }
        }
Beispiel #13
0
        public MainPanel()
        {
            UIView uiView = UIView.GetAView();

            markRouteBtn = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            markRouteBtn.text              = "Mark a Route";
            markRouteBtn.width             = 150;
            markRouteBtn.height            = 30;
            markRouteBtn.normalBgSprite    = "ButtonMenu";
            markRouteBtn.disabledBgSprite  = "ButtonMenuDisabled";
            markRouteBtn.hoveredBgSprite   = "ButtonMenuHovered";
            markRouteBtn.focusedBgSprite   = "ButtonMenuFocused";
            markRouteBtn.pressedBgSprite   = "ButtonMenuPressed";
            markRouteBtn.textColor         = new Color32(255, 255, 255, 255);
            markRouteBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            markRouteBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            markRouteBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            markRouteBtn.pressedTextColor  = new Color32(30, 30, 44, 255);
            markRouteBtn.eventClick       += markRouteBtn_eventClick;
            markRouteBtn.relativePosition  = new Vector3(180f, 60f);

            ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>();
            ToolsModifierControl.SetTool <DefaultTool>();
        }
Beispiel #14
0
        public NLT_UIBase()
        {
            UIView view = UIView.GetAView();

            UIButton button = (UIButton)view.AddUIComponent(typeof(UIButton));

            button.text   = "Test";
            button.height = 30;
            button.width  = 150;

            // Style the button to look like a menu button.
            button.normalBgSprite    = "ButtonMenu";
            button.disabledBgSprite  = "ButtonMenuDisabled";
            button.hoveredBgSprite   = "ButtonMenuHovered";
            button.focusedBgSprite   = "ButtonMenuFocused";
            button.pressedBgSprite   = "ButtonMenuPressed";
            button.textColor         = new Color32(255, 255, 255, 255);
            button.disabledTextColor = new Color32(7, 7, 7, 255);
            button.hoveredTextColor  = new Color32(7, 132, 255, 255);
            button.focusedTextColor  = new Color32(255, 255, 255, 255);
            button.pressedTextColor  = new Color32(30, 30, 44, 255);

            // Enable button sounds.
            button.playAudioEvents = true;

            // Place the button.
            button.relativePosition = new Vector3(180f, 20f);
        }
        public void Init()
        {
            uiView = UIView.GetAView();

            UICheckBox autosaveCheckbox = uiView.FindUIComponent<UICheckBox>("AutoSave");
            UITextField autosaveIntervalTextField = uiView.FindUIComponent<UITextField>("AutoSaveInterval");

            autosaveCheckbox.eventClicked += new MouseEventHandler(CheckBoxChanged);
            autosaveIntervalTextField.eventTextSubmitted += new PropertyChangedEventHandler<string>(IntervalChanged);

            createLabel();

            bAutosaveEnabled = autosaveCheckbox.isChecked;
            autoSaveInterval = int.Parse(autosaveIntervalTextField.text);

            timer = autoSaveInterval * 60;

            label.Enable();

            updateLabel(bAutosaveEnabled, (int)timer);

            hintLabel = uiView.AddUIComponent(typeof(UILabel)) as UILabel;
            hintLabel.name = "AutoSaveCountdownPlacementHint";
            hintLabel.text = "Press ENTER to finish placement.";
            hintLabel.textColor = Color.white;
            hintLabel.relativePosition = new Vector2(0, 0);
            hintLabel.anchor = UIAnchorStyle.Top;
            hintLabel.textScale = 2f;
            hintLabel.Hide();
        }
Beispiel #16
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            boxUIView   = UIView.GetAView();
            btnEcoStats = (UIButton)boxUIView.AddUIComponent(typeof(UIButton));

            var uiView = GameObject.FindObjectOfType <UIView>();

            if (uiView == null)
            {
                return;
            }

            btnEcoStats.width  = 125;
            btnEcoStats.height = 30;

            btnEcoStats.normalBgSprite  = "ButtonMenu";
            btnEcoStats.hoveredBgSprite = "ButtonMenuHovered";
            btnEcoStats.focusedBgSprite = "ButtonMenuFocused";
            btnEcoStats.pressedBgSprite = "ButtonMenuPressed";

            btnEcoStats.textColor         = new Color32(186, 217, 238, 0);
            btnEcoStats.disabledTextColor = new Color32(7, 7, 7, 255);
            btnEcoStats.hoveredTextColor  = new Color32(7, 132, 255, 255);
            btnEcoStats.focusedTextColor  = new Color32(255, 255, 255, 255);
            btnEcoStats.pressedTextColor  = new Color32(30, 30, 44, 255);

            btnEcoStats.transformPosition = new Vector3(1f, 0.95f);

            btnEcoStats.text = "Eco Stats";

            btnEcoStats.eventClick += BtnClickedEcoStats;

            updateStats();
        }
        private void CreateBannerUI()
        {
            // create UI using ColossalFramework UI classes
            UIView uiv = UIView.GetAView();

            if (uiv == null)
            {
                return;
            }

            //UISprite chirpSprite = (ChirpBannerSprite)uiv.AddUIComponent (typeof(ChirpBannerSprite));

            //UIComponent parent = UIView.Find("ChirpBannerSprite");
            theBannerPanel = (BannerPanel)uiv.AddUIComponent(typeof(BannerPanel));

            if (theBannerPanel != null)
            {
                //theBannerPanel.ScrollSpeed = CurrentConfig.ScrollSpeed;
                //byte bAlpha = (byte)(ushort)(255f * CurrentConfig.BackgroundAlpha);

                //theBannerPanel.BackgroundColor = new Color32(0, 0, 0, bAlpha);
                //theBannerPanel.FontSize = CurrentConfig.TextSize;
                theBannerPanel.SendToBack();

                // Tests for overlapping:
                //theBannerPanel.CreateBannerLabel("This is a really long chirp! really chirpy chirpy!", 481516);
                //theBannerPanel.CreateBannerLabel("OMG", 123456);
                //theBannerPanel.CreateBannerLabel("OMG1222222222222233333333", 1234567);
                //theBannerPanel.CreateBannerLabel("OMG22222222222 222222  4434", 12345678);
            }
        }
        public void Init()
        {
            uiView = UIView.GetAView();

            UICheckBox  autosaveCheckbox          = uiView.FindUIComponent <UICheckBox>("AutoSave");
            UITextField autosaveIntervalTextField = uiView.FindUIComponent <UITextField>("AutoSaveInterval");

            autosaveCheckbox.eventClicked += new MouseEventHandler(CheckBoxChanged);
            autosaveIntervalTextField.eventTextSubmitted += new PropertyChangedEventHandler <string>(IntervalChanged);

            createLabel();

            bAutosaveEnabled = autosaveCheckbox.isChecked;
            autoSaveInterval = int.Parse(autosaveIntervalTextField.text);

            timer = autoSaveInterval * 60;

            label.Enable();

            updateLabel(bAutosaveEnabled, (int)timer);

            hintLabel                  = uiView.AddUIComponent(typeof(UILabel)) as UILabel;
            hintLabel.name             = "AutoSaveCountdownPlacementHint";
            hintLabel.text             = "Press ENTER to finish placement.";
            hintLabel.textColor        = Color.white;
            hintLabel.relativePosition = new Vector2(0, 0);
            hintLabel.anchor           = UIAnchorStyle.Top;
            hintLabel.textScale        = 2f;
            hintLabel.Hide();
        }
Beispiel #19
0
        private static T ShowPanel <T>(bool toggle) where T : UIComponent
        {
            if (!_uiView)
            {
                _uiView = UIView.GetAView();
            }

            string name  = typeof(T).Name;
            T      panel = _uiView.FindUIComponent <T>(name);

            if (panel)
            {
                if (toggle)
                {
                    panel.isVisible = !panel.isVisible;
                }
                else
                {
                    panel.isVisible = true;
                }
            }
            else
            {
                panel      = (T)_uiView.AddUIComponent(typeof(T));
                panel.name = name;
            }
            panel.Focus();

            return(panel);
        }
        /// <summary>
        /// Called from Options and Options-Maintenance tab, when features and options changed,
        /// which might require rebuilding the main menu buttons.
        /// </summary>
        internal void RebuildMenu()
        {
            CloseMainMenu();

            if (MainMenu != null)
            {
                CustomKeyHandler keyHandler = MainMenu.GetComponent <CustomKeyHandler>();
                if (keyHandler != null)
                {
                    UnityEngine.Object.Destroy(keyHandler);
                }

                UnityEngine.Object.Destroy(MainMenu);
                UnityEngine.Object.Destroy(MainMenuButton);
                MainMenu       = null;
                MainMenuButton = null;
#if DEBUG
                UnityEngine.Object.Destroy(DebugMenu);
                DebugMenu = null;
#endif
            }

            CreateMainMenuButtonAndWindow();
#if DEBUG
            UIView uiView = UIView.GetAView();
            DebugMenu = (DebugMenuPanel)uiView.AddUIComponent(typeof(DebugMenuPanel));
#endif
        }
Beispiel #21
0
 public static void SetupGui()
 {
     //if(Mod.IsEnabled && Mod.IsGuiEnabled)
     if (Mod.DEBUG_LOG_ON)
     {
         Helper.dbgLog(" Setting up Gui panel.");
     }
     try
     {
         parentGuiView = null;
         parentGuiView = UIView.GetAView();
         if (guiPanel == null)
         {
             guiPanel = (CSLShowMoreLimitsGUI)parentGuiView.AddUIComponent(typeof(CSLShowMoreLimitsGUI));
             if (Mod.DEBUG_LOG_ON)
             {
                 Helper.dbgLog(" GUI Setup.");
             }
             //guiPanel.Hide();
         }
         isGuiRunning = true;
     }
     catch (Exception ex)
     {
         Helper.dbgLog("Error: \r\n", ex, true);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="OnScreenDisplayPanel"/> class.
        /// Constructs the empty OSD panel and hides it.
        /// </summary>
        /// <param name="parent">The parent panel to attach to</param>
        public OnScreenDisplayPanel(UxLibrary uxmod)
        {
            uxmod_ = uxmod;

            UIView uiView = UIView.GetAView();

            items_ = new List <OsdItem>();

            thisPanel_                  = (OsdUnityUiPanel)uiView.AddUIComponent(typeof(OsdUnityUiPanel));
            thisPanel_.name             = UxLibrary.UXMOD_PANEL_NAME;
            thisPanel_.width            = 10f;
            thisPanel_.height           = PANEL_HEIGHT;
            thisPanel_.backgroundSprite = "GenericPanel";
            thisPanel_.color            = new Color32(64, 64, 64, 240);
            thisPanel_.objectUserData   = uxmod;

            // Hide!
            osdVisible_                 = uxmod_.OsdPanelVisible.value;
            thisPanel_.isVisible        = false;
            thisPanel_.absolutePosition = new Vector3(uxmod.OsdPanelX, uxmod.OsdPanelY);

            // Setup drag
            var dragHandler = new GameObject("UXMod_OSD_DragHandler");

            dragHandler.transform.parent        = thisPanel_.transform;
            dragHandler.transform.localPosition = Vector3.zero;
            Drag         = dragHandler.AddComponent <UIDragHandle>();
            Drag.enabled = true;

            // Update();
        }
        public override void OnLevelLoaded(LoadMode mode)
        {
            // this seems to get the default UIView
            UIView v = UIView.GetAView();

            //this adds an UIComponent to the view
            uiComponent = v.AddUIComponent(typeof(LaneUIToggle));
        }
Beispiel #24
0
 public static void SetupMainButton()
 {
     if (mainButton == null)
     {
         mainButton = (parentGuiView.AddUIComponent(typeof(MainButton)) as MainButton);
     }
     mainButton.Show();
 }
Beispiel #25
0
        public UIMainPanel()
        {
            UIView uiView = UIView.GetAView();

            vehicleSelectorBtn = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            mVehicleInfoListObject            = new GameObject("RoadNamePanel");
            mVehicleInfoList                  = mVehicleInfoListObject.AddComponent <VehicleInfoList>();
            mVehicleInfoList.transform.parent = uiView.transform;
            mVehicleInfoList.Hide();

            vehicleSelectorBtn.text              = "Vehicle Selector";
            vehicleSelectorBtn.width             = 150;
            vehicleSelectorBtn.height            = 30;
            vehicleSelectorBtn.normalBgSprite    = "ButtonMenu";
            vehicleSelectorBtn.disabledBgSprite  = "ButtonMenuDisabled";
            vehicleSelectorBtn.hoveredBgSprite   = "ButtonMenuHovered";
            vehicleSelectorBtn.focusedBgSprite   = "ButtonMenuFocused";
            vehicleSelectorBtn.pressedBgSprite   = "ButtonMenuPressed";
            vehicleSelectorBtn.textColor         = new Color32(255, 255, 255, 255);
            vehicleSelectorBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            vehicleSelectorBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            vehicleSelectorBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            vehicleSelectorBtn.pressedTextColor  = new Color32(30, 30, 44, 255);
            vehicleSelectorBtn.eventClick       += VehicleSelectorBtn_eventClick;
            vehicleSelectorBtn.relativePosition  = new Vector3(330f, 20f);

            spawnMeshBtn                   = (UIButton)uiView.AddUIComponent(typeof(UIButton));
            spawnMeshBtn.text              = "Spawn Vehicle";
            spawnMeshBtn.width             = 150;
            spawnMeshBtn.height            = 30;
            spawnMeshBtn.normalBgSprite    = "ButtonMenu";
            spawnMeshBtn.disabledBgSprite  = "ButtonMenuDisabled";
            spawnMeshBtn.hoveredBgSprite   = "ButtonMenuHovered";
            spawnMeshBtn.focusedBgSprite   = "ButtonMenuFocused";
            spawnMeshBtn.textColor         = new Color32(255, 255, 255, 255);
            spawnMeshBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            spawnMeshBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            spawnMeshBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            spawnMeshBtn.eventClick       += SpawnMeshBtn_eventClick;
            spawnMeshBtn.relativePosition  = new Vector3(330f, 60f);

            EventBusManager.Instance().Subscribe("closeVehiclePanel", mVehicleInfoList);
            EventBusManager.Instance().Subscribe("closeAll", mVehicleInfoList);
        }
Beispiel #26
0
        private void AddListPanel(UIView view)
        {
            _current_Settings_Panel = (UIMusicListPanel)view.AddUIComponent(typeof(UIMusicListPanel));
            _current_Settings_Panel.Hide();

            _current_Settings_Panel.AudioWatcher    = AudioWatcher;
            _current_Settings_Panel.SettingsManager = gameObject.GetComponent <SettingsManager>();
            _current_Settings_Panel.MusicManager    = gameObject.GetComponent <MusicManager>();
        }
Beispiel #27
0
        void Awake()
        {
            instance = this;
            gameObject.AddComponent <Scoreboard>();

            UIView v = UIView.GetAView();

            m_chat = v.AddUIComponent(typeof(Chat)) as Chat;
        }
        void Start()
        {
            m_modIsEnabled = GetModEnabledState();

            UIView v = UIView.GetAView();

            m_needToRestartGamePanel = v.AddUIComponent(typeof(NeedToRestartGamePanel)) as NeedToRestartGamePanel;

            InvokeRepeating("CheckIfModGotActivated", 0, 2);
        }
Beispiel #29
0
        public UIBase()
        {
            Log._Debug("##### Initializing UIBase.");

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

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

            // add the menu
            MainMenu = (MainMenuPanel)uiView.AddUIComponent(typeof(MainMenuPanel));
            MainMenu.gameObject.AddComponent <CustomKeyHandler>();
#if DEBUG
            DebugMenu = (DebugMenuPanel)uiView.AddUIComponent(typeof(DebugMenuPanel));
#endif

            ToolMode = TrafficManagerMode.None;
        }
Beispiel #30
0
        private void Initialize()
        {
            //Create ui
            UIView v = UIView.GetAView();

            m_ListPanel = (UIMusicListPanel)v.AddUIComponent(typeof(UIMusicListPanel));
            m_ListPanel.Hide();

            m_Initialized = true;

            CSLMusicMod.Log("Initialized music UI");
        }
        public void createLabel()
        {
            UISprite happiness = uiView.FindUIComponent <UISprite>("Happiness");
            UIPanel  panel     = uiView.FindUIComponent <UIPanel>("InfoPanel");

            label        = uiView.AddUIComponent(typeof(UILabel)) as UILabel;
            label.anchor = UIAnchorStyle.Left | UIAnchorStyle.Top;
            //label.relativePosition = new Vector2(1550, uiView.fixedHeight - 28); //this is overridden by LoadConfig() anyway
            label.eventClicked += new MouseEventHandler(labelClick);

            LoadConfig();
        }
Beispiel #32
0
 public static void SetupGui()
 {
     //if(Mod.IsEnabled && Mod.IsGuiEnabled)
     if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" Setting up Gui panel.");
     try
     {
         parentGuiView = null;
         parentGuiView = UIView.GetAView();
         if (guiPanel == null)
         {
             guiPanel = (CSLShowMoreLimitsGUI)parentGuiView.AddUIComponent(typeof(CSLShowMoreLimitsGUI));
             if (Mod.DEBUG_LOG_ON) Helper.dbgLog(" GUI Setup.");
             //guiPanel.Hide();
         }
         isGuiRunning = true;
     }
     catch (Exception ex)
     {
         Helper.dbgLog("Error: \r\n", ex,true);
     }
 }
Beispiel #33
0
        public static UIDialog CreateUIDialog(UIView view, string title, string details, OptionClicked accept, OptionClicked decline, bool destroyOnOption)
        {
            UIDialog dialog = (UIDialog)view.AddUIComponent (typeof(UIDialog));
            dialog.Start ();

            dialog.m_title.text = title;
            Vector2 screenRes = view.GetScreenResolution();

            dialog.m_details.text = details;
            dialog.m_title.relativePosition = new Vector3(WIDTH/2 - dialog.m_title.width/2,HEAD/2 - dialog.m_title.height/2);

            if (destroyOnOption) {
                dialog.eventAccept += () => {GameObject.DestroyImmediate(dialog.gameObject);};
                dialog.eventDecline += () => {GameObject.DestroyImmediate(dialog.gameObject);};
            }

            dialog.eventAccept += accept;
            dialog.eventDecline += decline;

            dialog.relativePosition = new Vector3(screenRes.x/2 - dialog.width/2,screenRes.y/2 - dialog.height/2);
            return dialog;
        }
Beispiel #34
0
        private void AddToolbarButton(UIView  view)
        {
            _toolbar_Button = (UICheckButton)view.AddUIComponent(typeof(UICheckButton));
            _toolbar_Button.atlas = _atlas;
            _toolbar_Button.normalBgSprite = "OptionBase";
            _toolbar_Button.hoveredBgSprite = "OptionBaseFocused";
            _toolbar_Button.pressedBgSprite = "OptionBasePressed";
            _toolbar_Button.normalFgSprite = "Music";
            _toolbar_Button.width = 36;
            _toolbar_Button.height = 36;
            Vector2 screenResolution = view.GetScreenResolution();
            _toolbar_Button.relativePosition = new Vector3(screenResolution.x - _toolbar_Button.width - 10 - 20 - 40, screenResolution.y - _toolbar_Button.height / 2 - 120 + 7);

            _toolbar_Button.eventClick += delegate
            {
                _toolbar_Button_MouseDown_Timer = -1;
                _current_Settings_Panel.isVisible = !_current_Settings_Panel.isVisible;
            };

            //Drag,drop
            _toolbar_Button.eventMouseDown += (component, eventParam) =>
            {
                _toolbar_Button_MouseDown_Timer = 60;
            };
            _toolbar_Button.eventMouseUp += (component, eventParam) =>
            {
                if (_toolbar_Button_dragging)
                {
                    gameObject.GetComponent<SettingsManager>().SaveModSettings();
                    _toolbar_Button_dragging = false;
                }

                _toolbar_Button_dragging = false;
                _toolbar_Button_MouseDown_Timer = -1;
            };
        }
Beispiel #35
0
        private void AddListPanel(UIView view)
        {
            _current_Settings_Panel = (UIMusicListPanel)view.AddUIComponent(typeof(UIMusicListPanel));
            _current_Settings_Panel.Hide();

            _current_Settings_Panel.AudioWatcher = AudioWatcher;
            _current_Settings_Panel.SettingsManager = gameObject.GetComponent<SettingsManager>();
            _current_Settings_Panel.MusicManager = gameObject.GetComponent<MusicManager>();
        }
        /// <summary>
        /// Our private little function to do whatever we need to setup and initialize our Gui screen object.
        /// </summary>
        private static void SetupGui()
        {
            if (SomeModName.DEBUG_LOG_ON) Logger.dbgLog(" Setting up Gui panel.");
            try
            {
                parentGuiView = null; //make sure we start fresh, even though we could just assume that was set during the last map unload.
                parentGuiView = UIView.GetAView(); //go get the root screen\view object from Unity via Colosalframework.ui function.

                //if our object is null (it should be) then lets create one, have the game ADD it, and store it and set our isGUIrunning flag.
                if (guiPanel == null)
                {
                    guiPanel = (SomeModNameGUI)parentGuiView.AddUIComponent(typeof(SomeModNameGUI));
                    if (SomeModName.DEBUG_LOG_ON) Logger.dbgLog(" GUI Created.");
                }
                isGuiRunning = true;
            }
            catch (Exception ex)
            {
                Logger.dbgLog("Error: \r\n", ex,true);
            }
        }