コード例 #1
0
ファイル: ServerConnectUI.cs プロジェクト: nwrush/DnD
        public override void Load()
        {
            base.Load();

            //this.BackgroundColor = Color.Black;

            Entity title = new Entity(new PointF(0, -100), new Size(512, 250), new Texture(Resources.Logo));
            title.Parallax = new PointF(0, 0);
            this.Add(title);

            GUITextField portBox = new GUITextField(new PointF(0, 90), new Size(300, 30), " ");
            portBox.InitTexture();
            portBox.TextColor = Color.White;
            this.Add(portBox);

            GUIButton start = new GUIButton(new Size(150, 30), "Start Server");
            start.BackgroundColor = Color.Crimson;
            start.TextColor = Color.DarkRed;
            start.Y = 140;
            this.Add(start);
            start.Pressed += (object sender, EventArgs e) =>
            {
                GV.Engine.SetWorld(new ServerUI());
            };

            portBox.OnEnter += (object sender, EventArgs e) => {
                start.SetState(ButtonState.Pressed);
            };
        }
コード例 #2
0
        public void AddLabledTextField(string labelText, string defaultFieldText, UDim2 position,
                                       out GUITextField textField, UDim?fieldXLength = null)
        {
            GUILabel label;

            AddLabledTextField(labelText, defaultFieldText, position, out label, out textField, fieldXLength);
        }
コード例 #3
0
        private void RiseHeightField_OnTextChanged(GUITextField field, string text)
        {
            int riseHeight;

            if (int.TryParse(text, out riseHeight))
            {
                RiseHeight = riseHeight;
            }
        }
コード例 #4
0
        private void GrainField_OnTextChanged(GUITextField field, string text)
        {
            int grain;

            if (int.TryParse(text, out grain))
            {
                Grain = grain;
            }
        }
コード例 #5
0
        private void BrushSizeField_OnTextChanged(GUITextField field, string text)
        {
            int brushSize;

            if (int.TryParse(text, out brushSize))
            {
                BrushSize = brushSize;
            }
        }
コード例 #6
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);
            }
        }
コード例 #7
0
        public UIFolder()
        {
            EditorHorizontalLayout layout = new EditorHorizontalLayout();

            this.Add(layout);

            textField = new GUITextField();
            layout.Add(textField);

            button = new GUIButton();
            button.TriggerHandler = this.OnClick;
            layout.Add(button);
        }
コード例 #8
0
        public ChatBox(UDim2 position, UDim2 size, GUITheme theme, MultiplayerScreen screen)
            : base(position, size, theme)
        {
            this.screen = screen;
            items       = new List <ChatItem>();
            Image       = null;
            font        = AssetManager.LoadFont("arial-bold-11");

            textField = new GUITextField(new UDim2(0, 0, 1f, -15), new UDim2(1f, 0, 0, 30), theme)
            {
                Parent = this
            };

            textField.OnEnterPressed += TextField_OnEnterPressed;
        }
コード例 #9
0
        public ConnectWindow(GUISystem system, GUITheme theme, UDim2 size) 
            : base(system, size, "Connect to server", theme)
        {
            GUILabel endPointLabel = new GUILabel(new UDim2(0, 10, 0, 50), UDim2.Zero, "Server Address:",
                TextAlign.Left, theme);
            Vector2 labelSize = endPointLabel.Font.MeasureString(endPointLabel.Text);
            endPointField = new GUITextField(new UDim2(0, labelSize.X + 20, 0, 35),
                new UDim2(1f, -labelSize.X - 30, 0, 30), "", TextAlign.Left, theme);

            GUILabel nameLabel = new GUILabel(new UDim2(0, 10, 0, 100), UDim2.Zero, "Player Name:",
                TextAlign.Left, theme);
            labelSize = nameLabel.Font.MeasureString(nameLabel.Text);
            playerField = new GUITextField(new UDim2(0, labelSize.X + 20, 0, 85),
                new UDim2(1f, -labelSize.X - 30, 0, 30), "Player", TextAlign.Left, theme);
            playerField.MaxLength = 60;

            connectBtn = new GUIButton(new UDim2(0, 10, 1f, -40), new UDim2(0, 100, 0, 30), "Connect", theme);
            connectBtn.OnMouseClick += (btn, mbtn) => { TryConnect(); };

            AddTopLevel(endPointLabel, endPointField, nameLabel, playerField, connectBtn);
        }
