コード例 #1
0
ファイル: MainEditor.cs プロジェクト: tinnystudios/RPGKit
    public void AddCharacter()
    {
        ConversationList.Characters c = new ConversationList.Characters();
        c.name     = inputName;
        c.uniqueId = System.Guid.NewGuid().ToString();
        conversationList.characters.Add(c);

        //Jump index
        characterIndex = conversationList.characters.Count - 1;
        _character     = conversationList.characters [characterIndex];

        Deselect();
    }
コード例 #2
0
ファイル: MainEditor.cs プロジェクト: tinnystudios/RPGKit
    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
ファイル: MainEditor.cs プロジェクト: tinnystudios/RPGKit
 public void CharacterPicker()
 {
     characterIndex = EditorGUILayout.Popup("", characterIndex, GetCharacterStrings(conversationList.characters, false, AssetType.character), "popUp", GUILayout.Width(titleWidth));
     _character     = conversationList.characters [characterIndex];
 }