BeginScrollView() публичный статический Метод

Begin an automatically layouted scrollview.

public static BeginScrollView ( Vector2 scrollPosition ) : Vector2
scrollPosition Vector2 The position to use display.
Результат Vector2
Пример #1
0
            public override void OnGUI(Rect rect)
            {
                searchText = searchField.OnGUI(searchText);

                scrollPosition = EGL.BeginScrollView(scrollPosition);

                foreach (var type in behaviourTypes)
                {
                    if (type.ToLower().Contains(searchText.ToLower()))
                    {
                        EGL.BeginHorizontal();
                        EGL.LabelField(type, GL.Width(140));
                        if (GL.Button("Add", GL.Width(40)))
                        {
                            var instance = (StateBehaviour)ScriptableObject.CreateInstance(type);
                            instance.name      = type;
                            instance.hideFlags = HideFlags.HideInHierarchy;
                            list.Add(instance);

                            AssetDatabase.AddObjectToAsset(instance, profile);
                            AssetDatabase.SaveAssets();

                            editorWindow.Close();
                        }
                        EGL.EndHorizontal();
                    }
                }

                EGL.EndScrollView();
            }
Пример #2
0
        private void OnGUI()
        {
            if (EntityManager == null)
            {
                EditorGUILayout.HelpBox("please set EntityManager -> BuffDebugWindow.EntityManager",
                                        MessageType.Warning);
                return;
            }

            var entitys = EntityManager.Entitys;

            EditorGUILayout.LabelField("Entity count:" + entitys.Count);

            EditorGUI.indentLevel++;
            _pos = EditorGUILayout.BeginScrollView(_pos, "box");
            {
                foreach (var entity in entitys)
                {
                    EditorGUILayout.LabelField($"{entity} Buff Count:" +
                                               EntityManager.GetAllBuff(entity).Count());
                }
            }
            EditorGUILayout.EndScrollView();
            EditorGUI.indentLevel--;

            Repaint();
        }
    void ShowSettings()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;

        EGL.BeginVertical();
        {
            EGL.Separator();

            GUILayout.Label("LOD Levels");

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                if (importCfg.LodLevels.Count >= 4)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Add LOD Level"))
                {
                    importCfg.LodLevels.Add(new LodLevel());
                    importCfg.IsDirty = true; // Todo: Nasty
                }
                GUI.enabled = true;

                // Show the list of LODS
                EGL.BeginVertical();
                {
                    _lodScrollPos = EGL.BeginScrollView(_lodScrollPos, GUILayout.MinHeight(96f), GUILayout.MaxHeight(Screen.height));
                    {
                        var removeThese = new List <LodLevel>();
                        int i           = 0;
                        foreach (LodLevel lod in importCfg.LodLevels)
                        {
                            if (ShowLodLevel(lod, i))
                            {
                                removeThese.Add(lod);
                                importCfg.IsDirty = true; // Nasty
                            }
                            i++;
                        }
                        foreach (LodLevel lod in removeThese)
                        {
                            importCfg.LodLevels.Remove(lod);
                        }
                    }
                    EGL.EndScrollView();
                }
                EGL.EndVertical();

                EGL.Space();

                GUILayout.Label("Control how many assets are processed in one go.");
                importCfg.BatchLimit = EGL.IntField("Batch limit", importCfg.BatchLimit);
                GUILayout.Label("Larger batches mean faster processing but require\nmore memory. Change this with care, or Unity's\nmemory might run out!");
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
    void OnGUI()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;

        if (editorUtilities == null)
        {
            GUILayout.Label("No running instance of LandmassImporter found");
            return;
        }

        if (editorUtilities.IsProcessing)
        {
            ShowProgressBar();
        }

        GUI.enabled = !editorUtilities.IsProcessing;

        EGL.BeginVertical();
        {
            EGL.Separator();

            _currentState = (MenuState)GUILayout.Toolbar((int)_currentState, menuTitles);

            EGL.BeginHorizontal();
            {
                _globalScrollPos = EGL.BeginScrollView(_globalScrollPos, GuiUtils.Skin.box);
                {
                    EGL.BeginVertical();
                    {
                        EGL.Separator();

                        _menus[_currentState]();
                        GUILayout.FlexibleSpace();

                        EGL.Separator();
                    }
                    EGL.EndVertical();
                }
                EGL.EndScrollView();
            }
            EGL.EndHorizontal();

            EGL.Separator();

            ShowSaveButtons();

            GUILayout.Space(16);
        }
        EGL.EndVertical();

        GUI.enabled = true;
    }
Пример #5
0
        public void OnGUI()
        {
            if (data != null)
            {
                scroll = UGL.BeginScrollView(scroll, EditorStyles.helpBox);
                UGL.BeginHorizontal(EditorStyles.miniButton);
                type      = (DataTypes)GUILayout.Toolbar((int)type, System.Enum.GetNames(typeof(DataTypes)));
                GUI.color = Color.green;
                if (GUILayout.Button("+"))
                {
                    data.Add(type, string.Empty);
                }
                GUI.color = Color.white;
                UGL.EndHorizontal();
                switch (type)
                {
                case DataTypes.Color:
                    ColorGUI();
                    break;

                case DataTypes.Float:
                    FloatGUI();
                    break;

                case DataTypes.Texture:
                    TextureGUI();
                    break;

                case DataTypes.Vector:
                    VectorGUI();
                    break;
                }
                UGL.EndScrollView();
                //UGL.EndVertical();
                if (data != null)
                {
                    data.SetValues();
                }
            }
        }
