void OnGUI()
    {
        GUILayoutOption[] width200 = new GUILayoutOption[] {GUILayout.Width(200)};

        GUILayout.BeginArea(new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 100, 400, 200));

        GUILayout.BeginVertical();
        GUILayout.Label("Time Left:" + this.timeLeft.ToString("0.000"));
        if (this.gs == gameState.waiting || this.gs == gameState.running)
        {
            if (GUILayout.Button("Click me as much as you can in " + this.startTime.ToString("0") + " seconds!"))
            {
                this.totalScore++;
                this.gs = gameState.running;
            }

            GUILayout.Label("Total Score: " + this.totalScore.ToString());
        }

        if (this.gs == gameState.enterscore)
        {
            GUILayout.Label("Total Score: " + this.totalScore.ToString());
            GUILayout.BeginHorizontal();
            GUILayout.Label("Your Name: ");
            this.playerName = GUILayout.TextField(this.playerName, width200);

            if (GUILayout.Button("Save Score"))
            {
                // add the score...
                dl.AddScore(this.playerName, totalScore);

                this.gs = gameState.leaderboard;
            }
            GUILayout.EndHorizontal();
        }

        if (this.gs == gameState.leaderboard)
        {
            GUILayout.Label("High Scores:");
            DreamloLeaderBoard.Score[] scoreList = dl.ToScoreArray();

            if (scoreList == null)
            {
                GUILayout.Label("(loading...)");
            }
            else
            {
                foreach (DreamloLeaderBoard.Score currentScore in scoreList)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(currentScore.PlayerName, width200);
                    GUILayout.Label(currentScore.PlayerScore.ToString(), width200);
                    GUILayout.EndHorizontal();
                }
            }
        }

        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
예제 #2
0
    static bool GUILayoutUtility_GetAspectRect__Single__GUIStyle__GUILayoutOption_Array(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 3)
        {
            System.Single                 arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
            UnityEngine.GUIStyle          arg1 = (UnityEngine.GUIStyle)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.GUILayoutOption[] arg2 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() =>
            {
                int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
                int length  = JSApi.getArrayLength(jsObjID);
                var ret     = new UnityEngine.GUILayoutOption[length];
                for (var i = 0; i < length; i++)
                {
                    JSApi.getElement(jsObjID, i);
                    ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
                }
                return(ret);
            });
            JSMgr.datax.setObject((int)JSApi.SetType.Rval, UnityEngine.GUILayoutUtility.GetAspectRect(arg0, arg1, arg2));
        }

        return(true);
    }
예제 #3
0
    static bool ScrollViewScope_ScrollViewScope2(JSVCall vc, int argc)
    {
        int _this = JSApi.getObject((int)JSApi.GetType.Arg);

        JSApi.attachFinalizerObject(_this);
        --argc;

        int len = argc;

        if (len == 4)
        {
            UnityEngine.Vector2           arg0 = (UnityEngine.Vector2)JSApi.getVector2S((int)JSApi.GetType.Arg);
            System.Boolean                arg1 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
            System.Boolean                arg2 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
            UnityEngine.GUILayoutOption[] arg3 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() =>
            {
                int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
                int length  = JSApi.getArrayLength(jsObjID);
                var ret     = new UnityEngine.GUILayoutOption[length];
                for (var i = 0; i < length; i++)
                {
                    JSApi.getElement(jsObjID, i);
                    ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
                }
                return(ret);
            });
            JSMgr.addJSCSRel(_this, new UnityEngine.GUILayout.ScrollViewScope(arg0, arg1, arg2, arg3));
        }

        return(true);
    }
    static bool HorizontalScope_HorizontalScope3(JSVCall vc, int argc)
    {
        int _this = JSApi.getObject((int)JSApi.GetType.Arg);

        JSApi.attachFinalizerObject(_this);
        --argc;

        int len = argc;

        if (len == 3)
        {
            System.String                 arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
            UnityEngine.GUIStyle          arg1 = (UnityEngine.GUIStyle)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.GUILayoutOption[] arg2 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() =>
            {
                int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
                int length  = JSApi.getArrayLength(jsObjID);
                var ret     = new UnityEngine.GUILayoutOption[length];
                for (var i = 0; i < length; i++)
                {
                    JSApi.getElement(jsObjID, i);
                    ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
                }
                return(ret);
            });
            JSMgr.addJSCSRel(_this, new UnityEngine.GUILayout.HorizontalScope(arg0, arg1, arg2));
        }

        return(true);
    }
 private void BakeButtons()
 {
     float width = 95f;
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     bool flag = !EditorApplication.isPlayingOrWillChangePlaymode;
     GUI.enabled = (StaticOcclusionCulling.umbraDataSize != 0) && flag;
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(width) };
     if (GUILayout.Button("Clear", options))
     {
         StaticOcclusionCulling.Clear();
     }
     GUI.enabled = flag;
     if (StaticOcclusionCulling.isRunning)
     {
         GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(width) };
         if (GUILayout.Button("Cancel", optionArray2))
         {
             StaticOcclusionCulling.Cancel();
         }
     }
     else
     {
         GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(width) };
         if (GUILayout.Button("Bake", optionArray3))
         {
             StaticOcclusionCulling.GenerateInBackground();
         }
     }
     GUILayout.EndHorizontal();
     GUI.enabled = true;
 }
