Пример #1
0
            /// <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;
            }
Пример #2
0
            /// <inheritdoc/>
            protected override GUILayoutX CreateKeyGUI(GUILayoutY layout)
            {
                GUILayoutX titleLayout = layout.AddLayoutX();

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

                keyField.OnChanged += SetKey;

                return(titleLayout);
            }
Пример #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);
            }
        }
Пример #4
0
            /// <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);
            }
Пример #5
0
 private static extern void Internal_CreateInstance(GUITextField instance, bool multiline, GUIContent title, int titleWidth,
                                                    string style, GUIOption[] options, bool withTitle);
Пример #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;
            }
        }
Пример #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();
        }
Пример #8
0
        /// <summary>
        /// Initializes the drop down window by creating the necessary GUI. Must be called after construction and before
        /// use.
        /// </summary>
        /// <param name="animEvent">Event whose properties to edit.</param>
        /// <param name="componentNames">List of component names that the user can select from.</param>
        /// <param name="updateCallback">Callback triggered when event values change.</param>
        internal void Initialize(AnimationEvent animEvent, string[] componentNames, Action updateCallback)
        {
            int    selectedIndex = -1;
            string methodName    = "";

            if (!string.IsNullOrEmpty(animEvent.Name))
            {
                string[] nameEntries = animEvent.Name.Split('/');
                if (nameEntries.Length > 1)
                {
                    string typeName = nameEntries[0];
                    for (int i = 0; i < componentNames.Length; i++)
                    {
                        if (componentNames[i] == typeName)
                        {
                            selectedIndex = i;
                            break;
                        }
                    }

                    methodName = nameEntries[nameEntries.Length - 1];
                }
            }

            GUIFloatField timeField = new GUIFloatField(new LocEdString("Time"), 40, "");

            timeField.Value      = animEvent.Time;
            timeField.OnChanged += x => { animEvent.Time = x; updateCallback(); }; // TODO UNDOREDO

            GUIListBoxField componentField = new GUIListBoxField(componentNames, new LocEdString("Component"), 40);

            if (selectedIndex != -1)
            {
                componentField.Index = selectedIndex;
            }

            componentField.OnSelectionChanged += x =>
            {
                string compName = "";
                if (x != -1)
                {
                    compName = componentNames[x] + "/";
                }

                animEvent.Name = compName + x;
                updateCallback();
            };// TODO UNDOREDO

            GUITextField methodField = new GUITextField(new LocEdString("Method"), 40, false, "", GUIOption.FixedWidth(190));

            methodField.Value      = methodName;
            methodField.OnChanged += x =>
            {
                string compName = "";
                if (componentField.Index != -1)
                {
                    compName = componentNames[componentField.Index] + "/";
                }

                animEvent.Name = compName + x;
                updateCallback();
            }; // TODO UNDOREDO

            GUILayoutY vertLayout = GUI.AddLayoutY();

            vertLayout.AddFlexibleSpace();
            GUILayoutX horzLayout = vertLayout.AddLayoutX();

            horzLayout.AddFlexibleSpace();
            GUILayout contentLayout = horzLayout.AddLayoutY();
            GUILayout timeLayout    = contentLayout.AddLayoutX();

            timeLayout.AddSpace(5);
            timeLayout.AddElement(timeField);
            timeLayout.AddFlexibleSpace();
            GUILayout componentLayout = contentLayout.AddLayoutX();

            componentLayout.AddSpace(5);
            componentLayout.AddElement(componentField);
            componentLayout.AddFlexibleSpace();
            GUILayout methodLayout = contentLayout.AddLayoutX();

            methodLayout.AddSpace(5);
            methodLayout.AddElement(methodField);
            methodLayout.AddFlexibleSpace();
            horzLayout.AddFlexibleSpace();
            vertLayout.AddFlexibleSpace();
        }