private void MarkAllDialog_ItemSelected(object sender, DialogChoice e) { if (e.DisplayText == Config.Global.UI.Strings.PromptAnswerYes as string) { selectedFeed?.MarkAllRead(); } _mainView?.Refresh(); }
public void AddChoice(string text, UnityEngine.Events.UnityAction click) { DialogChoice c = Instantiate(choiceObject); c.transform.SetParent(choiceHolder); c.SetText(text, choiceGrandParent); c.transform.localScale = Vector3.one; c.SetOnClick(click); }
public override void Close(DialogChoice choice) { base.Close(choice); if (choice == DialogChoice.Yes) { OnYes.Invoke(); } else if (choice == DialogChoice.No) { OnNo.Invoke(); } }
public virtual void defaultOnChoice(DialogChoice c) { logger.LogFormat(LogType.Log, "{0} ({1}) got choice {2} target {3}", LogTag, path, c.name, c.target); if (!c.HasTarget) { this.OnSkipped(SkipSource.User); } else { parent.TransitionToState(c.target); } }
public void OnNewGameDialogClose(DialogChoice choice) { if (choice == DialogChoice.Yes) { DisableInput = true; GameManager.Instance.StartNewGame(Names[Picker.SelectedObject]); } Picker.DisableInput = false; NewGameDialog.OnClose.RemoveListener(OnNewGameDialogClose); Input.ResetInputAxes(); }
public void DismissDialog(DialogChoice dialogChoice) { switch (dialogChoice) { case DialogChoice.LOADING: loadingDialog.Dismiss(); break; case DialogChoice.INPUT_TEXT: inputDialog.Dismiss(); break; } }
public bool GetDialogState(DialogChoice dialogChoice) { switch (dialogChoice) { case DialogChoice.LOADING: return(loadingDialog.IsShowing); case DialogChoice.INPUT_TEXT: return(inputDialog.IsShowing); } return(false); }
public void ShowDialog(DialogChoice dialogChoice) { switch (dialogChoice) { case DialogChoice.LOADING: loadingDialog.Show(); break; case DialogChoice.INPUT_TEXT: inputDialog.Show(); inputDialog.GetButton((int)DialogButtonType.Positive).Click += inputText_AddClick; inputDialog.GetButton((int)DialogButtonType.Negative).Click += inputText_CancelClick; break; } }
private static void ChooseAction(DialogChoice choice, string tiledMapPath) { if (choice == DialogChoice.CANCEL) { return; } EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); if (choice == DialogChoice.CURRENT_SCENE) { } else if (choice == DialogChoice.NEW_SCENE) { Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene); TiledMapParser.ParseMap(tiledMapPath); } }
public void ChoicePressure() { // Dialog Analytics Analytics.CustomEvent("DialogOption", new Dictionary <string, object> { { "TopicName", myConversation.availableTopics[activeTopic].topicName }, { "Response", "Pressure" } }); DialogChoice activeResponse = myConversation.availableTopics[activeTopic].badCop; currentDialog = activeResponse.choiceResponse; dialogStage = 0; dialogStages = currentDialog.Length; talkingChoice = true; talkingFinished = true; Dialog = false; UpdateConversation(); }
public void OnLoadGameDialogClose(DialogChoice choice) { if (choice == DialogChoice.Yes) { DisableInput = true; GameManager.Instance.LoadGame(Saves[Picker.SelectedObject]); if (GameManager.Instance.LevelData != null) { GameManager.Instance.LoadLevel(GameManager.Instance.LevelData); } else { GameManager.Instance.LoadLevel(GameManager.Instance.Levels.FirstOrDefault()); } } Picker.DisableInput = false; LoadGameDialog.OnClose.RemoveListener(OnLoadGameDialogClose); Input.ResetInputAxes(); }
public void SetDialogState(DialogState state) { if (curState != null) { UnloadCurrentDialogState(); } curState = state; if (state == null) { dialogCanvas.enabled = false; } else { dialogCanvas.enabled = true; _stateStartTime = Time.time; avatarImage.sprite = (Sprite)Resources.Load("Avatars/" + state.GetUIProp <string>("avatar"), typeof(Sprite)); dialogText.text = state.text; nameText.text = state.GetUIProp <string>("name"); if (curState.HasChoices) { foreach (DialogChoice c in curState.choices) { GameObject choiceButton = Instantiate(choicePrefab, dialogPanel.transform); choiceButton.transform.Find("Text").GetComponent <Text>().text = string.Format("{0}) {1}", c.name, c.text); DialogChoice cc = c; choiceButton.GetComponent <Button>().onClick.AddListener(() => { OnChoiceClick(cc); }); } } } }
void OnChoiceClick(DialogChoice c) { curState.OnChoice(c); }
private void Purge_ItemSelected(object sender, DialogChoice e) { purge |= e.DisplayText == Config.Global.UI.Strings.PromptAnswerYes as string; }
private void MarkAllDialog_ItemSelected(object sender, DialogChoice e) { markAllread |= e.DisplayText == Config.Global.UI.Strings.PromptAnswerYes as string; }
public void Reset() { Choice = DialogChoice.None; }
void LoadDialog(string[] questDialog) { ParseMode parseMode = ParseMode.None; DialogBase currentDialogEvent = null; characterList = new List<Character>(); int currentBranch = 0; int currentChoiceIndex = 0; int maxBranch = currentBranch; List<int> branchQueue = new List<int> (); List<int> priorityQueue = new List<int> (); List<int> finishedQueue = new List<int> (); //for pending branches to be merged later bool mergePending = false; priorityQueue.Add (currentBranch); foreach (string dataLine in questDialog) { if (dataLine == "<Chara>"){ parseMode = ParseMode.Character; continue; } else if (dataLine == "<Dialog>"){ parseMode = ParseMode.Dialog; continue; } else if (dataLine == "<Choice>"){ parseMode = ParseMode.Choice; continue; } else if (dataLine == "<ChoiceOptions>"){ parseMode = ParseMode.ChoiceOptions; continue; }else if (dataLine == "<End>"){ break; } else if (dataLine == "<ChoiceEnd>"){ finishedQueue.Insert (0, currentBranch); priorityQueue.RemoveAt (0); currentBranch = priorityQueue[0]; if (currentBranch == branchQueue[0]) mergePending = true; continue; } DialogBase nextEvent = null; switch (parseMode){ case ParseMode.Character: { string[] parts = dataLine.Split(new char[] {',',':'}); characterList.Add(new Character(int.Parse(parts[0]), parts[1])); } break; case ParseMode.Dialog: { string[] parts = dataLine.Split(new char[] {'^'}); DialogLine newDialogLine = new DialogLine(); newDialogLine.eventGroup = currentBranch; newDialogLine.characterID = int.Parse(parts[0]); newDialogLine.dialogLine = parts[1].Replace("<playername>", PlayerProfile.Get ().playerName).Replace("\\n", System.Environment.NewLine); newDialogLine.anims = null; if (parts.Length > 2){ string[] anims = parts[2].Split (new char[]{','}); newDialogLine.anims = new string[anims.Length]; for (int i = 0; i < anims.Length; ++i){ newDialogLine.anims[i] = anims[i]; } if (parts.Length > 3){ newDialogLine.isLoopAnim = (parts[3] == "L"); } } nextEvent = newDialogLine; } break; case ParseMode.Choice: { string[] parts = dataLine.Split(new char[] {'^'}); DialogChoice newChoice = new DialogChoice(); int branchCount = int.Parse(parts[1]); newChoice.eventGroup = currentBranch; newChoice.choiceOptions = new string[branchCount]; newChoice.choiceCost = new int[branchCount]; newChoice.choiceReward = new int[branchCount]; newChoice.choiceEnergyReward = new int[branchCount]; newChoice.choiceMoneyReward = new int[branchCount]; parseMode = ParseMode.ChoiceOptions; currentChoiceIndex = 0; // newChoice.eventGroup = currentBranch; // newChoice.choiceOptions = new string[parts.Length]; // newChoice.choiceCost = new int[parts.Length]; // newChoice.choiceReward = new int[parts.Length]; // // int i = 0; // // foreach (string choiceLine in parts){ // string[] lineParts = choiceLine.Split(new string[]{"::"}, System.StringSplitOptions.None); // newChoice.choiceCost[i] = int.Parse(lineParts[0].Split (':')[1]); // newChoice.choiceReward[i] = int.Parse(lineParts[2].Split (':')[1]); // newChoice.choiceOptions[i++] = lineParts[1]; // maxBranch = maxBranch + i; // priorityQueue.Insert(0, maxBranch); // } // // branchQueue.Insert(0, currentBranch); //store last branch node // currentBranch = priorityQueue[0]; //remove first node from pq // // parseMode = ParseMode.Dialog; // branchQueue.Add (currentBranch); nextEvent = newChoice; } break; case ParseMode.ChoiceOptions: { DialogChoice currentChoice = currentDialogEvent as DialogChoice; string[] parts = dataLine.Split(new char[] {'^'}); currentChoice.choiceCost[currentChoiceIndex] = int.Parse(parts[0]); currentChoice.choiceOptions[currentChoiceIndex] = parts[1]; currentChoice.choiceReward[currentChoiceIndex] = int.Parse (parts[2]); currentChoice.choiceMoneyReward[currentChoiceIndex] = int.Parse (parts[3]); currentChoice.choiceEnergyReward[currentChoiceIndex] = int.Parse (parts[4]); currentChoiceIndex++; maxBranch = maxBranch + currentChoiceIndex; priorityQueue.Insert(0, maxBranch); if (currentChoiceIndex >= currentChoice.choiceCost.Length){ branchQueue.Insert(0, currentBranch); //store last branch node currentBranch = priorityQueue[0]; //remove first node from pq parseMode = ParseMode.Dialog; } continue; } break; } if (currentDialogEvent == null){ openingDialogEvent = nextEvent; } else{ if (currentDialogEvent.eventGroup == nextEvent.eventGroup) currentDialogEvent.nextEvent = nextEvent; else{ int lastBranch = branchQueue[0]; if (lastBranch != priorityQueue[0]) //branch splitting { currentDialogEvent = openingDialogEvent.FindBranch(lastBranch); // while (currentDialogEvent.eventGroup != lastBranch && currentDialogEvent.eventType != DialogBase.EventType.Choice){ // currentDialogEvent = currentDialogEvent.nextEvent; // } DialogChoice branchEvent = (DialogChoice)currentDialogEvent; branchEvent.nextEvents.Add (nextEvent); }else{ //branch merging foreach (int finishedIndex in finishedQueue){ currentDialogEvent = openingDialogEvent.FindLeaf(finishedIndex); currentDialogEvent.nextEvent = nextEvent; } finishedQueue.Clear (); branchQueue.RemoveAt(0); } } } currentDialogEvent = nextEvent; } charactersInScene = characterList.ToArray (); currentDialogEvent = openingDialogEvent; currentDialogEvent.DumpContents (); // while (currentDialogEvent != null) { // DialogLine dialog = currentDialogEvent as DialogLine; // Debug.Log(dialog.dialogLine + "\n"); // // currentDialogEvent = currentDialogEvent.nextEvent; // } }
public virtual void Close(DialogChoice choice) { IsOpen = false; OnClose.Invoke(choice); gameObject.SetActive(false); }