示例#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
 public PerformanceModel(TextBoxUI textBoxPrefab = null, LinearMenuSelect responseBoxPrefab = null)
 {
     TextBoxPrefab     = textBoxPrefab;
     ResponseBoxPrefab = responseBoxPrefab;
 }