Пример #1
0
    public static void TargetDirectionFilter(Property property)
    {
        var target = (Target)property.value;
        string targetString = target.ToString();

        if (target.entityRef.entity == null && target.direction == -1)
            targetString = "Any";

        GUILayout.BeginHorizontal();
        AlignedLabel(property);
        if (GUILayout.Button(targetString, GUI.skin.textField))
        {
            TargetGUI targetGUI = GUIPanel.guiGameObject.AddComponent<TargetGUI>();
            targetGUI.title = property.name;
            targetGUI.voxelArray = VoxelArrayEditor.instance;
            targetGUI.allowNullTarget = true;
            targetGUI.allowObjectTarget = false;
            targetGUI.handler = (Target newTarget) =>
            {
                property.value = newTarget;
            };
        }
        GUILayout.EndHorizontal();
    }
Пример #2
0
        private void OnGUIEditor()
        {
            EditorGUILayout.Space();
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("Add File", GUILayout.MaxWidth(75f)))
            {
                BrowseForFile();
            }
            if (GUILayout.Button("Add Folder", GUILayout.MaxWidth(75f)))
            {
                BrowseForFolder();
            }

            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (m_BundleList.Count > 0)
            {
                int halfWidth = (int)(m_Position.width / 2.0f);
                m_BundleTreeView.OnGUI(new Rect(m_Position.x, m_Position.y + 30, halfWidth, m_Position.height - 30));
                m_SingleInspector.OnGUI(new Rect(m_Position.x + halfWidth, m_Position.y + 30, halfWidth, m_Position.height - 30));
            }
        }
Пример #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        CheckAndCreateSubEditors(conditionCollection.requiredConditions);

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUI.indentLevel++;
        EditorGUILayout.BeginHorizontal();
        descriptionProperty.isExpanded = EditorGUILayout.Foldout(descriptionProperty.isExpanded, descriptionProperty.stringValue);
        if (GUILayout.Button("Remove Collection", GUILayout.Width(collectionButtonWidth)))
        {
            collectionsProperty.RemoveFromObjectArray(conditionCollection);
        }
        EditorGUILayout.EndHorizontal();

        if (descriptionProperty.isExpanded)
        {
            ExpandedGUI();
        }

        EditorGUI.indentLevel--;
        EditorGUILayout.EndVertical();
        serializedObject.ApplyModifiedProperties();
    }
Пример #4
0
        void OnGUI()
        {
            GUILayout.Label("Lightmap UV Settings", EditorStyles.boldLabel);

            Lightmapping.autoUnwrapLightmapUV = EditorGUILayout.Toggle(m_AutoLightmapUVContent, Lightmapping.autoUnwrapLightmapUV);

            if (m_MissingLightmaps.Count > 0)
            {
                EditorGUILayout.HelpBox(GetMissingLightmapText(), MessageType.Warning);

                GUILayout.BeginHorizontal();

                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Build Missing Lightmap UVs"))
                {
                    // copy the missing lightmaps array so that MeshOptimized does not interfere with the rebuild iterator
                    Lightmapping.RebuildMissingLightmapUVs(m_MissingLightmaps.ToArray());
                    EditorUtility.ShowNotification("Rebuild Missing Lightmap UVs");
                }

                GUILayout.EndHorizontal();
            }
        }
