public void QuitConsole() { mainCamera.GetComponent <cameraModeSwap>().SwapCameraMode(); UICanvas.GetComponent <Canvas>().renderMode = RenderMode.ScreenSpaceOverlay; dialogueMenu.SetActive(false); CurrentDialogueState = DialogueState.quitDialogue; }
private void SetContent() { dialogState = DialogueState.TYPING; roleName.text = curChapterData.dataList[curNum].Name; curDialogContent = curChapterData.dataList[curNum].Content; StartContentCoroutine(true); }
void FishTalks() { foreach (GameObject answer in answers) { answer.SetActive(false); } // Player click next line if (Input.GetMouseButtonDown(0)) { SplitAndType(); } if (index >= currentSplittedTextFile.Count) { index = 0; if (currentDialogueBlock.answers.Count != 0) { state = DialogueState.playerAnswer; } else { EndDate(); } } }
IEnumerator EndDialogue() { if (currentDialogue != null && currentDialogue.cannotReplay && currentDialogue.played) { currentDialogue.OnEnd(); } else { if (currentDialogue == null || !currentDialogue.notCloseAfterEnd) { HideDialogueBox(); } yield return(new WaitForSeconds(.3f)); state = DialogueState.NotRunning; if (currentDialogue == null || !currentDialogue.notCloseAfterEnd) { dialogueBoxText.SetText(""); } if (currentDialogue != null) { currentDialogue.played = true; } } dialogueOpen = false; currentDialogue?.OnEnd(); }
IEnumerator TypeText() { state = DialogueState.Typing; char[] textArray = textToType.ToCharArray(); string text = ""; for (int i = 0; i < textArray.Length; i++) { text += textArray[i]; dialogueBoxText.SetText(text); if (state == DialogueState.SpeedUp) { for (int j = i + 1; j < textArray.Length; j++) { text += textArray[j]; dialogueBoxText.SetText(text); } break; } else { yield return(new WaitForSeconds(timeBtwLetters)); } } state = DialogueState.FinishTyping; }
private void DialogueViewTransitionIn(Entity speaker = null) { currentState = DialogueState.In; var windowRect = window.GetComponent <RectTransform>(); switch (dialogueStyle) { case DialogueStyle.Original: windowRect.anchorMin = windowRect.anchorMax = new Vector2(0.5F, 0.5F); windowRect.anchoredPosition = new Vector2(0, 0); break; case DialogueStyle.Remastered: default: if (speaker && player) { if (player.transform.position.y <= speaker.transform.position.y) { windowRect.anchorMin = new Vector2(0, 0); windowRect.anchorMax = new Vector2(1, 0); windowRect.anchoredPosition = new Vector2(0, 200); } else { windowRect.anchorMin = new Vector2(0, 1); windowRect.anchorMax = new Vector2(1, 1); windowRect.anchoredPosition = new Vector2(0, -200); } } FadeBarIn(); break; } }
//when player enters trigger open up the canvas private void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Player") { if (Input.GetKeyDown(KeyCode.E)) { if (active == false) { _dialogueState = DialogueState.INTRO; //send a true notifcation out to the player that we are in the menu if (inMenu != null) { Cursor.lockState = CursorLockMode.None; inMenu(true); } //show the canvas canvasHolder.SetActive(true); //probably send a notification to the player that they are in the menu if (spokeWithNpc != null) { Debug.Log(questObjectID + "Dialogue"); spokeWithNpc(questObjectID); } active = true; } else { Cursor.lockState = CursorLockMode.Locked; canvasHolder.SetActive(false); _dialogueState = DialogueState.EXIT; active = false; } } } }
// 다이얼로그의 내용들을 표시하는 함수 IEnumerator DisplayContents() { _state = DialogueState.Start; yield return(null); _state = DialogueState.Displaying; while (_state == DialogueState.Displaying) { while (_isDisplayingContents) { _contentsText.text += _contents[_textIndex]; _textIndex++; if (_textIndex >= _contents.Length) { _isDisplayingContents = false; } yield return(new WaitForSeconds(_secondsBtweenCharacters)); } yield return(null); } }
public void Dialogue(ref PlayerState playerState) { switch (this.dialogueState) { case DialogueState.Setup: this.dialogueManager.StartDialogue(dialogue); this.dialogueState = DialogueState.Dialoguing; break; case DialogueState.Dialoguing: bool notDone = true; if (Input.GetButtonDown("Interact")) { notDone = this.dialogueManager.DisplayNextSentence(); } if (notDone == false) { this.dialogueState = DialogueState.Done; } break; case DialogueState.Done: playerState = this.prevState; this.dialogueState = DialogueState.Setup; break; } }
IEnumerator BarFadeIn() { blackBarTop.gameObject.SetActive(true); blackBarBottom.gameObject.SetActive(true); float count = blackBarBottom.anchoredPosition.y; while (count < blackBarBottom.sizeDelta.y) { if (currentState != DialogueState.In) { break; } count += 0.1F * blackBarBottom.sizeDelta.y; hudGroup.alpha -= 0.1F; blackBarTop.anchoredPosition = new Vector2(0, -count); blackBarBottom.anchoredPosition = new Vector2(0, count); yield return(new WaitForSeconds(0.0025F)); } hudGroup.alpha = 0F; if (currentState == DialogueState.In) { currentState = DialogueState.Idle; } }
public void setDialogue(DialogueState state, Animator animator) { if (current == null) { current = animator; } else { if (animator != current) { return; } } dialogueUIObject.SetActive(true); //destroy all previously created buttons foreach (GameObject g in buttons) { Destroy(g); } buttons.RemoveAll((o) => o == null); //set the new text dialogueTextBox.text = state.dialogueText; //reset content box size responseBox.sizeDelta = Vector2.zero; //generate responses float yoffset = 0; for (int i = 0; i < state.responses.Length; i++) { //set dialogue text string response = state.responses[i]; GameObject responsebutton = Instantiate(responseButtonPrefab) as GameObject; buttons.Add(responsebutton); Text rtext = responsebutton.GetComponentInChildren <Text>(); rtext.text = response; //resize buttons to fit response RectTransform rt = responsebutton.GetComponent <RectTransform>(); rt.SetParent(responseBox, false); Vector2 tmp = rt.sizeDelta; tmp.y = rtext.preferredHeight + 10; //add 10 for padding rt.sizeDelta = tmp; rt.localPosition = new Vector3(0, -(tmp.y / 2) - yoffset, 0); yoffset += tmp.y; //rescale the content box for the scrollbars tmp = responseBox.sizeDelta; tmp.y = yoffset; responseBox.sizeDelta = tmp; int tmp2 = i + 1; // need to capture value of variable before passing to delegate responsebutton.GetComponent <Button>().onClick.AddListener(() => { animator.SetInteger("optionselect", tmp2); }); } GameObject.FindGameObjectWithTag("Player").GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>().enabled = false; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; }
/// <summary> /// Initialises the states of the objects /// </summary> private void InitialiseState() { dialogueState = new DialogueState(); playerState = new PlayerState(); journalState = new JournalState(); inventoryState = new InventoryState(); }
IEnumerator FishCallout() { yield return(new WaitForSeconds(1)); tutorialDialogueState = DialogueState.fishElse; //this is specifically for the taking picture process screamImage.enabled = true; fishText.text = "Hey you! Over here!"; //scrollControl(true); //swipe is enabled //myHSS.enabled = true; //FinalCameraController.subwayScrollRect.enabled = true; // arrow.enabled = false; if (temp) { DialogueRT.anchoredPosition -= new Vector2(0, 300); temp = false; } yield return(new WaitForSeconds(1)); backToSubway = true; Show(arrowButton); }
IEnumerator BarFadeOut() { if (blackBarTop == null || blackBarBottom == null) { yield break; } blackBarTop.gameObject.SetActive(true); blackBarBottom.gameObject.SetActive(true); float count = blackBarBottom.anchoredPosition.y; while (count > 0) { if (currentState != DialogueState.Out) { break; } count -= 0.1F * blackBarBottom.sizeDelta.y; if (!PlayerViewScript.hidingHUD) { hudGroup.alpha += 0.1F; } blackBarTop.anchoredPosition = new Vector2(0, -count); blackBarBottom.anchoredPosition = new Vector2(0, count); yield return(new WaitForSeconds(0.0025F)); } if (currentState == DialogueState.Out) { currentState = DialogueState.Idle; } }
private void changeScenario() { // Just as with initial setup, go to the start of the dialogue print sequence currentTextIndex = 0; currentWritingIndex = 0; dialogue.GetComponent <Text>().text = ""; // Change the scenario if (theDialogue.scenarioID == 0) { // The only linked events are ScenarioID 0 followed by 1, while all others are randomized theDialogue.scenarioID = 1; } else { theDialogue.scenarioID = Random.Range(2, theDialogue.masterText.GetLength(0)); } // Fill with the new text and move to the next stage in the back-and-forth for (int i = 0; i < theDialogue.masterText.GetLength(1); i++) { textToDisplay[i] = theDialogue.masterText[theDialogue.scenarioID, i]; } currentDialogueState = DialogueState.Writing; currentBackAndForthState = BackAndForthState.Dialogue; }
IEnumerator TrainMoveIn() { FinalCameraController.DisableInput(true); yield return(new WaitForSeconds(0.5f)); //todo: transitionspeed??? //myHSS.transitionSpeed = 2f; for (int i = 0; i < 5; i++) { yield return(new WaitForSeconds(0)); //myHSS.GoToScreen(i); cameraMovement.currentPage = i; if (i == 4) { //karara appears yield return(new WaitForSeconds(1)); KararaDisappear(false); yield return(new WaitForSeconds(2)); //todo: transitionspeed //myHSS.transitionSpeed = 7.5f; //show karara dialogue tutorialDialogueState = DialogueState.karara; StartCoroutine(AnimateText(kararaText, "poster", true, poster, posterV)); Hide(arrowButton);//player should click poster scrollControl(false); } } }
private IEnumerator DoDisplay(BeatData data, float typingTime) { while (IsBusy()) { yield return(null); //wait until dialogue is no longer busy } currentDialogueState = DialogueState.Busy; DisplayTypingBubble(); AudioManager.instance.Play("TypingSFX"); //wait time should probably create a small texting bubble yield return(new WaitForSeconds(typingTime)); typingBubble.SetActive(false); AudioManager.instance.Stop("TypingSFX"); //if there is no previous bubble assume this is the start of the conversation if (previousBubble == false) { DisplayFirstBeat(data); } //if not append from previous bubble else { DisplaySmsBubble(data); } currentDialogueState = DialogueState.Idle; OnBeatDisplayed?.Invoke(data); }
public void ContinueDialogue() { if (currentState == DialogueState.OutputtingText) { currentState = DialogueState.WaitingForInput; } else if (currentState == DialogueState.WaitingForInput) { currentState = DialogueState.OutputtingText; currentLineIndex = 0; dialogLineIndex++; if (dialogLineIndex < currentDialogueLines.Length) { currentLine = currentDialogueLines[dialogLineIndex]; if (currentDialogueSprites != null && currentDialogueSprites.Length > dialogLineIndex) { faceplate.sprite = currentDialogueSprites[dialogLineIndex]; } else { faceplate.sprite = null; } } else { currentState = DialogueState.NoDialogue; this.gameObject.SetActive(false); Global.UnblockInput(); OnDialogueEndEvent?.Invoke(); } } }
private void Update() { switch (currentState) { case DialogueState.NoDialogue: break; case DialogueState.OutputtingText: characterTimer -= Time.deltaTime; if (characterTimer < 0) { if (currentLineIndex < currentLine.Length) { currentLineIndex++; characterTimer = lineSpeed; //Play sound here } else { currentState = DialogueState.WaitingForInput; break; } } textBox.text = currentLine.Substring(0, (int)currentLineIndex); break; case DialogueState.WaitingForInput: textBox.text = currentLine; break; default: throw new ArgumentOutOfRangeException(); } }
public DialogueNode(DialogueState dialogueState, Rectangle dialogueRec, BitmapFont font, string text, string playerText, int nextTree, int speed, int interval) { this.dialogueState = dialogueState; this.font = font; this.text = text; this.playerText = playerText; this.nextTree = nextTree; speakSpeed = speed; speakInterval = interval; this.textWriteArea = dialogueRec; this.questionWriteArea = new Rectangle(0, 300, 256, 44); if (playerText != null) { playerText = ParseText(playerText); } if (text != null) { this.text = ParseText(text); } timer = 0; textPos = 0; lineIsRead = false; }
public void PlayDialogue(DialogueBluePrint bluePrint) { m_State = DialogueState.None; AddBluePrint(bluePrint); m_CurBluePrint = bluePrint; m_CurBluePrint.StartDialogue(this); }
public void OpenChat() { messagesRead = true; dialogueMenu.SetActive(false); dialogueChat.SetActive(true); CurrentDialogueState = DialogueState.chat; }
public DialogueManager() { NodeCurrent = null; TopicCurrent = null; State = DialogueState.INACTIVE; }
public DialogueScene(bool alignTop, int?loopID, List <string> lines) { AlignTop = alignTop; LoopID = loopID; _lines = lines; state = new DialogueState(); }
public void DialogueViewTransitionOut() { if (!isInCutscene) { currentState = DialogueState.Out; StartCoroutine("BarFadeOut"); } }
// 다이얼로그를 종료 하고 초기화 하는 함수 void EndDialogue() { _contentsIndex = 0; _isDisplayingContents = true; _state = DialogueState.End; StopAllCoroutines(); EventManager.PostNotification(Event_Type.EndDialogue, this); _dialogueUI.SetActive(false); }
/// <summary> /// 执行一个选择分支对话 /// </summary> /// <param name="choose"></param> public void DoChoose(DialogueChoose choose) { m_CurNode = choose; m_State = DialogueState.Choose; if (OnDoChoose != null) { OnDoChoose.Invoke(choose); } }
/// <summary> /// 执行一个普通内容对话 /// </summary> /// <param name="content"></param> public void DoContent(DialogueContent content) { m_CurNode = content; m_State = DialogueState.Content; if (OnDoContent != null) { OnDoContent.Invoke(content); } }
IEnumerator MessageAppear() { tutorialDialogueState = DialogueState.fish; StartCoroutine(AnimateText(fishText, "Stop talking! listen, never dare you...", true, KararaStanding, messageV)); // fishText.text = "Stop talking! listen, never dare you..."; yield return(new WaitForSeconds(1.5f)); Show(anotherApp); }
// Use this for initialization void Start() { dialogueState = DialogueState.Prologue; Player player = FindObjectOfType <Player>(); player.shotActive = false; player.moveActive = false; ShowCanvas(prologueTextFile.text); }
protected void SetDialogue(string text) { GlobalState.Dialogue = text; GlobalState.SetDialogueMode = false; _subsubstate = new DialogueState(true); InDialogueMode = true; }
private void Parse(Connection connection,DialogueState state, Speech speech) { switch (state) { //maybe define better rules for account names and passwords case DialogueState.AskName: if (speech.Message.Length > 30) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Account names must be no more than 30 characters."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your account name to be?"); } else if (!System.Text.RegularExpressions.Regex.IsMatch(speech.Message, "^[a-zA-Z0-9]+$")) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Only alphanumeric characters(a-z A-Z 0-9) can be used in account names."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your account name to be?"); } else if (Database.AccountNameExists(speech.Message)) { connection.SendTextMessage(TextMessageType.ConsoleRed, "The account name " + speech.Message + " is already being used."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your account name to be?"); creators[connection].State = DialogueState.AskName; } else { connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your password to be?"); creators[connection].AccName = speech.Message; creators[connection].State = DialogueState.AskPassword; } break; case DialogueState.AskPassword: if (speech.Message.Length > 29) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Passwords must be shorter or as long as 29 characters."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your password to be?"); } else if (!System.Text.RegularExpressions.Regex.IsMatch(speech.Message, "^[a-zA-Z0-9]+$")) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Only alphanumeric characters(a-z A-Z 0-9) can be used in passwords."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your password to be?"); } else { creators[connection].Password = speech.Message; int id = Database.CreateAccount(creators[connection].AccName, creators[connection].Password); if (id > 0) { uint pId = game.GenerateAvailableId(); if (-1 != Database.CreatePlayer(id, "Account Manager " + Convert.ToBase64String(BitConverter.GetBytes(pId)), pId)) { connection.SendTextMessage(TextMessageType.ConsoleBlue, "Congratulations! Your account has been created successfully."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Details:"); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Account Name: " + creators[connection].AccName); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Password: "******"You can now login using your account and manage it."); return; } else { connection.SendTextMessage(TextMessageType.ConsoleRed, "An error has ocurred and your account could not be created. Sorry for the inconvenience."); Database.DeleteAccount(id); return; } } else { connection.SendTextMessage(TextMessageType.ConsoleRed, "An error has ocurred and your account could not be created. Sorry for the inconvenience."); return; } } break; } }
// new, not complete private void StartTopic(int id) { NodeList = ConversationPartner.GetTopic(id).GetNodeList(); State = DialogueState.IN_TOPIC; NodeCurrentId = 0; GotoNode(); }
private void EndConvo() { dui.Hide(); State = DialogueState.INACTIVE; im.SetMode(InteractMode.gMode.GM_WORLD); }
// IN USE but will be phased out public void StartConvo(List<DialogueNode> nl) { NodeList = nl; State = DialogueState.IN_TOPIC; dui.Show(); NodeCurrentId = 0; GotoNode(); }
private void ReturnToTopicList() { if (TopicCurrent.GetFlag() == "") { //do nothing } else { ps.ChangePlotStatus(ps.GetEnum(TopicCurrent.GetFlag())); } ConversationPartner.RemoveAvaliableTopic(CurrentTopicId); State = DialogueState.PICK_TOPIC; UpdateGUI(); }
// new, not complete public void StartConversation(int charId) { ConversationPartner = db.GetCharacter(charId); if(ConversationPartner != null) { State = DialogueState.PICK_TOPIC; dui.Show (); UpdateGUI(); } }
/// <summary> /// Use this to force stop dialogue /// </summary> public void DialogueStop() { DialogueWorkerState = DialogueState.DialogueStop; }
private void EndConvo() { dui.Hide(); State = DialogueState.INACTIVE; // Check if ANY character is in bad mood, if true then GAMEOVER NOOB }
/// <summary> /// Update for the Dialogue /// </summary> /// <param name="content"></param> public void Update() { if (DialogueWorkerState != DialogueState.DialogueStop) { switch (DialogueWorkerState) { case DialogueState.DialogueContinue: intDialogueKey++; if (intDialogueKey < intNumOfDialogues) { DialogueWorkerState = DialogueState.DialogueWait; } else { mAvatar.Peek.Enable(); DialogueWorkerState = DialogueState.DialogueStop; } break; case DialogueState.DialogueWait: break; } } }
private void Parse(Connection connection, DialogueState state, Speech speech) { switch (state) { #region AskTask case DialogueState.AskTask: switch (speech.Message.ToLower()) { case "create": connection.SendTextMessage(TextMessageType.ConsoleBlue, "Would you like it to be {male} or {female}'?"); managers[connection].State = DialogueState.AskGender; break; case "delete": managers[connection].CharactersList =new List<CharacterListItem>(Database.GetCharacterList(connection.AccountId)); if (managers[connection].CharactersList.Count > 1) { connection.SendTextMessage(TextMessageType.ConsoleBlue, "Your account contains the following characters:"); for (int i = 1; i < managers[connection].CharactersList.Count; i++) { connection.SendTextMessage(TextMessageType.ConsoleBlue, i + ". " + managers[connection].CharactersList[i].Name); } connection.SendTextMessage(TextMessageType.ConsoleBlue, "What character would you like to delete (by index)?"); managers[connection].State = DialogueState.AskDeleteIndex; } else { connection.SendTextMessage(TextMessageType.ConsoleRed, "Your account doesn't contain any characters yet."); connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); managers[connection].State = DialogueState.AskTask; } break; case "password": connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your new password to be?"); managers[connection].State = DialogueState.AskPassword; break; default: connection.SendTextMessage(TextMessageType.ConsoleRed, CantUnderstand); connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); break; } break; #endregion #region AskPassword case DialogueState.AskPassword: if (speech.Message.Length > 29) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Passwords must be no more than 29 characters."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your password to be?"); } else if (!System.Text.RegularExpressions.Regex.IsMatch(speech.Message, "^[a-zA-Z0-9]+$")) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Only alphanumeric characters(a-z A-Z 0-9) can be used in passwords."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your password to be?"); } else if (Database.UpdateAccountPassword(connection.AccountId, speech.Message)) { connection.SendTextMessage(TextMessageType.ConsoleBlue, "Your account password has been changed with success."); connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); managers[connection].State = DialogueState.AskTask; } else { connection.SendTextMessage(TextMessageType.ConsoleRed, "An error has occurred and your password could not be changed. Sorry for the inconvenience."); connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); managers[connection].State = DialogueState.AskTask; } break; #endregion #region AskGender case DialogueState.AskGender: switch (speech.Message.ToLower()) { case "male": managers[connection].CharacterGender = Gender.Male; break; case "female": managers[connection].CharacterGender = Gender.Female; break; default: connection.SendTextMessage(TextMessageType.ConsoleRed, CantUnderstand); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Would you like it to be {male} or {female}?"); return; } connection.SendTextMessage(TextMessageType.ConsoleBlue, vocationsText); managers[connection].State = DialogueState.AskVocation; break; #endregion #region AskVocation case DialogueState.AskVocation: try { managers[connection].CharacterVocation = (Vocation)Enum.Parse(typeof(Vocation), speech.Message, true); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your character's name to be?"); managers[connection].State = DialogueState.AskName; } catch { connection.SendTextMessage(TextMessageType.ConsoleRed, CantUnderstand); connection.SendTextMessage(TextMessageType.ConsoleBlue, vocationsText); } break; #endregion #region AskName case DialogueState.AskName: if (speech.Message.Length > 29) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Character names must be shorter or as long as 29 characters."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your character name to be?"); } else if (!System.Text.RegularExpressions.Regex.IsMatch(speech.Message, "^[a-zA-Z-' ]+$")) { connection.SendTextMessage(TextMessageType.ConsoleRed, "Only letters(a-z A-Z), hyphens(-) and apostrophes(') can be used in character names."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your character name to be?"); } else if (Database.PlayerNameExists(speech.Message)) { connection.SendTextMessage(TextMessageType.ConsoleRed, "A character with that name already exists."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "What would you like your character's name to be?"); } else { managers[connection].CharacterName = speech.Message; managers[connection].State = DialogueState.AskGender; Player p = new Player(); p.Connection = connection; p.Name = managers[connection].CharacterName; p.Gender = managers[connection].CharacterGender; p.Vocation = managers[connection].CharacterVocation; p.Id=game.GenerateAvailableId(); p.Tile = new Tile(); p.Tile.Location = new Location(97, 205, 7);//"temple position" if (p.Gender == Gender.Male) p.Outfit = new Outfit(128, 0); else p.Outfit = new Outfit(136, 0); Database.CreatePlayer(connection.AccountId, p.Name, p.Id); Database.SavePlayerInfo(p); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Your character has been created sucessfully.You can now relog to access it."); connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); managers[connection].State = DialogueState.AskTask; } break; #endregion #region AskDeleteIndex case DialogueState.AskDeleteIndex: ushort us; if(ushort.TryParse(speech.Message,out us)) { if (us < managers[connection].CharactersList.Count && us != 0) { managers[connection].DeleteSelected = managers[connection].CharactersList[(int)us].Name; connection.SendTextMessage(TextMessageType.ConsoleOrange, "Are you sure you want to delete the character " + managers[connection].DeleteSelected + " from your account('yes' or 'no')?This decision is irreversible."); managers[connection].State = DialogueState.AskDeleteConfirmation; } else { connection.SendTextMessage(TextMessageType.ConsoleRed, "Index out of range(1-" + (managers[connection].CharactersList.Count - 1) + ")."); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Which character would you like to delete (by index)?"); } } else { connection.SendTextMessage(TextMessageType.ConsoleRed, CantUnderstand); connection.SendTextMessage(TextMessageType.ConsoleBlue, "Which character would you like to delete (by index)?"); } break; #endregion #region AskDeleteConfirmation case DialogueState.AskDeleteConfirmation: switch (speech.Message.ToLower()) { case "yes": if (Database.DeletePlayerByName(managers[connection].DeleteSelected)) { connection.SendTextMessage(TextMessageType.ConsoleBlue, "Your character has been deleted sucessfully."); } else { connection.SendTextMessage(TextMessageType.ConsoleRed, "An error has occurred and your character could not be deleted.Sorry for the inconvenience."); } connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); managers[connection].State = DialogueState.AskTask; break; case "no": connection.SendTextMessage(TextMessageType.ConsoleBlue, "Character deletion canceled."); connection.SendTextMessage(TextMessageType.ConsoleBlue, HelpPrompt); managers[connection].State = DialogueState.AskTask; break; default: connection.SendTextMessage(TextMessageType.ConsoleRed, CantUnderstand); connection.SendTextMessage(TextMessageType.ConsoleOrange, "Are you sure you want to delete the character " + managers[connection].DeleteSelected + " from your account ({yes} or {no})? This decision is irreversible."); break; } break; #endregion } }
public void ResetTopic() { State = DialogueState.PICK_TOPIC; dui.Show(); UpdateGUI(); }
/// <summary> /// Use this to start and continue dialogue /// </summary> public void DialogueContinue() { DialogueWorkerState = DialogueState.DialogueContinue; }
public void StartConversation(int charId) { if(State == DialogueState.INACTIVE) // cant start a convo if we are already in one { ConversationPartner = db.GetCharacter(charId); if(ConversationPartner != null) { State = DialogueState.PICK_TOPIC; dui.Show (); UpdateGUI(); im.SetMode(InteractMode.gMode.GM_DIALOGUE); } } }