OnGUI() public method

public OnGUI ( ) : void
return void
 protected override void OnWindowGUI()
 {
     if (m_fileBrowser != null)
     {
         m_fileBrowser.OnGUI();
     }
 }
示例#2
0
    void OnGUI()
    {
        if (browserActive)
        {
            GUI.skin = (GUISkin)Resources.Load("SciFi", typeof(GUISkin));

            if (fileBrowser == null)
            {
                float windowWidth  = 512;
                float windowHeight = 512f;

                Rect browserRect = new Rect(Screen.width - windowWidth, Screen.height / 2 - (windowHeight / 2), windowWidth, windowHeight);
                //fileBrowser = new FileBrowser (browserRect, "Choose song", FileSelectedCallback, "*.mp3");
                fileBrowser = new FileBrowser(browserRect, "Choose song", FileSelectedCallback, "*.mp3");

                fileBrowser.DirectoryImage = (Texture2D)Resources.Load("folder", typeof(Texture2D));
                fileBrowser.FileImage      = (Texture2D)Resources.Load("file", typeof(Texture2D));

                fileBrowser.OnGUI();
            }
            else
            {
                fileBrowser.OnGUI();
            }
        }
    }
示例#3
0
 private void OpenFileBrowser()
 {
     if (m_fileBrowser != null)
     {
         m_fileBrowser.OnGUI();
     }
 }
示例#4
0
 protected void OnGUI()
 {
     if (m_fileBrowser != null)
     {
         m_fileBrowser.OnGUI();
     }
 }
示例#5
0
 protected void OnGUI()
 {
     GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), m_TitleTex);
     OnGUIMain();
     if (m_fileBrowser != null)
     {
         m_fileBrowser.OnGUI();
     }
 }
 protected void OnGUI()
 {
     if (m_fileBrowser1 != null)
     {
         m_fileBrowser1.OnGUI();
     }
     else
     {
         OnGUIMain();
     }
 }
示例#7
0
 void OnGUI()
 {
     if (!Visible)
     {
         //GUI.skin = AssetBase.GetGUISkin("KSP window 7");
         //winPos = GUILayout.Window(8935, winPos, drawWindow, "MuMech Embedded C# Console");
         if (fb != null)
         {
             fb.OnGUI();
         }
     }
 }
示例#8
0
 protected void OnGUI()
 {
     GUI.skin = thisMetalGUISkin;
     if (m_fileBrowser != null)
     {
         m_fileBrowser.OnGUI();
     }
     else
     {
         OnGUIMain();
     }
 }
示例#9
0
 void OnGUI()
 {
     if (!hidden)
     {
         GUI.skin = AssetBase.GetGUISkin("KSP window 7");
         winPos   = GUILayout.Window(8935, winPos, WindowGUI, "MuMech Embedded C# Console");
         if (fb != null)
         {
             fb.OnGUI();
         }
     }
 }
示例#10
0
    protected void OnGUI()
    {
        GUI.skin = skinWithListStyle;

        if (m_fileBrowser != null)
        {
            m_fileBrowser.OnGUI();
        }
        else
        {
            OnGUIMain();
        }
    }
示例#11
0
 protected void OnGUI()
 {
     if (isActive)
     {
         if (m_fileBrowser != null)
         {
             m_fileBrowser.OnGUI();
         }
         else
         {
             OnGUIMain();
         }
     }
 }
        private void OnGUI()
        {
            //GUI.skin = _skin;

            if (_show)
            {
                fileBrowser.OnGUI();

                _windowPosition = GUI.Window(Mathf.RoundToInt(transform.position.x * transform.position.z),
                                             _windowPosition, BillboardWindow, "Billboard");

                if (Input.GetKeyUp(KeyCode.Escape))
                {
                    _show = false;
                }
            }
        }
 //Called every frame. Calls the file browser's on GUI if it is not null (meaning it's open)
 void OnGUI()
 {
     if (fileBrowser != null)
     {
         //Disable controls while browser is open to prevent clicking through browser
         launchButton.interactable            = false;
         singleDatabaseToggle.interactable    = false;
         GetComponent <Button>().interactable = false;
         field.interactable              = false;
         sliderFrames.interactable       = false;
         browseButton.interactable       = false;
         browseButtonMng.interactable    = false;
         fieldMng.interactable           = false;
         cameraOptionButton.interactable = false;
         GUI.skin = skin;
         fileBrowser.OnGUI();
     }
 }
