示例#1
0
    static void Init()
    {
        ConversationEditorWindow window = (ConversationEditorWindow)EditorWindow.GetWindow(typeof(ConversationEditorWindow));

        window.Repaint();
        window.title = "Conversation Editor";
    }
示例#2
0
    public override void OnInspectorGUI()
    {
        if (!sideIcon)
        {
            sideIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof(Texture2D));
        }

        if (_target)
        {
            _target.Upgrade();
        }
        else
        {
            return;
        }

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Conversation settings", EditorStyles.boldLabel);
        _target.interactionSource = (InteractionSource)EditorGUILayout.EnumPopup("Interaction source:", _target.interactionSource);
        _target.autoPlay          = EditorGUILayout.Toggle("Auto-play lone option?", _target.autoPlay);
        _target.isTimed           = EditorGUILayout.Toggle("Is timed?", _target.isTimed);
        if (_target.isTimed)
        {
            _target.timer = EditorGUILayout.FloatField("Timer length (s):", _target.timer);
        }
        if (GUILayout.Button("Conversation Editor"))
        {
            ConversationEditorWindow window = (ConversationEditorWindow)EditorWindow.GetWindow(typeof(ConversationEditorWindow));
            window.Repaint();
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();
        CreateOptionsGUI();
        EditorGUILayout.Space();

        if (_target.selectedOption != null && _target.options.Contains(_target.selectedOption))
        {
            EditorGUILayout.LabelField("Dialogue option '" + _target.selectedOption.label + "' properties", EditorStyles.boldLabel);
            EditOptionGUI(_target.selectedOption, _target.interactionSource);
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(_target);
        }
    }