/// <inheritdoc/>
            protected override void CreateValueGUI(GUILayoutY layout)
            {
                string value = GetValue <string>();

                valueField = new GUITextField(new LocEdString(value));
                layout.AddElement(valueField);

                valueField.OnChanged   += x => { SetValue(x); MarkAsModified(); };
                valueField.OnConfirmed += ConfirmModify;
                valueField.OnFocusLost += ConfirmModify;
            }
Exemple #2
0
            /// <inheritdoc/>
            protected override GUILayoutX CreateKeyGUI(GUILayoutY layout)
            {
                GUILayoutX titleLayout = layout.AddLayoutX();

                keyField = new GUITextField(new LocEdString("Name"));
                titleLayout.AddElement(keyField);

                keyField.OnChanged += SetKey;

                return(titleLayout);
            }
Exemple #3
0
        /// <inheritoc/>
        protected internal override void Initialize(int layoutIndex)
        {
            if (property.Type == SerializableProperty.FieldType.String)
            {
                guiField              = new GUITextField(new GUIContent(title));
                guiField.OnChanged   += OnFieldValueChanged;
                guiField.OnConfirmed += OnFieldValueConfirm;
                guiField.OnFocusLost += OnFieldValueConfirm;

                layout.AddElement(layoutIndex, guiField);
            }
        }
            /// <inheritdoc/>
            protected override GUILayoutX CreateGUI(GUILayoutY layout)
            {
                AnimationSplitInfo rowSplitInfo = GetValue <AnimationSplitInfo>();

                if (rowSplitInfo == null)
                {
                    rowSplitInfo = new AnimationSplitInfo();
                    SetValue(rowSplitInfo);
                }

                GUILayoutX titleLayout   = layout.AddLayoutX();
                GUILayoutX contentLayout = layout.AddLayoutX();

                GUILabel title = new GUILabel(new LocEdString(SeqIndex + ". "));

                nameField       = new GUITextField(new LocEdString("Name"), 40, false, "", GUIOption.FixedWidth(160));
                startFrameField = new GUIIntField(new LocEdString("Start"), 40, "", GUIOption.FixedWidth(80));
                endFrameField   = new GUIIntField(new LocEdString("End"), 40, "", GUIOption.FixedWidth(80));
                isAdditiveField = new GUIToggleField(new LocEdString("Is additive"), 50, "", GUIOption.FixedWidth(80));

                startFrameField.SetRange(0, int.MaxValue);
                endFrameField.SetRange(0, int.MaxValue);

                titleLayout.AddElement(title);
                titleLayout.AddElement(nameField);
                titleLayout.AddFlexibleSpace();
                contentLayout.AddSpace(10);
                contentLayout.AddElement(startFrameField);
                contentLayout.AddSpace(5);
                contentLayout.AddElement(endFrameField);
                contentLayout.AddSpace(5);
                contentLayout.AddElement(isAdditiveField);

                nameField.OnChanged += x =>
                {
                    AnimationSplitInfo splitInfo = GetValue <AnimationSplitInfo>();
                    splitInfo.Name = x;

                    MarkAsModified();
                };

                nameField.OnFocusLost += ConfirmModify;
                nameField.OnConfirmed += ConfirmModify;

                startFrameField.OnChanged += x =>
                {
                    AnimationSplitInfo splitInfo = GetValue <AnimationSplitInfo>();
                    splitInfo.StartFrame = x;

                    MarkAsModified();
                };

                startFrameField.OnFocusLost += ConfirmModify;
                startFrameField.OnConfirmed += ConfirmModify;

                endFrameField.OnChanged += x =>
                {
                    AnimationSplitInfo splitInfo = GetValue <AnimationSplitInfo>();
                    splitInfo.EndFrame = x;

                    MarkAsModified();
                };

                endFrameField.OnFocusLost += ConfirmModify;
                endFrameField.OnConfirmed += ConfirmModify;

                isAdditiveField.OnChanged += x =>
                {
                    AnimationSplitInfo splitInfo = GetValue <AnimationSplitInfo>();
                    splitInfo.IsAdditive = x;

                    MarkAsModified();
                    ConfirmModify();
                };

                return(titleLayout);
            }
 private static extern void Internal_CreateInstance(GUITextField instance, bool multiline, ref GUIContent title,
                                                    int titleWidth, string style, GUIOption[] options, bool withTitle);
