Esempio n. 1
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            appearanceTableRect = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, 0.15f * windowHeight);
            rightPanelRect      = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.15f * windowHeight);
            propertiesTable     = new Rect(0f, 0.25f * windowHeight, windowWidth, 0.25f * windowHeight);
            previewRect         = new Rect(0f, 0.5f * windowHeight, windowWidth, windowHeight * 0.45f);

            GUILayout.BeginArea(appearanceTableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("Scene.LookPanelTitle"), GUILayout.Width(windowWidth * 0.44f));
            GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.44f));
            GUILayout.EndHorizontal();
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            // Appearance table
            for (int i = 0; i < Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList().Count; i++)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[
                                    GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i].getId(), GUILayout.Width(windowWidth * 0.44f));
                GUILayout.Label(Controller.getInstance().getSelectedChapterDataControl().getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex].getActiveAreasList().getActiveAreasList()[i].getConditions
                                    ().size().ToString(), GUILayout.Width(windowWidth * 0.44f));
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTexture, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Debug.Log("ADD");
            }
            if (GUILayout.Button(duplicateImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Debug.Log("Duplicate");
            }
            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Debug.Log("Clear");
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();

            GUILayout.Space(30);

            GUILayout.BeginArea(propertiesTable);
            // Background chooser
            GUILayout.Label(TC.get("Background image of the scene"));
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
            {
                backgroundPath = "";
            }
            GUILayout.Box(backgroundPath, GUILayout.Width(0.7f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
            {
                ShowAssetChooser(AssetType.BACKGROUND);
            }
            GUILayout.EndHorizontal();

            // Foreground chooser
            GUILayout.Label(TC.get("Resources.DescriptionSceneForeground"));
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
            {
                foregroundMaskPath = "";
            }
            GUILayout.Box(foregroundMaskPath, GUILayout.Width(0.7f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
            {
                ShowAssetChooser(AssetType.FOREGROUND);
            }
            GUILayout.EndHorizontal();

            // Music chooser
            GUILayout.Label(TC.get("Resources.DescriptionSceneMusic"));
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth)))
            {
                musicPath = "";
            }
            GUILayout.Box(musicPath, GUILayout.Width(0.7f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.19f * windowWidth)))
            {
                ShowAssetChooser(AssetType.MUSIC);
            }
            GUILayout.EndHorizontal();

            GUILayout.EndArea();

            if (backgroundPath != "")
            {
                GUI.DrawTexture(previewRect, backgroundPreview, ScaleMode.ScaleToFit);
            }
        }
Esempio n. 2
0
        ///////////////////////////////

        protected override void OnSelect(ReorderableList r)
        {
            GameRources.GetInstance().selectedConversationIndex = r.index;
            EditorWindowBase.WantsMouseMove = true;
        }
 void OnShowBubbleChange()
 {
     shouldShowSpeachBubbleLast = shouldShowSpeachBubble;
     Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
         GameRources.GetInstance().selectedCharacterIndex].setShowsSpeechBubbles(shouldShowSpeachBubble);
 }
        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);
            }
        }
Esempio n. 5
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;
            }
        }
