コード例 #1
0
            protected override void DrawPreviewInspector()
            {
                base.DrawPreviewInspector();
                var adventureData = Controller.Instance.AdventureData;

                EditorGUI.BeginChangeCheck();
                iconChooser.Path = string.IsNullOrEmpty(adventureData.getInventoryImage()) ? iconChooser.Empty : adventureData.getInventoryImage();
                iconChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    adventureData.setInventoryImage(iconChooser.Path);
                    ReloadIcon();
                }

                EditorGUI.BeginChangeCheck();
                var newPosition = EditorGUILayout.Vector2Field(TC.get("Inventory.Coords"), adventureData.getInventoryCoords());

                if (EditorGUI.EndChangeCheck())
                {
                    adventureData.setInventoryCoords(newPosition);
                }

                EditorGUI.BeginChangeCheck();
                var newScale = EditorGUILayout.FloatField(TC.get("Inventory.Scale"), adventureData.getInventoryScale());

                if (EditorGUI.EndChangeCheck())
                {
                    adventureData.setInventoryScale(newScale);
                }
            }
コード例 #2
0
        protected override void DrawInspector()
        {
            workingBook = Controller.Instance.SelectedChapterDataControl.getBooksList().getBooks()[GameRources.GetInstance().selectedBookIndex];

            // Appearance table
            appearanceEditor.Data = workingBook;
            appearanceEditor.OnInspectorGUI();

            GUILayout.Space(10);

            // Background
            EditorGUI.BeginChangeCheck();
            background.Path = workingBook.getPreviewImage();
            background.DoLayout();
            if (EditorGUI.EndChangeCheck())
            {
                workingBook.setPreviewImage(background.Path);
            }

            // Arrows
            GUILayout.BeginHorizontal();
            DoArrowField(left, BookDataControl.ARROW_LEFT, BookDataControl.ARROW_NORMAL);
            DoArrowField(right, BookDataControl.ARROW_RIGHT, BookDataControl.ARROW_NORMAL);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            DoArrowField(left_over, BookDataControl.ARROW_LEFT, BookDataControl.ARROW_OVER);
            DoArrowField(right_over, BookDataControl.ARROW_RIGHT, BookDataControl.ARROW_OVER);
            GUILayout.EndHorizontal();
        }
コード例 #3
0
        protected override void DrawInspector()
        {
            var cutscene = GetCurrentCutscene();

            appearanceEditor.Data = cutscene;
            appearanceEditor.OnInspectorGUI();

            /*
             * View for videoscene
             */
            if (cutscene.isVideoscene())
            {
                PreviewTitle = "Videoscenes.Preview".Traslate();
                // Background chooser
                EditorGUI.BeginChangeCheck();
                video.Path = cutscene.getPathToVideo();
                video.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    cutscene.setPathToVideo(video.Path);
                }

                EditorGUI.BeginChangeCheck();
                var canSkipVideo = EditorGUILayout.Toggle(new GUIContent(TC.get("Videoscene.Skip.border"), TC.get("Videoscene.Skip.label")), cutscene.getCanSkip());
                if (EditorGUI.EndChangeCheck())
                {
                    cutscene.setCanSkip(canSkipVideo);
                }
            }

            /*
             * View for slidescene
             */
            else
            {
                PreviewTitle = "Slidescenes.Preview".Traslate();
                // Background chooser
                EditorGUI.BeginChangeCheck();
                slides.Path = cutscene.getPathToSlides();
                slides.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    cutscene.setPathToSlides(slides.Path);
                }

                // Music chooser
                EditorGUI.BeginChangeCheck();
                music.Path = cutscene.getPathToMusic();
                music.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    cutscene.setPathToMusic(music.Path);
                }
            }
        }
コード例 #4
0
        public void draw()
        {
            // Music field
            musicField.Label = TC.get("Effect.PlaySound");
            musicField.Path  = effect.getPath();
            musicField.DoLayout();
            effect.setPath(musicField.Path);
            // Play at background
            effect.setBackground(GUILayout.Toggle(effect.isBackground(), TC.get("PlaySoundEffect.BackgroundCheckBox")));

            EditorGUILayout.HelpBox(TC.get("PlaySoundEffect.Description"), MessageType.Info);
        }