Пример #5
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.LabelField("Debug", EditorStyles.boldLabel);
        GUI.enabled = Application.isPlaying;
        if (GUILayout.Button("Mix board"))
        {
            MethodInfo mix = typeof(Board).GetMethod("Mix", BindingFlags.NonPublic | BindingFlags.Instance);
            mix.Invoke(target, null);
        }
        GUI.enabled = true;

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Gem Prefabs", EditorStyles.boldLabel);
        SerializedProperty gemPrefabs = serializedObject.FindProperty("gemPrefabs");
        gemPrefabs.arraySize = 6;
        EditorGUILayout.PropertyField(gemPrefabs.GetArrayElementAtIndex(0), new GUIContent("Blue Gem Prefab"));
        EditorGUILayout.PropertyField(gemPrefabs.GetArrayElementAtIndex(1), new GUIContent("Green Gem Prefab"));
        EditorGUILayout.PropertyField(gemPrefabs.GetArrayElementAtIndex(2), new GUIContent("Orange Gem Prefab"));
        EditorGUILayout.PropertyField(gemPrefabs.GetArrayElementAtIndex(3), new GUIContent("Purple Gem Prefab"));
        EditorGUILayout.PropertyField(gemPrefabs.GetArrayElementAtIndex(4), new GUIContent("Red Gem Prefab"));
        EditorGUILayout.PropertyField(gemPrefabs.GetArrayElementAtIndex(5), new GUIContent("Teal Gem Prefab"));

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("SFX", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("matchAudioClip"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("errorAudioClip"));

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Others", EditorStyles.boldLabel);
        EditorGUILayout.PropertyField(serializedObject.FindProperty("size"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("cellSize"));

        serializedObject.ApplyModifiedProperties();
    }
Пример #6
0
        void OnGUI()
        {
            if (languageManager.NumberOfSupportedLanguages > 0)
            {
                if (languageManager.CurrentlyLoadedCulture != null)
                {
                    GUILayout.Label("“екущий ¤зык:" + languageManager.CurrentlyLoadedCulture.ToString());
                }

                GUILayout.BeginHorizontal();
                GUILayout.Label("Keys:", GUILayout.Width(460));
                GUILayout.Label("Values:", GUILayout.Width(460));
                GUILayout.EndHorizontal();

                valuesScrollPosition = GUILayout.BeginScrollView(valuesScrollPosition);
                foreach (var languageKey in currentLanguageKeys)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(languageKey, GUILayout.Width(460));
                    GUILayout.Label(languageManager.GetTextValue(languageKey), GUILayout.Width(460));
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();

                languagesScrollPosition = GUILayout.BeginScrollView(languagesScrollPosition);
                foreach (SmartCultureInfo language in availableLanguages)
                {
                    if (GUILayout.Button(language.nativeName, GUILayout.Width(960)))
                    {
                        languageManager.ChangeLanguage(language);
                    }
                }

                GUILayout.EndScrollView();
            }
        }
Пример #7
0
 private void BottomArea()
 {
     GUILayout.BeginVertical(PackageExport.Styles.bottomBarBg, new GUILayoutOption[0]);
     GUILayout.Space(8f);
     GUILayout.BeginHorizontal();
     GUILayout.Space(10f);
     if (GUILayout.Button(PackageExport.Styles.allText, new GUILayoutOption[1] {
         GUILayout.Width(50f)
     }))
     {
         this.m_Tree.SetAllEnabled(PackageExportTreeView.EnabledState.All);
     }
     if (GUILayout.Button(PackageExport.Styles.noneText, new GUILayoutOption[1] {
         GUILayout.Width(50f)
     }))
     {
         this.m_Tree.SetAllEnabled(PackageExportTreeView.EnabledState.None);
     }
     GUILayout.Space(10f);
     EditorGUI.BeginChangeCheck();
     this.m_IncludeDependencies = GUILayout.Toggle(this.m_IncludeDependencies, PackageExport.Styles.includeDependenciesText);
     if (EditorGUI.EndChangeCheck())
     {
         this.RefreshAssetList();
     }
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(EditorGUIUtility.TextContent("Export...")))
     {
         this.Export();
         GUIUtility.ExitGUI();
     }
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.Space(5f);
     GUILayout.EndVertical();
 }
        private void ApplyRevertGUI()
        {
            EditorGUILayout.Space();
            bool wasEnabled = GUI.enabled;

            GUI.enabled = m_DirtyOrders;

            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Revert"))
                {
                    Revert();
                }

                if (GUILayout.Button("Apply"))
                {
                    Apply();
                }
            } GUILayout.EndHorizontal();

            GUI.enabled = wasEnabled;
        }