Esempio n. 6
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            tableRect      = new Rect(0f, 0.1f * windowHeight, 0.9f * windowWidth, windowHeight * 0.33f);
            rightPanelRect = new Rect(0.9f * windowWidth, 0.1f * windowHeight, 0.08f * windowWidth, 0.33f * windowHeight);
            previewRect    = new Rect(0f, 0.5f * windowHeight, windowWidth, windowHeight * 0.45f);

            GUILayout.BeginArea(tableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("BookParagraphsList.ParagraphType"), GUILayout.Width(windowWidth * 0.19f));
            GUILayout.Box(TC.get("BookParagraphsList.Content"), GUILayout.Width(windowWidth * 0.69f));
            GUILayout.EndHorizontal();

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                     GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs().Count;
                 i++)
            {
                GUI.skin = noBackgroundSkin;
                if (i == selectedElement)
                {
                    GUI.skin = selectedElementSkin;
                }

                GUILayout.BeginHorizontal();
                tmpType = Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                    GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                    i].getType();
                switch (tmpType)
                {
                case Controller.BOOK_TITLE_PARAGRAPH:
                    tmpTexture           = titleParagraphTex;
                    tmpParagraphTypeName = TC.get("Element.Name14");
                    break;

                case Controller.BOOK_BULLET_PARAGRAPH:
                    tmpTexture           = bulletParagraphTex;
                    tmpParagraphTypeName = TC.get("Element.Name16");
                    break;

                case Controller.BOOK_TEXT_PARAGRAPH:
                    tmpTexture           = textParagraphTex;
                    tmpParagraphTypeName = TC.get("Element.Name15");
                    break;

                case Controller.BOOK_IMAGE_PARAGRAPH:
                    tmpTexture           = imageParagraphTex;
                    tmpParagraphTypeName = TC.get("Element.Name1");
                    break;
                }

                if (GUILayout.Button(new GUIContent(tmpParagraphTypeName, tmpTexture),
                                     GUILayout.Width(windowWidth * 0.19f), GUILayout.MaxHeight(0.05f * windowHeight)))
                {
                    selectedElement = i;
                }

                if (selectedElement != i)
                {
                    if (
                        GUILayout.Button(
                            Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                                GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()
                            [
                                i].getParagraphContent(),
                            GUILayout.Width(windowWidth * 0.69f)))
                    {
                        selectedElement = i;
                    }
                }
                else
                {
                    if (tmpType == Controller.BOOK_IMAGE_PARAGRAPH)
                    {
                        if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.09f * windowWidth)))
                        {
                        }
                        if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.MaxWidth(0.20f * windowWidth)))
                        {
                            ImageFileOpenDialog imageDialog =
                                (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
                            imageDialog.Init(this, BaseFileOpenDialog.FileType.BOOK_IMAGE_PARAGRAPH);
                        }
                        GUILayout.Box(Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                                          GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                                          i].getParagraphContent(), GUILayout.MaxWidth(0.4f * windowWidth));
                    }
                    else
                    {
                        editableFieldContent =
                            Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                                GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                                i].getParagraphContent();
                        editableFieldContent = GUILayout.TextField(editableFieldContent, GUILayout.Width(0.69f * windowWidth));
                        Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                            GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                            i].setParagraphTextContent(editableFieldContent);
                    }
                }

                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                addMenu.menu.ShowAsContext();
            }
            if (GUILayout.Button(moveUpTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                    GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().moveElementUp(
                    Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                        GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                        selectedElement]);
            }
            if (GUILayout.Button(moveDownTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                    GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().moveElementDown(
                    Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                        GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                        selectedElement]);
            }
            if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                    GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().deleteElement(
                    Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                        GameRources.GetInstance().selectedBookIndex].getBookParagraphsList().getBookParagraphs()[
                        selectedElement], false);
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();
        }
Esempio n. 7
0
 public void ShowItemWindowView(int o)
 {
     GameRources.GetInstance().selectedCharacterIndex = o;
 }
Esempio n. 8
0
 private void OnItemDescriptionChanged(string val)
 {
     fullItemDescriptionLast = val;
     Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
         GameRources.GetInstance().selectedItemIndex].setDocumentation(fullItemDescription);
 }
Esempio n. 9
0
 private void OnDragAndDropToogleValueChange(bool val)
 {
     dragdropToogleLast = val;
     Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
         GameRources.GetInstance().selectedItemIndex].setReturnsWhenDragged(val);
 }
Esempio n. 10
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);
            }
        }