コード例 #5
0
        public void draw()
        {
            // Line
            EditorGUILayout.LabelField(TC.get("ConversationEditor.Line"));
            effect.setLine(EditorGUILayout.TextArea(effect.getLine(), GUILayout.MinWidth(200), GUILayout.MinHeight(50)));

            // Sound
            audioField.Label = TC.get("Animation.Sound");
            audioField.Path  = effect.getAudioPath();
            audioField.DoLayout();
            effect.setAudioPath(audioField.Path);

            EditorGUILayout.HelpBox(TC.get("SpeakPlayerEffect.Description"), MessageType.Info);
        }
コード例 #6
0
        protected override void DrawInspector()
        {
            workingScene = Controller.Instance.SelectedChapterDataControl.getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex];

            // Appearance table
            appearanceEditor.Data = workingScene;
            appearanceEditor.OnInspectorGUI();

            GUILayout.Space(10);

            EditorGUI.BeginChangeCheck();
            background.Path = workingScene.getPreviewBackground();
            background.DoLayout();
            if (EditorGUI.EndChangeCheck())
            {
                workingScene.setPreviewBackground(background.Path);
                componentBasedEditor.RefreshSceneResources(workingScene);
            }

            EditorGUI.BeginChangeCheck();
            foreground.Path = workingScene.getPreviewForeground();
            foreground.DoLayout();
            if (EditorGUI.EndChangeCheck())
            {
                workingScene.setPreviewForeground(foreground.Path);
                componentBasedEditor.RefreshSceneResources(workingScene);
            }

            EditorGUI.BeginChangeCheck();
            music.Path = workingScene.getPreviewMusic();
            music.DoLayout();
            if (EditorGUI.EndChangeCheck())
            {
                workingScene.setPreviewMusic(music.Path);
            }

            GUILayout.Space(10);

            EditorGUI.BeginChangeCheck();
            var newHideInventory = EditorGUILayout.Toggle("Scene.HideInventory".Traslate(), workingScene.HideInventory);

            if (EditorGUI.EndChangeCheck())
            {
                workingScene.HideInventory = newHideInventory;
            }
        }
コード例 #7
0
        public void OnGUI()
        {
            if (extElementRefDataControl != null && extElementRefDataControl.TransformManager != null)
            {
                // And then show the required parameters

                foreach (var param in extElementRefDataControl.TransformManager.ParameterDescription)
                {
                    if (param.Value.Type == typeof(float))
                    {
                        extElementRefDataControl.TransformManager[param.Key] = EditorGUILayout.FloatField(param.Key.Traslate(), (float)extElementRefDataControl.TransformManager[param.Key]);
                    }

                    if (param.Value.Type == typeof(Vector2))
                    {
                        extElementRefDataControl.TransformManager[param.Key] = EditorGUILayout.Vector2Field(param.Key.Traslate(), (Vector2)extElementRefDataControl.TransformManager[param.Key]);
                    }

                    if (param.Value.Type == typeof(Vector3))
                    {
                        extElementRefDataControl.TransformManager[param.Key] = EditorGUILayout.Vector3Field(param.Key.Traslate(), (Vector3)extElementRefDataControl.TransformManager[param.Key]);
                    }

                    if (param.Value.Type == typeof(Vector2d))
                    {
                        extElementRefDataControl.TransformManager[param.Key] = EditorGUILayout.Vector2Field(param.Key.Traslate(), ((Vector2d)extElementRefDataControl.TransformManager[param.Key]).ToVector2()).ToVector2d();
                    }

                    if (param.Value.Type == typeof(bool))
                    {
                        extElementRefDataControl.TransformManager[param.Key] = EditorGUILayout.Toggle(param.Key.Traslate(), (bool)extElementRefDataControl.TransformManager[param.Key]);
                    }

                    if (param.Value.Type == typeof(string))
                    {
                        textureField.Empty = extElementRefDataControl.TransformManager.ParameterDescription[param.Key]
                                             .DefaultValue as string;
                        textureField.Label = param.Key.Traslate();
                        textureField.Path  = extElementRefDataControl.TransformManager[param.Key] as string;
                        textureField.DoLayout();
                        extElementRefDataControl.TransformManager[param.Key] = textureField.Path;
                    }
                }
            }
        }