Пример #9
0
    // ------------------------------------------------------------------------

    void drawMainMenu()
    {
        GUILayout.BeginArea(new Rect(ar.sWidth / 2 - 300, ar.sHeight / 2 - 400, 600, 800));
        GUILayout.BeginVertical();
        if (GUILayout.Button("Play"))
        {
            currentMenu = Menu.levelselect;
            //sceneFader.loadScene("game");
        }
        if (GUILayout.Button("Tutorial"))
        {
            Debug.Log("Tutorial");
        }
        if (GUILayout.Button("Check for updates"))
        {
            StartCoroutine(gameObject.GetComponent <UpdateCheck>().checkForUpdate());
        }
        if (GUILayout.Button("Exit"))
        {
            Application.Quit();
        }
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Пример #10
0
        private void DrawInspector()
        {
            // Draw Local Switch Button


            if (GUILayout.Button(new GUIContent(EEUtils.labels["LocalSwitches"])))
            {
                LocalSwitchWindow.Open();
                LocalSwitchWindow.instance.Setup(gameEvent);
            }

            //Draw Pages
            reordlistEventPages.DoLayoutList();
            EEPageEditor pageEditor = GetPageEditor();

            if (pageEditor)
            {
                pageEditor.DrawInspectorGUI();
            }
            else
            {
                EditorGUILayout.HelpBox(EEUtils.labels["CreatePage"], MessageType.Info);
            }
        }
Пример #11
0
        private void DrawButtons()
        {
            EditorGUILayout.BeginHorizontal();
            string state;

            if (KrilloudServer.Instance.IsKrilloudServerActive())
            {
                // KLServer.Instance.startStopServer = false;
                state = "Stop";
            }
            else
            {
                // KLServer.Instance.startStopServer = false;
                state = "Start";
            }
            if (GUILayout.Button(state + " Server Manually"))
            {
                KLServer.Instance.StartStopServerManually();
                //SaveServerState();
            }
            GUI.enabled = true;

            EditorGUILayout.EndHorizontal();
        }
Пример #12
0
 public void AppSelector()
 {
     GUILayout.BeginVertical();
     {
         if (GUILayout.Button("Load", DefaultButtonOptions))
         {
             LoadManifests();
         }
         AppViewScrollPos = GUILayout.BeginScrollView(AppViewScrollPos, ScrollViewStyle);
         {
             foreach (string app in Apps)
             {
                 if (GUILayout.Button(app))
                 {
                     SelectCurrentManifest(app);
                 }
             }
         }
         GUILayout.EndScrollView();
     }
     GUILayout.EndVertical();
     lastRect         = GUILayoutUtility.GetLastRect();
     scrollViewHeight = lastRect.height;
 }
Пример #13
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        float width = EditorGUIUtility.currentViewWidth / 3f;

        CheckAndCreateSubEditors(conditionCollection.requiredConditions);

        EditorGUILayout.BeginVertical(GUI.skin.box);
        EditorGUI.indentLevel++;

        EditorGUILayout.BeginHorizontal();

        descriptionProperty.isExpanded = EditorGUILayout.Foldout(descriptionProperty.isExpanded, descriptionProperty.stringValue);

        //EditorGUILayout.PropertyField(obtainedProperty, GUIContent.none, GUILayout.Width(width + 30f));

        if (GUILayout.Button("Remove Collection", GUILayout.Width(collectionButtonWidth)))
        {
            collectionsProperty.RemoveFromObjectArray(conditionCollection);
        }

        EditorGUILayout.EndHorizontal();

        //EditorGUILayout.PropertyField (availableProperty);
        //EditorGUILayout.PropertyField(obtainedProperty, GUIContent.none, GUILayout.Width(width + 30f));
        if (descriptionProperty.isExpanded)
        {
            ExpandedGUI();
        }

        EditorGUI.indentLevel--;
        EditorGUILayout.EndVertical();

        serializedObject.ApplyModifiedProperties();
    }
