public override void Draw(int aID) { var windowWidth = m_Rect.width; var windowHeight = m_Rect.height; previewRect = new Rect(0f, 0.5f * windowHeight, windowWidth, windowHeight * 0.45f); // Background chooser GUILayout.Label(TC.get("Resources.DescriptionItemImage")); GUILayout.BeginHorizontal(); if (GUILayout.Button(clearImg, GUILayout.Width(0.1f * windowWidth))) { OnImageChanged(""); } GUILayout.Box(pathToImg, GUILayout.Width(0.6f * windowWidth)); if (GUILayout.Button(TC.get("Buttons.Select"), GUILayout.Width(0.1f * windowWidth))) { ImageFileOpenDialog imgDialog = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); imgDialog.Init(this, BaseFileOpenDialog.FileType.SET_ITEM_IMAGE); } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(TC.get("ImageAssets.Preview")); if (pathToImg != "" && atrezzoImg) { GUI.DrawTexture(previewRect, atrezzoImg, ScaleMode.ScaleToFit); } }
void ShowAssetChooser(AssetType type) { switch (type) { case AssetType.BACKGROUND: ImageFileOpenDialog backgroundDialog = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); backgroundDialog.Init(this, BaseFileOpenDialog.FileType.SCENE_BACKGROUND); break; case AssetType.FOREGROUND: ImageFileOpenDialog foregroundDialgo = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); foregroundDialgo.Init(this, BaseFileOpenDialog.FileType.SCENE_FOREGROUND); break; case AssetType.MUSIC: MusicFileOpenDialog musicDialog = (MusicFileOpenDialog)ScriptableObject.CreateInstance(typeof(MusicFileOpenDialog)); musicDialog.Init(this, BaseFileOpenDialog.FileType.SCENE_MUSIC); break; } }
void ShowAssetChooser(AssetType type) { switch (type) { case AssetType.ITEM: ImageFileOpenDialog itemDialog = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); itemDialog.Init(this, BaseFileOpenDialog.FileType.ITEM_IMAGE); break; case AssetType.ICON: ImageFileOpenDialog iconDialog = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); iconDialog.Init(this, BaseFileOpenDialog.FileType.ITEM_ICON); break; case AssetType.ITEM_OVER: ImageFileOpenDialog itemOverDialog = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); itemOverDialog.Init(this, BaseFileOpenDialog.FileType.ITEM_IMAGE_OVER); break; } }
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(); }
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(); } }
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(); }
void OnGUI() { /* * Documentation area */ GUILayout.BeginArea(animInfoRect); GUILayout.BeginVertical(); GUILayout.Label(TC.get("Animation.Documentation")); GUILayout.Space(5); documentationTextContent = GUILayout.TextField(documentationTextContent); GUILayout.EndVertical(); GUILayout.BeginVertical(); useTransitonFlag = GUILayout.Toggle(useTransitonFlag, TC.get("Animation.UseTransitions")); if (useTransitonFlag != useTransitonFlagLast) { OnUseTransitonFlagLastChanged(useTransitonFlag); } slidesAnimationFlag = GUILayout.Toggle(slidesAnimationFlag, TC.get("Animation.Slides")); if (slidesAnimationFlag != slidesAnimationFlagLast) { OnSlidesAnimationFlagLastChanged(slidesAnimationFlag); } GUILayout.EndVertical(); GUILayout.EndArea(); /* * Transition panel */ GUILayout.BeginArea(timelineRect); scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false), GUILayout.MaxHeight(0.25f * windowWidth)); GUI.skin = noBackgroundSkin; GUILayout.BeginHorizontal(); for (int i = 0; i < workingAnimation.getFrames().Count; i++) { GUILayout.BeginHorizontal(); if (selectedFrame == i) { GUI.skin = selectedFrameSkin; } if ( GUILayout.Button( workingAnimation.getFrames()[i].getImage(false, false, global::uAdventure.Core.Animation.ENGINE).texture, GUILayout.MaxHeight(0.2f * windowHeight), GUILayout.MaxWidth(0.2f * windowWidth))) { OnFrameSelectionChanged(i); } GUI.skin = noBackgroundSkin; GUILayout.EndHorizontal(); } GUI.skin = defaultSkin; GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUILayout.EndArea(); /* * Transition button panel */ GUILayout.BeginArea(timelineButtonsRect); GUILayout.BeginHorizontal(); GUI.skin = noBackgroundSkin; if (GUILayout.Button(moveLeft)) { workingAnimation.moveLeft(selectedFrame); } if (GUILayout.Button(clearImg)) { if (selectedFrame >= 0) { workingAnimation.removeFrame(selectedFrame); selectedFrame--; } } if (GUILayout.Button(addTexture)) { workingAnimation.addFrame(selectedFrame, null); } if (GUILayout.Button(duplicateImg)) { workingAnimation.addFrame(selectedFrame, workingAnimation.getFrame(selectedFrame)); } if (GUILayout.Button(moveRight)) { workingAnimation.moveRight(selectedFrame); } GUI.skin = defaultSkin; GUILayout.EndHorizontal(); GUILayout.EndArea(); /* * Frame info panel */ GUILayout.BeginArea(frameInfoRect); GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("Animation.Duration")); animationDurationString = GUILayout.TextField(animationDurationString); animationDurationString = (Regex.Match(animationDurationString, "^[0-9]{1,4}$").Success ? animationDurationString : animationDurationStringLast); if (!animationDurationString.Equals(animationDurationStringLast)) { OnFrameDurationChanged(animationDurationString); } GUILayout.Space(5); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("Animation.Image")); GUILayout.Box(imagePath, GUILayout.MinWidth(0.3f * windowWidth)); if (GUILayout.Button(TC.get("Buttons.Select"))) { ImageFileOpenDialog imageDialog = (ImageFileOpenDialog)ScriptableObject.CreateInstance(typeof(ImageFileOpenDialog)); imageDialog.Init(this, BaseFileOpenDialog.FileType.FRAME_IMAGE); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("Animation.Sound")); GUILayout.Space(5); if (GUILayout.Button(clearImg)) { } GUILayout.Box(soundPath, GUILayout.MinWidth(0.3f * windowWidth)); if (GUILayout.Button(TC.get("Buttons.Select"))) { MusicFileOpenDialog musicDialog = (MusicFileOpenDialog)ScriptableObject.CreateInstance(typeof(MusicFileOpenDialog)); musicDialog.Init(this, BaseFileOpenDialog.FileType.FRAME_MUSIC); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label(TC.get("NextScene.Transition") + " " + TC.get("Animation.Duration")); transitionDurationString = GUILayout.TextField(transitionDurationString); transitionDurationString = (Regex.Match(transitionDurationString, "^[0-9]{1,4}$").Success ? transitionDurationString : transitionDurationStringLast); if (!transitionDurationString.Equals(transitionDurationStringLast)) { OnTransitionDurationChanged(transitionDurationString); } GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.BeginArea(buttonRect); GUILayout.BeginHorizontal(); if (GUILayout.Button("OK")) { AnimationWriter.writeAnimation(cutscenePath, workingAnimation); reference.OnDialogOk("", this); this.Close(); } if (GUILayout.Button(TC.get("GeneralText.Cancel"))) { reference.OnDialogCanceled(); this.Close(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); }