Пример #1
0
    void OnGUI()
    {
        // set up fields to manipulate based on the data we want to have in out text data
        // have these fields directly change the text we associated with this window
        GUILayout.Label("Text Edit Options for : " + text.name, EditorStyles.boldLabel);
        text.text      = EditorGUILayout.TextField("Text: ", text.text);
        text.font      = (Font)EditorGUILayout.ObjectField("Font: ", text.font, typeof(Font), false);
        text.fontSize  = EditorGUILayout.IntField("Size: ", text.fontSize);
        text.color     = EditorGUILayout.ColorField("Color: ", text.color);
        text.alignment = (TextAnchor)EditorGUILayout.EnumPopup("Alignment: ", text.alignment);

        rt.localPosition = EditorGUILayout.Vector3Field("Position: ", rt.localPosition);
        rt.sizeDelta     = EditorGUILayout.Vector2Field("Width and Height: ", rt.sizeDelta);

        holdTime = EditorGUILayout.FloatField("HoldTime: ", holdTime);

        EditorGUILayout.Space();
        // save the data
        if (GUILayout.Button("Save"))
        {
            ctd.textToShow = text.text;
            ctd.font       = text.font.name;
            ctd.fontSize   = text.fontSize;
            ctd.textAnchor = text.alignment.ToString();
            ctd.fontColor  = new float[] { text.color.r, text.color.g, text.color.b, text.color.a };

            ctd.position  = new float[] { rt.localPosition.x, rt.localPosition.y, rt.localPosition.z };
            ctd.sizeDelta = new float[] { rt.sizeDelta.x, rt.sizeDelta.y };

            ctd.holdTime = holdTime;

            cutsceneCreator.UpdateTextData(targetIndex, ctd); // update the data in the CutsceneCreator with the target index

            Close();                                          // close the window when we save
        }
    }