コード例 #10
0
 void OnDisable()
 {
     _gui                = null;
     _guiSide            = null;
     _guiFrameCount      = null;
     _guiFrameWidth      = null;
     _guiFrameHeight     = null;
     _guiCurrentFrame    = null;
     _guiPositionOffset  = null;
     _guiScaleOffset     = null;
     _guiAnimationClips  = null;
     _guiAnimationClips  = null;
     _guiMaterials       = null;
     _guiStartRotation   = null;
     _guiEndRotation     = null;
     _guiLoopCount       = null;
     _guiPingPong        = null;
     _guiSpriteSheetName = null;
     _guiExport          = null;
     _guiPreview         = null;
 }
コード例 #11
0
        public void AddLabledTextField(string labelText, string defaultFieldText, UDim2 position,
                                       out GUILabel label, out GUITextField textField, UDim?fieldXLength = null)
        {
            label = new GUILabel(position, UDim2.Zero, labelText, TextAlign.Left, Theme);
            Vector2 textSize = label.Font.MeasureString(labelText);

            label.Size = new UDim2(0, textSize.X, 0, textSize.Y + (ElementPadding * 2));

            UDim labelXPos = position.X + new UDim(0, textSize.X + ElementPadding);

            if (!fieldXLength.HasValue)
            {
                fieldXLength = new UDim(1f, -(textSize.X + ElementPadding) - ElementPadding);
            }
            textField = new GUITextField(new UDim2(labelXPos, position.Y),
                                         new UDim2(fieldXLength.Value, new UDim(0, label.Size.Y.Offset)),
                                         defaultFieldText, TextAlign.Left, Theme);

            label.Parent     = this;
            textField.Parent = this;
        }
コード例 #12
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>
        /// <param name="closeCallback">Callback triggered just before the window closes.</param>
        internal void Initialize(AnimationEvent animEvent, string[] componentNames, Action updateCallback, 
            Action<bool> closeCallback)
        {
            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; changesMade = true; updateCallback(); };

            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;

                changesMade = true;
                updateCallback();
            };

            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;

                changesMade = true;
                updateCallback();
            };

            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();

            this.closeCallback = closeCallback;
        }
コード例 #13
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;
            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.ValueRef = winPlatformInfo.Icon;

                    titleField.OnChanged += x => winPlatformInfo.TitleText = x;
                    iconField.OnChanged += x => winPlatformInfo.Icon = x;
                }
                    break;
            }
        }
コード例 #14
0
ファイル: GUISkinInspector.cs プロジェクト: Ruu/BansheeEngine
            /// <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;
            }
コード例 #15
0
 private void TextField_OnEnterPressed(GUITextField field, string text)
 {
     field.Text = "";
     screen.ChatOut(text);
 }