示例#14
0
 public void OnGUI()
 {
     GUI.skin = HighLogic.Skin;
     if (_enabled)
     {
         _windowRect = GUI.Window(GetInstanceID(), _windowRect, DrawGui, "Bifrost DCPU window");
     }
     if (_fileBrowser != null)
     {
         _fileBrowser.OnGUI();
     }
     if (Event.current.isKey)
     {
         var translated = GetKeyValue(Event.current.character, Event.current.keyCode);
         if (_keyboardInst != null)
         {
             _keyboardInst.SystemKeyboardOnKeyDown(translated);
         }
     }
 }
示例#15
0
        private static void DisplayFileBrowser()
        {
            if (!m_showFileBrowser)
            {
                return;
            }

            if (null == m_fileBrowser)
            {
                Rect rect = GUIUtils.GetCenteredRect(FileBrowser.GetRecommendedSize());

                m_fileBrowser = new FileBrowser(rect, "Select path to GTA", (string path) => {
                    m_showFileBrowser = false;
                    Config.SetString(Config.const_game_dir, path);
                    Config.SaveUserConfigSafe();
                });
                m_fileBrowser.BrowserType = FileBrowserType.Directory;
            }

            m_fileBrowser.OnGUI();
        }
示例#16
0
    void OnGUI()
    {
        GUI.skin = guiSkin;

        if (fileBrowser != null)
        {
            fileBrowser.OnGUI();
        }

        if (_displayMenu)
        {
            GUI.Box(new Rect(0.2f * Screen.width, 0.2f * Screen.height, 0.6f * Screen.width, 0.6f * Screen.height), "");

            GUILayout.BeginArea(new Rect(0.2f * Screen.width, 0.2f * Screen.height, 0.6f * Screen.width, 0.6f * Screen.height));

            GUILayout.BeginVertical();

            // action id
            GUILayout.BeginHorizontal();
            GUILayout.Label("Action Name");
            actionName = GUILayout.TextField(actionName, GUILayout.MinWidth(0.4f * Screen.width), GUILayout.MaxWidth(0.4f * Screen.width));
            GUILayout.EndHorizontal();

            // action instance
            GUILayout.BeginHorizontal();
            GUILayout.Label("Action File path");
            if (GUILayout.Button(actionFileName, GUILayout.MinWidth(0.4f * Screen.width), GUILayout.MaxWidth(0.4f * Screen.width)))
            {
                fileBrowser = new FileBrowser(
                    new Rect(0.2f * Screen.width, 0.2f * Screen.height, 0.6f * Screen.width, 0.6f * Screen.height),
                    "Action File",
                    actionFileName,
                    onActionChosen);
                fileBrowser.SelectionPattern = "*.txt";
                _displayMenu = false;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Perform Action", GUILayout.MinWidth(0.4f * Screen.width), GUILayout.MaxWidth(0.4f * Screen.width)))
            {
                ActionInstance data = new ActionInstance(actionFileName);
                _playAction(data);
                setMenuVisible(false);
            }
            playOnce = GUILayout.Toggle(playOnce, "Once");
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Add Action"))
            {
                // create action data if not exist in database
                // add new action instance to actiondata
                // save action data to database
                ActionData data = ActionDatabase.instance.getAction(actionName);
                if (data == null)
                {
                    data = new ActionData(actionName);
                }

                ActionInstance actionInst = new ActionInstance(actionFileName);
                data.actionInstances.Add(actionInst);
                ActionDatabase.instance.addAction(data);

                setMenuVisible(false);
            }

            if (GUILayout.Button("Remove Action"))
            {
                ActionDatabase.instance.removeAction(actionName);
                setMenuVisible(false);
            }

            if (GUILayout.Button("Recognize Action"))
            {
                // recognize a sequence
                //  if nothing exists or no matching subsequence, add as a new sequence
                //  otherwise, add new subsequence to data

                if (ActionRecognizer.instance.recognizeSequence(new ActionInstance(actionFileName)))
                {
                    _message = "Performing Recognition...";
                }
                else
                {
                    _message = "Recognition already in progress";
                }
                setMenuVisible(false);
            }

            GUILayout.EndVertical();
            GUILayout.EndArea();
        }

        GUI.Box(new Rect(0, 0, 0.2f * Screen.width, 0.2f * Screen.height), "");
        GUILayout.BeginArea(new Rect(0, 0, 0.2f * Screen.width, 0.2f * Screen.height));
        GUILayout.Label(_actionsList + "\n--\n" + _message);
        GUILayout.EndArea();
    }
示例#17
0
    void DrawSaveLoadGUI(int WindowID)
    {
        if (Application.platform == RuntimePlatform.OSXWebPlayer ||
            Application.platform == RuntimePlatform.WindowsWebPlayer ||
            Application.platform == RuntimePlatform.NaCl)
        {
            GUI.Label(new Rect(10, 20, 500, 80), "Please download the desktop application to save and/or load. Save & load will, hopefully, be available later in the webplayer.");
        }
        else if (Application.platform == RuntimePlatform.WindowsPlayer ||
                 Application.platform == RuntimePlatform.OSXPlayer ||
                 Application.platform == RuntimePlatform.OSXEditor ||
                 Application.platform == RuntimePlatform.WindowsEditor)
        {
            if (_simpleSaveLoadMode)
            {
                if (_simpleSelectingFileToLoad == false)
                {
                    _saveDirectoryPath = Directory.GetCurrentDirectory() + "\\Maps";

                    //Name and description stuff
                    GUI.Label(new Rect(10, 15, 350, 20), "Name:");
                    _saveName = GUI.TextArea(new Rect(10, 35, 350, 20), _saveName, 50);
                    GUI.Label(new Rect(10, 55, 350, 20), "Description:");
                    _saveDescription = GUI.TextArea(new Rect(10, 75, 350, 60), _saveDescription, 150);

                    if (GUI.Button(new Rect(10, 145, 170, 30), "Save!"))
                    {
                        SaveMap();
                    }
                    if (GUI.Button(new Rect(190, 145, 170, 30), "Load!"))
                    {
                        string mapFolderPath = Directory.GetCurrentDirectory() + "\\Maps";
                        Directory.CreateDirectory(mapFolderPath);
                        _simpleLoadFilesArray = Directory.GetFiles(mapFolderPath, "*." + LevelFileExtension);
                        for (int i = 0, l = _simpleLoadFilesArray.Length; i < l; ++i)
                        {
                            int lastIndexOf = _simpleLoadFilesArray[i].LastIndexOf("\\");
                            _simpleLoadFilesArray[i] = _simpleLoadFilesArray[i].Remove(0, lastIndexOf + 1);
                            lastIndexOf = _simpleLoadFilesArray[i].LastIndexOf(".");
                            _simpleLoadFilesArray[i] = _simpleLoadFilesArray[i].Remove(lastIndexOf);
                        }
                        _simpleSelectingFileToLoad = true;
                    }
                }
                else
                {
                    GUI.Label(new Rect(10, 15, 350, 20), "Select Map to Load:");
                    if (_simpleLoadFilesArray.Length == 0)
                    {
                        GUI.Label(new Rect(10, 35, 350, 20), "No Maps Found :(");
                        if (GUI.Button(new Rect(10, 55, 350, 30), "Ok"))
                        {
                            _simpleSelectingFileToLoad = false;
                        }
                    }
                    else
                    {
                        _simpleLoadScrollPosition = GUI.BeginScrollView(new Rect(10, 35, 350, 190), _simpleLoadScrollPosition, new Rect(0, 0, 320, _simpleLoadFilesArray.Length * 20 + 40));
                        _simpleLoadFileID         = GUILayoutx.SelectionList(_simpleLoadFileID, _simpleLoadFilesArray, SimpleLoadMap);
                        GUI.EndScrollView();
                    }
                }
            }
            else
            {
                //Name and description stuff
                GUI.Label(new Rect(10, 15, 350, 20), "Name:");
                _saveName = GUI.TextArea(new Rect(10, 35, 350, 20), _saveName, 50);
                GUI.Label(new Rect(10, 55, 350, 20), "Description:");
                _saveDescription = GUI.TextArea(new Rect(10, 75, 350, 60), _saveDescription, 150);

                if (_saveDirectoryBrowser == null && _loadFileBrowser == null)
                {
                    _saveLoadWindowRect.width  = _nonBrowsingSize.width;
                    _saveLoadWindowRect.height = _nonBrowsingSize.height;

                    //SAVE
                    if (GUI.Button(new Rect(10, 145, 290, 30),
                                   _saveDirectoryPath == null ? "Select Save Directory..." : _saveDirectoryPath
                                   ))
                    {
                        _saveDirectoryBrowser             = new FileBrowser("Select Save Directory", SaveDirectorySelected);
                        _saveDirectoryBrowser.BrowserType = FileBrowserType.Directory;
                    }
                    if (GUI.Button(new Rect(310, 145, 50, 30), "Save!"))
                    {
                        SaveMap();
                    }

                    //LOAD
                    if (GUI.Button(new Rect(10, 185, 290, 30),
                                   _loadFilePath == null ? "Select File to Load..." : _loadFilePath
                                   ))
                    {
                        _loadFileBrowser                  = new FileBrowser("Select File To Load", LoadFileSelected);
                        _loadFileBrowser.BrowserType      = FileBrowserType.File;
                        _loadFileBrowser.SelectionPattern = "*." + LevelFileExtension;
                    }
                    if (GUI.Button(new Rect(310, 185, 50, 30), "Load!"))
                    {
                        LoadMap();
                    }
                }
                else
                {
                    _saveLoadWindowRect.width  = _browsingSize.width;
                    _saveLoadWindowRect.height = _browsingSize.height;

                    if (_saveDirectoryBrowser != null)
                    {
                        DrawSaveGUI();
                    }
                    else
                    {
                        _loadFileBrowser.OnGUI();
                    }
                }
            }
        }
        else
        {
            GUI.Label(new Rect(10, 20, 200, 50), "Please download the desktop application to save and/or load.");
        }

        DrawGUIWindowCloseButton(ref _drawSaveLoadWindow);
        GUI.DragWindow(new Rect(0, 0, 10000, 20));
    }
 void doFileBrowser(int winId)
 {
     fileBrowser.OnGUI();
     GUI.DragWindow();
 }
示例#19
0
        bool partsCostCorrected = false; // NK for setting part costs on load
        public void OnGUI()
        {
            if (!isValidScene())
            {
                pVessel = null;
                return;
            }
            if (HighLogic.LoadedScene.Equals(GameScenes.MAINMENU) || HighLogic.LoadedScene.Equals(GameScenes.SPACECENTER) || HighLogic.LoadedScene.Equals(GameScenes.EDITOR) ||
                HighLogic.LoadedScene.Equals(GameScenes.SPH) || HighLogic.LoadedScene.Equals(GameScenes.TRACKSTATION))
            {
                manager.resetLatest();
            }

            if (!HighLogic.LoadedSceneIsFlight)
            {
                canRecycle = true; // reenable once exit flight
            }
            // NK
            if (!partsCostCorrected)
            {
                pVessel            = null;
                partsCostCorrected = true;
                print("*MC* Calculating part costs!");
                foreach (AvailablePart ap in PartLoader.LoadedPartsList)
                {
                    try
                    {
                        int cst = PartCost.cost(ap);
                        print("For part " + ap.name + ", cost = " + cst);
                        ap.cost = cst;
                        //ap.partPrefab.partInfo.cost = cst;
                    }
                    catch
                    {
                    }
                }
                EditorPartList.Instance.Refresh();
            }

            if (drawLandingArea)
            {
                CelestialBody kerbin = FlightGlobals.Bodies.Find(b => b.bodyName.Equals("Kerbin"));
                if (kerbin != null)
                {
//                    GLUtils.drawLandingArea (kerbin, 80, 90, -170.0, 170.0, new Color(1.0f, 0.0f, 0.0f, 0.5f));
                }
            }

            loadIcons();
            loadStyles();

            GUI.skin = HighLogic.Skin;

            // We need to calculate the status in case the windows are not visible
            calculateStatus(currentMission, true, activeVessel);

            if (hideAll)
            {
                return;
            }

            if (GUI.Button(new Rect(Screen.width / 3 - 44, Screen.height - 29, 125, 35), iconMenu, styleIcon))     //3-15
            {
                toggleWindow();
            }

            if (showMainWindow)
            {
                mainWindowPosition = GUILayout.Window(98765, mainWindowPosition, drawMainWindow, mainWindowTitle, GUILayout.MinHeight(700), GUILayout.MinWidth(330));
            }

            if (showSettingsWindow)
            {
                settingsWindowPosition = GUILayout.Window(98763, settingsWindowPosition, drawSettingsWindow, "Settings", GUILayout.MinHeight(300), GUILayout.MinWidth(300));
            }

            if (showMissionPackageBrowser)
            {
                packageWindowPosition = GUILayout.Window(98762, packageWindowPosition, drawPackageWindow, currentPackage.name, GUILayout.MinHeight(750), GUILayout.MinWidth(1000));
            }

            if (showFinanceWindow)
            {
                financeWindowPosition = GUILayout.Window(98761, financeWindowPosition, drawFinaceWindow, "Finance Window", GUILayout.MinHeight(250), GUILayout.MinWidth(250));
            }

            if (showRecycleWindow)
            {
                GUILayout.Window(98766, new Rect(Screen.width / 2 - 200, Screen.height / 2 - 100, 400, 100), drawRecycleWindow, "Recycle Window");
            }

            if (showkerbalwindow)
            {
                kerbalnautswinpostion = GUILayout.Window(98760, kerbalnautswinpostion, drawKerbalnautWindow, "Kerbalnaut Window", GUILayout.MinHeight(350), GUILayout.MinWidth(275));
            }

            if (fileBrowser != null)
            {
                GUI.skin = HighLogic.Skin;
                GUIStyle list = GUI.skin.FindStyle("List Item");
                list.normal.textColor = XKCDColors.DarkYellow;
                list.contentOffset    = new Vector2(1, 0);
                list.fontSize         = 20;
                list.alignment        = TextAnchor.MiddleLeft;

                fileBrowser.OnGUI();

                // Reset Skin
                list.normal.textColor = new Color(0.739f, 0.739f, 0.739f);
                list.contentOffset    = new Vector2(1, 42.4f);
                list.fontSize         = 10;
            }
        }
        public void OnGUI()
        {
            if (!isValidScene())
            {
                return;
            }

            if (drawLandingArea)
            {
                CelestialBody kerbin = FlightGlobals.Bodies.Find(b => b.bodyName.Equals("Kerbin"));
                if (kerbin != null)
                {
//                    GLUtils.drawLandingArea (kerbin, 80, 90, -170.0, 170.0, new Color(1.0f, 0.0f, 0.0f, 0.5f));
                }
            }

            loadIcons();
            loadStyles();

            GUI.skin = HighLogic.Skin;

            // We need to calculate the status in case the windows are not visible
            calculateStatus(currentMission, true, activeVessel);

            if (hideAll)
            {
                return;
            }

            if (GUI.Button(new Rect(Screen.width / 6 - 44, Screen.height - 38, 45, 40), iconMenu, styleIcon))
            {
                toggleWindow();
            }

            if (showMainWindow)
            {
                mainWindowPosition = GUILayout.Window(98765, mainWindowPosition, drawMainWindow, mainWindowTitle);
            }

            if (showSettingsWindow)
            {
                settingsWindowPosition = GUILayout.Window(98763, settingsWindowPosition, drawSettingsWindow, "Settings");
            }

            if (showMissionPackageBrowser)
            {
                packageWindowPosition = GUILayout.Window(98762, packageWindowPosition, drawPackageWindow, currentPackage.name);
            }

            if (fileBrowser != null)
            {
                GUI.skin = HighLogic.Skin;
                GUIStyle list = GUI.skin.FindStyle("List Item");
                list.normal.textColor = XKCDColors.DarkYellow;
                list.contentOffset    = new Vector2(1, 0);
                list.fontSize         = 20;
                list.alignment        = TextAnchor.MiddleLeft;

                fileBrowser.OnGUI();

                // Reset Skin
                list.normal.textColor = new Color(0.739f, 0.739f, 0.739f);
                list.contentOffset    = new Vector2(1, 42.4f);
                list.fontSize         = 10;
            }
        }
示例#21
0
 private void DrawSaveGUI()
 {
     _saveDirectoryBrowser.OnGUI();
 }