public override void Draw(int aID)
    {
        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();
    }
Пример #2
0
    public override void Draw(int aID)
    {
        /**
         * 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();
        }
    }
Пример #3
0
    void OnGUI()
    {
        GUILayout.BeginHorizontal();

        GUILayout.Label(TC.get("Exit.ExitText"));

        GUILayout.Space(10);

        exitText = GUILayout.TextField(exitText);
        if (!exitText.Equals(exitTextLast))
        {
            OnChangeExitText(exitText);
        }

        GUILayout.EndHorizontal();


        GUILayout.Space(30);


        GUILayout.BeginHorizontal();
        if (audioPath != null && !audioPath.Equals(""))
        {
            GUILayout.Label(audioTexture);
            GUILayout.Space(5);
            GUILayout.Label(audioPath);
        }
        else
        {
            GUILayout.Label(noAudioTexture);
            GUILayout.Space(5);
            GUILayout.Label(TC.get("Conversations.NoAudio"));
        }
        if (GUILayout.Button(TC.get("Buttons.Select")))
        {
            MusicFileOpenDialog musicDialog =
                (MusicFileOpenDialog)ScriptableObject.CreateInstance(typeof(MusicFileOpenDialog));
            musicDialog.Init(this, BaseFileOpenDialog.FileType.EXIT_MUSIC);
        }
        if (GUILayout.Button(clearTexture))
        {
            OnChangeExitAudio("");
        }
        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        if (exitIconPath != null && !exitIconPath.Equals(""))
        {
            GUILayout.Label(exitTexture);
        }
        else
        {
            GUILayout.Label(defaultExitTexture);
        }
        if (GUILayout.Button(TC.get("Buttons.Select")))
        {
            ImageFileOpenDialog imageDialog =
                (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog));
            imageDialog.Init(this, BaseFileOpenDialog.FileType.EXIT_ICON);
        }
        if (GUILayout.Button(clearTexture))
        {
            OnChangeExitText("");
        }
        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        if (GUILayout.Button("OK"))
        {
            reference.OnDialogOk(textContent, this);
            this.Close();
        }
        GUILayout.EndHorizontal();
    }