Пример #14
0
        private static void TreeWindow(int id)
        {
            GUILayout.BeginVertical();
            {
                _folderTreeView.DrawDirectoryTree();

                GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
                {
                    if (Overlord.DrawDefaultCardsToggle())
                        OnFolderChanged();

                    if (GUILayout.Button("Refresh thumbnails"))
                    {
                        _folderTreeView.ResetTreeCache();
                        OnFolderChanged();
                    }

                    if (GUILayout.Button("Open folder in explorer"))
                        Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
        }
Пример #15
0
	/// <summary>
	/// 绘制插件界面配置项
	/// </summary>
	private void DrawOptions()
	{
		GUILayout.BeginHorizontal();
		EditorGUILayout.LabelField("请选择格式类型:",GUILayout.Width(85));
		indexOfFormat=EditorGUILayout.Popup(indexOfFormat,formatOption,GUILayout.Width(125));
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		EditorGUILayout.LabelField("请选择编码类型:",GUILayout.Width(85));
		indexOfEncoding=EditorGUILayout.Popup(indexOfEncoding,encodingOption,GUILayout.Width(125));
		GUILayout.EndHorizontal();
		EditorGUILayout.BeginHorizontal();
		{
			EditorGUILayout.LabelField("EXCAL文件路径", GUILayout.Width(160f));
			sourcePath = EditorGUILayout.TextField(sourcePath);
			if (GUILayout.Button("Browse...", GUILayout.Width(80f)))
			{
				 sourcePath = EditorUtility.OpenFolderPanel("Select Excal Directory", sourcePath, string.Empty);
			}
		}
		EditorGUILayout.EndHorizontal();
		EditorGUILayout.BeginHorizontal();
		{
			EditorGUILayout.LabelField("要导出的文件路径", GUILayout.Width(160f));
			targetPath = EditorGUILayout.TextField(targetPath);
			if (GUILayout.Button("Browse...", GUILayout.Width(80f)))
			{
				targetPath = EditorUtility.OpenFolderPanel("Select TXT Directory", targetPath, string.Empty);
			}
		}
		EditorGUILayout.EndHorizontal();
		/*sourcePath = EditorGUILayout.TextField("EXCAL文件路径:", sourcePath, GUILayout.Width(500), GUILayout.Height(20));
		TargetPath = EditorGUILayout.TextField("要导出的文件路径:", TargetPath, GUILayout.Width(500), GUILayout.Height(20));*/

		keepSource = GUILayout.Toggle(keepSource,"保留Excel源文件");
	}
Пример #16
0
    /// <summary>
    /// Draw details about the specified monobehavior in column format.
    /// </summary>

    bool DrawObject(MonoBehaviour mb)
    {
        bool retVal = false;

        GUILayout.BeginHorizontal();
        {
            if (EditorUtility.IsPersistent(mb.gameObject))
            {
                GUILayout.Label("Prefab", "AS TextArea", GUILayout.Width(80f), GUILayout.Height(20f));
            }
            else
            {
                GUI.color = Color.grey;
                GUILayout.Label("Object", "AS TextArea", GUILayout.Width(80f), GUILayout.Height(20f));
            }

            GUILayout.Label(NGUITools.GetHierarchy(mb.gameObject), "AS TextArea", GUILayout.Height(20f));
            GUI.color = Color.white;

            retVal = GUILayout.Button("Select", "ButtonLeft", GUILayout.Width(60f), GUILayout.Height(16f));
        }
        GUILayout.EndHorizontal();
        return(retVal);
    }
Пример #17
0
    void GUI_Disconnected()
    {
        if (PhotonNetwork.connectionState == ConnectionState.Connecting)
        {
            GUILayout.Label("Connecting...");
        }
        else
        {
            GUILayout.Label("Not connected. Check console output. (" + PhotonNetwork.connectionState + ")");
        }

        if (this.connectFailed)
        {
            GUILayout.Label("Connection failed. Check setup and use Setup Wizard to fix configuration.");
            GUILayout.Label(string.Format("Server: {0}:{1}", PhotonNetwork.PhotonServerSettings.ServerAddress, PhotonNetwork.PhotonServerSettings.ServerPort));
            GUILayout.Label(string.Format("AppId: {0}", PhotonNetwork.PhotonServerSettings.AppID));

            if (GUILayout.Button("Try Again", GUILayout.Width(100)))
            {
                this.connectFailed = false;
                PhotonNetwork.ConnectUsingSettings("1.0");
            }
        }
    }
Пример #18
0
 void OnGUI()
 {
     // The actual window code goes here
     scene = EditorGUILayout.ObjectField("Scene", scene, typeof(UnityEngine.Object), true);
     fileName = EditorGUILayout.TextField("Filename", fileName);
     path = EditorGUILayout.TextField("Relative Path", path);
     windowTitle = EditorGUILayout.TextField("Window Title", windowTitle);
     desktopWidth = EditorGUILayout.IntField("Width", desktopWidth);
     desktopHeight = EditorGUILayout.IntField("Height", desktopHeight);
     timeOut = EditorGUILayout.IntField("TimeOut", timeOut);
     horizontalOffset = EditorGUILayout.IntField("Horizontal Offset", horizontalOffset);
     shouldPlayInEditor = EditorGUILayout.Toggle("Play in Editor", shouldPlayInEditor);
     if (GUILayout.Button("Build & Run"))
     {
         BuildGame();
         StartGame();
         PlaySceneInEditor(shouldPlayInEditor);
     }
     if (GUILayout.Button("Run"))
     {
         StartGame();
         PlaySceneInEditor(shouldPlayInEditor);
     }
 }
Пример #19
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Align with Scene View"))
        {
            AlignWithSceneView();
        }


        serializedObject.Update();
        EditorGUILayout.PropertyField(_viewPosition);
        EditorGUILayout.PropertyField(_viewRotation);
        EditorGUILayout.PropertyField(_duration);
        EditorGUILayout.PropertyField(_nextView);
        if (_viewTarget.nextView == null && GUILayout.Button("Create Next From Scene View"))
        {
            CreateNextViewTarget();
        }
        serializedObject.ApplyModifiedProperties();

        if (GUILayout.Button("View in Scene"))
        {
            AlignSceneViewWithTarget();
        }
    }
Пример #20
0
    //Implements all of the window functionality
    private void OnGUI()
    {
        ////Display the current Major and Minor build numbers in the window UI
        GUILayout.Label(BuildMajor + ":" + BuildMinor);

        //Place a button which loads the current build info from the XML file
        if (GUILayout.Button("Load"))
        {
            LoadBuildInfo();
        }

        //Place a button which increments the current minor build number then resaves the XML file
        if (GUILayout.Button("Increment"))
        {
            IncrementBuildNumber();
        }

        //Place a text field to enter in a custom build version name and a button to apply it to the ingame UI
        BuildCustom = GUILayout.TextField(BuildCustom);
        if (GUILayout.Button("Set Custom"))
        {
            SetCustomBuildName();
        }
    }
Пример #21
0
	public override void OnInspectorGUI(){
		DrawDefaultInspector ();

		var script = (RandomMapTester)target;

		if (GUILayout.Button ("Generate Island")) {
			if (Application.isPlaying) {
				script.MakeMap ();
			}
		}

		if (GUILayout.Button ("Create Player")) {
			if (Application.isPlaying) {
				script.CreatePlayer ();
			}
		}

		if (GUILayout.Button ("Reset")) {
			if (Application.isPlaying) {
				script.Reset ();
			}
		}

		if (GUILayout.Button ("Start Battle")) {
			if (Application.isPlaying) {
				script.StartBattle ();
			}
		}

		if (GUILayout.Button ("End Battle")) {
			if (Application.isPlaying) {
				script.EndBattle ();
			}
		}

	}
        void DrawScale()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            {
                Vector3 localScale = (base.serializedObject.targetObject as Transform).localScale;
                SetColor((localScale == Vector3.one) ? Color.white : Color.gray, 0.5f);
                GUI.skin.button.padding = new RectOffset(0, 0, 0, 0);
                Texture2D image = (Texture2D)EditorGUIUtility.Load((localScale == Vector3.one) ? "d_ScaleTool" : "d_ScaleTool On");


                if (GUILayout.Button(new GUIContent(image, "Reset Scale"), GUILayout.Width(32f), GUILayout.Height(_buttonHeight)))
                {
                    Undo.RecordObject(ExTransform.transform, "Reset Scale " + ExTransform.transform.name);
                    this.mScl.vector3Value = Vector3.one;
                    base.serializedObject.ApplyModifiedProperties();
                }

                EditorGUI.BeginChangeCheck();
                {
                    GUI.skin.button.padding = new RectOffset(6, 6, 2, 3);
                    SetColor(redLt, 0.5f);
                    EditorGUILayout.PropertyField(this.mScl.FindPropertyRelative("x"), new GUILayoutOption[0]);
                    SetColor(greenLt, 0.5f);
                    EditorGUILayout.PropertyField(this.mScl.FindPropertyRelative("y"), new GUILayoutOption[0]);
                    SetColor(blueLt, 0.5f);
                    EditorGUILayout.PropertyField(this.mScl.FindPropertyRelative("z"), new GUILayoutOption[0]);
                    ResetColors();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(ExTransform.transform, "Scale Changed" + ExTransform.transform.name);
                    base.serializedObject.ApplyModifiedProperties();
                }
            }
            GUILayout.EndHorizontal();
        }
