public void StartBubbleCascadeFromDialogue(Dialogue dialogue) { if (dialogue == null) { Debug.LogError("WTF null dialogue"); return; } CurrentFadeTime = FadeTime; CurrentDialogueFragment = DialogueManager.instance.GetStartFragmentForDialogue(dialogue); if (SpeechBubbleSpeaker != null) { Destroy(SpeechBubbleSpeaker.gameObject); } Shop.instance.SetPriceText(0); Shop.instance.SetNameText(""); MakeSpeakerBubble(); bIsBubbleSpeechActive = true; AudioManager.instance.UpdateMusicVolume(); Debug.Log("Bubble Dialogue"); }
public DialogueFragment GetStartFragmentForDialogue(Dialogue dialogue) { Condition condition = dialogue.InputPins[0].Connections[0].Target as Condition; Jump jump = dialogue.InputPins[0].Connections[0].Target as Jump; DialogueFragment dialogueFragment = dialogue.InputPins[0].Connections[0].Target as DialogueFragment; while (condition != null) { bool conditionResult = condition.Evaluate(); if (conditionResult) { condition.OutputPins[0].Evaluate(); dialogueFragment = condition.OutputPins[0].Connections[0].Target as DialogueFragment; jump = condition.OutputPins[0].Connections[0].Target as Jump; condition = condition.OutputPins[0].Connections[0].Target as Condition; } else { condition.OutputPins[1].Evaluate(); dialogueFragment = condition.OutputPins[1].Connections[0].Target as DialogueFragment; jump = condition.OutputPins[1].Connections[0].Target as Jump; condition = condition.OutputPins[1].Connections[0].Target as Condition; } if (jump != null) { condition = jump.Target as Condition; dialogueFragment = jump.Target as DialogueFragment; } } dialogueFragment.OutputPins[0].Evaluate(); return(dialogueFragment); }
public void SetChoice(int index, DialogueFragment choiceFragment) { AssignedChoiceFragment = choiceFragment; string text = /*(index + 1) + ". " + */ choiceFragment.Text; text = text.Replace("[SPAWN_COUNTER]", SaveManager.instance.GetCurrentPlayerState().GetSpawnCounter().ToString()); TextChoice.text = text; }
// Use this for initialization void Start() { if (myRef.HasReference) { var obj = myRef.GetObject(); //Debug.Log (obj); DialogueFragment test = ArticyDatabase.GetObject <DialogueFragment> (obj.TechnicalName); //Debug.Log (test); //On peut recuperer les proprietes du DialogueFragment avec nomdufragment.propriete //Debug.Log(test.Text); //Debug.Log (test.Speaker); toPrint = test.Text; speaker = test.Speaker; Debug.Log(speaker); //Debug.Log (toPrint); //Debug.Log (speaker); //Debug.Log (test.Children); //Debug.Log (test.OutputPins); test.GetInputPins(); test.GetOutputPins(); //print (test.InputPins); //print (test.OutputPins); //print(test.Children); /* * * for (int i = 0; i < test.InputPins.Count; i++) { * print(test.InputPins[i]); * print (test.InputPins [i].Id); * print (test.InputPins [i].Text); * } * * for (int j = 0; j < test.OutputPins.Count; j++) { * print (test.OutputPins [j]); * print (test.OutputPins [j].Id); * print (test.OutputPins [j].Text); * } * * for (int k = 0; k < test.Children.Count; k++) { * print (test.Children [k]); * } */ } }
public void StartDialogue(Dialogue dialogue, bool startOnDayEnd) { Cursor.visible = true; CurrentDialogue = dialogue; DialogueFragment startFragment = GetStartFragmentForDialogue(dialogue); CurrentDialogueFragment = startFragment; AudioManager.instance.UpdateMusicVolume(); DialogueScreen.instance.UpdateFromDialogueFragment(CurrentDialogueFragment); bStartDayOnEnd = startOnDayEnd; }
public void StartSingleBubble(DialogueFragment frag) { CurrentFadeTime = FadeTime; CurrentDialogueFragment = frag; if (SpeechBubbleSpeaker != null) { Destroy(SpeechBubbleSpeaker.gameObject); } Shop.instance.SetPriceText(0); Shop.instance.SetNameText(""); MakeSpeakerBubble(); bIsBubbleSpeechActive = true; AudioManager.instance.UpdateMusicVolume(); Debug.Log("Bubble Dialogue"); }
public void ShowBubble(DialogueFragment fragment) { CurrentFragment = fragment; ToggleBubbleVisibility(true); TextSpeechBubble.text = CurrentFragment.Text; if (CurrentFragment.Speaker == DialogueManager.instance.YouEntity) { TextSpeechBubble.color = SpeechBubbleManager.instance.ColorYou; } else if (CurrentFragment.Speaker == DialogueManager.instance.ConscienceEntity) { TextSpeechBubble.color = SpeechBubbleManager.instance.ColorConscience; //GameManager.instance.PaletteBlueRegular; } else if (CurrentFragment.Speaker == DialogueManager.instance.ShopkeeperEntity) { TextSpeechBubble.color = SpeechBubbleManager.instance.ColorShopkeeper; //GameManager.instance.PaletteBlueRegular; } }
public void OnBubbleClicked() { if (this == SpeechBubbleManager.instance.GetSpeakerBubble()) { SpeechBubbleManager.instance.SkipBubble(); } else { SpeechBubbleManager.instance.ContinueBubbleCascadeFromElement(DialogueManager.instance.GetNextDialogueElementFromFragment(CurrentFragment)); } if (bMakeCloudPoof) { CloudParticleEngine particle = Instantiate(SpeechBubbleManager.instance.CloudParticleTemplate); particle.InitCloudPoof(); particle.gameObject.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition); } CurrentFragment = null; }
public void ProceedDialogue(DialogueFragment choiceFragment = null) { CurrentDialogueFragment.OutputPins[0].Evaluate(); if (choiceFragment == null) { } else { CurrentDialogueFragment = choiceFragment; CurrentDialogueFragment.OutputPins[0].Evaluate(); } ArticyObject element = GetNextDialogueElementFromFragment(CurrentDialogueFragment); if (SaveManager.instance.GetCurrentPlayerState().GetCurrentDayNumberNotIndexThisHasOneAddedToIt() == 22) { IntroController.instance.CheckCustomNameBooleans(); } DialogueFragment fragment = element as DialogueFragment; Hub hub = element as Hub; if (fragment != null) { CurrentDialogueFragment = fragment; DialogueScreen.instance.UpdateFromDialogueFragment(CurrentDialogueFragment); } else if (hub != null) { DialogueScreen.instance.UpdateFromHub(CurrentDialogueFragment); } else { EndDialogueInstantly(); } }
public void ShowChoiceButtons(DialogueFragment hubFragment) { HideChoiceButtons(); if (hubFragment.OutputPins[0].Connections.Count <= 0) { Debug.LogError("Hub has no choices!"); } List <SortingHelper> sorts = new List <SortingHelper>(); for (int i = 0; i < hubFragment.OutputPins[0].Connections.Count; ++i) { DialogueFragment frag = hubFragment.OutputPins[0].Connections[i].Target as DialogueFragment; IObjectWithPosition positionObject = hubFragment.OutputPins[0].Connections[i].Target as IObjectWithPosition; SortingHelper sort = new SortingHelper(); sort.Fragment = frag; sort.PositionY = positionObject.Position.y; sorts.Add(sort); } sorts = sorts.OrderBy(f => f.PositionY).ToList(); for (int i = 0; i < sorts.Count; ++i) { if (sorts[i].Fragment.InputPins[0].Evaluate()) { DialogueChoiceButton choiceButton = Instantiate(ButtonChoiceTemplate); choiceButton.gameObject.SetActive(true); choiceButton.gameObject.transform.SetParent(PanelChoice, false); choiceButton.SetChoice(i, sorts[i].Fragment); ButtonChoiceList.Add(choiceButton); } } }
protected void OnDialogue(DialogueFragment dialogueFragment) { lastData = new DialogueData(); var speaker = dialogueFragment.Speaker; if (speaker is IObjectWithFeatureCharacterPreviewImage characterImage) { var feature = characterImage.GetFeatureCharacterPreviewImage(); switch (ArticyGlobalVariables.Default.Session.AvatarIndex) { case 1: lastData.sprite = (feature.Image1 as Asset).LoadAssetAsSprite(); break; case 2: lastData.sprite = (feature.Image2 as Asset).LoadAssetAsSprite(); break; case 3: lastData.sprite = (feature.Image3 as Asset).LoadAssetAsSprite(); break; case 4: lastData.sprite = (feature.Image4 as Asset).LoadAssetAsSprite(); break; case 5: lastData.sprite = (feature.Image5 as Asset).LoadAssetAsSprite(); break; case 6: lastData.sprite = (feature.Image6 as Asset).LoadAssetAsSprite(); break; default: lastData.sprite = (feature.Image7 as Asset).LoadAssetAsSprite(); break; } } else if (speaker is IObjectWithPreviewImage speakerImage) { var asset = speakerImage.PreviewImage.Asset; if (asset != null) { lastData.sprite = asset.LoadAssetAsSprite(); } } if (speaker is IObjectWithDisplayName speakerName) { lastData.name = speakerName.DisplayName; } if (dialogueFragment is IObjectWithFeatureImageDescription imageDescription) { var articyObject = imageDescription.GetFeatureImageDescription().Image; //Debug.Log( $"Type: {articyObject.GetType()} {articyObject.GetArticyType()}" ); lastData.descriptionSprite = (articyObject as Asset).LoadAssetAsSprite(); } if (dialogueFragment is IObjectWithFeatureAudioSource audio) { lastData.clip = (audio.GetFeatureAudioSource()?.AudioClip as Asset)?.LoadAsset <AudioClip>(); } else if (dialogueFragment is IObjectWithFeatureDoubleAudioSource playerAudio) { var doubleAudioSource = playerAudio.GetFeatureDoubleAudioSource(); try { lastData.clip = ((_settings.data.PlayerSex == Gender.Female ? doubleAudioSource.FemaleClip : doubleAudioSource.MaleClip) as Asset).LoadAsset <AudioClip>(); } catch { Debug.Log("Null reference dialogue"); } } lastData.text = dialogueFragment.Text; }
public ArticyObject GetNextDialogueElementFromFragment(DialogueFragment currentFragment) { if (currentFragment.OutputPins[0].Connections.Count == 0) { return(null); } DialogueFragment fragment = currentFragment.OutputPins[0].Connections[0].Target as DialogueFragment; Hub hub = currentFragment.OutputPins[0].Connections[0].Target as Hub; Condition condition = currentFragment.OutputPins[0].Connections[0].Target as Condition; Jump jump = currentFragment.OutputPins[0].Connections[0].Target as Jump; while (condition != null) { bool conditionResult = condition.Evaluate(); if (conditionResult) { condition.OutputPins[0].Evaluate(); fragment = condition.OutputPins[0].Connections[0].Target as DialogueFragment; hub = condition.OutputPins[0].Connections[0].Target as Hub; jump = condition.OutputPins[0].Connections[0].Target as Jump; condition = condition.OutputPins[0].Connections[0].Target as Condition; if (jump != null) { condition = jump.Target as Condition; } } else { condition.OutputPins[1].Evaluate(); fragment = condition.OutputPins[1].Connections[0].Target as DialogueFragment; hub = condition.OutputPins[1].Connections[0].Target as Hub; jump = condition.OutputPins[1].Connections[0].Target as Jump; condition = condition.OutputPins[1].Connections[0].Target as Condition; if (jump != null) { condition = jump.Target as Condition; } } } if (jump != null) { fragment = jump.Target as DialogueFragment; hub = jump.Target as Hub; } if (fragment != null) { fragment.OutputPins[0].Evaluate(); return(fragment); } if (hub != null) { hub.OutputPins[0].Evaluate(); return(hub); } return(null); }
public void ProceedCurrentDialogue(DialogueFragment choice = null) { ProceedDialogue(choice); }
public void ContinueBubbleCascadeFromElement(ArticyObject element) { CurrentFadeTime = FadeTime; //clicked on speaker bubble //if (element == null) //{ // element = DialogueManager.instance.GetNextDialogueElementFromFragment(CurrentDialogueFragment); //} // end if (element == null) { HideAllBubbles(); bIsBubbleSpeechActive = false; return; } DialogueFragment fragment = element as DialogueFragment; Hub hub = element as Hub; bIsBubbleSpeechActive = true; HideAllBubbles(); //for (int i = 0; i < SpeechBubbleOptions.Count; ++i) //{ // SpeechBubbleOptions[i].HideBubble(); //} if (fragment != null) { CurrentDialogueFragment.OutputPins[0].Evaluate(); //CurrentDialogueFragment. CurrentDialogueFragment = fragment; //if (SpeechBubbleSpeaker != null) //{ // Destroy(SpeechBubbleSpeaker.gameObject); //} MakeSpeakerBubble(); CurrentHub = null; } else if (hub != null) { CurrentHub = hub; MakeSpeakerBubble(false); hub.OutputPins[0].Evaluate(); for (int i = 0; i < hub.OutputPins[0].Connections.Count; ++i) { //if(hub.OutputPins[0].Connections[i].) DialogueFragment frag = hub.OutputPins[0].Connections[i].Target as DialogueFragment; if (frag.InputPins[0].Evaluate()) { SpeechBubble newBubble = Instantiate(GetSpeechBubbleForString(frag.Text)); newBubble.ShowBubble(frag); newBubble.gameObject.transform.SetParent(SpeechBubbleMarkers[i].gameObject.transform); newBubble.gameObject.transform.localPosition = new Vector3(); newBubble.gameObject.transform.localScale = new Vector3(1, 1, 1); newBubble.InitOrbit(); SpawnedBubbles.Add(newBubble); //SpeechBubbleOptions[i].ShowBubble(frag); } } } else { Debug.LogError("Fail ott pls fix speechbubblemanager"); SpeechBubbleSpeaker.HideBubble(); } }
public override void InitManager() { base.InitManager(); instance = this; if (MirrorReference.HasReference) { MirrorTemplate = MirrorReference.GetObject <template_item>(); } if (EraserReference.HasReference) { EraserTemplate = EraserReference.GetObject <template_item>(); } if (ShopKeeperAltGreetReference.HasReference) { List <SortingHelper> sorts = new List <SortingHelper>(); Dialogue altGreetDialogue = ShopKeeperAltGreetReference.GetObject <Dialogue>(); for (int i = 0; i < altGreetDialogue.Children.Count; ++i) { DialogueFragment frag = altGreetDialogue.Children[i] as DialogueFragment; if (frag != null) { IObjectWithPosition positionObject = frag as IObjectWithPosition; SortingHelper sort = new SortingHelper(); sort.Fragment = frag; sort.PositionY = positionObject.Position.y; sorts.Add(sort); } } sorts.OrderBy(f => f.PositionY); for (int i = 0; i < sorts.Count; ++i) { AltGreetFragments.Add(sorts[i].Fragment); } } for (int i = 0; i < 3; ++i) { ItemDictionary.Add(i, new List <template_item>()); } if (StarterBodyReference.HasReference) { StarterBody = StarterBodyReference.GetObject <template_item>(); } if (StarterHeadReference.HasReference) { StarterHead = StarterHeadReference.GetObject <template_item>(); } if (ItemFolderReference.HasReference) { UserFolder itemFolder = ItemFolderReference.GetObject <UserFolder>(); if (itemFolder != null) { for (int i = 0; i < itemFolder.Children.Count; ++i) { UserFolder childFolder = itemFolder.Children[i] as UserFolder; for (int j = 0; j < childFolder.Children.Count; ++j) { template_item item = childFolder.Children[j] as template_item; UserFolder childSubfolder = childFolder.Children[j] as UserFolder; if (childSubfolder != null) { for (int y = 0; y < childSubfolder.Children.Count; ++y) { template_item subfolderItem = childSubfolder.Children[y] as template_item; if (subfolderItem != null) { ReadItemData(subfolderItem); } } } if (item != null) { ReadItemData(item); } } } } Debug.Log("Found " + ItemDictionary[0].Count + " Slot 0 items"); Debug.Log("Found " + ItemDictionary[1].Count + " Slot 1 items"); Debug.Log("Found " + ItemDictionary[2].Count + " Slot 2 items"); Debug.Log("Found " + HeadList.Count + " heads"); Debug.Log("Found " + BodyList.Count + " bodies"); } }
public void UpdateFromHub(DialogueFragment fragment, bool isFirstNode = false) { StartCoroutine(UpdateDialogueRoutine(0.5f, fragment, isFirstNode)); }
IEnumerator UpdateDialogueRoutine(float duration, DialogueFragment fragment, bool isFirstNode = false) { if (isFirstNode) { TextCurrent.color = new Color(TextCurrent.color.r, TextCurrent.color.g, TextCurrent.color.b, 0.0f); for (int i = 0; i < ButtonChoiceList.Count; ++i) { ButtonChoiceList[i].TextChoice.color = new Color(ButtonChoiceList[i].TextChoice.color.r, ButtonChoiceList[i].TextChoice.color.g, ButtonChoiceList[i].TextChoice.color.b, 0.0f); } ButtonContinue.TextContinue.color = new Color(ButtonContinue.TextContinue.color.r, ButtonContinue.TextContinue.color.g, ButtonContinue.TextContinue.color.b, 0.0f); } else { yield return(FadeOutRoutine(duration)); } string text = ""; bool saySpawnCounter = false; if (fragment.OutputPins[0].Connections.Count == 1) { Jump jump = fragment.OutputPins[0].Connections[0].Target as Jump; Hub hub = fragment.OutputPins[0].Connections[0].Target as Hub; if (jump != null) { //if(jump.Target as DialogueFragment != null) //{ // fragment = jump.Target as DialogueFragment; //} hub = jump.Target as Hub; } text = fragment.Text; if (text.Contains("[SPAWN_COUNTER]")) { text = text.Replace("[SPAWN_COUNTER]", SaveManager.instance.GetCurrentPlayerState().GetSpawnCounter().ToString()); saySpawnCounter = true; } TextCurrent.text = text; if (fragment.Speaker == DialogueManager.instance.FateEntity) { TextCurrent.color = ColorFate; } else if (fragment.Speaker == DialogueManager.instance.FatePhoneEntity) { TextCurrent.color = ColorFate; TextCurrent.text = "<i>" + TextCurrent.text + "</i>"; } else if (fragment.Speaker == DialogueManager.instance.ConscienceEntity) { TextCurrent.color = ColorConscience; } else if (fragment.Speaker == DialogueManager.instance.CatEntity || fragment.Speaker == DialogueManager.instance.CatToyEntity) { TextCurrent.color = ColorCat; } Condition condition = fragment.OutputPins[0].Connections[0].Target as Condition; while (condition != null) { bool conditionResult = condition.Evaluate(); if (conditionResult) { DialogueFragment conditionFragment = condition.OutputPins[0].Connections[0].Target as DialogueFragment; hub = condition.OutputPins[0].Connections[0].Target as Hub; condition = condition.OutputPins[0].Connections[0].Target as Condition; } else { DialogueFragment conditionFragment = condition.OutputPins[1].Connections[0].Target as DialogueFragment; hub = condition.OutputPins[1].Connections[0].Target as Hub; condition = condition.OutputPins[1].Connections[0].Target as Condition; } } if (hub != null) { hub.OutputPins[0].Evaluate(); ShowChoiceButtons(hub); HideContinueButton(); } else { ShowContinueButton(); HideChoiceButtons(); } } else { text = fragment.Text; if (text.Contains("[SPAWN_COUNTER]")) { text = text.Replace("[SPAWN_COUNTER]", SaveManager.instance.GetCurrentPlayerState().GetSpawnCounter().ToString()); saySpawnCounter = true; } TextCurrent.text = text; if (fragment.Speaker == DialogueManager.instance.FateEntity) { TextCurrent.color = ColorFate; } else if (fragment.Speaker == DialogueManager.instance.FatePhoneEntity) { TextCurrent.color = ColorFate; TextCurrent.text = "<i>" + TextCurrent.text + "</i>"; } else if (fragment.Speaker == DialogueManager.instance.ConscienceEntity) { TextCurrent.color = ColorConscience; } else if (fragment.Speaker == DialogueManager.instance.CatEntity || fragment.Speaker == DialogueManager.instance.CatToyEntity) { TextCurrent.color = ColorCat; } ShowChoiceButtons(fragment); HideContinueButton(); } if (fragment.StageDirections != "") { AudioClip clippy = AudioManager.instance.PlayVoiceClip(fragment.StageDirections, fragment.Speaker as Entity); if (saySpawnCounter) { AudioManager.instance.SaySpawnCounter(clippy.length); } } yield return(FadeInRoutine(duration)); }