예제 #6
0
 public static int AspectSelectionGridImageAndText(int selected, GUIContent[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
     EditorGUILayout.BeginVertical(GUIContent.none, EditorStyles.helpBox, options);
     int num = 0;
     doubleClick = false;
     if (textures.Length != 0)
     {
         int xCount = 0;
         Rect position = GetBrushAspectRect(textures.Length, approxSize, 12, out xCount);
         Event current = Event.current;
         if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && position.Contains(current.mousePosition))
         {
             doubleClick = true;
             current.Use();
         }
         num = GUI.SelectionGrid(position, selected, textures, xCount, style);
     }
     else
     {
         GUILayout.Label(emptyString, new GUILayoutOption[0]);
     }
     GUILayout.EndVertical();
     return num;
 }
예제 #7
0
 public static void Show(SerializedProperty bodyMask, int count)
 {
     if (styles.UnityDude.image != null)
     {
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth((float) styles.UnityDude.image.width) };
         Rect position = GUILayoutUtility.GetRect(styles.UnityDude, GUIStyle.none, options);
         position.x += (GUIView.current.position.width - position.width) / 2f;
         Color color = GUI.color;
         GUI.color = (bodyMask.GetArrayElementAtIndex(0).intValue != 1) ? Color.red : Color.green;
         if (styles.BodyPart[0].image != null)
         {
             GUI.DrawTexture(position, styles.BodyPart[0].image);
         }
         GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f);
         GUI.DrawTexture(position, styles.UnityDude.image);
         for (int i = 1; i < count; i++)
         {
             GUI.color = (bodyMask.GetArrayElementAtIndex(i).intValue != 1) ? Color.red : Color.green;
             if (styles.BodyPart[i].image != null)
             {
                 GUI.DrawTexture(position, styles.BodyPart[i].image);
             }
         }
         GUI.color = color;
         DoPicking(position, bodyMask, count);
     }
 }
예제 #8
0
			internal LayoutedWindow(GUI.WindowFunction f, Rect _screenRect, GUIContent _content, GUILayoutOption[] _options, GUIStyle _style)
			{
				this.func = f;
				this.screenRect = _screenRect;
				this.options = _options;
				this.style = _style;
			}