コード例 #16
0
        private void DrawRegularTab(OnNetInstanceCacheContainerXml item, Rect areaRect)
        {
            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_NAME"));
                var newName = GUITextField.TextField(f_SaveName, item.SaveName);
                if (!newName.IsNullOrWhiteSpace() && newName != item.SaveName)
                {
                    item.SaveName = newName;
                }
            });

            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUILayout.Label(Locale.Get("K45_WTS_BUILDINGEDITOR_MODELLAYOUTSELECT"));
                GUI.SetNextControlName(f_ModelSelect);
                if (GUILayout.Button((m_currentModelType != 1 ? item.PropLayoutName : PropIndexes.GetListName(item.SimpleProp)) ?? "<color=#FF00FF>--NULL--</color>"))
                {
                    m_filterSelectionView = true;
                    m_lastModelFilterText = (m_currentModelType != 1 ? item.PropLayoutName : PropIndexes.GetListName(item.SimpleProp)) ?? "";
                    m_searchResult.Value  = null;
                    RestartLayoutFilterCoroutine();
                }
            });

            GUIKlyteCommons.DoInHorizontal(() =>
            {
                GUI.SetNextControlName(f_InstanceMode);
                item.SegmentPositionRepeating = GUILayout.Toggle(item.SegmentPositionRepeating, Locale.Get("K45_WTS_POSITIONINGMODE_ISMULTIPLE"));
            });

            if (item.SegmentPositionRepeating)
            {
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION_START"));
                    GUILayout.Space(areaRect.width / 3);
                    var rect = GUILayoutUtility.GetLastRect();
                    item.SegmentPositionStart = GUI.HorizontalSlider(new Rect(rect.x, rect.yMin + 7, rect.width, 15), item.SegmentPositionStart, 0, 1);
                    item.SegmentPositionStart = GUIFloatField.FloatField(f_SegmentPathStart, item.SegmentPositionStart, 0, 1);
                });
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION_END"));
                    GUILayout.Space(areaRect.width / 3);
                    var rect = GUILayoutUtility.GetLastRect();
                    item.SegmentPositionEnd = GUI.HorizontalSlider(new Rect(rect.x, rect.yMin + 7, rect.width, 15), item.SegmentPositionEnd, 0, 1);
                    item.SegmentPositionEnd = GUIFloatField.FloatField(f_SegmentPathEnd, item.SegmentPositionEnd, 0, 1);
                });
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION_COUNT"));
                    item.SegmentPositionRepeatCount = (ushort)GUIIntField.IntField(f_SegmentRepeatCount, item.SegmentPositionRepeatCount, 1, ushort.MaxValue);
                });
            }
            else
            {
                GUIKlyteCommons.DoInHorizontal(() =>
                {
                    GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_SEGMENTPOSITION"));
                    GUILayout.Space(areaRect.width / 3);
                    var rect             = GUILayoutUtility.GetLastRect();
                    item.SegmentPosition = GUI.HorizontalSlider(new Rect(rect.x, rect.yMin + 7, rect.width, 15), item.SegmentPosition, 0, 1);
                    item.SegmentPosition = GUIFloatField.FloatField(f_SegmentPathSingle, item.SegmentPosition, 0, 1);
                });
            }
            GUILayout.Space(12);


            GUIKlyteCommons.DoInHorizontal(() =>
            {
                item.InvertSign = GUILayout.Toggle(item.InvertSign, Locale.Get("K45_WTS_INVERT_SIGN_SIDE"));
            });

            GUIKlyteCommons.DoInHorizontal(() => GUILayout.Label(Locale.Get("K45_WTS_ONNETEDITOR_LOCATION_SETTINGS")));

            GUIKlyteCommons.AddVector3Field(item.PropPosition, "K45_WTS_ONNETEDITOR_POSITIONOFFSET", f_SegmentPositionOffset);
            GUIKlyteCommons.AddVector3Field(item.PropRotation, "K45_WTS_ONNETEDITOR_ROTATION", f_SegmentRotationOffset);
            GUIKlyteCommons.AddVector3Field(item.Scale, "K45_WTS_ONNETEDITOR_SCALE", f_SegmentScaleOffset);
        }
コード例 #17
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();
        }
コード例 #18
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;
            }