Пример #6
0
        private void StacktraceListView(Event e, GUIContent tempContent)
        {
            float maxWidth = LogEntries.wrapped.StacktraceListView_GetMaxWidth(tempContent, Constants.MessageStyle);

            if (m_StacktraceLineContextClickRow != -1)
            {
                var stacktraceLineInfoIndex = m_StacktraceLineContextClickRow;
                m_StacktraceLineContextClickRow = -1;
                GenericMenu menu = new GenericMenu();
                if (LogEntries.wrapped.StacktraceListView_CanOpen(stacktraceLineInfoIndex))
                {
                    menu.AddItem(new GUIContent("Open"), false, LogEntries.wrapped.StacktraceListView_Open, stacktraceLineInfoIndex);
                    menu.AddSeparator("");
                    if (LogEntries.wrapped.StacktraceListView_CanWrapper(stacktraceLineInfoIndex))
                    {
                        menu.AddItem(new GUIContent("Wrapper"), LogEntries.wrapped.StacktraceListView_IsWrapper(stacktraceLineInfoIndex), LogEntries.wrapped.StacktraceListView_Wrapper, stacktraceLineInfoIndex);
                    }
                }
                menu.AddItem(new GUIContent("Copy"), false, LogEntries.wrapped.StacktraceListView_Copy, stacktraceLineInfoIndex);
                menu.AddItem(new GUIContent("Copy All"), false, LogEntries.wrapped.StacktraceListView_CopyAll);
                menu.ShowAsContext();
            }

            int  id = GUIUtility.GetControlID(0);
            int  rowDoubleClicked = -1;
            int  selectedRow      = -1;
            bool openSelectedItem = false;

            m_ListViewMessage.totalRows = LogEntries.wrapped.StacktraceListView_GetCount();
            GUILayout.BeginHorizontal(Constants.Box);
            m_ListViewMessage.scrollPos          = EditorGUILayout.BeginScrollView(m_ListViewMessage.scrollPos);
            ListViewGUI.ilvState.beganHorizontal = true;
            m_ListViewMessage.draggedFrom        = -1;
            m_ListViewMessage.draggedTo          = -1;
            m_ListViewMessage.fileNames          = (string[])null;
            Rect rect = GUILayoutUtility.GetRect(maxWidth,
                                                 (float)(m_ListViewMessage.totalRows * m_ListViewMessage.rowHeight + 3));

            foreach (ListViewElement el in ListViewGUI.DoListView(rect, m_ListViewMessage, null, string.Empty))
            {
                if (e.type == EventType.MouseDown && (e.button == 0 || e.button == 1) && el.position.Contains(e.mousePosition))
                {
                    if (e.button == 1)
                    {
                        m_ListViewMessage.row           = el.row;
                        selectedRow                     = m_ListViewMessage.row;
                        m_StacktraceLineContextClickRow = selectedRow;
                        continue;
                    }

                    selectedRow = m_ListViewMessage.row;
                    if (e.clickCount == 2)
                    {
                        openSelectedItem = true;
                    }
                }
                else if (e.type == EventType.Repaint)
                {
                    tempContent.text = LogEntries.wrapped.StacktraceListView_GetLine(el.row);
                    rect             = el.position;
                    if (rect.width < maxWidth)
                    {
                        rect.width = maxWidth;
                    }
                    Constants.MessageStyle.Draw(rect, tempContent, id, m_ListViewMessage.row == el.row);
                }
            }

            // Open entry using return key
            if ((GUIUtility.keyboardControl == m_ListViewMessage.ID) && (e.type == EventType.KeyDown) && (e.keyCode == KeyCode.Return) && (m_ListViewMessage.row != 0))
            {
                selectedRow      = m_ListViewMessage.row;
                openSelectedItem = true;
            }

            if (openSelectedItem)
            {
                rowDoubleClicked = selectedRow;
                e.Use();
            }

            if (m_StacktraceLineContextClickRow != -1)
            {
                Repaint();
            }

            if (rowDoubleClicked != -1)
            {
                LogEntries.wrapped.StacktraceListView_Open(rowDoubleClicked);
            }
        }
    void ShowTreemaps()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;

        EGL.BeginVertical();
        {
            GUILayout.Label("The settings for processing tree maps.");

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Postfix for treemap files.");
                importCfg.TreemapTag = EGL.TextField("Name postfix", importCfg.TreemapTag);
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Treemap file specifications. Please use x^2.");
                importCfg.SplatmapExtention = EGL.TextField("File extention", importCfg.SplatmapExtention);
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("The prototypes to assign. (Current count: " + editorUtilities.TreePrototypes.Count + ")");

                EGL.Separator();

                EGL.BeginHorizontal();
                {
                    if (editorUtilities.TreePrototypes.Count >= 8)
                    {
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button("Add Prototype"))
                    {
                        editorUtilities.TreePrototypes.Add(new TreePrototype());
                        importCfg.IsDirty = true; // Todo: Nasty
                    }
                    GUI.enabled = true;
                }
                EGL.EndHorizontal();

                // Show the list
                EGL.BeginVertical();
                {
                    _prototypeScrollPos = EGL.BeginScrollView(_prototypeScrollPos, GUILayout.MinHeight(96f), GUILayout.MaxHeight(Screen.height));
                    {
                        List <TreePrototype> removeThese = new List <TreePrototype>();
                        int i = 0;
                        foreach (TreePrototype prototype in editorUtilities.TreePrototypes)
                        {
                            if (ShowTreePrototype(prototype, i))
                            {
                                removeThese.Add(prototype);
                                importCfg.IsDirty = true; // Nasty
                            }
                            i++;
                        }
                        foreach (TreePrototype prototype in removeThese)
                        {
                            editorUtilities.TreePrototypes.Remove(prototype);
                        }
                    }
                    EGL.EndScrollView();
                }
                EGL.EndVertical();
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
    void ShowDetailMaps()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;

        EGL.BeginVertical();
        {
            GUILayout.Label("The settings for processing detail maps.");

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Postfix for detailmap files.");
                importCfg.SplatmapTag = EGL.TextField("Name postfix", importCfg.SplatmapTag);
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Splatmap file specifications. Please use x^2.");
                importCfg.SplatmapExtention = EGL.TextField("File extention", importCfg.SplatmapExtention);
                importCfg.SplatmapFlipX     = EGL.Toggle("Mirror X", importCfg.SplatmapFlipX);
                importCfg.SplatmapFlipY     = EGL.Toggle("Mirror Y", importCfg.SplatmapFlipY);
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("The textures to assign. (Current count: " + editorUtilities.DetailPrototypes.Count + ")");

                EGL.Separator();

                EGL.BeginHorizontal();
                {
                    if (editorUtilities.DetailPrototypes.Count >= 8)
                    {
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button("Add Prototype"))
                    {
                        editorUtilities.DetailPrototypes.Add(new DetailPrototype());
                        importCfg.IsDirty = true; // Todo: Nasty, because the above prototypes still need to be converted to a serializable format, which is not directly done here
                    }
                    GUI.enabled = true;
                }
                EGL.EndHorizontal();

                // Show the list
                EGL.BeginVertical();
                {
                    _prototypeScrollPos = EGL.BeginScrollView(_prototypeScrollPos, GUILayout.MinHeight(96f), GUILayout.MaxHeight(Screen.height));
                    {
                        List <DetailPrototype> removeThese = new List <DetailPrototype>();
                        int i = 0;
                        foreach (DetailPrototype prototype in editorUtilities.DetailPrototypes)
                        {
                            if (ShowDetailPrototype(prototype, i))
                            {
                                removeThese.Add(prototype);
                                importCfg.IsDirty = true; // Nasty
                            }
                            i++;
                        }
                        foreach (DetailPrototype prototype in removeThese)
                        {
                            editorUtilities.DetailPrototypes.Remove(prototype);
                        }
                    }
                    EGL.EndScrollView();
                }
                EGL.EndVertical();
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
    void ShowSplatmaps()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;

        EGL.BeginVertical();
        {
            GUILayout.Label("The settings for processing splatmaps.");

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Postfix for splatmap files.");
                importCfg.SplatmapTag = EGL.TextField("Name postfix", importCfg.SplatmapTag);
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Splatmap file specifications. Please use x^2.");
                importCfg.SplatmapExtention = EGL.TextField("File extention", importCfg.SplatmapExtention);
                importCfg.SplatmapFlipX     = EGL.Toggle("Mirror X", importCfg.SplatmapFlipX);
                importCfg.SplatmapFlipY     = EGL.Toggle("Mirror Y", importCfg.SplatmapFlipY);
                importCfg.TrimEmptyChannels = EGL.Toggle("Trim empty", importCfg.TrimEmptyChannels);
                importCfg.NormalizationMode = (NormalizationMode)EditorGUILayout.EnumPopup("Normalize mode", importCfg.NormalizationMode);
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("The textures to assign. (Current count: " + editorUtilities.SplatPrototypes.Count + ")");

                EGL.Separator();

                EGL.BeginHorizontal();
                {
                    if (editorUtilities.SplatPrototypes.Count >= 8)
                    {
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button("Add Prototype"))
                    {
                        editorUtilities.SplatPrototypes.Add(new SplatPrototype());
                        importCfg.IsDirty = true; // Todo: Nasty
                    }
                    GUI.enabled = true;

                    if (GUILayout.Button("Grab from Selected Terrain Object or Asset"))
                    {
                        GetPrototypesFromSelectedTerrain();
                        importCfg.IsDirty = true; // Todo: Nasty
                    }
                }
                EGL.EndHorizontal();

                // Show the list
                EGL.BeginVertical();
                {
                    _prototypeScrollPos = EGL.BeginScrollView(_prototypeScrollPos, GUILayout.MinHeight(96f), GUILayout.MaxHeight(Screen.height));
                    {
                        List <SplatPrototype> removeThese = new List <SplatPrototype>();
                        int i = 0;
                        foreach (SplatPrototype splatPrototype in editorUtilities.SplatPrototypes)
                        {
                            if (ShowSplatPrototype(splatPrototype, i))
                            {
                                removeThese.Add(splatPrototype);
                                importCfg.IsDirty = true; // Nasty
                            }
                            i++;
                        }
                        foreach (SplatPrototype splatPrototype in removeThese)
                        {
                            editorUtilities.SplatPrototypes.Remove(splatPrototype);
                        }
                    }
                    EGL.EndScrollView();
                }
                EGL.EndVertical();
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
Пример #10
0
    private void OnGUI()
    {
        UG.BeginVertical();

        UG.BeginHorizontal();
        UG.LabelField("当前数据源:" + (_dataPath.IsNullPath() ? "未在本地保存,已编辑内容随时可能丢失!" : _dataPath));
        if (GUILayout.Button("选择"))
        {
            string path = EditorUtility.OpenFilePanelWithFilters("选择数据源文件", Application.dataPath + "/Hotassets/Data", new [] { "text", "txt" });
            if (!string.IsNullOrEmpty(path))
            {
                Dictionary <string, List <InterlocutionData> > temperData = null;
                try {
                    temperData = JsonConvert.DeserializeObject <Dictionary <string, List <InterlocutionData> > >(File.ReadAllText(path));
                } catch (JsonException) {
                    temperData = _data;
                    path       = _dataPath;
                    EditorApplication.Beep();
                    EditorUtility.DisplayDialog("异常捕获!", "数据源文件不能被正确加载,请确定.json文件的有效性", "知道了");
                } finally {
                    _data     = temperData;
                    _dataPath = path;
                }
            }
        }

        UG.EndHorizontal();

        UG.BeginHorizontal();

        int subject = UG.Popup("所属学科", _editingSubject, InterlocutionData.Keys);

        if (subject != _editingSubject)
        {
            _editingInterlocution = -1;
        }
        _editingSubject = subject;
        string key = InterlocutionData.Keys[_editingSubject];

        UG.LabelField("分组", _editingSubject != InterlocutionData.Keys.Length - 1 ? Subject.ToSubject(InterlocutionData.Keys[_editingSubject]).group.ToString() : "无");

        UG.EndHorizontal();

        _scrollPostion = UG.BeginScrollView(_scrollPostion);

        if (!_data.ContainsKey(key))
        {
            _data[key] = new List <InterlocutionData>();
        }
        List <InterlocutionData> interlocutions = _data[key];

        int _deletedInterlocution = -1;

        UG.LabelField("[已有 " + interlocutions.Count + " 道问答]");
        for (int i = 0, l = interlocutions.Count; i < l; i++)
        {
            UG.BeginHorizontal();

            UG.LabelField("[Q " + i + "] " + interlocutions[i].question);
            if (GUILayout.Button("编辑"))
            {
                _editingInterlocution = i;
            }

            if (GUILayout.Button("删除"))
            {
                EditorApplication.Beep();
                if (EditorUtility.DisplayDialog("危险操作警告⚠️", "即将删除问答 [Q" + i + "] (该操作不可逆)", "确认", "取消"))
                {
                    _deletedInterlocution = i;
                    if (_editingInterlocution == _deletedInterlocution)
                    {
                        _editingInterlocution = -1;
                    }
                }
            }

            UG.EndHorizontal();
        }

        if (_deletedInterlocution != -1)
        {
            interlocutions.RemoveAt(_deletedInterlocution);
        }

        UG.EndScrollView();

        if (GUILayout.Button("添加问答"))
        {
            _editingInterlocution = interlocutions.Count;
            interlocutions.Add(new InterlocutionData());
        }

        UG.LabelField("问答编辑区");
        if (_editingInterlocution != -1)
        {
            UG.LabelField("Q " + _editingInterlocution);
            InterlocutionData interlocution = interlocutions[_editingInterlocution];
            interlocution.question = UG.TextArea(interlocution.question);
            interlocution.answer   = (Option)UG.EnumPopup("正确选项", interlocution.answer);
            UG.LabelField("选项A");
            interlocution.optionA = UG.TextArea(interlocution.optionA);
            UG.LabelField("选项B");
            interlocution.optionB = UG.TextArea(interlocution.optionB);
            UG.LabelField("选项C");
            interlocution.optionC = UG.TextArea(interlocution.optionC);
            UG.LabelField("选项D");
            interlocution.optionD = UG.TextArea(interlocution.optionD);
        }
        else
        {
            UG.HelpBox("需要选择一个问答进行编辑!", MessageType.Warning);
        }

        if (GUILayout.Button("保存"))
        {
            bool toSave   = true;
            bool toImport = false;
            if (_dataPath.IsNullPath())
            {
                string path = EditorUtility.SaveFilePanel("保存问答数据", Application.dataPath + "/Hotassets/Data", "InterlocutionData", "txt");
                if (string.IsNullOrEmpty(path))
                {
                    toSave = false;
                }
                else
                {
                    _dataPath = path;
                    toImport  = true;
                }
            }

            if (toSave)
            {
                File.WriteAllText(_dataPath, JsonConvert.SerializeObject(_data));
                EditorPrefs.SetString(DATA_SAVE_PATH, _dataPath);
            }

            if (toImport)
            {
                AssetDatabase.ImportAsset(_dataPath.Substring(_dataPath.IndexOf("Assets")));
            }
        }

        UG.EndVertical();
    }
Пример #11
0
    void OnGUI()
    {
        //This is used for debugging, when the code is changed, simply refocussing the City Generator window will reload the code
        if (window == null)
        {
            OpenWindow();
        }
        scrollLocation = EGL.BeginScrollView(scrollLocation);

        GL.BeginHorizontal();
        GL.Label("Procedural City Generator", EditorStyles.boldLabel);
        GL.Space(50);
        EGL.BeginHorizontal("Box");
        rDebugToggle.target = EGL.ToggleLeft("Debug Mode?", rDebugToggle.target);
        EGL.EndHorizontal();
        GL.EndHorizontal();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showTerrainGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showPopulationMapGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showGrowthMapGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showRoadMapGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        showBuildingGUI();

        GL.Box("", new GUILayoutOption[] { GL.ExpandWidth(true), GL.Height(1) });
        if (GL.Button("Reset"))
        {
            oldShowPop          = false;
            oldShowGrowth       = false;
            showTerrainUI       = true;
            showPopUI           = false;
            showGrowthUI        = false;
            showRoadMapAdvanced = false;
            showRoadMapUI       = false;
            showBuildingUI      = false;
            terrainGenerated    = false;
            populationGenerated = false;
            growthMapGenerated  = false;
            roadMapGenerated    = false;
            roadMeshGenerated   = false;

            terrainLabel    = "1. Terrain Generation - NOT COMPLETED ✘";
            populationLabel = "2. Population Map Generation - NOT COMPLETED ✘";
            growthLabel     = "3. Growth Map Generation - NOT COMPLETED ✘";
            roadmapLabel    = "4. Road Map Generation - NOT COMPLETED ✘";
            buildingLabel   = "5. Building Generation - NOT COMPLETED ✘";
        }

        // TESTING

        /*
         * if (GL.Button ("Generate Houses")) {
         *      generator.testHouses ();
         * }*/
        //END TESTING

        EGL.EndScrollView();
    }
Пример #12
0
 public ScrollGroup(Vector2 scrollPosition, GUILayoutOption[] options = null)
 {
     pos = EGL.BeginScrollView(scrollPosition, options);
 }
Пример #13
0
        private void MultiParticleSystemGUI(bool verticalLayout)
        {
            // Background
            GUILayout.BeginVertical(ParticleSystemStyles.Get().effectBgStyle);
            m_EmitterAreaScrollPos = EditorGUILayout.BeginScrollView(m_EmitterAreaScrollPos);
            {
                Rect emitterAreaRect = EditorGUILayout.BeginVertical();
                {
                    // Click-Drag with Alt pressed in entire area
                    m_EmitterAreaScrollPos -= EditorGUI.MouseDeltaReader(emitterAreaRect, Event.current.alt);
                    // Top padding
                    GUILayout.Space(3);

                    GUILayout.BeginHorizontal();
                    // Left padding
                    GUILayout.Space(3); // added because cannot use padding due to clippling

                    // Draw Emitters
                    Color orgColor           = GUI.color;
                    bool  isRepaintEvent     = Event.current.type == EventType.Repaint;
                    bool  isShowOnlySelected = IsShowOnlySelectedMode();
                    List <ParticleSystemUI> selectedSystems = GetSelectedParticleSystemUIs();

                    for (int i = 0; i < m_Emitters.Length; ++i)
                    {
                        if (i != 0)
                        {
                            GUILayout.Space(ModuleUI.k_SpaceBetweenModules);
                        }

                        bool isSelected = selectedSystems.Contains(m_Emitters[i]);

                        ModuleUI rendererModuleUI = m_Emitters[i].GetParticleSystemRendererModuleUI();
                        if (isRepaintEvent && rendererModuleUI != null && !rendererModuleUI.enabled)
                        {
                            GUI.color = GetDisabledColor();
                        }

                        if (isRepaintEvent && isShowOnlySelected && !isSelected)
                        {
                            GUI.color = GetDisabledColor();
                        }

                        Rect psRect = EditorGUILayout.BeginVertical();
                        {
                            if (isRepaintEvent && isSelected && m_Emitters.Length > 1)
                            {
                                DrawSelectionMarker(psRect);
                            }

                            m_Emitters[i].OnGUI(ModuleUI.k_CompactFixedModuleWidth, true);
                        }
                        EditorGUILayout.EndVertical();

                        GUI.color = orgColor;
                    }

                    GUILayout.Space(5);
                    if (GUILayout.Button(s_Texts.addParticleSystem, "OL Plus", GUILayout.Width(20)))
                    {
                        // Store state of inspector before creating new particle system that will reload the inspector (new selected object)
                        //SessionState.SetFloat("CurrentEmitterAreaScroll", m_EmitterAreaScrollPos.x);
                        CreateParticleSystem(ParticleSystemEditorUtils.GetRoot(m_SelectedParticleSystems[0]), SubModuleUI.SubEmitterType.None);
                    }

                    GUILayout.FlexibleSpace(); // prevent centering
                    GUILayout.EndHorizontal();
                    GUILayout.Space(4);

                    // Click-Drag in background (does not require Alt pressed)
                    m_EmitterAreaScrollPos -= EditorGUI.MouseDeltaReader(emitterAreaRect, true);

                    GUILayout.FlexibleSpace();  // Makes the emitter area background extend to bottom
                }
                EditorGUILayout.EndVertical();  // EmitterAreaRect
            }
            EditorGUILayout.EndScrollView();

            GUILayout.EndVertical();    // Background

            //GUILayout.FlexibleSpace();    // Makes the emitter area background align to bottom of highest emitter

            // Handle shortcut keys last so we do not activate them if inputfield has used the event
            HandleKeyboardShortcuts();
        }
        public void OnGUI()
        {
            LoadResources();


            GUILayout.BeginVertical();
            GUILayout.Space(10);
            GUI.Box(new Rect(13, 8, s_UnityLogo.image.width, s_UnityLogo.image.height), s_UnityLogo, GUIStyle.none);
            GUILayout.Space(5);
            GUILayout.BeginHorizontal();
            GUILayout.Space(120);
            GUILayout.BeginVertical();

            if (s_HasConnectionError)
            {
                GUILayout.Label(s_ErrorString, "WordWrappedLabel", GUILayout.Width(405));
            }
            else if (s_HasUpdate)
            {
                GUILayout.Label(string.Format(s_TextHasUpdate.text, InternalEditorUtility.GetFullUnityVersion(), s_LatestVersionString), "WordWrappedLabel", GUILayout.Width(300));

                GUILayout.Space(20);
                m_ScrollPos = EditorGUILayout.BeginScrollView(m_ScrollPos, GUILayout.Width(405), GUILayout.Height(200));
                GUILayout.Label(s_LatestVersionMessage, "WordWrappedLabel");
                EditorGUILayout.EndScrollView();

                GUILayout.Space(20);
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Download new version", GUILayout.Width(200)))
                {
                    Help.BrowseURL(s_UpdateURL);
                }

                if (GUILayout.Button("Skip new version", GUILayout.Width(200)))
                {
                    EditorPrefs.SetString("EditorUpdateSkipVersionString", s_LatestVersionString);
                    Close();
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.Label(string.Format(s_TextUpToDate.text, Application.unityVersion), "WordWrappedLabel", GUILayout.Width(405));
            }


            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUILayout.Space(8);


            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(GUILayout.Height(20));
            GUILayout.FlexibleSpace();
            GUI.changed     = false;
            s_ShowAtStartup = GUILayout.Toggle(s_ShowAtStartup, s_CheckForNewUpdatesText);
            if (GUI.changed)
            {
                EditorPrefs.SetBool("EditorUpdateShowAtStartup", s_ShowAtStartup);
            }

            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
 public void OnGUI()
 {
     EditorUpdateWindow.LoadResources();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     GUI.Box(new Rect(13f, 8f, (float)EditorUpdateWindow.s_UnityLogo.image.width, (float)EditorUpdateWindow.s_UnityLogo.image.height), EditorUpdateWindow.s_UnityLogo, GUIStyle.none);
     GUILayout.Space(5f);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(120f);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     if (EditorUpdateWindow.s_HasConnectionError)
     {
         GUILayout.Label(EditorUpdateWindow.s_ErrorString, "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(405f)
         });
     }
     else if (EditorUpdateWindow.s_HasUpdate)
     {
         GUILayout.Label(string.Format(EditorUpdateWindow.s_TextHasUpdate.text, InternalEditorUtility.GetFullUnityVersion(), EditorUpdateWindow.s_LatestVersionString), "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(300f)
         });
         GUILayout.Space(20f);
         this.m_ScrollPos = EditorGUILayout.BeginScrollView(this.m_ScrollPos, new GUILayoutOption[]
         {
             GUILayout.Width(405f),
             GUILayout.Height(200f)
         });
         GUILayout.Label(EditorUpdateWindow.s_LatestVersionMessage, "WordWrappedLabel", new GUILayoutOption[0]);
         EditorGUILayout.EndScrollView();
         GUILayout.Space(20f);
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         if (GUILayout.Button("Download new version", new GUILayoutOption[]
         {
             GUILayout.Width(200f)
         }))
         {
             Help.BrowseURL(EditorUpdateWindow.s_UpdateURL);
         }
         if (GUILayout.Button("Skip new version", new GUILayoutOption[]
         {
             GUILayout.Width(200f)
         }))
         {
             EditorPrefs.SetString("EditorUpdateSkipVersionString", EditorUpdateWindow.s_LatestVersionString);
             base.Close();
         }
         GUILayout.EndHorizontal();
     }
     else
     {
         GUILayout.Label(string.Format(EditorUpdateWindow.s_TextUpToDate.text, Application.unityVersion), "WordWrappedLabel", new GUILayoutOption[]
         {
             GUILayout.Width(405f)
         });
     }
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
     GUILayout.Space(8f);
     GUILayout.FlexibleSpace();
     GUILayout.BeginHorizontal(new GUILayoutOption[]
     {
         GUILayout.Height(20f)
     });
     GUILayout.FlexibleSpace();
     GUI.changed = false;
     EditorUpdateWindow.s_ShowAtStartup = GUILayout.Toggle(EditorUpdateWindow.s_ShowAtStartup, EditorUpdateWindow.s_CheckForNewUpdatesText, new GUILayoutOption[0]);
     if (GUI.changed)
     {
         EditorPrefs.SetBool("EditorUpdateShowAtStartup", EditorUpdateWindow.s_ShowAtStartup);
     }
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }
 public void OnGUI(int windowID)
 {
     if (this.m_LookDevView != null)
     {
         List <CubemapInfo> hdriList = this.m_LookDevView.envLibrary.hdriList;
         bool flag = (146f * hdriList.Count) > this.m_PositionInLookDev.height;
         if (flag)
         {
             this.m_ScrollPosition = EditorGUILayout.BeginScrollView(this.m_ScrollPosition, new GUILayoutOption[0]);
         }
         else
         {
             this.m_ScrollPosition = new Vector2(0f, 0f);
         }
         if (hdriList.Count == 1)
         {
             Color color = GUI.color;
             GUI.color = Color.gray;
             Vector2 vector   = GUI.skin.label.CalcSize(styles.sDragAndDropHDRIText);
             Rect    position = new Rect((this.m_PositionInLookDev.width * 0.5f) - (vector.x * 0.5f), (this.m_PositionInLookDev.height * 0.5f) - (vector.y * 0.5f), vector.x, vector.y);
             GUI.Label(position, styles.sDragAndDropHDRIText);
             GUI.color = color;
         }
         for (int i = 0; i < hdriList.Count; i++)
         {
             Rect        rect5;
             Rect        rect6;
             CubemapInfo infos       = hdriList[i];
             ShadowInfo  shadowInfo  = infos.shadowInfo;
             int         intProperty = this.m_LookDevView.config.GetIntProperty(LookDevProperty.HDRI, LookDevEditionContext.Left);
             int         num3        = this.m_LookDevView.config.GetIntProperty(LookDevProperty.HDRI, LookDevEditionContext.Right);
             if ((this.m_LookDevView.config.lookDevMode == LookDevMode.Single1) || (this.m_LookDevView.config.lookDevMode == LookDevMode.Single2))
             {
                 num3 = -1;
             }
             bool     flag2 = (i == intProperty) || (i == num3);
             Color    black = Color.black;
             Color    firstViewGizmoColor = Color.black;
             GUIStyle miniLabel           = EditorStyles.miniLabel;
             if (flag2)
             {
                 if (i == intProperty)
                 {
                     black = (Color)LookDevView.m_FirstViewGizmoColor;
                     firstViewGizmoColor = (Color)LookDevView.m_FirstViewGizmoColor;
                     miniLabel           = styles.sLabelStyleFirstContext;
                 }
                 else if (i == num3)
                 {
                     black = (Color)LookDevView.m_SecondViewGizmoColor;
                     firstViewGizmoColor = (Color)LookDevView.m_SecondViewGizmoColor;
                     miniLabel           = styles.sLabelStyleSecondContext;
                 }
                 if (intProperty == num3)
                 {
                     black = (Color)LookDevView.m_FirstViewGizmoColor;
                     firstViewGizmoColor = (Color)LookDevView.m_SecondViewGizmoColor;
                     miniLabel           = styles.sLabelStyleBothContext;
                 }
             }
             GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.Width(250f) };
             GUILayout.BeginVertical(optionArray1);
             int num4 = hdriList.FindIndex(x => x == this.m_SelectedCubemapInfo);
             if ((((this.m_SelectedCubemap != null) || this.m_DragBeingPerformed) && this.GetInsertionRect(i).Contains(Event.current.mousePosition)) && ((((num4 - i) != 0) && ((num4 - i) != -1)) || (num4 == -1)))
             {
                 GUILayout.Label(GUIContent.none, styles.sSeparatorStyle, new GUILayoutOption[0]);
                 GUILayoutUtility.GetRect((float)250f, (float)16f);
             }
             GUILayout.Label(GUIContent.none, styles.sSeparatorStyle, new GUILayoutOption[0]);
             GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(250f), GUILayout.Height(18f) };
             GUILayout.BeginHorizontal(optionArray2);
             StringBuilder builder = new StringBuilder();
             builder.Append(i.ToString());
             builder.Append(" - ");
             builder.Append(infos.cubemap.name);
             GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Height(18f), GUILayout.MaxWidth(175f) };
             GUILayout.Label(builder.ToString(), miniLabel, optionArray3);
             GUILayout.FlexibleSpace();
             if (GUILayout.Button(styles.sEnvControlIcon, LookDevView.styles.sToolBarButton, new GUILayoutOption[0]))
             {
                 PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), new EnvSettingsWindow(this.m_LookDevView, infos));
                 GUIUtility.ExitGUI();
             }
             using (new EditorGUI.DisabledScope(infos.cubemap == LookDevResources.m_DefaultHDRI))
             {
                 if (GUILayout.Button(styles.sCloseIcon, LookDevView.styles.sToolBarButton, new GUILayoutOption[0]))
                 {
                     this.m_LookDevView.envLibrary.RemoveHDRI(infos.cubemap);
                 }
             }
             GUILayout.EndHorizontal();
             Rect lastRect = GUILayoutUtility.GetLastRect();
             if ((Event.current.type == EventType.MouseDown) && lastRect.Contains(Event.current.mousePosition))
             {
                 Event.current.Use();
             }
             Rect rect = GUILayoutUtility.GetRect((float)250f, (float)125f);
             rect.width = 253f;
             float   num5      = 24f;
             float   num6      = num5 * 0.5f;
             float   latitude  = shadowInfo.latitude;
             float   longitude = shadowInfo.longitude;
             Vector2 vector2   = ((Vector2)(this.LatLongToPosition(latitude, longitude + infos.angleOffset) * 0.5f)) + new Vector2(0.5f, 0.5f);
             Rect    rect3     = rect;
             rect3.x      = (rect3.x + (vector2.x * rect.width)) - num6;
             rect3.y      = (rect3.y + ((1f - vector2.y) * rect.height)) - num6;
             rect3.width  = num5;
             rect3.height = num5;
             Rect rect4 = rect;
             rect4.x      = (rect4.x + (vector2.x * rect.width)) - (num6 * 0.5f);
             rect4.y      = (rect4.y + ((1f - vector2.y) * rect.height)) - (num6 * 0.5f);
             rect4.width  = num5 * 0.5f;
             rect4.height = num5 * 0.5f;
             this.GetFrameAndShadowTextureRect(rect, out rect5, out rect6);
             if (this.m_LookDevView.config.enableShadowCubemap)
             {
                 EditorGUIUtility.AddCursorRect(rect4, MouseCursor.Pan);
             }
             if ((Event.current.type == EventType.MouseDown) && rect.Contains(Event.current.mousePosition))
             {
                 if ((!Event.current.control && (Event.current.button == 0)) && (this.m_SelectedCubeMapOffsetIndex == -1))
                 {
                     if (this.m_LookDevView.config.enableShadowCubemap && rect4.Contains(Event.current.mousePosition))
                     {
                         this.m_SelectedLightIconIndex = i;
                         this.m_SelectedShadowInfo     = shadowInfo;
                         Undo.RecordObject(this.m_LookDevView.envLibrary, "Light Icon selection");
                         this.m_SelectedShadowInfo.latitude  += 0.0001f;
                         this.m_SelectedShadowInfo.longitude += 0.0001f;
                     }
                     if (this.m_SelectedShadowInfo == null)
                     {
                         Rect rect10 = rect5;
                         rect10.x     += 100f;
                         rect10.y     += 4f;
                         rect10.width  = 11f;
                         rect10.height = 11f;
                         if (this.m_LookDevView.config.enableShadowCubemap && rect10.Contains(Event.current.mousePosition))
                         {
                             Undo.RecordObject(this.m_LookDevView.envLibrary, "Update shadow cubemap");
                             hdriList[i].SetCubemapShadowInfo(hdriList[i]);
                             this.m_LookDevView.envLibrary.dirty = true;
                         }
                         else
                         {
                             if (this.m_LookDevView.config.enableShadowCubemap && rect6.Contains(Event.current.mousePosition))
                             {
                                 this.m_SelectedShadowCubemapOwnerInfo = hdriList[i];
                                 this.m_SelectedCubemapInfo            = this.m_SelectedShadowCubemapOwnerInfo.cubemapShadowInfo;
                             }
                             else
                             {
                                 this.m_SelectedCubemapInfo = hdriList[i];
                             }
                             this.m_SelectedPositionOffset     = Event.current.mousePosition - new Vector2(rect.x, rect.y);
                             this.m_RenderOverlayThumbnailOnce = true;
                         }
                     }
                 }
                 else if ((Event.current.control && (Event.current.button == 0)) && ((this.m_SelectedCubemapInfo == null) && (this.m_SelectedShadowInfo == null)))
                 {
                     this.m_SelectedCubeMapOffsetIndex = i;
                     this.m_SelectedCubeMapOffsetValue = infos.angleOffset - this.ComputeAngleOffsetFromMouseCoord(Event.current.mousePosition);
                 }
                 GUIUtility.hotControl = this.m_LookDevView.hotControl;
                 Event.current.Use();
             }
             if ((Event.current.GetTypeForControl(this.m_LookDevView.hotControl) == EventType.MouseDrag) && ((this.m_SelectedShadowInfo == shadowInfo) && (this.m_SelectedLightIconIndex == i)))
             {
                 Vector2 mousePosition = Event.current.mousePosition;
                 mousePosition.x = (((mousePosition.x - rect.x) / rect.width) * 2f) - 1f;
                 mousePosition.y = ((1f - ((mousePosition.y - rect.y) / rect.height)) * 2f) - 1f;
                 Vector2 vector4 = PositionToLatLong(mousePosition);
                 this.m_SelectedShadowInfo.latitude  = vector4.x;
                 this.m_SelectedShadowInfo.longitude = vector4.y - infos.angleOffset;
                 this.m_LookDevView.envLibrary.dirty = true;
             }
             if (Event.current.type == EventType.Repaint)
             {
                 this.DrawLatLongThumbnail(infos, infos.angleOffset, 1f, 1f, rect);
                 if (this.m_LookDevView.config.enableShadowCubemap)
                 {
                     if ((infos.cubemapShadowInfo != infos) || ((this.m_HoveringCubeMapIndex == i) && (this.m_SelectedCubemapInfo != infos)))
                     {
                         CubemapInfo cubemapShadowInfo = infos.cubemapShadowInfo;
                         if ((this.m_HoveringCubeMapIndex == i) && (this.m_SelectedCubemapInfo != infos))
                         {
                             cubemapShadowInfo = this.m_SelectedCubemapInfo;
                         }
                         float alpha = 1f;
                         if (this.m_SelectedShadowInfo == shadowInfo)
                         {
                             alpha = 0.1f;
                         }
                         else if (((this.m_HoveringCubeMapIndex == i) && (this.m_SelectedCubemapInfo != infos)) && (infos.cubemapShadowInfo != this.m_SelectedCubemapInfo))
                         {
                             alpha = 0.5f;
                         }
                         this.DrawLatLongThumbnail(cubemapShadowInfo, infos.angleOffset, 0.3f, alpha, rect6);
                         GL.sRGBWrite = QualitySettings.activeColorSpace == ColorSpace.Linear;
                         GUI.DrawTexture(rect5, styles.sLatlongFrameTexture);
                         GL.sRGBWrite = false;
                     }
                     GL.sRGBWrite = QualitySettings.activeColorSpace == ColorSpace.Linear;
                     GUI.DrawTexture(rect3, styles.sLightTexture);
                     GL.sRGBWrite = false;
                 }
                 if (flag2)
                 {
                     this.DrawSelectionFeedback(rect, black, firstViewGizmoColor);
                 }
             }
             GUILayout.EndVertical();
         }
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(250f) };
         GUILayout.BeginVertical(options);
         if (((this.m_SelectedCubemap != null) || this.m_DragBeingPerformed) && this.GetInsertionRect(hdriList.Count).Contains(Event.current.mousePosition))
         {
             GUILayout.Label(GUIContent.none, styles.sSeparatorStyle, new GUILayoutOption[0]);
             GUILayoutUtility.GetRect((float)250f, (float)16f);
             GUILayout.Label(GUIContent.none, styles.sSeparatorStyle, new GUILayoutOption[0]);
         }
         GUILayout.EndVertical();
         if (flag)
         {
             EditorGUILayout.EndScrollView();
         }
         this.HandleMouseInput();
         this.RenderOverlayThumbnailIfNeeded();
         if ((Event.current.type == EventType.Repaint) && (this.m_SelectedCubemap != null))
         {
             this.m_LookDevView.Repaint();
         }
     }
 }