예제 #9
0
    void OnGUI()
    {
        GUILayoutOption[] ops = new GUILayoutOption[]{};

        GUI.skin.label.fontSize = 30;
        GUI.skin.textArea.fontSize = 30;
        GUI.skin.button.fontSize = 30;

        if (GUILayout.Button ("UUID", ops)) {
            currentUUID = SystemInfo.deviceUniqueIdentifier;
            Debug.Log ("CurrentUUID: [" + currentUUID + "]");
        }

        GUILayout.TextArea (currentUUID, ops);

        if (GUILayout.Button ("Load UUID", ops)) {
            saveUUID = KeyChain.BindGetKeyChainUser ();
            Debug.Log ("LoadUUID: [" + saveUUID + "]");
        }

        GUILayout.TextArea (saveUUID, ops);

        if (GUILayout.Button ("Save UUID", ops)) {
            currentUUID = SystemInfo.deviceUniqueIdentifier;
            KeyChain.BindSetKeyChainUser ("0", currentUUID);
            Debug.Log ("SaveUUID: [" + currentUUID + "]");
        }

        if (GUILayout.Button ("Delete UUID", ops)) {
            KeyChain.BindDeleteKeyChainUser ();
        }
    }
		public static void Buttons (ArrayList _buttonsList, System.Action<string> _callbackOnPress,
		                            Rect _normalisedBounds)
		{
			if (_buttonsList == null)
				return;

			Rect _absoluteBounds	= GetScreenSpaceBounds(_normalisedBounds);

			// Calculating height
			float _buttonHeight		= Screen.height * 0.05f;
			float _yOffsetBwButtons	= Screen.height * 0.01f;
			float _heightPerButton	= _buttonHeight + _yOffsetBwButtons;

			// Calculating total rows and columns
			int _totalButtons			= _buttonsList.Count;
			int _maxButtonsPerColumn	= (int)(_absoluteBounds.height / _heightPerButton);
			int _totalColumns			= ((int)(_totalButtons / _maxButtonsPerColumn)) + (((_totalButtons % _maxButtonsPerColumn) == 0) ? 0 : 1);

			// Drawing GUI buttons
			GUILayoutOption[] _layoutOptions	= new GUILayoutOption[] { GUILayout.Height(_buttonHeight) };

			GUILayout.BeginArea(_absoluteBounds);
			GUILayout.BeginHorizontal();
			{
				for (int _bIter = 0; _bIter < _totalColumns; _bIter++)
				{
					DrawButtonsLayout(_buttonsList, 					_callbackOnPress,
					                  _bIter * _maxButtonsPerColumn, 	_maxButtonsPerColumn, 
					                  _layoutOptions);
				}
			}
			GUILayout.EndHorizontal();
			GUILayout.EndArea();
		}
예제 #11
0
		public override void ApplyOptions(GUILayoutOption[] options)
		{
			if (options == null)
			{
				return;
			}
			base.ApplyOptions(options);
			for (int i = 0; i < options.Length; i++)
			{
				GUILayoutOption gUILayoutOption = options[i];
				switch (gUILayoutOption.type)
				{
				case GUILayoutOption.Type.fixedWidth:
				case GUILayoutOption.Type.minWidth:
				case GUILayoutOption.Type.maxWidth:
					this.userSpecifiedHeight = true;
					break;
				case GUILayoutOption.Type.fixedHeight:
				case GUILayoutOption.Type.minHeight:
				case GUILayoutOption.Type.maxHeight:
					this.userSpecifiedWidth = true;
					break;
				case GUILayoutOption.Type.spacing:
					this.spacing = (float)((int)gUILayoutOption.value);
					break;
				}
			}
		}
예제 #12
0
 public void DrawAudioFilterGUI(MonoBehaviour behaviour)
 {
     int customFilterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour);
     if (customFilterChannelCount > 0)
     {
         if (this.dataOut == null)
         {
             this.dataOut = new EditorGUI.VUMeter.SmoothingData[customFilterChannelCount];
         }
         double num2 = ((double) AudioUtil.GetCustomFilterProcessTime(behaviour)) / 1000000.0;
         float r = ((float) num2) / ((((float) AudioSettings.outputSampleRate) / 1024f) / ((float) customFilterChannelCount));
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.Space(13f);
         GUILayout.BeginVertical(new GUILayoutOption[0]);
         EditorGUILayout.Space();
         for (int i = 0; i < customFilterChannelCount; i++)
         {
             GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.MinWidth(50f), GUILayout.Height(5f) };
             EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, i), ref this.dataOut[i], optionArray1);
         }
         GUILayout.EndVertical();
         Color color = GUI.color;
         GUI.color = new Color(r, 1f - r, 0f, 1f);
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f), GUILayout.Height(20f) };
         GUILayout.Box(string.Format("{0:00.00}ms", num2), options);
         GUI.color = color;
         GUILayout.EndHorizontal();
         EditorGUILayout.Space();
         GUIView.current.Repaint();
     }
 }