コード例 #8
0
        private void DoArrowField(FileChooser arrow, int arrowOrientation, int arrowState)
        {
            EditorGUI.BeginChangeCheck();
            arrow.Path = workingBook.getArrowImagePath(arrowOrientation, arrowState);
            if (string.IsNullOrEmpty(arrow.Path))
            {
                arrow.Path = arrow.Empty;
                workingBook.setArrowImagePath(arrowOrientation, arrowState, arrow.Path);
                RefreshPathInformation(workingBook);
            }

            arrow.DoLayout(GUILayout.ExpandWidth(true));
            if (EditorGUI.EndChangeCheck())
            {
                workingBook.setArrowImagePath(arrowOrientation, arrowState, arrow.Path);
                RefreshPathInformation(workingBook);
            }
        }
コード例 #9
0
        protected override void DrawInspector()
        {
            var workingAtrezzo = Target != null ? Target as AtrezzoDataControl : Controller.Instance.SelectedChapterDataControl.getAtrezzoList().getAtrezzoList()[GameRources.GetInstance().selectedSetItemIndex];

            // Appearance table
            appearanceEditor.Data = workingAtrezzo;
            appearanceEditor.OnInspectorGUI();

            GUILayout.Space(10);

            EditorGUI.BeginChangeCheck();
            image.Path = workingAtrezzo.getPreviewImage();
            image.DoLayout(GUILayout.ExpandWidth(true));
            if (EditorGUI.EndChangeCheck())
            {
                workingAtrezzo.setImage(image.Path);
            }
        }
コード例 #10
0
        public void draw()
        {
            var npcs = Controller.Instance.IdentifierSummary.getIds <NPC>();

            // Character
            var selected = Mathf.Max(0, Array.IndexOf(npcs, effect.getTargetId()));

            effect.setTargetId(npcs[EditorGUILayout.Popup(TC.get("Element.Name28"), selected, npcs)]);

            // Line
            EditorGUILayout.LabelField(TC.get("ConversationEditor.Line"));
            effect.setLine(EditorGUILayout.TextArea(effect.getLine(), GUILayout.MinWidth(200), GUILayout.MinHeight(50)));

            // Sound
            audioField.Label = TC.get("Animation.Sound");
            audioField.Path  = effect.getAudioPath();
            audioField.DoLayout();
            effect.setAudioPath(audioField.Path);

            EditorGUILayout.HelpBox(TC.get("SpeakCharacterEffect.Description"), MessageType.Info);
        }
コード例 #11
0
        protected override void DrawInspector()
        {
            workingItem = Target as ItemDataControl ?? Controller.Instance.SelectedChapterDataControl.getItemsList().getItems()[GameRources.GetInstance().selectedItemIndex];

            // Appearance table
            appearanceEditor.Data = workingItem;
            appearanceEditor.OnInspectorGUI();

            EditorGUI.BeginChangeCheck();

            string previousValue = image.Path = workingItem.getPreviewImage();

            image.DoLayout(GUILayout.ExpandWidth(true));
            if (previousValue != image.Path)
            {
                workingItem.setPreviewImage(image.Path);
            }

            previousValue = icon.Path = workingItem.getIconImage();
            icon.DoLayout(GUILayout.ExpandWidth(true));
            if (previousValue != icon.Path)
            {
                workingItem.setIconImage(icon.Path);
            }

            previousValue = image_over.Path = workingItem.getMouseOverImage();
            image_over.DoLayout(GUILayout.ExpandWidth(true));
            if (previousValue != image_over.Path)
            {
                workingItem.setMouseOverImage(image_over.Path);
            }

            if (EditorGUI.EndChangeCheck())
            {
                RefreshResources(workingItem);
            }
        }
            public override void Draw(int aID)
            {
                var exitLook = (Target as ExitDataControl).getExitLookDataControl();

                // Text and sound
                EditorGUI.BeginChangeCheck();
                displayField.Content = exitLook.getCustomizedText();
                displayField.Path    = exitLook.getSoundPath();
                displayField.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    exitLook.setExitText(displayField.Content);
                    exitLook.setSoundPath(displayField.Path);
                }

                // Cursor
                EditorGUI.BeginChangeCheck();
                cursorField.Path = exitLook.getCustomizedCursor();
                cursorField.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    exitLook.setCursorPath(cursorField.Path);
                }
            }
