예제 #1
0
 public void AddChapter(ConversationList.Stories curStory)
 {
     ConversationList.Chapters aChapter = new ConversationList.Chapters();
     curStory.chapters.Add(aChapter);
 }
예제 #2
0
    void OnGUI()
    {
        if (isHide)
        {
            if (GUILayout.Button("Unhide"))
            {
                isHide = false;
            }
        }

        if (isHide)
        {
            return;
        }

        if (Application.isPlaying)
        {
            return;
        }

        _instance = this;
        if (defaultSkin == null)
        {
            defaultSkin = GUI.skin;
        }

        //if (Input.GetKey (KeyCode.KeypadEnter) || Input.GetKey ("enter"))
        //Deselect ();

        if (editorSkin == null)
        {
            editorSkin = (GUISkin)(AssetDatabase.LoadAssetAtPath("Assets/RPGKit/GUISkins/GUISkin.guiskin", typeof(GUISkin)));
        }

        GUI.skin = editorSkin;

        smallButtonSize = 35;

        if (window != null)
        {
            window.minSize = new Vector2(500, 500);
            window.maxSize = new Vector2(500, 500);
        }
        if (conversationList == null)
        {
            conversationList = AssetDatabase.LoadAssetAtPath("Assets/ConversationList.asset", typeof(ConversationList)) as ConversationList;
        }

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Characters", GUILayout.Width(Screen.width * 0.5F), GUILayout.Height(50)))
        {
            assetType = AssetType.character;
        }

        if (GUILayout.Button("Main Story", GUILayout.Width(Screen.width * 0.5F), GUILayout.Height(50)))
        {
            assetType = AssetType.story;
        }
        GUILayout.EndHorizontal();


        //conversationList = EditorGUILayout.ObjectField (conversationList, typeof(ConversationList), true) as ConversationList;

        if (assetType == AssetType.character)
        {
            _character = conversationList.characters [characterIndex];
        }

        if (assetType == AssetType.story)
        {
            _character = conversationList.stories [0].chapters [0];
        }

        //#here
        FindTarget();

        EditorSceneManager.MarkAllScenesDirty();

        if (targetObject == null)
        {
            eventTargetType = EventTargetTypes.global;
        }

        if (targetObject != null)
        {
            eventTargetType = EventTargetTypes.target;
        }

        if (targetObject != null)
        {
            Selection.activeObject    = targetObject.transform;
            Selection.activeTransform = targetObject.transform;
        }

        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height * 0.9F));

        if (assetType == AssetType.character)
        {
            DisplayCharacterCreation();
        }

        if (assetType == AssetType.story)
        {
            if (GUILayout.Button("New Story"))
            {
                AddStory();
            }

            for (int i = 0; i < conversationList.stories.Count; i++)
            {
                ConversationList.Stories curStory = conversationList.stories [i];
                curStory.name = "Story";

                if (GUILayout.Button(i.ToString() + ":" + curStory.name))
                {
                    curStory.isActive = !curStory.isActive;
                }

                //STORY IS ACTIVE
                if (curStory.isActive)
                {
                    if (GUILayout.Button("Add Chapter"))
                    {
                        AddChapter(curStory);
                    }

                    int chapterIndex = 0;

                    foreach (ConversationList.Chapters curChapter in curStory.chapters)
                    {
                        curChapter.name = "Chapter";
                        if (GUILayout.Button(chapterIndex.ToString() + ":" + curChapter.name))
                        {
                            curChapter.isActive = !curChapter.isActive;
                        }

                        if (curChapter.isActive)
                        {
                            characterIndex = chapterIndex;

                            foreach (ConversationList.Chapters otherChaps in curStory.chapters)
                            {
                                if (otherChaps != curChapter)
                                {
                                    otherChaps.isActive = false;
                                }
                            }


                            DisplayConversationContent();
                            GUILayout.BeginVertical();

                            GUILayout.BeginHorizontal();
                            GUILayout.Space(40);

                            GUILayout.BeginVertical();
                            GUILayout.Label("Notes: ");
                            curChapter.notes = GUILayout.TextArea(curChapter.notes, GUILayout.Height(150));
                            GUILayout.EndVertical();

                            GUILayout.EndHorizontal();
                            GUILayout.EndVertical();

                            //Make everything else disable
                        }

                        chapterIndex++;
                    }
                }


                //Get current story
            }
        }

        EditorGUILayout.EndScrollView();
    }
예제 #3
0
 public void AddStory()
 {
     ConversationList.Stories aStory = new ConversationList.Stories();
     conversationList.stories.Add(aStory);
 }