Пример #23
0
        ///----------------------------------------------------------------------------------------------

        //The connection's inspector
        public static void ShowConnectionInspectorGUI(Connection c)
        {
            UndoManager.CheckUndo(c.graph, "Connection Inspector");

            GUILayout.BeginHorizontal();
            GUI.color = new Color(1, 1, 1, 0.5f);

            if (GUILayout.Button("◄", GUILayout.Height(14), GUILayout.Width(20)))
            {
                GraphEditorUtility.activeElement = c.sourceNode;
            }

            if (GUILayout.Button("►", GUILayout.Height(14), GUILayout.Width(20)))
            {
                GraphEditorUtility.activeElement = c.targetNode;
            }

            c.isActive = EditorGUILayout.ToggleLeft("ACTIVE", c.isActive, GUILayout.Width(150));

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("X", GUILayout.Height(14), GUILayout.Width(20)))
            {
                GraphEditorUtility.PostGUI += delegate { c.graph.RemoveConnection(c); };
                return;
            }

            GUI.color = Color.white;
            GUILayout.EndHorizontal();

            EditorUtils.BoldSeparator();
            c.OnConnectionInspectorGUI();
            c.sourceNode.OnConnectionInspectorGUI(c.sourceNode.outConnections.IndexOf(c));

            UndoManager.CheckDirty(c.graph);
        }