Esempio n. 11
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            descriptionRect      = new Rect(0f, 0.1f * windowHeight, windowWidth, 0.1f * windowHeight);
            rightPanelRect       = new Rect(0.9f * windowWidth, 0.2f * windowHeight, 0.08f * windowWidth, 0.15f * windowHeight);
            descriptionTableRect = new Rect(0f, 0.2f * windowHeight, 0.9f * windowWidth, 0.15f * windowHeight);
            settingsTable        = new Rect(0f, 0.35f * windowHeight, windowWidth, windowHeight * 0.65f);


            GUILayout.BeginArea(descriptionRect);
            GUILayout.Label(TC.get("Item.Documentation"));
            fullItemDescription = GUILayout.TextField(fullItemDescription);
            if (!fullItemDescription.Equals(fullItemDescriptionLast))
            {
                OnItemDescriptionChanged(fullItemDescription);
            }
            GUILayout.EndArea();

            /*
             * Desciptor table
             */
            GUILayout.BeginArea(descriptionTableRect);
            GUILayout.BeginHorizontal();
            GUILayout.Box(TC.get("DescriptionList.Descriptions"), GUILayout.Width(windowWidth * 0.44f));
            GUILayout.Box(TC.get("Conditions.Title"), GUILayout.Width(windowWidth * 0.44f));
            GUILayout.EndHorizontal();
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            for (int i = 0;
                 i <
                 Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                     GameRources.GetInstance().selectedItemIndex].getDescriptionController().getDescriptionCount();
                 i++)
            {
                if (i == selectedDescription)
                {
                    GUI.skin = selectedAreaSkin;
                }
                else
                {
                    GUI.skin = noBackgroundSkin;
                }

                tmpTex = (Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                              GameRources.GetInstance().selectedItemIndex].getDescriptionController()
                          .getDescriptionController(i)
                          .getConditionsController()
                          .getBlocksCount() > 0
                    ? conditionsTex
                    : noConditionsTex);

                GUILayout.BeginHorizontal();

                if (i == selectedDescription)
                {
                    if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                             GameRources.GetInstance().selectedItemIndex].getDescriptionController()
                                         .getDescriptionController(i)
                                         .getName(), GUILayout.Width(windowWidth * 0.44f)))
                    {
                        OnDescriptionSelectionChange(i);
                    }
                    if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.44f)))
                    {
                        ConditionEditorWindow window =
                            (ConditionEditorWindow)ScriptableObject.CreateInstance(typeof(ConditionEditorWindow));
                        window.Init(
                            Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                GameRources.GetInstance().selectedItemIndex].getDescriptionController()
                            .getDescriptionController(i)
                            .getConditionsController());
                    }
                }
                else
                {
                    if (GUILayout.Button(Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                                             GameRources.GetInstance().selectedItemIndex].getDescriptionController()
                                         .getDescriptionController(i)
                                         .getName(), GUILayout.Width(windowWidth * 0.44f)))
                    {
                        OnDescriptionSelectionChange(i);
                    }
                    if (GUILayout.Button(tmpTex, GUILayout.Width(windowWidth * 0.44f)))
                    {
                        OnDescriptionSelectionChange(i);
                    }
                }
                GUILayout.EndHorizontal();
                GUI.skin = defaultSkin;
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();



            /*
             * Right panel
             */
            GUILayout.BeginArea(rightPanelRect);
            GUI.skin = noBackgroundSkin;
            if (GUILayout.Button(addTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                    GameRources.GetInstance().selectedItemIndex].getDescriptionController().addElement();
            }
            if (GUILayout.Button(duplicateTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                    GameRources.GetInstance().selectedItemIndex].getDescriptionController().duplicateElement();
            }
            if (GUILayout.Button(clearTex, GUILayout.MaxWidth(0.08f * windowWidth)))
            {
                Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
                    GameRources.GetInstance().selectedItemIndex].getDescriptionController().deleteElement();
            }
            GUI.skin = defaultSkin;
            GUILayout.EndArea();



            /*
             * Properties panel
             */
            GUILayout.BeginArea(settingsTable);


            GUILayout.Label(TC.get("Item.Name"));
            GUILayout.BeginHorizontal();
            descriptionName = GUILayout.TextField(descriptionName, GUILayout.MaxWidth(0.6f * windowWidth));
            if (!descriptionName.Equals(descriptionNameLast))
            {
                OnDescriptionNameChanged(descriptionName);
            }
            if (!string.IsNullOrEmpty(descriptionSound))
            {
                audioTextureTmp = audioTexture;
            }
            else
            {
                audioTextureTmp = noAudioTexture;
            }
            GUILayout.Label(audioTextureTmp);
            GUILayout.Label(descriptionSound);
            if (GUILayout.Button(TC.get("Buttons.Select")))
            {
                ShowAssetChooser(AssetType.NAME_SOUND);
            }
            if (GUILayout.Button(clearTex))
            {
                OnDescriptorNameSoundChange("");
            }
            GUILayout.EndHorizontal();

            GUILayout.Label(TC.get("Item.Description"));
            GUILayout.BeginHorizontal();
            briefDescription = GUILayout.TextField(briefDescription, GUILayout.MaxWidth(0.6f * windowWidth));
            if (!briefDescription.Equals(briefDescriptionLast))
            {
                OnBriefDescriptionChanged(briefDescription);
            }
            if (!string.IsNullOrEmpty(briefDescriptionSound))
            {
                audioTextureTmp = audioTexture;
            }
            else
            {
                audioTextureTmp = noAudioTexture;
            }
            GUILayout.Label(audioTextureTmp);
            GUILayout.Label(briefDescriptionSound);
            if (GUILayout.Button(TC.get("Buttons.Select")))
            {
                ShowAssetChooser(AssetType.BRIEF_DESCRIPTION_SOUND);
            }
            if (GUILayout.Button(clearTex))
            {
                OnDescriptorBriefSoundChange("");
            }
            GUILayout.EndHorizontal();

            GUILayout.Label(TC.get("Item.DetailedDescription"));
            GUILayout.BeginHorizontal();
            detailedDescription = GUILayout.TextField(detailedDescription, GUILayout.MaxWidth(0.6f * windowWidth));
            if (!detailedDescription.Equals(detailedDescriptionLast))
            {
                OnDetailedDescriptionChanged(detailedDescription);
            }
            if (!string.IsNullOrEmpty(detailedDescriptionSound))
            {
                audioTextureTmp = audioTexture;
            }
            else
            {
                audioTextureTmp = noAudioTexture;
            }
            GUILayout.Label(audioTextureTmp);
            GUILayout.Label(detailedDescriptionSound);
            if (GUILayout.Button(TC.get("Buttons.Select")))
            {
                ShowAssetChooser(AssetType.DETAILED_DESCRIPTION_SOUND);
            }
            if (GUILayout.Button(clearTex))
            {
                OnDescriptorDetailedSoundChange("");
            }
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.Label(TC.get("Item.ReturnsWhenDragged.Title"));
            GUILayout.Box(TC.get("Item.ReturnsWhenDragged.Description"));
            dragdropToogle = GUILayout.Toggle(dragdropToogle, TC.get("Item.ReturnsWhenDragged"));
            if (dragdropToogle != dragdropToogleLast)
            {
                OnDragAndDropToogleValueChange(dragdropToogle);
            }

            GUILayout.FlexibleSpace();

            GUILayout.Label(TC.get("Behaviour"));
            GUILayout.BeginHorizontal();
            selectedBehaviourType = EditorGUILayout.Popup(selectedBehaviourType, behaviourTypes,
                                                          GUILayout.MaxWidth(0.2f * windowWidth));
            if (selectedBehaviourType != selectedBehaviourTypeLast)
            {
                OnBehaviourChange(selectedBehaviourType);
            }
            GUILayout.Box(behaviourTypesDescription[selectedBehaviourType]);
            GUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();

            GUILayout.Label(TC.get("Resources.TransitionTime"));
            GUILayout.Box(TC.get("Resources.TransitionTime.Description"));
            transitionTime = GUILayout.TextField(transitionTime);
            transitionTime = (Regex.Match(transitionTime, "^[0-9]{1,3}$").Success ? transitionTime : transitionTimeLast);
            if (!transitionTime.Equals(transitionTimeLast))
            {
                OnTransitionTimeChange(transitionTime);
            }


            GUILayout.EndArea();
        }
