public CrossVisual(InteractionCanvas parent) : base(parent) { X.IsHitTestVisible = false; Y.IsHitTestVisible = false; parent.AddElement(X); parent.AddElement(Y); }
public RectInteractionGroup(InteractionCanvas interaction, int col = 1, int row = 1, params DrawingGrid[] canvas) { InteractionVisuals = new List <InteractionCanvas>(); Containers = canvas.ToList(); ContainersUsed = new List <DrawingGrid>(Containers); ContainersUnused = new List <DrawingGrid>(); Containers.ForEach(it => ContainerGrid.Children.Add(it)); GlobalInteraction = interaction; if (interaction != null) { SetColumn(interaction, 0); SetRow(interaction, 0); SetColumnSpan(interaction, col); SetRowSpan(interaction, row); SizeChanged += RectInteractionGroup_SizeChanged; } else { SizeChanged += RectInteractionGroup_SizeChanged2; } Resize(col, row); Canvas = canvas.ToDictionary(it => it.DrawingCanvas.Id, it => it.DrawingCanvas); Children.Add(ContainerGrid); EnableInteraction = true; }
// Start is called before the first frame update void Start() { //get canvas with the script interactionCanvas canvas = FindObjectOfType <InteractionCanvas>(); //get this object's text mesh pro component tmpro = GetComponent <TextMeshProUGUI>(); //load text file from the resources folder. Has to be from the resources folder txt = Resources.Load("TextFiles/" + owner.GetFileName()) as TextAsset; //get all sentences by splitting the text wherever a period is found //this will end up with one empty sentences at the end will have to deal with that sentences = txt.text.Split('\n'); //WE WILL HAVE TO BE CAREFUL WITH ABREVIATIONS OR FIND A WAY TO DEAL WITH THEM //start index at second position because we will show the first one on instantiation currIndex = 1; //on creation show first sentence StartCoroutine(ShowText(sentences[0])); }
/// <summary> /// In the start method we fetch our cached instances from the scene. /// We initialize our sentences array and we display the first sentence in the dialogue. /// </summary> void Start() { //get canvas with the script interactionCanvas canvas = FindObjectOfType <InteractionCanvas>(); //get this object's text mesh pro component tmpro = GetComponent <TextMeshProUGUI>(); //load text file from the resources folder. Has to be from the resources folder. //txt = Resources.Load("TextFiles/" + owner.GetFileName()) as TextAsset; unsused for now //Loading the dialogue manager associated to our owner. Because we only have a reference to the owner's prefab, it will search for the file with the name that is stated in the prefab, not the instance d = Resources.Load("TextFiles/" + owner.GetFileName()) as DialogueText; //get all sentences in our dialogueText object sentences = d.sentences;//txt.text.Split('\n'); <---Previous way to do it //start index at second position because we will show the first one on instantiation currIndex = 1; //on creation show first sentence StartCoroutine(ShowText(sentences[0])); }
//function to show dialogue box void showDialogue(InteractionCanvas intCanvas) { intCanvas.ShowBox(); }
void Start() { canvas = FindObjectOfType <InteractionCanvas>(); }