////////////////////// VerticalScope ///////////////////////////////////////
// constructors

    static bool VerticalScope_VerticalScope1(JSVCall vc, int argc)
    {
        int _this = JSApi.getObject((int)JSApi.GetType.Arg);

        JSApi.attachFinalizerObject(_this);
        --argc;

        int len = argc;

        if (len == 1)
        {
            UnityEngine.GUILayoutOption[] arg0 = JSDataExchangeMgr.GetJSArg <UnityEngine.GUILayoutOption[]>(() =>
            {
                int jsObjID = JSApi.getObject((int)JSApi.GetType.Arg);
                int length  = JSApi.getArrayLength(jsObjID);
                var ret     = new UnityEngine.GUILayoutOption[length];
                for (var i = 0; i < length; i++)
                {
                    JSApi.getElement(jsObjID, i);
                    ret[i] = (UnityEngine.GUILayoutOption)JSMgr.datax.getObject((int)JSApi.GetType.SaveAndRemove);
                }
                return(ret);
            });
            JSMgr.addJSCSRel(_this, new UnityEngine.GUILayout.VerticalScope(arg0));
        }

        return(true);
    }
예제 #14
0
 private void ShowEntry(GUIContent logo, string url, GUIContent header, GUIContent text, string analyticsAction)
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(55f) };
     GUILayout.BeginHorizontal(options);
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(120f) };
     GUILayout.BeginHorizontal(optionArray2);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(logo, GUIStyle.none, new GUILayoutOption[0]))
     {
         this.ShowHelpPageOrBrowseURL(url, analyticsAction);
     }
     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     if (GUILayout.Button(header, "HeaderLabel", new GUILayoutOption[0]))
     {
         this.ShowHelpPageOrBrowseURL(url, analyticsAction);
     }
     EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
     GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(400f) };
     GUILayout.Label(text, "WordWrappedLabel", optionArray3);
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
 }
예제 #15
0
 private void BottomArea()
 {
     GUILayout.BeginVertical(Styles.bottomBarBg, new GUILayoutOption[0]);
     GUILayout.Space(8f);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(50f) };
     if (GUILayout.Button(Styles.allText, options))
     {
         this.m_Tree.SetAllEnabled(1);
     }
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(50f) };
     if (GUILayout.Button(Styles.noneText, optionArray2))
     {
         this.m_Tree.SetAllEnabled(0);
     }
     GUILayout.Space(10f);
     EditorGUI.BeginChangeCheck();
     this.m_IncludeDependencies = GUILayout.Toggle(this.m_IncludeDependencies, Styles.includeDependenciesText, new GUILayoutOption[0]);
     if (EditorGUI.EndChangeCheck())
     {
         this.RefreshAssetList();
     }
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(EditorGUIUtility.TextContent("Export..."), new GUILayoutOption[0]))
     {
         this.Export();
         GUIUtility.ExitGUI();
     }
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.Space(5f);
     GUILayout.EndVertical();
 }
 public override void OnInspectorGUI()
 {
     GUILayout.Label(Styles.sketchUpLabel, EditorStyles.boldLabel, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_GenerateBackFace, Styles.generateBackFaceLabel, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_MergeCoplanarFaces, Styles.mergeCoplanarFaces, new GUILayoutOption[0]);
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(EditorGUIUtility.labelWidth) };
     GUILayout.Label(Styles.fileUnitLabel, options);
     GUILayout.Label("1", new GUILayoutOption[0]);
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MaxWidth(100f) };
     EditorGUILayout.Popup(this.m_FileUnit, Styles.measurementOptions, GUIContent.Temp(""), optionArray2);
     this.lengthToUnit = ConvertGlobalScaleToUnit((EFileUnit) this.m_FileUnit.intValue, this.m_GlobalScale.floatValue);
     GUILayout.Label("=", new GUILayoutOption[0]);
     this.lengthToUnit = EditorGUILayout.FloatField(this.lengthToUnit, new GUILayoutOption[0]);
     this.m_GlobalScale.floatValue = CovertUnitToGlobalScale((EFileUnit) this.m_FileUnit.intValue, this.lengthToUnit);
     EditorGUILayout.EndHorizontal();
     using (new EditorGUI.DisabledScope(true))
     {
         EditorGUILayout.FloatField(Styles.longitudeLabel, this.m_Longitude.floatValue, new GUILayoutOption[0]);
         EditorGUILayout.FloatField(Styles.latitudeLabel, this.m_Latitude.floatValue, new GUILayoutOption[0]);
         EditorGUILayout.FloatField(Styles.northCorrectionLabel, this.m_NorthCorrection.floatValue, new GUILayoutOption[0]);
     }
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     if (GUILayout.Button(Styles.selectNodeButton, new GUILayoutOption[0]))
     {
         SketchUpImportDlg.Launch(this.m_Target.GetNodes(), this);
         GUIUtility.ExitGUI();
     }
     GUILayout.FlexibleSpace();
     EditorGUILayout.EndHorizontal();
     base.OnInspectorGUI();
 }