Пример #24
0
    /// <summary>
    /// Render all options with non-empty text.
    /// </summary>
    private void RenderOptionButtons () {
        Option selected = Option.SelectedNone;

        // Render options with non-empty text.
        var options = GetOptionList();

        // Space the button similar to Unity dialog. Ex.
        // | [ Option 1 (Cancel) ]                         [ Option 2 (Alt) ] [ Option 0 (Ok) ] |
        // |                                            [ Option 1 (Cancel) ] [ Option 0 (Ok) ] |
        // |                                                                  [ Option 0 (Ok) ] |
        List<int> spacesBeforeButtons = new List<int>(options.Count == 3 ?
                new int[3] { 0, 2, 0 } :
                new int[3] { 2, 0, 0 } );

        for (int i = 0; i < options.Count; ++i) {
            // Place spaces before the button.
            if (i < spacesBeforeButtons.Count ) {
                for (int j = 0; j < spacesBeforeButtons[i]; ++j) {
                    EditorGUILayout.Space();
                }
            }

            var pair = options [i];
            if (GUILayout.Button(pair.Key)) {
                selected = pair.Value;
            }
        }

        if (selected != Option.SelectedNone) {
            selectedOption = selected;
            if (dialogContext.CompleteAction != null) {
                dialogContext.CompleteAction(selectedOption);
            }
            Close();
        }
    }
Пример #25
0
    void OnGUI()
    {
        if (GUILayout.Button("Play"))
        {
            this.ResetAllToBegining();
            this.PlayAll();
        }
        if (GUILayout.Button("Reset"))
        {
            this.ResetAllToBegining();
        }

        if (GUILayout.Button("Skip"))
        {
            this.SkipAll();
        }

        if (GUILayout.Button("TestModify"))
        {
            int value = Random.Range(1, 100);
            Debug.Log(value);
            ModifyHashValue("TestModify","to",value);
        }
    }
Пример #26
0
    public override void OnInspectorGUI()
    {
        ParticleCountManager myTarget = (ParticleCountManager)target;

        myTarget.ParticleCountFactor = EditorGUILayout.IntSlider("Particle Count", myTarget.ParticleCountFactor, 1, 1024);
        EditorGUILayout.LabelField("Final count: " + (myTarget.ParticleCountFactor * 1024));

        myTarget.ParticleBuffer = (BufferSetup)EditorGUILayout.ObjectField("Particle Buffer", myTarget.ParticleBuffer, typeof(BufferSetup), true);
        myTarget.DistanceBuffer = (BufferSetup)EditorGUILayout.ObjectField("Distance Buffer", myTarget.DistanceBuffer, typeof(BufferSetup), true);

        if (myTarget.ParticleBuffer != null)
        {
            if (Application.isPlaying)
            {
                if ((myTarget.ParticleCountFactor * 1024) != myTarget.ParticleBuffer.Count)
                {
                    if (GUILayout.Button("Apply Particle Count"))
                    {
                        myTarget.ApplyParticleCount();
                    }
                }
            }
        }
    }
