| | 1 | | using DCL.Components; |
| | 2 | | using DCL.Controllers; |
| | 3 | | using DCL.Helpers; |
| | 4 | | using System.Collections; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | namespace DCL |
| | 8 | | { |
| | 9 | | public class InputTextTestsController : MonoBehaviour |
| | 10 | | { |
| | 11 | | protected ISceneController sceneController; |
| | 12 | | protected ParcelScene scene; |
| | 13 | |
|
| | 14 | | protected IEnumerator InitScene(bool spawnCharController = true) |
| | 15 | | { |
| 0 | 16 | | sceneController = Environment.i.world.sceneController; |
| | 17 | |
|
| 0 | 18 | | yield return new WaitForSeconds(0.01f); |
| | 19 | |
|
| 0 | 20 | | scene = sceneController.CreateTestScene() as ParcelScene; |
| | 21 | |
|
| 0 | 22 | | yield return new WaitForSeconds(0.01f); |
| | 23 | |
|
| 0 | 24 | | if (spawnCharController) |
| | 25 | | { |
| 0 | 26 | | if (DCLCharacterController.i == null) |
| | 27 | | { |
| 0 | 28 | | GameObject.Instantiate(Resources.Load("Prefabs/CharacterController")); |
| | 29 | | } |
| | 30 | | } |
| 0 | 31 | | } |
| | 32 | |
|
| | 33 | | public IEnumerator Start() |
| | 34 | | { |
| 0 | 35 | | yield return InitScene(spawnCharController: false); |
| | 36 | |
|
| 0 | 37 | | DCLCharacterController.i.gravity = 0; |
| | 38 | |
|
| 0 | 39 | | UIScreenSpace ssshape = TestHelpers.SharedComponentCreate<UIScreenSpace, UIScreenSpace.Model>( |
| | 40 | | scene, |
| | 41 | | DCL.Models.CLASS_ID.UI_SCREEN_SPACE_SHAPE); |
| | 42 | |
|
| 0 | 43 | | yield return ssshape.routine; |
| | 44 | |
|
| 0 | 45 | | UIInputText text = TestHelpers.SharedComponentCreate<UIInputText, UIInputText.Model>( |
| | 46 | | scene, |
| | 47 | | Models.CLASS_ID.UI_INPUT_TEXT_SHAPE, |
| | 48 | | new UIInputText.Model() |
| | 49 | | { |
| | 50 | | textModel = new DCL.Components.TextShape.Model() |
| | 51 | | { |
| | 52 | | color = Color.white, |
| | 53 | | opacity = 1, |
| | 54 | | }, |
| | 55 | |
|
| | 56 | | placeholder = "Chat here!", |
| | 57 | | placeholderColor = Color.grey, |
| | 58 | | focusedBackground = Color.black, |
| | 59 | | parentComponent = ssshape.id, |
| | 60 | | positionX = new UIValue(200, UIValue.Unit.PIXELS), |
| | 61 | | positionY = new UIValue(200, UIValue.Unit.PIXELS), |
| | 62 | | height = new UIValue(200, UIValue.Unit.PIXELS), |
| | 63 | | width = new UIValue(200, UIValue.Unit.PIXELS), |
| | 64 | | hAlign = "left", |
| | 65 | | vAlign = "top", |
| | 66 | | }); |
| | 67 | |
|
| 0 | 68 | | yield return text.routine; |
| 0 | 69 | | } |
| | 70 | | } |
| | 71 | | } |