예제 #17
0
 public override void OnInspectorGUI()
 {
     base.serializedObject.Update();
     GUI.changed = false;
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     EditorGUILayout.PrefixLabel("Size", EditorStyles.popup);
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f) };
     EditorGUILayout.PropertyField(this.m_Width, GUIContent.none, options);
     GUILayout.Label("x", new GUILayoutOption[0]);
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(40f) };
     EditorGUILayout.PropertyField(this.m_Height, GUIContent.none, optionArray2);
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
     EditorGUILayout.IntPopup(this.m_AntiAliasing, kRenderTextureAntiAliasing, kRenderTextureAntiAliasingValues, EditorGUIUtility.TempContent("Anti-Aliasing"), new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_ColorFormat, EditorGUIUtility.TempContent("Color Format"), new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_DepthFormat, EditorGUIUtility.TempContent("Depth Buffer"), new GUILayoutOption[0]);
     RenderTexture target = this.target as RenderTexture;
     if (GUI.changed && (target != null))
     {
         target.Release();
     }
     base.isInspectorDirty = true;
     EditorGUILayout.Space();
     base.DoWrapModePopup();
     base.DoFilterModePopup();
     EditorGUI.BeginDisabledGroup(this.RenderTextureHasDepth());
     base.DoAnisoLevelSlider();
     EditorGUI.EndDisabledGroup();
     if (this.RenderTextureHasDepth())
     {
         base.m_Aniso.intValue = 0;
         EditorGUILayout.HelpBox("RenderTextures with depth must have an Aniso Level of 0.", MessageType.Info);
     }
     base.serializedObject.ApplyModifiedProperties();
 }
예제 #18
0
 public GUIWordWrapSizer(GUIStyle style, GUIContent content, GUILayoutOption[] options) : base(0f, 0f, 0f, 0f, style)
 {
     this.m_Content = new GUIContent(content);
     this.ApplyOptions(options);
     this.m_ForcedMinHeight = base.minHeight;
     this.m_ForcedMaxHeight = base.maxHeight;
 }
 protected override void DrawInspectedStacktrace()
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandHeight(false) };
     this.m_StacktraceScrollPos = EditorGUILayout.BeginScrollView(this.m_StacktraceScrollPos, GUIViewDebuggerWindow.s_Styles.stacktraceBackground, options);
     base.DrawStackFrameList(this.m_Instruction.stackframes);
     EditorGUILayout.EndScrollView();
 }
