Esempio n. 1
0
    public void AttemptCreateCharacter()
    {
        if (string.IsNullOrEmpty(m_inputName.text))
        {
            WarningMessageUI.Instance.ShowMessage("You must type a name!", 2f);
            return;
        }

        m_ActorInfo.Name = m_inputName.text;

        LoadingWindowUI.Instance.Register(this);
        m_createCharacter.Create(m_ActorInfo);
    }
Esempio n. 2
0
    void InitializeCharacter(int listPos)
    {
        Character newCharacter = CreateCharacter.Create();

        if (newCharacter)
        {
            string relPath = AssetDatabase.GetAssetPath(newCharacter);
            //EditorPrefs.SetString("CharacterObjectPath_" + System.DateTime.Now.Millisecond, relPath);
            if (characters && (characters.allCharacters != null))
            {
                characters.allCharacters[listPos] = newCharacter;
            }
        }
    }
Esempio n. 3
0
    void CreateNewCharacter(int counter = 0)
    {
        //if (counter == 0) counter = System.DateTime.Now.Millisecond;
        Character newCharacter = CreateCharacter.Create();

        if (newCharacter)
        {
            string relPath = AssetDatabase.GetAssetPath(newCharacter);
            //EditorPrefs.SetString("CharacterObjectPath_" + counter, relPath);
            if (characters && (characters.allCharacters != null))
            {
                characters.allCharacters.Add(newCharacter);
                viewIndex++;
                EditorUtility.SetDirty(characters);
            }
        }
    }
    void OnGUI()
    {
        GUILayout.Label("Character Editor", EditorStyles.boldLabel);

        characterName = EditorGUILayout.TextField("Name", characterName);

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Load Character"))
        {
            // Check if the asset with the entered name exists
            if (AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Characters/" + characterName + ".asset") != null)
            {
                loadedCharacter = AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/Characters/" + characterName + ".asset");
                Debug.Log("\'" + characterName + ".asset\' loaded.");

                characterName = loadedCharacter.name;
            }
            else
            {
                Debug.Log("Asset not found!");
            }
        }

        if (GUILayout.Button("Save Character"))
        {
            CreateCharacter.Create(characterName);
        }

        GUILayout.EndHorizontal();
        GUILayout.Space(10);
        GUILayout.Label("Conversation", EditorStyles.boldLabel);

        nodeText = EditorGUILayout.TextField("Text", nodeText);

        if (GUILayout.Button("Create Node"))
        {
            CreateDialogueNode.Create(characterName, nodeText);
        }
    }