Esempio n. 12
0
        public override void DrawPreview(Rect rect)
        {
            var item = Target as ItemDataControl ?? Controller.Instance.SelectedChapterDataControl.getItemsList().getItems()[GameRources.GetInstance().selectedItemIndex];

            RefreshResources(item);

            if (imageTex == null)
            {
                return;
            }

            GUI.DrawTexture(rect, rect.Contains(Event.current.mousePosition) && imageOverTex ? imageOverTex : imageTex, ScaleMode.ScaleToFit);
        }
 // Two methods responsible for showing right window content
 // - concrete item info or base window view
 public void ShowBaseWindowView()
 {
     GameRources.GetInstance().selectedSetItemIndex = -1;
 }
Esempio n. 14
0
        public override void Draw(int aID)
        {
            var windowWidth  = m_Rect.width;
            var windowHeight = m_Rect.height;

            tableRect       = new Rect(0f, 0.1f * windowHeight, windowWidth, windowHeight * 0.33f);
            infoPreviewRect = new Rect(0f, 0.45f * windowHeight, windowWidth, windowHeight * 0.05f);
            previewRect     = new Rect(0f, 0.5f * windowHeight, windowWidth, windowHeight * 0.45f);

            /**
             * TABLE
             */
            GUILayout.BeginArea(tableRect);

            GUILayout.Label(TC.get("Resources.DescriptionBookBackground"));
            GUILayout.BeginHorizontal();
            GUILayout.Box(backgroundPath, GUILayout.MaxWidth(0.85f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.MaxWidth(0.15f * windowWidth)))
            {
                ImageFileOpenDialog imageDialog =
                    (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
                imageDialog.Init(this, BaseFileOpenDialog.FileType.BOOK_IMAGE_PARAGRAPH);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            // NORMAL ARROWS PART
            GUILayout.Label(TC.get("Resources.ArrowLeftNormal"), GUILayout.MaxWidth(0.5f * windowWidth));
            GUILayout.Label(TC.get("Resources.ArrowRightNormal"), GUILayout.MaxWidth(0.5f * windowWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.05f * windowWidth)))
            {
                //TODO: clear
            }
            GUILayout.Box(leftNormalArrowPath, GUILayout.MaxWidth(0.3f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.MaxWidth(0.1f * windowWidth)))
            {
                ImageFileOpenDialog imageDialog =
                    (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
                imageDialog.Init(this, BaseFileOpenDialog.FileType.BOOK_ARROW_LEFT_NORMAL);
            }

            GUILayout.Space(0.05f * windowWidth);

            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.05f * windowWidth)))
            {
                //TODO: clear
            }
            GUILayout.Box(rightNormalArrowPath, GUILayout.MaxWidth(0.3f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.MaxWidth(0.1f * windowWidth)))
            {
                ImageFileOpenDialog imageDialog =
                    (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
                imageDialog.Init(this, BaseFileOpenDialog.FileType.BOOK_ARROW_RIGHT_NORMAL);
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(10);

            // OVER ARROWS PART
            GUILayout.BeginHorizontal();
            GUILayout.Label(TC.get("Resources.ArrowLeftOver"), GUILayout.MaxWidth(0.5f * windowWidth));
            GUILayout.Label(TC.get("Resources.ArrowRightOver"), GUILayout.MaxWidth(0.5f * windowWidth));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.05f * windowWidth)))
            {
                //TODO: clear
            }
            GUILayout.Box(leftOverArrowPath, GUILayout.MaxWidth(0.3f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.MaxWidth(0.1f * windowWidth)))
            {
                ImageFileOpenDialog imageDialog =
                    (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
                imageDialog.Init(this, BaseFileOpenDialog.FileType.BOOK_ARROW_LEFT_OVER);
            }

            GUILayout.Space(0.05f * windowWidth);

            if (GUILayout.Button(clearImg, GUILayout.MaxWidth(0.05f * windowWidth)))
            {
                //TODO: clear
            }
            GUILayout.Box(rightOverArrowPath, GUILayout.MaxWidth(0.3f * windowWidth));
            if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.MaxWidth(0.1f * windowWidth)))
            {
                ImageFileOpenDialog imageDialog =
                    (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
                imageDialog.Init(this, BaseFileOpenDialog.FileType.BOOK_ARROW_RIGHT_OVER);
            }
            GUILayout.EndHorizontal();

            GUILayout.EndArea();


            if (backgroundPath != "")
            {
                /**
                 * PREVIEW BUTTON
                 */
                GUILayout.BeginArea(infoPreviewRect);
                if (GUILayout.Button(TC.get("GeneralText.Edit")))
                {
                    BooksAppearanceEditor window =
                        (BooksAppearanceEditor)ScriptableObject.CreateInstance(typeof(BooksAppearanceEditor));
                    window.Init(this, Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
                                    GameRources.GetInstance().selectedBookIndex]);
                }
                GUILayout.EndArea();


                /**
                 * PREVIEW TEXTURE
                 */
                GUI.DrawTexture(previewRect, backgroundPreview, ScaleMode.ScaleToFit);
            }
            else
            {
                GUILayout.BeginArea(infoPreviewRect);
                GUILayout.Button("No background!");
                GUILayout.EndArea();
            }
        }
            public override void OnDrawingGizmosSelected()
            {
                var rect = ScenesWindowElementReference.ReferenceComponent.GetElementRect(Target);

                // Rect resizing
                var id = GUIUtility.GetControlID(GetHashCode(), FocusType.Passive);

                EditorGUI.BeginChangeCheck();
                var newRect = HandleUtil.HandleFixedRatioRect(id, rect, rect.width / rect.height, 10f,
                                                              (polygon, over, active) => HandleUtil.DrawPolyLine(polygon, true, SceneEditor.GetColor(Color.red)),
                                                              (point, over, active) => HandleUtil.DrawPoint(point, 4.5f, SceneEditor.GetColor(Color.blue), SceneEditor.GetColor(Color.black)));

                if (EditorGUI.EndChangeCheck())
                {
                    var original = newRect.ViewportToScreen(SceneEditor.Current.Size.x, SceneEditor.Current.Size.y, SceneEditor.Current.Viewport);
                    var unscaled = ScenesWindowElementReference.ReferenceComponent.GetUnscaledRect(Target);
                    // And then we rip the position
                    var position = original.center + new Vector2(0, original.height / 2f);
                    var scale    = original.size.magnitude / unscaled.size.magnitude;

                    if (Target is PlayerDataControl)
                    {
                        var workingScene = Controller.Instance.SelectedChapterDataControl.getScenesList().getScenes()[
                            GameRources.GetInstance().selectedSceneIndex];
                        // And then we set the values in the reference
                        workingScene.setDefaultInitialPosition(Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y));
                        workingScene.setPlayerScale(scale);
                    }
                    else if (Target is NodeDataControl)
                    {
                        var node = Target as NodeDataControl;
                        node.setNode(Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y), scale);
                    }
                }

                // Rect movement
                var movementId = GUIUtility.GetControlID(GetHashCode() + 1, FocusType.Passive);

                EditorGUI.BeginChangeCheck();
                rect = HandleUtil.HandleRectMovement(movementId, rect);
                if (EditorGUI.EndChangeCheck())
                {
                    var original = rect.ViewportToScreen(SceneEditor.Current.Size.x, SceneEditor.Current.Size.y, SceneEditor.Current.Viewport);
                    var rectBase = original.Base();
                    if (Target is PlayerDataControl)
                    {
                        var workingScene = Controller.Instance.SelectedChapterDataControl.getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex];
                        workingScene.setDefaultInitialPosition(Mathf.RoundToInt(rectBase.x), Mathf.RoundToInt(rectBase.y));
                    }
                    else if (Target is NodeDataControl)
                    {
                        var node = Target as NodeDataControl;
                        node.setNode(Mathf.RoundToInt(rectBase.x), Mathf.RoundToInt(rectBase.y), node.getScale());
                    }
                }
            }
