public override void OnEnter() { if (!showAlways && executionCount >= showCount) { Continue(); return; } executionCount++; // Override the active say dialog if needed if (setSayDialog != null) { SayDialog.activeSayDialog = setSayDialog; } SayDialog sayDialog = SayDialog.GetSayDialog(); if (sayDialog == null) { Continue(); return; } sayDialog.SetCharacter(characterID); sayDialog.SetCharacterImage(portrait); sayDialog.Say(storyText, !extendPrevious, waitForClick, fadeWhenDone, voiceOverClip, delegate { sayDialog.Hide(); Continue(); }); }
private IEnumerator Say_Continue(SayDialog sayDialog, string text) { LeftSay.SayDialogAnimatorController.SetBool("IsSelected", false); yield return(sayDialog.Say(text, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, waitForVO, voiceOverClip, character)); Continue(); }
// показать или спрятать портрет в диалоге фунгуса; используем ShowSpeakerFace private void ShowPortrait(Person Pers, SayDialog Okno, bool state) { if (Pers == null || Okno == null) { return; } if (state) { // подготовить диалог, перса и портрет Character currentCharacter = GetChar(Pers); Okno.SetActive(state); Okno.Clear(); // Okno = currentCharacter.SetSayDialog; Okno.SetCharacter(currentCharacter); string title = ""; if (Pers.GetPost() != null) { title = Pers.GetPost().Titul; } Okno.SetCharacterName(Pers.Name + ", " + title, Color.blue); } Sprite currentPortrait = ShowSpeakerFace(Pers, state); Okno.SetCharacterImage(currentPortrait); }
public override void OnEnter() { base.OnEnter(); var sayDialog = SayDialog.GetSayDialog(); SayDialogWithResponse sayDlg = sayDialog as SayDialogWithResponse; Debug.Assert(sayDlg != null); sayDlg.SetResponse(_responseText); }
public override void OnEnter() { setSayDialog = SayDialog.GetSayDialog("RightDialog"); LeftSay = (GridFightSayDialog)SayDialog.GetSayDialog("LeftDialog"); if (!showAlways && executionCount >= showCount) { Continue(); return; } executionCount++; // Override the active say dialog if needed if (character != null && character.SetSayDialog != null) { SayDialog.ActiveSayDialog = character.SetSayDialog; } if (setSayDialog != null) { SayDialog.ActiveSayDialog = setSayDialog; } var sayDialog = SayDialog.GetSayDialog(); if (sayDialog == null) { Continue(); return; } var flowchart = GetFlowchart(); sayDialog.SetActive(true); sayDialog.SetCharacter(character); string displayText = storyText; var activeCustomTags = CustomTag.activeCustomTags; for (int i = 0; i < activeCustomTags.Count; i++) { var ct = activeCustomTags[i]; displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith); if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "") { displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith); } } string subbedText = flowchart.SubstituteVariables(displayText); StartCoroutine(Say_Continue(sayDialog, subbedText)); }
public override bool OnStopExecuting() { SayDialog sayDialog = SayDialog.GetSayDialog(); if (sayDialog != null) { sayDialog.Stop(); } return(true); }
protected virtual void OnWriterStateChange(Writer writer, WriterState writerState) { // Add a new boxful when it's done being typed out. if (writerState == WriterState.End) { var sayDialog = SayDialog.GetSayDialog(); var newEntry = new Entry(sayDialog.StoryText, sayDialog.NameText); AddNewEntry(newEntry); } }
public override void OnEnter() { setSayLeftDialog = (GridFightSayDialog)SayDialog.GetSayDialog("LeftDialog"); setSayRightDialog = (GridFightSayDialog)SayDialog.GetSayDialog("RightDialog"); setSayLeftDialog.SayDialogAnimatorController.SetBool("InOut", false); setSayRightDialog.SayDialogAnimatorController.SetBool("InOut", false); setSayLeftDialog.LastCharacter = null; setSayRightDialog.LastCharacter = null; Continue(); }
public override void OnStopExecuting() { ISayDialog sayDialog = SayDialog.GetSayDialog(); if (sayDialog == null) { return; } sayDialog.Stop(); }
// гавкнуть в сейдайлог, в порядке общей очереди, через корутины private IEnumerator SpeakerSay(Person Pers, SayDialog Okno, string s) { while (SayBlockExecution) { yield return(null); } if (!SayBlockExecution) { ShowPortrait(Pers, SayWindow, true); yield return(StartCoroutine(VOkno(Okno, Pers, s))); } }
public override void OnEnter() { if (!showAlways && executionCount >= showCount) { Continue(); return; } executionCount++; // Override the active say dialog if needed if (character != null && character.SetSayDialog != null) { SayDialog.activeSayDialog = character.SetSayDialog; } if (setSayDialog != null) { SayDialog.activeSayDialog = setSayDialog; } ISayDialog sayDialog = SayDialog.GetSayDialog(); if (sayDialog == null) { Continue(); return; } var flowchart = GetFlowchart(); sayDialog.SetActive(true); sayDialog.SetCharacter(character, flowchart); sayDialog.SetCharacterImage(portrait); string displayText = storyText; foreach (CustomTag ct in CustomTag.activeCustomTags) { displayText = displayText.Replace(ct.TagStartSymbol, ct.ReplaceTagStartWith); if (ct.TagEndSymbol != "" && ct.ReplaceTagEndWith != "") { displayText = displayText.Replace(ct.TagEndSymbol, ct.ReplaceTagEndWith); } } string subbedText = flowchart.SubstituteVariables(displayText); sayDialog.Say(subbedText, !extendPrevious, waitForClick, fadeWhenDone, stopVoiceover, voiceOverClip, delegate { Continue(); }); }
private void Awake() { Instance = this; SayDialog = FindObjectOfType <SayDialog>(); SayDialog.Hide(); AR = FindObjectOfType <LevelAR>(); CameraSetup = FindObjectOfType <LevelCameraSetup>(); AudioSource = GetComponent <AudioSource>(); }
protected ISayDialog GetSayDialog(Character character) { ISayDialog sayDialog = null; if (character != null) { if (character.SetSayDialog != null) { sayDialog = character.SetSayDialog; } } if (sayDialog == null) { sayDialog = SayDialog.GetSayDialog(); } return(sayDialog); }
// куорутина, которая кидает реплику в диалог и сигналит флагом о завершении private IEnumerator VOkno(SayDialog Okno, Person Pers, string s) { exitSayWait = false; SayBlockExecution = true; Okno.Say(s, true, true, true, false, null, () => { exitSayWait = true; }); while (!exitSayWait) { yield return(null); } if (exitSayWait) { ShowPortrait(Pers, SayWindow, false); SayBlockExecution = false; } exitSayWait = false; }
private void Awake() { story = new Story(ink.text); if (sayDialog == null) { sayDialog = FindObjectOfType <SayDialog>(); } if (menuDialog == null) { menuDialog = FindObjectOfType <MenuDialog>(); } if (gatewayFlowchart == null) { gatewayFlowchart = GetComponentInChildren <Flowchart>(); } choiceTime = defaultChoiceTime; flags.Add("hide", new Flag(hideQuestions)); flags.Add("echo", new Flag(echoAnswers)); flags.Add("auto", new Flag(autoProceed)); flags.Add("verbatim", new Flag(ignoreDialogRegex)); flags.Add("timer", new Flag(choiceTimer)); }
public void ReplaceSayDialog(SayDialog sayDialog) { this.sayDialog = sayDialog; }
/****************************************************************** * И Н И Ц И А Л И З А Ц И Я *****************************************************************/ void Start() { BackPanel = GameObject.Find("BackPanel").GetComponent <CanvasGroup>(); Zaglushka = GameObject.Find("Глушак").GetComponent <CanvasGroup>(); OfficePanel = GameObject.Find("OfficePanel").GetComponent <CanvasGroup>(); ListBottomPanel = GameObject.Find("ListNavPanel").GetComponent <CanvasGroup>(); CourtPanel = GameObject.Find("CourtPanel").GetComponent <CanvasGroup>(); ArmyPanel = GameObject.Find("ArmyPanel").GetComponent <CanvasGroup>(); Army2Panel = GameObject.Find("Army2Panel").GetComponent <CanvasGroup>(); TradePanel = GameObject.Find("TradePanel").GetComponent <CanvasGroup>(); CultPanel = GameObject.Find("CultPanel").GetComponent <CanvasGroup>(); Trade2Panel = GameObject.Find("Trade2Panel").GetComponent <CanvasGroup>(); Cult2Panel = GameObject.Find("Cult2Panel").GetComponent <CanvasGroup>(); DvorPanel = GameObject.Find("DvorPanel").GetComponent <CanvasGroup>(); SpyPanel = GameObject.Find("SpyPanel").GetComponent <CanvasGroup>(); Spy2Panel = GameObject.Find("Spy2Panel").GetComponent <CanvasGroup>(); MainPanel = GameObject.Find("MainPanel").GetComponent <CanvasGroup>(); CounsilPanel = GameObject.Find("CounsilPanel").GetComponent <CanvasGroup>(); StratPanel = GameObject.Find("StratPanel").GetComponent <CanvasGroup>(); DiploPanel = GameObject.Find("DiploPanel").GetComponent <CanvasGroup>(); GamePanel = GameObject.Find("GamePanel").GetComponent <CanvasGroup>(); ProjectPanel = GameObject.Find("ProjectPanel").GetComponent <CanvasGroup>(); TaskPanel = GameObject.Find("TaskPanel").GetComponent <CanvasGroup>(); PrivatePanel = GameObject.Find("PrivatePanel").GetComponent <CanvasGroup>(); PopupPanel = GameObject.Find("PopupPanel").GetComponent <CanvasGroup>(); PopInfoPanel = GameObject.Find("PopInfoPanel").GetComponent <CanvasGroup>(); StoryText2 = GameObject.Find("StoryText2").GetComponent <Text>(); OfficeForm = GameObject.Find("OfficeForm").GetComponent <OfficeForm>(); ArmyForm = GameObject.Find("ArmyForm").GetComponent <ArmyForm>(); DvorForm = GameObject.Find("DvorForm").GetComponent <DvorForm>(); TradeForm = GameObject.Find("TradeForm").GetComponent <TradeForm>(); CultForm = GameObject.Find("CultForm").GetComponent <CultForm>(); CourtForm = GameObject.Find("CourtForm").GetComponent <CourtForm>(); CounsilForm = GameObject.Find("CounsilForm").GetComponent <CounsilForm>(); SpyForm = GameObject.Find("SpyForm").GetComponent <SpyForm>(); MainForm = GameObject.Find("MainForm").GetComponent <MainForm>(); StratForm = GameObject.Find("StratForm").GetComponent <StratForm>(); DiploForm = GameObject.Find("DiploForm").GetComponent <DiploForm>(); GameForm = GameObject.Find("GameForm").GetComponent <GameForm>(); ProjectForm = GameObject.Find("ProjectForm").GetComponent <ProjectForm>(); TaskForm = GameObject.Find("TaskForm").GetComponent <TaskForm>(); PrivateForm = GameObject.Find("PrivateForm").GetComponent <PrivateForm>(); Popup = GameObject.Find("Popup").GetComponent <Popup>(); PopInfo = GameObject.Find("PopInfo").GetComponent <PopInfo>(); PersonInfo = GameObject.Find("PersonInfo").GetComponent <PersonInfo>(); MainStory = GameObject.Find("Story").GetComponent <Story>(); Char1 = GameObject.Find("СобеседникМВ").GetComponent <Character>(); Char2 = GameObject.Find("СобеседникМЗ").GetComponent <Character>(); Char3 = GameObject.Find("СобеседникМС").GetComponent <Character>(); Char4 = GameObject.Find("СобеседникЖ").GetComponent <Character>(); Char5 = GameObject.Find("Спецперсона").GetComponent <Character>(); Empty = GameObject.Find("Poleno").GetComponent <Person>(); BigWindow = GameObject.Find("SayDialog2").GetComponent <SayDialog>(); SayWindow = GameObject.Find("SayDialog1").GetComponent <SayDialog>(); SideWindow = GameObject.Find("SayDialog3").GetComponent <SayDialog>(); LongList = GameObject.Find("MenuDialog1").GetComponent <MenuDialog>(); Flow = GameObject.Find("Flowchart").GetComponent <Flowchart>(); // MainView = GameObject.Find ("View").GetComponent<View>(); FormStack = new Stack <FormList>(); ReturnFromPersonToPlaceFlag = FormList.Empty; CourtListPos = 0; exitSayWait = SayBlockExecution = SpeakingCharLeft = SpeakingCharRight = false; CurrentTalk = ""; }
private void Narrate() { if (story.canContinue || loading) { foreach (Flag flag in flags.Values) { flag.Reset(); } if (!loading) { story.Continue(); if (beforeFirstSync) { SyncAllVariablesToFungus(); beforeFirstSync = false; } } string line = story.currentText; Debug.Log("»" + line); ProcessTags(story.currentTags); bool verbatim = flags["verbatim"].Get(); Match dialogLine = null; Sprite portrait = null; if (!verbatim) { dialogLine = compiledDialogRegex.Match(line); if (!dialogLine.Success) { verbatim = true; } } SayDialog sayDialogToUse = sayDialog; if (!verbatim) { line = dialogLine.Groups["text"].Value; string character = dialogLine.Groups["character"].Value; if (characters.ContainsKey(character)) { Character speaker = characters[character]; string portraitName = (dialogLine.Groups["portrait"].Success) ? dialogLine.Groups["portrait"].Value : null; portrait = FindPortrait(speaker, portraitName); SayDialog specificSayDialog = speaker.SetSayDialog; if (speaker.SetSayDialog != null && speaker.SetSayDialog != sayDialog) { sayDialogToUse = speaker.SetSayDialog; } sayDialogToUse.SetCharacter(speaker); } else { sayDialogToUse.SetCharacterName(character, defaultCharacterColor); } } else { sayDialogToUse.SetCharacterName("", defaultCharacterColor); } sayDialogToUse.SetCharacterImage(portrait); Action nextStep; if (pauseTime > 0) { nextStep = Idle; } else { nextStep = Narrate; } narrationHandle++; int originalNarrationHandle = narrationHandle; Action onSayComplete = delegate() { if (IsNarrationAt(originalNarrationHandle)) { nextStep(); } else { Debug.Log("Discarding orphan action associated with expired narration handle " + originalNarrationHandle); } }; bool fadeWhenDone = story.canContinue || flags["hide"].Get(); StartCoroutine(sayDialogToUse.DoSay(line, true, !flags["auto"].Get(), fadeWhenDone, true, true, null, onSayComplete)); AutoSave(); } else { List <Choice> choices = story.currentChoices; if (choices.Count == 0) { Debug.LogWarning("Story reached a stop"); BroadcastToFungus(textStopMessage); } else { menuDialog.SetActive(true); menuDialog.Clear(); if (flags["hide"].Get()) { menuDialog.HideSayDialog(); // probably not needed } foreach (Choice choice in choices) { int choiceIndex = choice.index; string line = choice.text; Debug.Log(choiceIndex + "»" + line); Block callbackBlock = gatewayFlowchart.FindBlock("Choose " + choiceIndex); if (callbackBlock == null) { Debug.LogError("Choice block #" + choice.index + " does not exist in the Gateway Flowchart"); } Match dialogLine = null; if (!flags["verbatim"].Get()) { dialogLine = compiledDialogRegex.Match(line); if (dialogLine.Success) { line = dialogLine.Groups["text"].Value; } } menuDialog.AddOption(line, true, false, callbackBlock); if (choice == choices[0] && flags["timer"].Get()) { menuDialog.ShowTimer(choiceTime, callbackBlock); } } } } }
public void OnClick(GameObject clickedObject) { // if we're not talking to anyone if (currentFlowchart == null || currentPersona == null) { // are we walking? if (IsWalking) { StopWalking(); } return; } // if we currently have a menuDialog active if (transform.FindChild("Dialogues/Player_MenuDialog").gameObject.activeSelf) { return; } // ok, we do NOT have a menuDialog active // if there is no current dialogue if (!currentFlowchart.HasExecutingBlocks()) { // if we're still in collision with a Persona if (currentPersona != null) { // try to force restart that previous dialogue TryToStartFlowchart(currentPersona); } // whatever the case, leave this method return; } List <GameObject> charactersInFlowchart = GetCharactersInFlowchart(currentFlowchart); // if the clicked object isn't even in the current dialog if (!charactersInFlowchart.Contains(clickedObject) && clickedObject != null) { Debug.LogWarning("Character " + GetPath(this.gameObject.transform) + " isn't in flowchart " + currentFlowchart.name); return; } // go through each persona we're potentially talking to foreach (GameObject characterObject in charactersInFlowchart) { // make sure that object isn't us // if (characterObject.name == this.gameObject.name) { // continue; // } // get the path to their SayDialog SayDialog personaSayDialog = characterObject.GetComponentInChildren <SayDialog>(); // if this dialog is actually something if (personaSayDialog != null) { // check to see if that dialog object is active if (personaSayDialog.gameObject.activeSelf) { // ok, push dat button! personaSayDialog.continueButton.onClick.Invoke(); // all done return; } } } }
public void AddC_Say(Block block, string storyText, Character character = null, AudioClip voClip = null, bool showAlways = true, bool fade = true, bool waitClick = true, bool waitForVO = false, bool extendPrev = false, SayDialog setSayDialog = null, string description = "") { if (block == null) { Debug.Log("Tried to add command to empty block: Say"); return; } Say_FungusCommand command = block.gameObject.AddComponent <Say_FungusCommand>(); command.StoryText = storyText; command.Character = character; command.VoiceOverClip = voClip; command.ShowAlways = showAlways; command.FadeWhenDone = fade; command.WaitForClick = waitClick; command.StopVoiceOver = !waitForVO; command.WaitForVO = waitForVO; command.ExtendPrevious = extendPrev; command.SetSayDialog = setSayDialog; command.Descrption = description; block.CommandList.Add(command); }