protected void ShowDialogueFragment(Dialogue_Fragment dialogueFrag, List <Branch> dialogueOptions) { StaticStuff.FlowDebug("going to set up a dialogue fragment with speaker: " + dialogueFrag.Speaker + " with text: " + dialogueFrag.Text); StaticStuff.FlowDebug("this dialogue fragment has: " + dialogueOptions.Count + " options"); DialogueUI.gameObject.SetActive(true); SetSpeakerImage(dialogueFrag.Speaker); SpeakerText.text = dialogueFrag.Text; foreach (GameObject go in DialogueOptions) { go.SetActive(false); } for (int i = 0; i < dialogueOptions.Count; i++) { DialogueOptions[i].SetActive(true); Dialogue_Fragment df = dialogueOptions[i].Target as Dialogue_Fragment; if (df != null) { DialogueOptions[i].GetComponentInChildren <Text>().text = df.MenuText; } else { string buttonText = dialogueFrag.Template.Dialogue_Fragment_Default_Button_Text.Default_Button_Text; StaticStuff.FlowDebug("ok we are not going to a dialogue fragment, so get the button text by the template: " + buttonText); if (buttonText.Equals("") == false) { DialogueOptions[i].GetComponentInChildren <Text>().text = buttonText; } else { string val = ArticyDatabase.DefaultGlobalVariables.GetVariableByString <string>("Misc_Globals.defaultDialogueFragmentButtonText"); DialogueOptions[i].GetComponentInChildren <Text>().text = val; } } } PlayerObject.ToggleMovementBlocked(true); }
// iFlowObject vs Branch // Branch.Target is an iFlowObjects protected override void DoOnBranchesUpdated(IList <Branch> aBranches) { //Debug.Log("**********DoOnBranchesUpdated()"); //Debug.Log("Num branches: " + aBranches.Count); StaticStuff.FlowDebug("**********DoOnBranchesUpdated()"); StaticStuff.FlowDebug("Num branches: " + aBranches.Count); List <Branch> validBranches = new List <Branch>(); CurBranches.Clear(); string s = ""; foreach (Branch b in aBranches) { base.PrintBranchInfo(b, "branch loop"); Dialogue_Fragment d = b.Target as Dialogue_Fragment; if (d != null) { s += "Branch " + b.BranchId + ": "; s += d.InputPins[0].Text.RawScript + "\n"; } //if (s != "") DebugText.text = s; CurBranches.Add(b); if (b.IsValid == true) { validBranches.Add(b); } } if (aBranches.Count == 1 && aBranches[0].IsValid && aBranches[0].Target.GetType().Equals(typeof(Hub))) { StaticStuff.FlowDebug("only one valid branch and it's a hub called: " + aBranches[0].DefaultDescription + " so Play() it"); NextBranch = aBranches[0]; base.PrintBranchInfo(NextBranch, "move to hub"); //inventorySystem.RemoveItem(heldItem); //inventorySystem.RemoveItem(thisRepresentedItem); } else { if (validBranches.Count == 1 && CurPauseObject.GetType().Equals(typeof(Hub))) { s = "1 valid branch on a hub pause object...check what it is: "; s += base.ReturnBranchInfo(validBranches[0], "checking 1 branch on hub"); StaticStuff.FlowDebug(s); if (validBranches[0].Target.GetType().Equals(typeof(OutputPin))) { StaticStuff.FlowDebug("only valid output is an OutputPin...which means that we're not linked to any other flow fragments so just sit tight and wait for something" + "like the player colliding with an NPC or something else to trigger the next StartOn"); } else { StaticStuff.FlowDebug("only valid output is something else that an OutputPin...so ROCK IT via Play(NextBranch)"); NextBranch = validBranches[0]; } } else { StaticStuff.FlowDebug("--------------------------NOT in a situation where we have 1 valid Hub branch, so find out what to do."); if (CurPauseObject.GetType().Equals(typeof(Dialogue_Fragment))) { StaticStuff.FlowDebug("We're on a dialogue fragment, so set up the dialogue via the CaptainsChairSceneRoot"); base.ShowDialogueFragment(CurPauseObject as Dialogue_Fragment, validBranches); } else { StaticStuff.FlowDebug("on something other than a dialogue fragment, so find out what to do"); if (validBranches.Count == 1 && CurPauseObject.GetType().Equals(typeof(Jump)) && validBranches[0].Target.GetType().Equals(typeof(MiniGameFragment))) { StaticStuff.FlowDebug("we have 1 valid branch that's a Jump to a MiniGame so go to that mini game"); base.GoToMiniGame(validBranches[0]); } else { StaticStuff.FlowDebugWarning("not a 1 valid brach that's a Jump to a MiniGame so figure out what to do"); } } } } StaticStuff.FlowDebug("************************************************************DoOnBranchesUpdated() END"); }