Esempio n. 16
0
 private void OnTransitionTimeChange(string val)
 {
     transitionTimeLast = val;
     Controller.getInstance().getSelectedChapterDataControl().getItemsList().getItems()[
         GameRources.GetInstance().selectedItemIndex].setResourcesTransitionTime(int.Parse(val));
 }
Esempio n. 17
0
 public void OnCliked()
 {
     Controller.getInstance().getSelectedChapterDataControl().getBooksList().getBooks()[
         GameRources.GetInstance().selectedBookIndex].getBookParagraphsList()
     .addElement(Controller.BOOK_IMAGE_PARAGRAPH, String.Empty);
 }
 protected override void OnSelect(ReorderableList r)
 {
     booksWindowContents.Target = Controller.Instance.SelectedChapterDataControl.getBooksList().getBooks()[r.index];
     GameRources.GetInstance().selectedBookIndex = r.index;
 }
Esempio n. 19
0
 // Two methods responsible for showing right window content
 // - concrete item info or base window view
 public void ShowBaseWindowView()
 {
     GameRources.GetInstance().selectedCharacterIndex = -1;
 }
Esempio n. 20
0
        public CutscenesWindowDocumentation(Rect aStartPos, GUIContent aContent, GUIStyle aStyle, params GUILayoutOption[] aOptions)
            : base(aStartPos, aContent, aStyle, aOptions)
        {
            string doc = "", name = "", sclass = "", stype = "";

            if (GameRources.GetInstance().selectedCutsceneIndex >= 0)
            {
                current = Controller.getInstance().getCharapterList().getSelectedChapterData().getCutscenes()[GameRources.GetInstance().selectedCutsceneIndex];

                doc    = current.getDocumentation();
                name   = current.getName();
                sclass = current.getXApiClass();
                stype  = current.getXApiType();
            }

            doc    = (doc == null ? "" : doc);
            name   = (name == null ? "" : name);
            sclass = (sclass == null ? "" : sclass);
            stype  = (stype == null ? "" : stype);

            descriptionOfCutscene = descriptionOfCutsceneLast = doc;
            nameOfCutscene        = nameOfCutsceneLast = name;
            sceneclass            = sceneclasslast = sclass;
            scenetype             = scenetypelast = stype;
        }
        public override void Draw(int aID)
        {
            workingItem = Target as ItemDataControl ?? Controller.Instance.SelectedChapterDataControl.getItemsList().getItems()[GameRources.GetInstance().selectedItemIndex];


            // -------------
            // Documentation
            // -------------

            GUILayout.Label(TC.get("Item.Documentation"));
            EditorGUI.BeginChangeCheck();
            var fullItemDescription = GUILayout.TextArea(workingItem.getDocumentation() ?? string.Empty);

            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setDocumentation(fullItemDescription);
            }


            // -------------
            // Descriptions
            // -------------
            descriptionsEditor.Descriptions = workingItem.getDescriptionController();
            descriptionsEditor.OnInspectorGUI();
            GUILayout.Space(20);

            // -------------
            // Drag & drop
            // -------------

            EditorGUILayout.LabelField(TC.get("Item.ReturnsWhenDragged.Title"));
            EditorGUI.BeginChangeCheck();
            var dragdropToogle = EditorGUILayout.Toggle(dragdropLabel, workingItem.isReturnsWhenDragged());

            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setReturnsWhenDragged(dragdropToogle);
            }
            GUILayout.Space(20);

            // -------------
            // Behaviour
            // -------------
            EditorGUI.BeginChangeCheck();
            var selectedBehaviourType = EditorGUILayout.Popup(TC.get("Behaviour"), (int)workingItem.getBehaviour(), behaviourTypes.Select(bt => TC.get(bt)).ToArray());

            Item.BehaviourType type = (selectedBehaviourType == 0 ? Item.BehaviourType.NORMAL : Item.BehaviourType.FIRST_ACTION);
            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setBehaviour(type);
            }
            EditorGUILayout.HelpBox(TC.get(behaviourTypesDescription[selectedBehaviourType]), MessageType.Info);
            GUILayout.Space(20);

            // -------------
            // Transition time
            // -------------
            EditorGUI.BeginChangeCheck();
            var transitionTime = Math.Max(EditorGUILayout.LongField(transitionLabel, workingItem.getResourcesTransitionTime()), 0);

            if (EditorGUI.EndChangeCheck())
            {
                workingItem.setResourcesTransitionTime(transitionTime);
            }
        }