Пример #27
0
 public void OnGUI() {
     EditorGUILayout.BeginVertical();
     EditorGUILayout.Space();
     if ( !string.IsNullOrEmpty( Info ) ) {
         EditorGUILayout.HelpBox( Info, MessageType.None );
     }
     EditorGUILayout.Space();
     if ( OnGUIFunc != null ) {
         ReturnValue = OnGUIFunc();
     }
     EditorGUILayout.Space();
     EditorGUILayout.BeginHorizontal();
     if ( Buttons != null ) {
         for ( int i = 0; i < Buttons.Length; ++i ) {
             if ( GUILayout.Button( Buttons[ i ], GUILayout.MinWidth( 80 ) ) ) {
                 m_closeButton = i;
                 if ( OnButtonClicks != null ) {
                     if ( i >= 0 && i <= OnButtonClicks.Length && OnButtonClicks[ i ] != null ) {
                         try {
                             OnButtonClicks[ i ]( ReturnValue );
                         } catch ( Exception e ) {
                             Debug.LogException( e );
                         }
                     }
                 }
                 EditorApplication.delayCall += () => {
                     Close();
                 };
             }
             GUILayout.Space( 5 );
         }
     }
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.Space();
     EditorGUILayout.EndVertical();
 }
Пример #28
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(_frameRate);
        EditorGUILayout.PropertyField(_superSampling);

        if (Application.isPlaying)
        {
            var iso         = (ImageSequenceOut)target;
            var buttonStyle = GUILayout.Height(30);
            if (iso.isRecording)
            {
                var time  = (float)iso.frameCount / iso.frameRate;
                var label = "STOP  (" + time.ToString("0.0") + "s)";
                if (GUILayout.Button(label, buttonStyle))
                {
                    iso.StopRecording();
                }
                EditorUtility.SetDirty(target); // force repaint
            }
            else
            {
                if (GUILayout.Button("REC", buttonStyle))
                {
                    iso.StartRecording();
                }
            }
        }
        else
        {
            EditorGUILayout.PropertyField(_recordOnStart);
        }

        serializedObject.ApplyModifiedProperties();
    }
Пример #29
0
    public static T[] drawObjectList <T> (string title, T[] array) where T : UnityEngine.Object
    {
        EditorGUILayout.PrefixLabel(title);
        EditorGUI.indentLevel += 1;
        List <T> list = new List <T> (array);

        for (int i = 0; i < list.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            list [i] = (T)EditorGUILayout.ObjectField("Element " + i, list [i], typeof(T), true);
            if (GUILayout.Button(deleteRowContent, EditorStyles.miniButton, minusButtonWidth))
            {
                list.RemoveAt(i);
            }
            EditorGUILayout.EndHorizontal();
        }
        if (GUILayout.Button(addRowContent, plusButtonWidth))
        {
            list.Add(default(T));
        }
        EditorGUI.indentLevel -= 1;

        return((T[])list.ToArray());
    }
Пример #30
0
        void OnGUI()
        {
            if (UpdateSucess)
            {
                if (GUILayout.Button("Enter Level 2"))
                {
                    Application.LoadLevel("Level2");
                }
                return;
            }

            WindowRect = GUILayout.Window(0, WindowRect, (windowId) => {
                GUILayout.Label(ProgressMessage);

                if (CurProgress != null)
                {
                    var progress = 100 * CurProgress.ProgressCurValue / CurProgress.ProgressTotalValue;
                    GUILayout.HorizontalScrollbar((float)progress, 0f, 0f, 100f);
                    GUILayout.Label(progress.ToString() + "%");
                    GUILayout.Label(CurProgress.CurState.ToString());
                }
                GUILayout.Label(DebugMessage);
            }, "Updater");
        }