예제 #20
0
        internal static GUILayoutGroup BeginLayoutGroup(GUIStyle style, GUILayoutOption[] options, System.Type layoutType)
        {
            GUILayoutGroup next;
            switch (Event.current.type)
            {
                case EventType.Used:
                case EventType.Layout:
                    next = CreateGUILayoutGroupInstanceOfType(layoutType);
                    next.style = style;
                    if (options != null)
                    {
                        next.ApplyOptions(options);
                    }
                    current.topLevel.Add(next);
                    break;

                default:
                    next = current.topLevel.GetNext() as GUILayoutGroup;
                    if (next == null)
                    {
                        throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
                    }
                    next.ResetCursor();
                    GUIDebugger.LogLayoutGroupEntry(next.rect, next.margin, next.style, next.isVertical);
                    break;
            }
            current.layoutGroups.Push(next);
            current.topLevel = next;
            return next;
        }
예제 #21
0
        public override void ApplyOptions(GUILayoutOption[] options)
        {
            if (options != null)
            {
                base.ApplyOptions(options);
                foreach (GUILayoutOption option in options)
                {
                    switch (option.type)
                    {
                        case GUILayoutOption.Type.fixedWidth:
                        case GUILayoutOption.Type.minWidth:
                        case GUILayoutOption.Type.maxWidth:
                            this.m_UserSpecifiedHeight = true;
                            break;

                        case GUILayoutOption.Type.fixedHeight:
                        case GUILayoutOption.Type.minHeight:
                        case GUILayoutOption.Type.maxHeight:
                            this.m_UserSpecifiedWidth = true;
                            break;

                        case GUILayoutOption.Type.spacing:
                            this.spacing = (int) option.value;
                            break;
                    }
                }
            }
        }
예제 #22
0
 public GUILayoutGroup(GUIStyle _style, GUILayoutOption[] options) : base(0f, 0f, 0f, 0f, _style)
 {
     this.entries = new List<GUILayoutEntry>();
     this.isVertical = true;
     this.resetCoords = false;
     this.spacing = 0f;
     this.sameSize = true;
     this.isWindow = false;
     this.windowID = -1;
     this.m_Cursor = 0;
     this.m_StretchableCountX = 100;
     this.m_StretchableCountY = 100;
     this.m_UserSpecifiedWidth = false;
     this.m_UserSpecifiedHeight = false;
     this.m_ChildMinWidth = 100f;
     this.m_ChildMaxWidth = 100f;
     this.m_ChildMinHeight = 100f;
     this.m_ChildMaxHeight = 100f;
     this.m_Margin = new RectOffset();
     if (options != null)
     {
         this.ApplyOptions(options);
     }
     this.m_Margin.left = _style.margin.left;
     this.m_Margin.right = _style.margin.right;
     this.m_Margin.top = _style.margin.top;
     this.m_Margin.bottom = _style.margin.bottom;
 }
예제 #23
0
    static bool FloatField(string name, ref float value, bool hidden, bool greyedOut, GUILayoutOption opt)
    {
        float newValue = value;
        GUI.changed = false;

        if (!hidden) {
            if (greyedOut) {
                GUI.color = new Color(0.7f, 0.7f, 0.7f);
                newValue = EditorGUILayout.FloatField(name, newValue, opt);
                GUI.color = Color.white;
            } else {
                newValue = EditorGUILayout.FloatField(name, newValue, opt);
            }
        } else if (greyedOut) {
            GUI.color = new Color(0.7f, 0.7f, 0.7f);
            float.TryParse(EditorGUILayout.TextField(name, "--", opt), out newValue);
            GUI.color = Color.white;
        } else {
            float.TryParse(EditorGUILayout.TextField(name, "--", opt), out newValue);
        }

        if (GUI.changed && Differs(newValue, value)) {
            value = newValue;
            return true;
        }
        return false;
    }
 public static void Expose( PropertyField[] properties )
 {
     GUILayoutOption[] emptyOptions = new GUILayoutOption[0];
     EditorGUILayout.BeginVertical(emptyOptions);
     foreach(PropertyField field in properties) {
         EditorGUILayout.BeginHorizontal(emptyOptions);
         switch(field.Type) {
         case SerializedPropertyType.Integer:
             field.SetValue(EditorGUILayout.IntField(field.Name, (int)field.GetValue(), emptyOptions));
             break;
         case SerializedPropertyType.Float:
             field.SetValue(EditorGUILayout.FloatField(field.Name, (float)field.GetValue(), emptyOptions));
             break;
         case SerializedPropertyType.Boolean:
             field.SetValue(EditorGUILayout.Toggle(field.Name, (bool)field.GetValue(), emptyOptions));
             break;
         case SerializedPropertyType.String:
             field.SetValue(EditorGUILayout.TextField(field.Name, (String)field.GetValue(), emptyOptions));
             break;
         case SerializedPropertyType.Vector2:
             field.SetValue(EditorGUILayout.Vector2Field(field.Name, (Vector2)field.GetValue(), emptyOptions));
             break;
         case SerializedPropertyType.Vector3:
             field.SetValue(EditorGUILayout.Vector3Field(field.Name, (Vector3)field.GetValue(), emptyOptions));
             break;
         case SerializedPropertyType.Enum:
             field.SetValue(EditorGUILayout.EnumPopup(field.Name, (Enum)field.GetValue(), emptyOptions));
             break;
         default:
             break;
         }
         EditorGUILayout.EndHorizontal();
     }
     EditorGUILayout.EndVertical();
 }