Exemple #6
0
        /// <summary>
        /// (Re)creates GUI with platform-specific options.
        /// </summary>
        private void BuildPlatformOptionsGUI()
        {
            optionsScrollArea.Layout.Clear();
            GUILayout layout = optionsScrollArea.Layout;

            PlatformInfo platformInfo = BuildManager.GetPlatformInfo(selectedPlatform);

            GUILabel options = new GUILabel(new LocEdString("Platform options"), EditorStyles.LabelCentered);

            GUIResourceField sceneField  = new GUIResourceField(typeof(Prefab), new LocEdString("Startup scene"));
            GUIToggleField   debugToggle = new GUIToggleField(new LocEdString("Debug"));

            GUIToggleField fullscreenField = new GUIToggleField(new LocEdString("Fullscreen"));
            GUIIntField    widthField      = new GUIIntField(new LocEdString("Window width"));
            GUIIntField    heightField     = new GUIIntField(new LocEdString("Window height"));

            GUITextField definesField = new GUITextField(new LocEdString("Defines"));

            layout.AddSpace(5);
            layout.AddElement(options);
            layout.AddSpace(5);
            layout.AddElement(sceneField);
            layout.AddElement(debugToggle);
            layout.AddElement(fullscreenField);
            layout.AddElement(widthField);
            layout.AddElement(heightField);
            layout.AddSpace(5);
            layout.AddElement(definesField);
            layout.AddSpace(5);

            sceneField.ValueRef   = platformInfo.MainScene;
            debugToggle.Value     = platformInfo.Debug;
            definesField.Value    = platformInfo.Defines;
            fullscreenField.Value = platformInfo.Fullscreen;
            widthField.Value      = platformInfo.WindowedWidth;
            heightField.Value     = platformInfo.WindowedHeight;

            if (platformInfo.Fullscreen)
            {
                widthField.Active  = false;
                heightField.Active = false;
            }

            sceneField.OnChanged      += x => platformInfo.MainScene = x.As <Prefab>();
            debugToggle.OnChanged     += x => platformInfo.Debug = x;
            definesField.OnChanged    += x => platformInfo.Defines = x;
            fullscreenField.OnChanged += x =>
            {
                widthField.Active  = !x;
                heightField.Active = !x;

                platformInfo.Fullscreen = x;
            };
            widthField.OnChanged  += x => platformInfo.WindowedWidth = x;
            heightField.OnChanged += x => platformInfo.WindowedHeight = x;

            switch (platformInfo.Type)
            {
            case PlatformType.Windows:
            {
                WinPlatformInfo winPlatformInfo = (WinPlatformInfo)platformInfo;

                GUITextField titleField = new GUITextField(new LocEdString("Title"));

                layout.AddElement(titleField);
                layout.AddSpace(5);

                GUITextureField iconField = new GUITextureField(new LocEdString("Icon"));
                layout.AddElement(iconField);

                titleField.Value     = winPlatformInfo.TitleText;
                iconField.TextureRef = winPlatformInfo.Icon;

                titleField.OnChanged += x => winPlatformInfo.TitleText = x;
                iconField.OnChanged  += x => winPlatformInfo.Icon = x.As <Texture>();
            }
            break;
            }
        }
Exemple #7
0
        private void OnInitialize()
        {
            Title = "Project Manager";

            Width  = 500;
            Height = 290;

            GUILayout vertLayout = GUI.AddLayoutY();

            vertLayout.AddSpace(5);
            GUILayout firstRow = vertLayout.AddLayoutX();

            vertLayout.AddFlexibleSpace();
            GUILayout secondRow = vertLayout.AddLayoutX();

            vertLayout.AddSpace(5);
            GUILayout thirdRow = vertLayout.AddLayoutX();

            vertLayout.AddFlexibleSpace();
            GUILayout fourthRow = vertLayout.AddLayoutX();

            vertLayout.AddSpace(5);

            projectInputBox       = new GUITextField(new LocEdString("Project path"), 70, false, "", GUIOption.FixedWidth(398));
            projectInputBox.Value = EditorSettings.LastOpenProject;

            GUIButton openBtn = new GUIButton(new LocEdString("Open"), GUIOption.FixedWidth(75));

            openBtn.OnClick += OpenProject;

            firstRow.AddSpace(5);
            firstRow.AddElement(projectInputBox);
            firstRow.AddSpace(15);
            firstRow.AddElement(openBtn);
            firstRow.AddSpace(5);

            GUILabel recentProjectsLabel = new GUILabel(new LocEdString("Recent projects:"));

            secondRow.AddSpace(5);
            secondRow.AddElement(recentProjectsLabel);
            secondRow.AddFlexibleSpace();
            GUIButton browseBtn = new GUIButton(new LocEdString("Browse"), GUIOption.FixedWidth(75));

            browseBtn.OnClick += BrowseClicked;
            secondRow.AddElement(browseBtn);
            secondRow.AddSpace(5);

            thirdRow.AddSpace(5);
            GUIPanel recentProjectsPanel = thirdRow.AddPanel();

            thirdRow.AddSpace(15);
            GUILayoutY thirdRowVertical = thirdRow.AddLayoutY();
            GUIButton  createBtn        = new GUIButton(new LocEdString("Create new"), GUIOption.FixedWidth(75));

            createBtn.OnClick += CreateClicked;
            thirdRowVertical.AddElement(createBtn);
            thirdRowVertical.AddFlexibleSpace();
            thirdRow.AddSpace(5);

            recentProjectsArea = new GUIScrollArea(GUIOption.FixedWidth(385), GUIOption.FixedHeight(170));
            GUILayoutX recentProjectsLayout = recentProjectsPanel.AddLayoutX();

            recentProjectsLayout.AddSpace(10);
            GUILayoutY recentProjectsPanelY = recentProjectsLayout.AddLayoutY();

            recentProjectsPanelY.AddSpace(5);
            recentProjectsPanelY.AddElement(recentProjectsArea);
            recentProjectsPanelY.AddSpace(5);
            recentProjectsLayout.AddFlexibleSpace();

            GUIPanel   scrollAreaBgPanel = recentProjectsPanel.AddPanel(1);
            GUITexture scrollAreaBgTex   = new GUITexture(null, true, EditorStylesInternal.ScrollAreaBg);

            scrollAreaBgPanel.AddElement(scrollAreaBgTex);

            autoLoadToggle       = new GUIToggle("");
            autoLoadToggle.Value = EditorSettings.AutoLoadLastProject;

            GUILabel autoLoadLabel = new GUILabel(new LocEdString("Automatically load last open project"));

            GUIButton cancelBtn = new GUIButton(new LocEdString("Cancel"), GUIOption.FixedWidth(75));

            cancelBtn.OnClick += CancelClicked;

            fourthRow.AddSpace(5);
            fourthRow.AddElement(autoLoadToggle);
            fourthRow.AddElement(autoLoadLabel);
            fourthRow.AddFlexibleSpace();
            fourthRow.AddElement(cancelBtn);
            fourthRow.AddSpace(5);

            RefreshRecentProjects();
        }