示例#1
0
        /// <summary>
        /// Create a new TextBox.
        /// <param name="prefab">The prefab to make a copy of.</param>
        /// <param name="position">The position in which to spawn the new Text Box.</param>
        /// <param name="model">The model in which to generate the data from.</param>
        /// </summary>
        public static TextBoxUI Initialize(
            TextBoxUI prefab,
            Vector2 position,
            TextBoxUIFullModel model
            )
        {
            TextBoxUI instance = SpawnManager.SpawnCanvasElement(prefab.gameObject, 4).GetComponentWithError <TextBoxUI>();

            if (model.Text != null)
            {
                instance.Text = model.Text;
            }

            if (model.Speaker != null)
            {
                instance.Speaker = model.Speaker ?? instance.Speaker;
            }

            if (model.Auto != null)
            {
                instance.Auto = model.Auto == true;
            }

            if (model.CrawlTime != null)
            {
                instance.CrawlTime = model.CrawlTime ?? instance.CrawlTime;
            }

            if (model.Tone != null)
            {
                instance.Tone = model.Tone;
            }

            if (model.CloseWhenDone != null)
            {
                instance.CloseWhenDone = model.CloseWhenDone == true;
            }

            if (model.ToneIntervalMax != null)
            {
                instance.ToneIntervalMax = model.ToneIntervalMax.Value;
            }

            if (model.ProceedInputs != null)
            {
                instance.ProceedInputs = model.ProceedInputs;
            }

            return(instance);
        }
示例#2
0
        /// <summary>
        /// Provide new model and execute.
        /// </summary>
        public async Task ExecuteAsync(TextBoxUIFullModel model)
        {
            if (model.Text != null)
            {
                Text = model.Text;
            }

            if (model.Speaker != null)
            {
                Speaker = model.Speaker;
            }

            if (model.Auto != null)
            {
                Auto = model.Auto == true;
            }

            if (model.CrawlTime != null)
            {
                CrawlTime = model.CrawlTime.Value;
            }

            if (model.Tone)
            {
                Tone = model.Tone;
            }

            if (model.CloseWhenDone != null)
            {
                CloseWhenDone = model.CloseWhenDone == true;
            }

            if (model.ToneIntervalMax != null)
            {
                ToneIntervalMax = model.ToneIntervalMax.Value;
            }

            if (model.ProceedInputs != null)
            {
                ProceedInputs = model.ProceedInputs;
            }

            await ExecuteAsync();
        }
示例#3
0
 /// <summary>
 /// An individual Section of a Rranch of a Performance.
 /// <param name="textBoxModel">The model describing the text box to be generated.</param>
 /// <param name="startAction">The awaited task that runs before the text box is generated and displayed.</param>
 /// <param name="endAction">The awaited task that runs after the text box is generated and displayed.</param>
 /// </summary>
 public Section(TextBoxUIFullModel textBoxModel, Func <Task> startAction = null, Func <Task> endAction = null)
 {
     TextBoxUIModel = textBoxModel;
     StartAction    = startAction;
     EndAction      = endAction;
 }