Esempio n. 22
0
 private void ChangeType(string s)
 {
     Controller.getInstance().getCharapterList().getSelectedChapterData().getCutscenes()[GameRources.GetInstance().selectedCutsceneIndex].setXApiType(s);
     scenetypelast = s;
 }
        private AtrezzoDataControl GetAtrezzo()
        {
            var atrezzo = Target as AtrezzoDataControl;

            if (atrezzo == null)
            {
                atrezzo = Controller.Instance.SelectedChapterDataControl.getAtrezzoList().getAtrezzoList()[GameRources.GetInstance().selectedSetItemIndex];
            }
            return(atrezzo);
        }
Esempio n. 24
0
 private void ChangeName(string s)
 {
     Controller.getInstance().getCharapterList().getSelectedChapterData().getCutscenes()[GameRources.GetInstance().selectedCutsceneIndex].setName(s);
     nameOfCutsceneLast = s;
 }
Esempio n. 25
0
        protected override void DrawInspector()
        {
            var prevWorkingChar = workingCharacter;

            var player = Controller.Instance.SelectedChapterDataControl.getPlayer();

            if (Target is NodeDataControl || IsPlayer)
            {
                workingCharacter = player;
            }
            else if (Target is NPCDataControl)
            {
                workingCharacter = Target as NPCDataControl;
            }
            else
            {
                workingCharacter = Controller.Instance.SelectedChapterDataControl.getNPCsList().getNPCs()[GameRources.GetInstance().selectedCharacterIndex];
            }

            if (workingCharacter != prevWorkingChar)
            {
                RefreshPathInformation(workingCharacter);
            }

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

            GUILayout.Label(TC.get("Resources.ResourcesGroup"));
            selectedAnimationGroup = groups[EditorGUILayout.Popup((int)selectedAnimationGroup, groupNames.Select(kv => TC.get(kv.Value)).ToArray())];

            // Draw the animation selector for each animation in the selected resource group
            foreach (var resourceTypeGroup in resourceTypeGroups[selectedAnimationGroup])
            {
                DoAnimationSelector(fields[resourceTypeGroup.Key], resourceTypeGroup.Value);
            }
        }