コード例 #13
0
        protected void OnGUI()
        {
            if (workingAnimation == null)
            {
                this.Close();
                return;
            }

            switch (Event.current.type)
            {
            case EventType.DragUpdated:
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                    Debug.Log("Dragging (" + Event.current.type + "):" + System.String.Join("\n", DragAndDrop.paths));
                }
                break;

            case EventType.DragPerform:
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    DragAndDrop.AcceptDrag();
                    foreach (var path in DragAndDrop.paths)
                    {
                        var uri   = AssetsController.AddSingleAsset(AssetsConstants.CATEGORY_ANIMATION_IMAGE, path);
                        var frame = workingAnimation.addFrame(selectedFrame, null);
                        frame.setUri(uri);
                    }
                }
                break;
            }

            EditorGUILayout.PrefixLabel(TC.get("Animation.GeneralInfo"), GUIStyle.none, titleStyle);
            EditorGUI.BeginChangeCheck();
            var documentationTextContent = EditorGUILayout.TextField(TC.get("Animation.Documentation"), workingAnimation.getDocumentation());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setDocumentation(documentationTextContent);
            }

            EditorGUI.BeginChangeCheck();
            var useTransitions = EditorGUILayout.Toggle(TC.get("Animation.UseTransitions"), workingAnimation.isUseTransitions());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setUseTransitions(useTransitions);
            }

            EditorGUI.BeginChangeCheck();
            var isSlides = EditorGUILayout.Toggle(TC.get("Animation.Slides"), workingAnimation.isSlides());

            if (EditorGUI.EndChangeCheck())
            {
                workingAnimation.setSlides(isSlides);
            }

            /*
             * Transition panel
             */
            EditorGUILayout.PrefixLabel(TC.get("Animation.Timeline"), GUIStyle.none, titleStyle);

            using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosition, true, false, GUILayout.Height(125)))
                using (new EditorGUILayout.HorizontalScope())
                    using (new GUIUtil.SkinScope(noBackgroundSkin))
                    {
                        scrollPosition = scroll.scrollPosition;
                        for (int i = 0, frameCount = workingAnimation.getFrames().Count; i < frameCount; i++)
                        {
                            if (selectedFrame == i)
                            {
                                GUI.skin = selectedFrameSkin;
                            }

                            var frame        = workingAnimation.getFrame(i);
                            var image        = Controller.ResourceManager.getImage(frame.getUri());
                            var frameContent = new GUIContent(frame.getTime().ToString(), image);
                            if (GUILayout.Button(frameContent, GUILayout.Height(100), GUILayout.Width(80)))
                            {
                                selectedFrame = (i == selectedFrame) ? -1 : i;
                                GUI.FocusControl(null);
                            }
                            if (useTransitions && i != workingAnimation.getFrames().Count - 1)
                            {
                                var transition        = workingAnimation.getTranstionForFrame(i);
                                var transitionContent = new GUIContent(transition.getTime().ToString(), transitionTypeTexture[(int)transition.getType()]);
                                if (GUILayout.Button(transitionContent, GUILayout.Height(100), GUILayout.Width(80)))
                                {
                                    selectedFrame = (i == selectedFrame) ? -1 : i;
                                    GUI.FocusControl(null);
                                }
                            }
                            GUI.skin = noBackgroundSkin;
                        }
                    }

            /*
             * Transition button panel
             */
            using (new EditorGUILayout.HorizontalScope())
                using (new GUIUtil.SkinScope(noBackgroundSkin))
                {
                    GUILayout.FlexibleSpace();
                    using (new EditorGUI.DisabledScope(selectedFrame < 0))
                    {
                        if (GUILayout.Button(moveLeft))
                        {
                            workingAnimation.moveLeft(selectedFrame);
                            selectedFrame--;
                        }
                    }
                    using (new EditorGUI.DisabledScope(selectedFrame < 0 || workingAnimation.getFrames().Count < 2))
                    {
                        if (GUILayout.Button(clearImg))
                        {
                            workingAnimation.removeFrame(selectedFrame);
                            selectedFrame--;
                        }
                    }

                    if (GUILayout.Button(addTexture))
                    {
                        var frame = workingAnimation.addFrame(selectedFrame, null);
                        frame.setUri(SpecialAssetPaths.ASSET_EMPTY_ANIMATION + "_01.png");
                    }

                    using (new EditorGUI.DisabledScope(selectedFrame < 0))
                    {
                        if (GUILayout.Button(duplicateImg))
                        {
                            workingAnimation.addFrame(selectedFrame, workingAnimation.getFrame(selectedFrame));
                        }
                    }

                    using (new EditorGUI.DisabledScope(selectedFrame >= workingAnimation.getFrames().Count - 1))
                    {
                        if (GUILayout.Button(moveRight))
                        {
                            workingAnimation.moveRight(selectedFrame);
                            selectedFrame++;
                        }
                    }
                    GUILayout.FlexibleSpace();
                }


            using (new EditorGUI.DisabledScope(selectedFrame == -1))
            {/*
              * Frame info panel
              */
                var frame = selectedFrame >= 0 ? workingAnimation.getFrame(selectedFrame): emptyFrame;

                EditorGUILayout.PrefixLabel(TC.get("Animation.Details"), GUIStyle.none, titleStyle);

                EditorGUI.BeginChangeCheck();
                var frameDocumentation = EditorGUILayout.TextField(TC.get("Animation.Documentation"), frame.getDocumentation());
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setDocumentation(frameDocumentation);
                }

                EditorGUI.BeginChangeCheck();
                var frameDuration = System.Math.Max(0, EditorGUILayout.LongField(TC.get("Animation.Duration"), frame.getTime()));
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setTime(frameDuration);
                }

                EditorGUI.BeginChangeCheck();
                imageChooser.Path = frame.getUri();
                imageChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setUri(imageChooser.Path);
                }

                EditorGUI.BeginChangeCheck();
                soundChooser.Path = frame.getSoundUri();
                soundChooser.DoLayout();
                if (EditorGUI.EndChangeCheck())
                {
                    frame.setSoundUri(soundChooser.Path);
                }

                var editTransition = useTransitions && selectedFrame.InRange(-1, workingAnimation.getFrames().Count - 1);
                var transition     = editTransition ? workingAnimation.getTranstionForFrame(selectedFrame) : emptyTransition;

                using (new EditorGUI.DisabledScope(!editTransition))
                {
                    EditorGUILayout.PrefixLabel(TC.get("NextScene.Transition"), GUIStyle.none, titleStyle);
                    EditorGUI.BeginChangeCheck();
                    var transitionDuration = EditorGUILayout.LongField(TC.get("Animation.Duration"), transition.getTime());
                    if (EditorGUI.EndChangeCheck())
                    {
                        transition.setTime(transitionDuration);
                    }

                    EditorGUI.BeginChangeCheck();
                    var transitionType = EditorGUILayout.Popup(TC.get("Conditions.Type"), (int)transition.getType(), transitionTypeName);
                    if (EditorGUI.EndChangeCheck())
                    {
                        transition.setType((TransitionType)transitionType);
                    }
                }
            }

            var lastEditorRect = GUILayoutUtility.GetLastRect();


            // Ending buttons
            GUILayout.FlexibleSpace();
            using (new EditorGUILayout.HorizontalScope())
            {
                if (GUILayout.Button("OK"))
                {
                    // If it doesnt have an extension its because its an old animation
                    if (!Path.HasExtension(cutscenePath))
                    {
                        cutscenePath = cutscenePath + ".eaa.xml";
                    }

                    AnimationWriter.WriteAnimation(cutscenePath, workingAnimation);
                    AssetDatabase.Refresh(ImportAssetOptions.Default);
                    if (reference != null)
                    {
                        reference.OnDialogOk(cutscenePath, this);
                    }
                    this.Close();
                }
                if (GUILayout.Button(TC.get("GeneralText.Cancel")))
                {
                    if (reference != null)
                    {
                        reference.OnDialogCanceled();
                    }
                    this.Close();
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                var lastButtonRect = GUILayoutUtility.GetLastRect();
                var minheight      = lastEditorRect.y + lastEditorRect.height + lastEditorRect.height + 10;
                minSize = new Vector2(400, minheight);
            }
        }