예제 #25
0
 public static int AspectSelectionGrid(int selected, Texture[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
     GUILayout.BeginVertical("box", options);
     int num = 0;
     doubleClick = false;
     if (textures.Length != 0)
     {
         float num2 = (EditorGUIUtility.currentViewWidth - 20f) / ((float) approxSize);
         int num3 = (int) Mathf.Ceil(((float) textures.Length) / num2);
         Rect aspectRect = GUILayoutUtility.GetAspectRect(num2 / ((float) num3));
         Event current = Event.current;
         if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && aspectRect.Contains(current.mousePosition))
         {
             doubleClick = true;
             current.Use();
         }
         num = GUI.SelectionGrid(aspectRect, selected, textures, Mathf.RoundToInt(EditorGUIUtility.currentViewWidth - 20f) / approxSize, style);
     }
     else
     {
         GUILayout.Label(emptyString, new GUILayoutOption[0]);
     }
     GUILayout.EndVertical();
     return num;
 }
예제 #26
0
 private void OnGUI()
 {
     GUILayout.Label("(Available only in Developer builds)", EditorStyles.boldLabel, new GUILayoutOption[0]);
     float minHeight = base.position.height - 60f;
     float minWidth = (base.position.width * 0.5f) - 5f;
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     GUILayout.Label("Undos", new GUILayoutOption[0]);
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(minHeight), GUILayout.MinWidth(minWidth) };
     this.undosScroll = GUILayout.BeginScrollView(this.undosScroll, EditorStyles.helpBox, options);
     int num3 = 0;
     foreach (string str in this.undos)
     {
         GUILayout.Label(string.Format("[{0}] - {1}", num3++, str), new GUILayoutOption[0]);
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     GUILayout.Label("Redos", new GUILayoutOption[0]);
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinHeight(minHeight), GUILayout.MinWidth(minWidth) };
     this.redosScroll = GUILayout.BeginScrollView(this.redosScroll, EditorStyles.helpBox, optionArray2);
     num3 = 0;
     foreach (string str2 in this.redos)
     {
         GUILayout.Label(string.Format("[{0}] - {1}", num3++, str2), new GUILayoutOption[0]);
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUILayout.EndHorizontal();
 }
예제 #27
0
 private void DrawColumnNames(GUILayoutOption[] buttonLayout, GUILayoutOption[] fieldLayout)
 {
     GUILayout.Label("", buttonLayout);
     for (int i = 0; i <= book.LastCol; ++i)
     {
         GUILayout.Button(book.getText(0, i), fieldLayout);
     }
 }
예제 #28
0
 public ScreenshotDrawer()
     : base()
 {
     _column1 = GUILayout.Width (128);
     _history = new ScreenshotHistory ();
     _history.Load ();
     _scrolls = new ScrollableContainer ();
 }