Esempio n. 26
0
 private void ChangeDocumentation(string s)
 {
     Controller.getInstance().getCharapterList().getSelectedChapterData().getCutscenes()[GameRources.GetInstance().selectedCutsceneIndex].setDocumentation(s);
     descriptionOfCutsceneLast = s;
 }
 void OnBubbleBorderChange(Color val)
 {
     bubbleBorderColorLast = val;
     Controller.getInstance().getSelectedChapterDataControl().getNPCsList().getNPCs()[
         GameRources.GetInstance().selectedCharacterIndex].setBubbleBorderColor(val);
 }
            public static void PutTransform(DataControl target)
            {
                SceneEditor.Current.PushMatrix();
                var matrix = SceneEditor.Current.Matrix;

                if (target is PlayerDataControl)
                {
                    var workingScene = Controller.Instance.SelectedChapterDataControl.getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex];
                    SceneEditor.Current.Matrix = matrix * Matrix4x4.TRS(new Vector3(workingScene.getDefaultInitialPositionX(), workingScene.getDefaultInitialPositionY(), 0), Quaternion.identity, Vector3.one * workingScene.getPlayerScale());
                }
                else if (target is NodeDataControl)
                {
                    var node = target as NodeDataControl;
                    SceneEditor.Current.Matrix = matrix * Matrix4x4.TRS(new Vector3(node.getX(), node.getY(), 0), Quaternion.identity, Vector3.one * node.getScale());
                }
            }
