// create the window - we need the cutscene creator that made this window
    public void Init(CutsceneCreator cc)
    {
        DefaultTextOptionsWindow window = (DefaultTextOptionsWindow)GetWindow(typeof(DefaultTextOptionsWindow), true);

        window.Show();

        cutsceneCreator = cc;
        filePath        = CutsceneCreator.textDefaultFilePath;

        LoadFromJson(); // load any existing text defaults
    }
Пример #2
0
    CutsceneCreator cutsceneCreator;    // the CutsceneCreator we are using

    // Initialize the window
    // requires a text we will edit and a CutsceneCreator we will manipulate the values of
    public void Init(Text textToEdit, CutsceneCreator cc)
    {
        // set up and show the window
        CutsceneCreatorTextEditorWindow window = (CutsceneCreatorTextEditorWindow)GetWindow(typeof(CutsceneCreatorTextEditorWindow), true);

        window.Show();

        text            = textToEdit;
        rt              = text.gameObject.GetComponent <RectTransform>();
        cutsceneCreator = cc;
        targetIndex     = text.transform.GetSiblingIndex(); // the index we target will be whatever the text's transform's index is in the hierarchy
        // check if there is text data in the CutsceneCreator already and if we're editing something existing rather than something new
        if (cutsceneCreator.currentTextDataList.Count > targetIndex && cutsceneCreator.currentTextDataList[targetIndex] != null)
        {
            try
            {
                ctd      = cutsceneCreator.currentTextDataList[targetIndex];
                holdTime = ctd.holdTime;    // set the hold time
            }
            catch (Exception e)
            {
                Debug.LogError("Could not find textData of index " + targetIndex + ". Further details: " + e.Message);
            }
        }
        else
        // otherwise, set up the defaults for a new text object and make a new data and add the window to the list
        {
            // Call upon the CutsceneCreator's struct and method to set up the default parameters
            CutsceneCreator.TextAndRectTransform tart = new CutsceneCreator.TextAndRectTransform();

            tart = cc.ParseDataToText(cc.textDefaults, text, rt);

            // set the parameters for the objects this class is using via the struct in CutsceneCreator
            text = tart.text;
            rt   = tart.rt;

            // set up holdTime separately as this is not included in the CutsceneCreator's method
            holdTime = cc.textDefaults.holdTime;

            // add the new cutscene text data to the window
            ctd = new CutsceneTextData();
            cutsceneCreator.activeWindows.Add(targetIndex, this);
        }
    }
 private void OnEnable()
 {
     _cutsceneCreator = (CutsceneCreator)target;
 }