예제 #29
0
		public GUILayoutEntry(float _minWidth, float _maxWidth, float _minHeight, float _maxHeight, GUIStyle _style, GUILayoutOption[] options)
		{
			this.minWidth = _minWidth;
			this.maxWidth = _maxWidth;
			this.minHeight = _minHeight;
			this.maxHeight = _maxHeight;
			this.style = _style;
			this.ApplyOptions(options);
		}
예제 #30
0
 public static Object ObjectField(string label, Object obj, Type objType, bool allowSceneObjects, params GUILayoutOption[] options)
 {
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
     GUI.Label(GUILayoutUtility.GetRect(EditorGUIUtility.labelWidth, 32f, EditorStyles.label, optionArray1), label, EditorStyles.label);
     GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(64f) };
     Object obj2 = EditorGUI.ObjectField(GUILayoutUtility.GetAspectRect(1f, EditorStyles.objectField, optionArray2), obj, objType, allowSceneObjects);
     GUILayout.EndHorizontal();
     return obj2;
 }
예제 #31
0
        public SceneHistoryDrawer()
            : base()
        {
            _history = new SceneHistory ();
            _history.Load ();

            _channel = EditorPreferenceHandler.GetChannel (this, CLASS_NAME);
            _restoreOnStop = _channel.GetBool (RESTORE_VAR);
            _textCol1 = GUILayout.Width (100);
        }
        public bool OnGUILayout(SerializedProperty property, GUIContent label, bool includeChildren, GUILayoutOption[] options)
        {
            if (_visibleDrawer == null) this.Init();

            if (label == null) label = EditorHelper.TempContent(property.displayName);
            var rect = EditorGUILayout.GetControlRect(true, _visibleDrawer.GetPropertyHeight(property, label), options);
            _visibleDrawer.OnGUI(rect, property, label);
            SPPropertyAttributePropertyHandler.AddAsHandled(property, this);
            return false;
        }
예제 #33
0
    private void DrawInputSection()
    {
        GUILayoutOption[] GUILayoutOption = new UnityEngine.GUILayoutOption[] { GUILayout.Width(Screen.width / 2) };
        GUILayout.Space(8);

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("New Name:");
        m_NewName = EditorGUILayout.TextField(m_NewName);
        GUILayout.Label("Seperator:");
        m_NewName = EditorGUILayout.TextField(m_NewName);
        GUILayout.Label("Digits:");
        m_NumSequentialDigits = EditorGUILayout.IntField(m_NumSequentialDigits);

        if (m_NumSequentialDigits < 1)
        {
            m_NumSequentialDigits = 1;
        }
        else if (m_NumSequentialDigits > 5)
        {
            m_NumSequentialDigits = 5;
        }

        EditorGUILayout.EndHorizontal();


        EditorGUILayout.BeginHorizontal();

        GUILayout.Label("Find:  ");
        m_Find = EditorGUILayout.TextField(m_Find);
        GUILayout.Label("Replace: ");
        m_Replace = EditorGUILayout.TextField(m_Replace);

        EditorGUILayout.EndHorizontal();

        GUILayout.Space(8);
        if (GUILayout.Button("Rename Object(s)"))
        {
            RenameSelectedObjects(Selection.gameObjects, m_NewName, m_Find, m_Replace);
            //Debug.Log("Renaming <" + Selection.activeObject + "> to " + m_NewName);
        }
    }
예제 #34
-1
 void OnEnable()
 {
     Height40 = GUILayout.Height(40f);
     _FoldoutStyle = new GUIStyle(EditorStyles.foldout);
     _FoldoutStyle.normal.textColor = Color.gray;
     _FoldoutStyle.fontStyle = FontStyle.Bold;
 }
예제 #35
-1
		public GUIWordWrapSizer(GUIStyle _style, GUIContent _content, GUILayoutOption[] options) : base(0f, 0f, 0f, 0f, _style)
		{
			this.content = new GUIContent(_content);
			base.ApplyOptions(options);
			this.forcedMinHeight = this.minHeight;
			this.forcedMaxHeight = this.maxHeight;
		}