protected override void OnSpawnedPanel(Entity character, Entity panelUI, object spawnData) { var dialogueTree = Bootstrap.instance.data.dialogues[0].dialogueTree; //int startingDialogueID = dialogueTree.id; //DialogueDatam dialogueTree = meta[startingDialogueID]; var branch = dialogueTree.branches[0]; float fontSize = 0.03f; RenderText renderText = new RenderText { fontSize = fontSize, offsetX = ((-branch.speech.Length - 1f) / 2f) * fontSize }; renderText.SetColor(Color.blue); DialogueUI dialogueUI = new DialogueUI { treeID = dialogueTree.id, timePerLetterMin = 0.07f, timePerLetterMax = 0.21f }; dialogueUI.RandomizeCooldown(); dialogueUI.SetText(branch.speech, ref renderText); //UnityEngine.Debug.LogError("Testing dialogue - self talking: " + dialogueTree.data[0].speech); World.EntityManager.AddComponentData(panelUI, dialogueUI); World.EntityManager.AddComponentData(panelUI, renderText); byte uiIndex = ((byte)((int)PlayerUIType.DialogueUI)); World.EntityManager.SetComponentData(panelUI, new PanelUI { id = uiIndex, characterID = World.EntityManager.GetComponentData <ZoxID>(character).id, size = new float2((branch.speech.Length) * (fontSize * 1.1f), fontSize), dirty = 1, orbitDepth = uiDatam.orbitDepth, anchor = (byte)UIAnchoredPosition.Middle }); Childrens children = new Childrens { }; World.EntityManager.AddComponentData(panelUI, children); }
private void IncrementLetters(ref DialogueUI dialogue, ref RenderText renderText) { dialogue.RandomizeCooldown(); dialogue.IncreaseIndex(ref renderText); //RefreshPanelSize(e, newText); }