コード例 #19
0
        void OnEnable()
        {
            CreateExportFolderIfNeeded();

            _lastFrameTime = Time.realtimeSinceStartup;

            _gui = new GUIHorizontal();

            GUIVertical sideContainer = _gui.Add(new GUIVertical(GUILayout.MaxWidth(290.0f))) as GUIVertical;

            _guiSide = sideContainer.Add(new GUIScrollView()) as GUIScrollView;

            GUIObjectField <GameObject> guiGameObject = _guiSide.Add(new GUIObjectField <GameObject>(new GUIContent("GameObject", "GameObject to render as sprite sheet"),
                                                                                                     true, GameObjectChanged)) as GUIObjectField <GameObject>;

            _guiFrameCount = _guiSide.Add(new GUIIntSlider(new GUIContent("Frame Count", "Number of frames in the sprite sheet"),
                                                           12, 1, 64, FrameCountChanged)) as GUIIntSlider;
            _guiFrameWidth = _guiSide.Add(new GUIIntSlider(new GUIContent("Frame Width", "Width of each frame in the sprite sheet"),
                                                           100, 32, 512, ResizeFrame)) as GUIIntSlider;
            _guiFrameHeight = _guiSide.Add(new GUIIntSlider(new GUIContent("Frame Height", "Height of each frame in the sprite sheet"),
                                                            100, 32, 512, ResizeFrame)) as GUIIntSlider;
            _guiFOV = _guiSide.Add(new GUISlider(new GUIContent("FOV"), 20, 1, 179, OffsetChanged)) as GUISlider;

            _guiSide.Add(new GUISpace());
            _guiCurrentFrame = _guiSide.Add(new GUIIntSlider(new GUIContent("Current Frame"),
                                                             0, 0, _guiFrameCount.value - 1, RenderPreviewAction)) as GUIIntSlider;
            _guiDuration = _guiSide.Add(new GUISlider(new GUIContent("Duration"),
                                                      1, 0, 100, RenderPreviewAction)) as GUISlider;
            _guiPlay = _guiSide.Add(new GUIToggle(new GUIContent("Play"))) as GUIToggle;

            _guiSide.Add(new GUISpace());
            GUIFoldout offsetFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Position/Scale"))) as GUIFoldout;

            _guiPositionOffset = offsetFoldout.Add(new GUIVector3Field(new GUIContent("Position Offset"), OffsetChanged)) as GUIVector3Field;
            _guiScaleOffset    = offsetFoldout.Add(new GUISlider(new GUIContent("Scale Offset"), 0.0f, -10.0f, 10.0f, OffsetChanged)) as GUISlider;

            _guiAnimationClips = _guiSide.Add(new GUISpriteSheetClips(RenderPreviewAction)) as GUISpriteSheetClips;
            _guiMaterials      = _guiSide.Add(new GUISpriteSheetMaterials(RenderPreviewAction)) as GUISpriteSheetMaterials;

            GUIFoldout rotationFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Rotation"))) as GUIFoldout;

            _guiStartRotation = rotationFoldout.Add(new GUIVector3Field(new GUIContent("Start Rotation"), RenderPreviewAction)) as GUIVector3Field;
            _guiEndRotation   = rotationFoldout.Add(new GUIVector3Field(new GUIContent("End Rotation"), RenderPreviewAction)) as GUIVector3Field;

            GUIFoldout loopFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Rotation/Material Looping"))) as GUIFoldout;

            _guiLoopCount = loopFoldout.Add(new GUIIntSlider(new GUIContent("Loop Count"), 1, 1, 10, RenderPreviewAction)) as GUIIntSlider;
            _guiPingPong  = loopFoldout.Add(new GUIToggle(new GUIContent("Pingpong"), RenderPreviewAction)) as GUIToggle;

            GUIFoldout    outlineFoldout = _guiSide.Add(new GUIFoldout(new GUIContent("Outline Effect"))) as GUIFoldout;
            GUIColorField outlineColor   = outlineFoldout.Add(new GUIColorField(new GUIContent("Color"),
                                                                                OutlineColorChanged)) as GUIColorField;
            GUISlider outlineThreshold = outlineFoldout.Add(new GUISlider(new GUIContent("Threshold"),
                                                                          0.05f, 0.0f, 0.05f, OutlineThresholdChanged)) as GUISlider;

            _guiSide.Add(new GUISpace());
            _guiSpriteSheetName = _guiSide.Add(new GUITextField(new GUIContent("Sprite Sheet Name"))) as GUITextField;
            _guiExport          = _guiSide.Add(new GUIButton(new GUIContent("Export Sprite Sheet"), ExportSpriteSheet)) as GUIButton;

            _guiPreview = _gui.Add(new GUIVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))) as GUIVertical;
            _guiPreview.shouldStoreLastRect = true;

            InitPreviewRenderTexture();
            InitPreviewCamera();
            InitRootGameObject();
            guiGameObject.value = _modelGameObject;
            GameObjectChanged(guiGameObject);
            RenderPreview(0);

            _guiStartRotation.vector = Vector3.zero;
            _guiEndRotation.vector   = Vector3.zero;
            outlineColor.color       = _previewOutline.outlineColor;
            outlineThreshold.value   = _previewOutline.depthThreshold;
        }