Esempio n. 29
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();
        }
        public override void Draw(int aID)
        {
            dataControlList.index = GameRources.GetInstance().selectedSceneIndex;
            // SceneEditor population
            if (GameRources.GetInstance().selectedSceneIndex != -1)
            {
                var scene = Controller.Instance.SelectedChapterDataControl.getScenesList().getScenes()[GameRources.GetInstance().selectedSceneIndex];

                sceneEditor.Components = EditorWindowBase.Components;
                var allElements = new List <DataControl>();
                allElements.AddRange(scene
                                     .getReferencesList()
                                     .getAllReferencesDataControl()
                                     .FindAll(elem => elem.getErdc() != null)
                                     .ConvertAll(elem => elem.getErdc() as DataControl));
                allElements.AddRange(scene.getActiveAreasList().getActiveAreas().Cast <DataControl>());
                allElements.AddRange(scene.getExitsList().getExits().Cast <DataControl>());

                var playerMode = ScenesWindowPlayerMovement.PlayerMode.NoPlayer;
                if (Controller.Instance.PlayerMode == Controller.FILE_ADVENTURE_3RDPERSON_PLAYER)
                {
                    allElements.AddRange(scene.getBarriersList().getBarriers().Cast <DataControl>());
                    playerMode = ScenesWindowPlayerMovement.GetScenePlayerMode(scene);
                }
                switch (playerMode)
                {
                case ScenesWindowPlayerMovement.PlayerMode.InitialPosition:
                    allElements.Add(Controller.Instance.SelectedChapterDataControl.getPlayer());
                    break;

                case ScenesWindowPlayerMovement.PlayerMode.Trajectory:
                    allElements.AddRange(scene.getTrajectory().getNodes().Cast <DataControl>());
                    allElements.AddRange(scene.getTrajectory().getSides().Cast <DataControl>());
                    allElements.Add(scene.getTrajectory());
                    break;
                }
                sceneEditor.Elements = allElements;
            }

            // Send the callback back
            base.Draw(aID);
        }