Beispiel #1
0
        public virtual void Initialize(TextboxController tbController)
        {
            textboxController = tbController;

            if (rectTransform == null)
            {
                Debug.LogWarning(this.name + " has a null rect trans!");
            }
        }
        public void Initialize(TextboxController tbController, bool showTextImmediately = true)
        {
            textboxController = tbController;

            InitializeBasicAttributes();
            InitializeSubmodules();
            WrapText(textboxController.textToDisplay);

            SubscribeToEvents();

            if (showTextImmediately)
            {
                DisplayText(textboxController.textToDisplay);
            }
        }
Beispiel #3
0
        void SpawnTextboxOnInput()
        {
            if (Input.GetKey(KeyCode.P) && !textboxIsThere)
            {
                textbox = Textbox.Create(textboxPrefab, 2);
                textbox.transform.SetParent(mainCanvas.transform, false);
                textboxController = textbox.GetComponent <TextboxController>();


                if (useEnum)
                {
                    textboxController.PlaceOnScreen(enumAnchor);
                }
                else
                {
                    textboxController.PlaceOnScreen(anchoredPos);
                }

                textboxController.DisplayText(textToDisplay);

                textboxIsThere = true;
            }
        }
        public static GameObject Create(GameObject prefab,
                                        int linesPerTextbox = 3,
                                        TextSpeed textSpeed = TextSpeed.medium)
        {
            GameObject textbox = MonoBehaviour.Instantiate <GameObject>(prefab);

            textbox.SetActive(true);

            TextboxController textboxController = textbox.GetComponent <TextboxController>();

            // for safety
            if (textboxController == null)
            {
                string errorMessage = "Prefab passed in TST Textbox instantiation has no TST Textbox Controller.";
                throw new ArgumentException(errorMessage);
            }

            textboxController.Initialize(textSpeed, linesPerTextbox);

            textboxesOnScreen++;
            ATextboxSpawned.Invoke(textboxController);
            return(textbox);
        }
Beispiel #5
0
 public void Initialize(TextboxController tbController)
 {
     textboxController = tbController;
 }