コード例 #20
0
ファイル: LibraryWindow.cs プロジェクト: Ruu/BansheeEngine
        private void OnInitialize()
        {
            ProjectLibrary.OnEntryAdded += OnEntryChanged;
            ProjectLibrary.OnEntryImported += OnEntryChanged;
            ProjectLibrary.OnEntryRemoved += OnEntryChanged;

            GUILayoutY contentLayout = GUI.AddLayoutY();

            searchBarLayout = contentLayout.AddLayoutX();
            searchField = new GUITextField();
            searchField.OnChanged += OnSearchChanged;
            searchField.OnFocusGained += StopRename;

            GUIContent clearIcon = new GUIContent(EditorBuiltin.GetLibraryWindowIcon(LibraryWindowIcon.Clear),
                new LocEdString("Clear"));
            GUIButton clearSearchBtn = new GUIButton(clearIcon);
            clearSearchBtn.OnClick += OnClearClicked;
            clearSearchBtn.SetWidth(40);

            GUIContent optionsIcon = new GUIContent(EditorBuiltin.GetLibraryWindowIcon(LibraryWindowIcon.Options),
                new LocEdString("Options"));
            optionsButton = new GUIButton(optionsIcon);
            optionsButton.OnClick += OnOptionsClicked;
            optionsButton.SetWidth(40);
            searchBarLayout.AddElement(searchField);
            searchBarLayout.AddElement(clearSearchBtn);
            searchBarLayout.AddElement(optionsButton);

            folderBarLayout = contentLayout.AddLayoutX();

            GUIContent homeIcon = new GUIContent(EditorBuiltin.GetLibraryWindowIcon(LibraryWindowIcon.Home),
                new LocEdString("Home"));
            GUIButton homeButton = new GUIButton(homeIcon, GUIOption.FixedWidth(FOLDER_BUTTON_WIDTH));
            homeButton.OnClick += OnHomeClicked;

            GUIContent upIcon = new GUIContent(EditorBuiltin.GetLibraryWindowIcon(LibraryWindowIcon.Up),
                new LocEdString("Up"));
            GUIButton upButton = new GUIButton(upIcon, GUIOption.FixedWidth(FOLDER_BUTTON_WIDTH));
            upButton.OnClick += OnUpClicked;

            folderBarLayout.AddElement(homeButton);
            folderBarLayout.AddElement(upButton);
            folderBarLayout.AddSpace(10);

            contentScrollArea = new GUIScrollArea(GUIOption.FlexibleWidth(), GUIOption.FlexibleHeight());
            contentLayout.AddElement(contentScrollArea);
            contentLayout.AddFlexibleSpace();

            entryContextMenu = LibraryMenu.CreateContextMenu(this);
            content = new LibraryGUIContent(this, contentScrollArea);

            Refresh();

            dropTarget = new LibraryDropTarget(this);
            dropTarget.Bounds = GetScrollAreaBounds();
            dropTarget.OnStart += OnDragStart;
            dropTarget.OnDrag += OnDragMove;
            dropTarget.OnLeave += OnDragLeave;
            dropTarget.OnDropResource += OnResourceDragDropped;
            dropTarget.OnDropSceneObject += OnSceneObjectDragDropped;
            dropTarget.OnEnd += OnDragEnd;

            Selection.OnSelectionChanged += OnSelectionChanged;
            Selection.OnResourcePing += OnPing;
        }
コード例 #21
0
ファイル: GUITextMessage.cs プロジェクト: marshl/Leviathan2
 private void Awake()
 {
     this.textField = this.GetComponent<GUITextField>();
 }