public void Initialize(Camera camera, int animationId, string message, Action <int> callback) { this.gameObject.name = "PromptDialog"; canvas.worldCamera = camera; this.onClickCallback = callback; GameObject messageBoxBase = this.transform.Find("Canvas/MessageBase").gameObject; messageBoxBase.transform.localPosition = new Vector2(0, -150); Clickable clickable = messageBoxBase.AddComponent <Clickable>(); clickable.Initialize(() => { this.OnClicked(); }); localizedMessage = message; localizedMessage = localizedMessage.Replace("#", "\r\n"); datoControl = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl"); datoControl.Initialize(messageBoxBase.transform, animationId, new Vector2(-230, -150), true); textObj = FontAssets.ComposeTextMeshObject(localizedMessage); Transform textAnchor = this.transform.Find("Canvas/TextAnchor"); textObj.transform.parent = textAnchor; textObj.transform.localPosition = new Vector3(0, 0, 0); textObj.transform.localScale = new Vector3(5, 5, 1); textObj.gameObject.layer = 5; // textObj.fontSize = 20; displayLength = 4; textObj.text = localizedMessage.Substring(0, 4); }
protected GameObject AddText(string textString, Transform subDialog, Vector3 position, Vector3 scale, Action action = null) { GameObject textObj = FontAssets.ComposeTextMeshObject(textString).gameObject; IntialText(textObj, subDialog, position, scale, action); return(textObj); }
protected TextMeshPro RenderText(string content, string anchorName, FontAssets.FontSizeType sizeType) { TextMeshPro textObj = FontAssets.ComposeTextMeshObject(content, sizeType); textObj.transform.parent = this.transform.Find(anchorName); textObj.rectTransform.pivot = new Vector2(0, 1); textObj.transform.localPosition = new Vector3(0, 0, 0); textObj.transform.localScale = new Vector3(5, 5, 1); textObj.gameObject.layer = 5; return(textObj); }
public void Initialize(Camera camera, Vector2 popupPosition, int animationId, string message, Action <int> callback, int forChapterId = 0) { this.gameObject.name = "MessageDialog"; canvas.worldCamera = camera; this.onClickCallback = callback; if (animationId > 500) { dialogPosition = MessageDialogPosition.UP; } messageBoxBase = this.transform.Find("Canvas/MessageBase").gameObject; messageBoxBase.transform.localPosition = GetBasePosition(dialogPosition); Clickable clickable = messageBoxBase.GetComponent <Clickable>(); clickable.Initialize(() => { this.OnClicked(); }); PopUp popUp = messageBoxBase.GetComponent <PopUp>(); popUp.Initialize(popupPosition); localizedMessage = message; localizedMessage = localizedMessage.Replace("#", "\r\n"); datoControl = GameObjectExtension.CreateFromPrefab <DatoControl>("Prefabs/DatoControl"); datoControl.Initialize(messageBoxBase.transform, animationId, GetDatoPosition(dialogPosition), (dialogPosition == MessageDialogPosition.DOWN)); if (forChapterId > 0) { textObj = FontAssets.ComposeTextMeshObjectForChapter(forChapterId, localizedMessage); } else { textObj = FontAssets.ComposeTextMeshObject(localizedMessage); } Transform textAnchor = this.transform.Find("Canvas/MessageBase/TextAnchor"); textAnchor.localPosition = GetTextPosition(dialogPosition); textObj.transform.parent = textAnchor; //textObj.transform.localPosition = new Vector2(190, -50); textObj.transform.localPosition = new Vector3(0, 0, 0); textObj.transform.localScale = new Vector3(5, 5, 1); textObj.gameObject.layer = 5; // textObj.fontSize = 20; displayLength = 1; textObj.text = localizedMessage.Substring(0, 1); }