private void Start () { if (Instance == null) Instance = this; else Destroy(Instance); dialogue = GameObject.FindObjectOfType<Dialogue>(); }
/// <summary> /// Sets the dialogue bubble, depending on speaker /// </summary> /// <param name='dialogue'> /// Dialogue: to check who is speaking /// </param>/ public void SetDialogueBubble(Dialogue dialogue) { background.enabled = true; //if the speaker is the player if(dialogue.dialogueBubbleType == Dialogue.DialogueLocation.PLAYER){ finalLoc = playerLocUV; finalColor = playerColor; PlayLocLerpAnimation(); } //if the speaker is the npc1 else if(dialogue.dialogueBubbleType == Dialogue.DialogueLocation.NPC1){ finalLoc = npc1LocUV + dialogue.dialogueBubbleOffset; finalColor = dialogue.owner.npc1Color; PlayLocLerpAnimation(); } //if the spekaer is the npc2 else if(dialogue.dialogueBubbleType == Dialogue.DialogueLocation.NPC2){ finalLoc = npc2LocUV + dialogue.dialogueBubbleOffset; finalColor = dialogue.owner.npc2Color; //finalColor = npc2Color; PlayLocLerpAnimation(); } //if the spekaer is the npc3 else if(dialogue.dialogueBubbleType == Dialogue.DialogueLocation.NPC3){ finalLoc = npc2LocUV + dialogue.dialogueBubbleOffset; finalColor = dialogue.owner.npc3Color; //finalColor = npc2Color; PlayLocLerpAnimation(); } //no speaker, use neutral dialogue bubble else if(dialogue.dialogueBubbleType == Dialogue.DialogueLocation.NEUTRAL1){ finalColor = neutral1Color; Rect newUVRect = background.uvRect; newUVRect.x = neutralLocUV; background.uvRect = newUVRect; } //no speaker, use neutral dialogue bubble else if(dialogue.dialogueBubbleType == Dialogue.DialogueLocation.NEUTRAL2){ finalColor = neutral2Color; Rect newUVRect = background.uvRect; newUVRect.x = neutralLocUV; background.uvRect = newUVRect; } //finalColor = dialogue.dialogueColor; PlayColorAnimation(); }
public UI() { dialogue = new Dialogue(); this.AddChild(dialogue); background = new FSprite("bg"); slotA = new FSprite("slot_a"); slotB = new FSprite("slot_b"); slotASelected = new FSprite("jump_soul"); slotBSelected = new FSprite("sword_soul"); hearts = new FSprite("heart_full"); this.AddChild(background); this.AddChild(slotA); this.AddChild(slotB); this.AddChild(slotASelected); this.AddChild(slotBSelected); this.AddChild(hearts); slotASelected.isVisible = false; slotBSelected.isVisible = false; background.y = Futile.screen.halfHeight - background.height / 2f; slotB.y = background.y; slotA.y = background.y; slotB.x = -Futile.screen.halfWidth + slotB.width / 2f + 20; slotA.x = slotB.x + slotB.width / 2f + slotA.width / 2f + 3; slotASelected.SetPosition(slotA.GetPosition()); slotBSelected.SetPosition(slotB.GetPosition()); slotASelected.x += 1; slotBSelected.x += 1; hearts.y = background.y; hearts.x = Futile.screen.halfWidth - hearts.width / 2f - 20; }
public WarpManager(Game1 game) { warpFileCount = Directory.GetFiles(@"Content\Warp\").Length; warps = new List<WarpItem>(); dialogue = new Dialogue(null, Game1.textBox, game, Game1.spriteFont, "doorLocked", "Door"); dialogue.dialogueManager.ReachedExit += new ExitEventHandler(ExitedDialogue); }
void EnteredNewDialogue(Dialogue dialogue) { this.dialogue = dialogue; textTimer = 0; textIndex = 0; if(dialogue == Dialogue.Empty) { text.color = Color.white; text.text = ""; return; } isVisible = true; charInfo = null; Debug.Log(dialogue.text); textToAdd = dialogue.text.Split(new char[]{' '}); if(textToAdd.Length > 0 && dialogue.duration > 0) { // Debug.Log("W " + textToAdd.Length + " " + ((textToAdd.Length + 1) / dialogue.duration) + " " + ((textToAdd.Length + 1) / dialogue.duration * textApearBeforeFinish)); timePerWord = dialogue.duration / (textToAdd.Length + 1) * textApearBeforeFinish; } else { Debug.LogWarning("--Empty string or duration zero--//"); } if(charRef == null) { text.color = Color.white; } else { charInfo = charRef.GetCharacterDialogueInfo(dialogue.speaker); if(charInfo != null) { text.text = preCharacter + charInfo.textAperance + postCharacter + " "; text.color = charInfo.textColor; } } }
public void Init(string speaker, string speech, List<string> actions, Dialogue next = null) { this.Speaker = speaker; this.Speech = speech; this.Next = next; this.actionToPerform = actions; }
void Start() { manager = DialogueManager.LoadDialogueFile(dialogueFile); currentDialogue = manager.GetDialogue("TutorialStart"); currentChoice = currentDialogue.GetChoices()[0]; currentDialogue.PickChoice(currentChoice); }
IEnumerator Speak() { dialogue = Controller.GetComponent<Dialogue>(); for(int i = 0; i < dialogueSpeech.Length; i++) { dialogue.Show(dialogueSpeech[i], null, null); while(!dialogue.isFinished) yield return null; } }
public static void WriteDialogue(Dialogue dial) { GameOperator.instance.DialogueIterator = 0; GameOperator.instance.DialogueString = dial.Speech; GameOperator.instance.DialogueGUIText.guiText.text = ""; GameOperator.instance.Mode = OperatorMode.DIALOGUETEXT; GameOperator.instance.ShowDialogueBox(true); }
public void initializeDialogueGUI() { isDialogueRunning = true; currentDialogue = GetComponent<DialogueHolder> ().ReturnCurrentDialogue (); currentDialogueIndex = 0; displayCurrentDialogueElement(); GUIManager.s_instance.isInDialogue = true; }
public static void finishDialogue() { Controller = GameObject.FindGameObjectWithTag("GameController"); dialogue = Controller.GetComponent<Dialogue>(); dialogue.Hide(); if(dialogue.canvas != null) dialogue.canvas.SetActive (true); Time.timeScale = 1; }
void Start () { dialogueScript = dialogueManager.GetComponent<Dialogue> (); entranceScript = gameObject.GetComponent<Entrance>(); playerMovementScript = gameObject.GetComponent<playerMovement>(); dancingScript = giraffe.GetComponent<dancing>(); endGameScript = gameObject.GetComponent<EndGame> (); }
void Start() { audioSources = GameObject.Find("_audioSources"); dialogueText = this.transform.FindChild("Text").GetComponent<Text>(); dialogue = dialogueText.transform.GetComponent<Dialogue>(); UpdateDialogue(); }
public void changeDialogue(Dialogue newDialogue) { /* * Change the dialogue by exiting, then entering the new one */ currentDialogue.Exit(); currentDialogue = newDialogue; currentDialogue.Enter(); }
void Start() { foreach(DialogueTextTrees d in this.gameObject.GetComponents<DialogueTextTrees>()){ DialogueChoices.Add(d); } camMov = Camera.main.GetComponent("Camera_movement") as Camera_movement; diaBox = GameObject.Find("Dialogue"); dia = diaBox.GetComponent("Dialogue") as Dialogue; }
// Use this for initialization void Start () { bulletSpawn = this.transform.FindChild("BulletSpawn"); bulletPrefab = Resources.Load("BulletNut"); rigidbody_2d = this.GetComponent<Rigidbody2D>(); animator = this.GetComponent<Animator>(); dialogue = GameObject.Find("Dialogue").GetComponent<Dialogue>(); }
//private Color questOutlineColor = new Color(255, 255, 0, 255); void Start() { player = GameObject.FindGameObjectWithTag("Player"); gameManager = GameObject.Find("GameManager"); dialogueManager = gameManager.GetComponent<Dialogue>(); //dialogueCamera = GameObject.Find("DialogueCamera").GetComponent<Camera>(); questPanel = gameManager.GetComponent<GameManager>().quest; acceptButton = questPanel.gameObject.transform.Find("Button (Accept)").gameObject; declineButton = questPanel.gameObject.transform.Find("Button (Decline)").gameObject; completeButton = questPanel.gameObject.transform.Find("Button (Complete)").gameObject; }
// Use this for initialization void Start() { //StartCoroutine (countdown ()); timeLeft = startTime; GameObject canvas = GameObject.Find("HUD"); timer = canvas.transform.FindChild("TimerBG").FindChild("TimeLeft").GetComponent<Text>(); dialogue = GameObject.Find("Dialogue").GetComponent<Dialogue>(); paused = true; manager = GameObject.Find("GameManager").GetComponent<GameManager>(); }
void Awake() { dialogue = GetComponent<Dialogue>(); foreach (var gameObject in optionButtons) { gameObject.SetActive(false); } if (defaultDialogue != null) { textToRun = defaultDialogue.text; } }
// Use this for initialization void Start () { rigidbody_2d = this.GetComponent<Rigidbody2D>(); Teleport_Ready1 = false; Telepad1 = GameObject.FindGameObjectWithTag("TeleportPad1"); Telepad2 = GameObject.FindGameObjectWithTag("TeleportPad2"); dialogue = GameObject.Find("Dialogue").GetComponent<Dialogue>(); player = GameObject.Find("Squirrel").GetComponent<Player>(); moleTalking = false; Toll = 5; Head = GameObject.FindGameObjectWithTag("Head"); animator = Head.GetComponent<Animator>(); }
void Awake() { dialogue = GetComponent<Dialogue>(); transitionTime = dialogueScript.matchSpeed; foreach (var gameObject in optionButtons) { gameObject.SetActive(false); } if (defaultDialogue != null) { textToRun = defaultDialogue.text; } }
// Use this for initialization void Start () { player = GameObject.Find("Squirrel").GetComponent<Player>(); GameObject canvas = GameObject.Find("HUD"); carriedNutsGUI = canvas.transform.FindChild("GoalBG").FindChild("Carrying").GetComponent<Text>(); goalGUI = canvas.transform.FindChild("GoalBG").FindChild("Goal").GetComponent<Text>(); dialogue = GameObject.Find("Dialogue").GetComponent<Dialogue>(); timer = GameObject.Find("Timer").GetComponent<Timer>(); GameOver = GameObject.Find("Dialogue").transform.FindChild("GAMEOVERSHIT").GetComponent<CanvasGroup>(); level = 1; goal = 2; turnedIn = 0; isGameOver = false; }
/*Conversation format in text files is a line for each 'pane' of dialogue. It contains the character's * name, image filename and what they say, separated by ':' as shown below. * character name:character image:dialogue */ public static Dialogue[] loadConversation(TextAsset dialogueLog) { Dialogue[] conversation = null; string[] lines = dialogueLog.text.Split('\n'); conversation = new Dialogue[lines.Length]; for (int i = 0; i < lines.Length; i++) { string[] message = lines[i].Split(':'); Sprite s = Resources.Load<Sprite>("Sprites/" + message[1]); conversation[i] = new Dialogue(message[0], s, message[2]); } return conversation; }
/* public Dialogue LoadDialoguesText(TextAsset file) { string[] lines = file.text.Split('\n'); Debug.Log("DialogueLoader:"+lines.Length); Dialogue dialogue = new Dialogue(Dialogue.DialogueType.description); foreach(string line in lines) { dialogue.addLine(new DialogueLine(line)); } return dialogue; }*/ public Dictionary<string, Dialogue> LoadDialoguesJSON(TextAsset file) { Dictionary<string,Dialogue> dict = new Dictionary<string, Dialogue>(); JSONNode chapter = JSON.Parse(file.text); JSONArray dialoguesJSON = chapter["dialogues"].AsArray; foreach(JSONNode dialogueJSON in dialoguesJSON) { Dialogue newDialogue = new Dialogue(); Debug.Log(dialogueJSON); parseLines(newDialogue,dialogueJSON["lines"].AsArray); dict.Add(dialogueJSON["id"],newDialogue); } return dict; }
public void AddChoice(Dialogue.Choice choice) { GameObject choiceButton = GameObject.Instantiate(buttonPrefab); choiceButton.transform.SetParent(content.transform, false); choiceButton.transform.localScale = new Vector3(1, 1, 1); Text btnText = choiceButton.transform.GetChild(0).GetComponent<Text>(); btnText.text = choice.dialogue; this.choices.Add(choice); int count = this.choices.Count-1; choiceButton.GetComponent<Button>().onClick.AddListener( () => { OnChoiceClicked(count); }); AdjustChoiceButtonHeight(choiceButton, btnText); }
void parseLines(Dialogue dialogue,JSONArray linesJSON) { foreach(JSONNode lineJSON in linesJSON) { dialogue.addLine(new DialogueLine(lineJSON["line"],lineJSON["character"], lineJSON["expression"], lineJSON["index"].AsInt,lineJSON["image"], lineJSON["addition"],lineJSON["special"])); } /* if(linesJSON) foreach(JSONNode lineJSON in linesJSON) { Debug.Log(lineJSON["additional"]); } */ }
public void PortriatCase(Dialogue.Person person ) { PortraitActive = true; switch(person) { case Dialogue.Person.Princess: Portrait.sprite = tempTest; break; case Dialogue.Person.Knight: Portrait.sprite = Resources.Load<Sprite>("Sprites/Icons"); break; default: Debug.Log("welldam"); break; } }
public void NextChoice(Dialogue.Choice nextChoice) { currentDialogue.PickChoice(nextChoice); nextChoices = currentDialogue.GetChoices(); Debug.Log(nextChoices.Length); if(nextChoices.Length > 0){ currentChoice = null; if(nextChoices.Length == 1) { currentChoice = nextChoices[0]; currentDialogue.PickChoice(currentChoice); nextChoices = currentDialogue.GetChoices(); } SetupDialogueBox(); } else { dialogueBox.Dismiss(); LevelManager.Instance().clickLocked = false; } }
void Start() { player = GameObject.Find ("Player").GetComponent<Player> (); hooded = GameObject.Find ("HoodedCharacter") as GameObject; fevens = GameObject.Find ("EvilFevens") as GameObject; // before using the healthbar, check if stats need to be set: if (GameObject.FindGameObjectWithTag ("GameController") != null) { GameObject.FindGameObjectWithTag ("GameController").SendMessage ("SetStats", player.mStats); } player.SetLevelLabel (); dialogue = GameObject.Find ("Dialogue") as GameObject; dialogueText = GameObject.Find ("DialogueText").GetComponent<Dialogue> (); dialogue.SetActive (false); levelText = GameObject.Find ("LevelText").GetComponent<Text> (); levelText.gameObject.SetActive (false); }
// Use this for initialization protected virtual void OnEnable() { DialogueManager manager = DialogueManager.LoadDialogueFile(dialogFile); currentDialogue = manager.GetDialogue(dialogName); currentDialogue.Start(); Dialogue.Choice[] choices = currentDialogue.GetChoices(); Debug.Log(choices.Length); if(choices.Length > 0 ){ if(choices.Length == 1) { currentChoice = choices[0]; currentDialogue.PickChoice(currentChoice); nextChoices = currentDialogue.GetChoices(); } else { currentChoice = null; nextChoices = choices; } LevelManager.Instance().clickLocked = true; SetupDialogueBox(); this.gameObject.SetActive(false); } }
//SETTING A BOUNTY RESOURCE private void SetBountyResourceType(Player player, Options selection, Dialogue dialogue, object contextData) { if (selection == Options.Cancel || dialogue.ValueMessage.Length == 0) { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have cancelled the bounty request."); return; } // Check who is setting the bounty var playerName = player.Name; // Get resource var resourceName = Capitalise(dialogue.ValueMessage); if (resourceName != "Wood" && resourceName != "Stone" && resourceName != "Iron" && resourceName != "Flax" && resourceName != "Iron Ingot" && resourceName != "Steel Ingot" && resourceName != "Water" && resourceName != "Lumber" && resourceName != "Wool" && resourceName != "Bone" && resourceName != "Sticks" && resourceName != "Hay" && resourceName != "Dirt" && resourceName != "Clay" && resourceName != "Oil") { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : I am afraid that you cannot use that item as a bounty reward at this time. Only harvestable resources may be used."); return; } // Check if I have already set a resource foreach (var bounty in bountyList) { if (bounty[0] == playerName.ToLower()) { if (bounty[4] != "active") { // Add the resource to the existing bounty request bounty[2] = resourceName; PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have added the resource [00FF00]" + resourceName + "[FFFFFF] to the bounty you are creating."); SaveBountyListData(); // Load the next Popup! player.ShowInputPopup("Set Bounty Details", "How much of that resource are you offering as a reward?", "", "Confirm", "Cancel", (options, dialogue1, data) => SetBountyAmountOfResource(player, options, dialogue1, data)); return; } } } // Create a new bounty to add this resource bountyList.Add(CreateEmptyBountyListing()); // Add the player's name to the bounty listing var lastRecord = bountyList.Count - 1; bountyList[lastRecord][0] = playerName.ToLower(); // Add the resource bountyList[lastRecord][2] = resourceName; // Tell the player PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have added the resource [00FF00]" + resourceName + "[FFFFFF] to the bounty you are creating."); // Save the data SaveBountyListData(); // Load the next Popup! player.ShowInputPopup("Set Bounty Details", "How much of that resource are you offering as a reward?", "", "Confirm", "Cancel", (options, dialogue1, data) => SetBountyAmountOfResource(player, options, dialogue1, data)); }
public static bool Prefix(Dialogue __instance, bool ___transitioning, int ___transitionWidth, int ___transitionHeight) => !___transitioning || (___transitionWidth > 0 && ___transitionHeight > 0);
// If not formatted properly, parse may throw exceptions or return null public static Dialogue Parse(string input) { if (input[0] != '{') { return(null); } if (input[1] == '[') { // parse plain dialogue bool isLeft = false; if (input[2] == 'L') { isLeft = true; } else if (input[2] == 'R') { isLeft = false; } else { Debug.Log("Parse1. Expected L or R, got " + input[2]); return(null); } if (input[3] != ']') { Debug.Log("Parse2. Expected ], got " + input[3]); return(null); } int currentChar = 4; string rawSpriteId = ""; while (input[currentChar] != '}') { rawSpriteId = rawSpriteId + input[currentChar]; currentChar++; } int spriteId = int.Parse(rawSpriteId); // Skip over '}' currentChar++; // Parse until the next dialogue string rawText = ""; while (currentChar < input.Length && input[currentChar] != '{') { rawText = rawText + input[currentChar]; currentChar++; } if (currentChar >= input.Length) { // ended parsing return(new PlainDialogue(isLeft, spriteId, rawText)); } else { Dialogue restOfDialogue = DialogueParser .Parse(input.Substring(currentChar)); return(new PlainDialogue(isLeft, spriteId, rawText, restOfDialogue)); } } else { // parse choice dialogue int currentChar = 1; string rawNumChoices = ""; while (input[currentChar] != '}') { rawNumChoices = rawNumChoices + input[currentChar]; currentChar++; } // Skip over '}' currentChar++; int numberOfChoices; try { numberOfChoices = int.Parse(rawNumChoices); } catch (FormatException) { Debug.Log("Parse3. Expected number, got " + rawNumChoices); return(null); } string[] choicesTexts = new string[numberOfChoices]; Dialogue[] choicesDialogues = new Dialogue[numberOfChoices]; for (int j = 0; j < numberOfChoices; j++) { if (input[currentChar] != '[') { Debug.Log("Parse4. Expected [, got " + input[currentChar]); return(null); } currentChar++; if (input[currentChar] != 'C') { Debug.Log("Parse5. Expected C, got " + input[currentChar]); return(null); } currentChar++; if (input[currentChar] != ',') { Debug.Log("Parse6. Expected , , got " + input[currentChar]); return(null); } currentChar++; int numberOfBracketsOpened = 1; string text = ""; while (numberOfBracketsOpened > 0) { if (input[currentChar] == ']') { numberOfBracketsOpened--; } if (input[currentChar] == '[') { numberOfBracketsOpened++; } text = text + input[currentChar]; currentChar++; } // remove last ] to get the choice text text = text.Substring(0, text.Length - 1); choicesTexts[j] = text; if (input[currentChar] != '<') { Debug.Log("Parse7. Expected <, got " + input[currentChar]); return(null); } currentChar++; // find next choice string dialogue = ""; int numberOfAnglesOpened = 1; while (numberOfAnglesOpened > 0) { if (input[currentChar] == '>') { numberOfAnglesOpened--; } if (input[currentChar] == '<') { numberOfAnglesOpened++; } dialogue = dialogue + input[currentChar]; currentChar++; } // remove last > to get all the dialogue text dialogue = dialogue.Substring(0, dialogue.Length - 1); // recursive call to parse() to parse the nested dialogue Dialogue parsedDialogue = DialogueParser.Parse(dialogue); choicesDialogues[j] = parsedDialogue; // now input[currentChar] == '[' for the next choice // the for-loop will handle the next choice } return(new ChoiceDialogue(choicesDialogues, choicesTexts)); } }
//문자 수신 이후 현재 대화를 업데이트 해야하는 경우 호출됨. public void ReloadCurrentDialogue() { _CurDialogue = MessageDBManager.Get().LoadDialogue(_CurThread_id, true, (int)TextMessage.MESSAGE_TYPE.ALL); }
public static void LeopoldTalkAboutChangingPigForm() { PigQuestData data = (PigQuestData)Data; List <int> CompanionsCanChangeForm = new List <int>(); for (int i = 0; i < 4; i++) { if (data.MetPigs[i] && data.SolidificationRequestGiven[i] && data.SolidificationUnlocked[i]) { bool HasCompanionsSummoned = false; switch (i) { case WrathID: if (PlayerMod.PlayerHasGuardian(Main.LocalPlayer, GuardianBase.Wrath)) { HasCompanionsSummoned = true; } break; } if (HasCompanionsSummoned) { CompanionsCanChangeForm.Add(i); } } } Dialogue.ShowDialogueWithContinue("*You want to change the state of the body of one of the emotional pigs?*"); if (CompanionsCanChangeForm.Count == 0) { Dialogue.ShowEndDialogueMessage("*You should have the companion you want to change their body state following you, or else I can't do anything.*", false); } else { string[] Options = new string[CompanionsCanChangeForm.Count + 1]; for (int i = 0; i < CompanionsCanChangeForm.Count; i++) { switch (CompanionsCanChangeForm[i]) { case WrathID: Options[i] = "Change Wrath's Form"; break; } } Options[CompanionsCanChangeForm.Count] = "Nevermind"; int PickedOption = Dialogue.ShowDialogueWithOptions("*Who do you want to change the body form?*", Options); if (PickedOption == CompanionsCanChangeForm.Count) { Dialogue.ShowEndDialogueMessage("*Changed your mind? Then I will do nothing. Want to talk about something else?*", false); } else { TerraGuardian tg = null; PlayerMod player = Main.LocalPlayer.GetModPlayer <PlayerMod>(); string CloudFormDialogue = "", SolidFormDialogue = ""; switch (CompanionsCanChangeForm[PickedOption]) { case WrathID: { tg = PlayerMod.GetPlayerSummonedGuardian(Main.LocalPlayer, GuardianBase.Wrath); } break; } if (tg == null) { Dialogue.ShowEndDialogueMessage("*Oh well... Something unexpected happened. Want to talk about something else?*", false); } else { if (Dialogue.ShowDialogueWithOptions("*Do you really want to change " + tg.Name + "'s form to " + (player.PigGuardianCloudForm[PickedOption] ? "Astral" : "Solid") + "?*", new string[] { "Yes", "No" }) == 0) { player.PigGuardianCloudForm[PickedOption] = !player.PigGuardianCloudForm[PickedOption]; TerraGuardian Speaker = Dialogue.GetSpeaker; if (player.PigGuardianCloudForm[PickedOption]) { Dialogue.ShowDialogueWithContinue(CloudFormDialogue, tg); } else { Dialogue.ShowDialogueWithContinue(SolidFormDialogue, tg); } Dialogue.ShowEndDialogueMessage("*Well, It's done. Do you want something else?*", false, Speaker); } } } } }
public MensajeDialogo() { dialogo = new Dialogue(); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (Game1.globalFade || Freeze) { return; } if (BackButton.containsPoint(x, y)) { BackButton.scale = BackButton.baseScale; BackButtonPressed(); } if (OkButton != null && OkButton.containsPoint(x, y) && readyToClose()) { if (NamingAnimal) { Game1.globalFadeToBlack(SetUpForReturnToShopMenu); Game1.playSound("smallSelect"); } else { Game1.exitActiveMenu(); Game1.playSound("bigDeSelect"); } } if (NamingAnimal) { TextBox.OnEnterPressed += TextBoxEvent; Game1.keyboardDispatcher.Subscriber = TextBox; //this.textBox.Text = this.animalBeingPurchased.name; TextBox.Selected = true; if (DoneNamingButton.containsPoint(x, y)) { AnimalBeingPurchased.Name = TextBox.Text; TextBoxEnter(TextBox); Game1.playSound("smallSelect"); } else { if (RandomButton.containsPoint(x, y)) { AnimalBeingPurchased.Name = Dialogue.randomName(); TextBox.Text = AnimalBeingPurchased.Name; RandomButton.scale = RandomButton.baseScale; Game1.playSound("drumkit6"); } } } foreach (var textureComponent in AnimalsToPurchase) { if (textureComponent.containsPoint(x, y) && ((Object)textureComponent.item).Type == null) { var int32 = Convert.ToInt32(textureComponent.name); if (Game1.player.Money >= int32) { //Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f); //Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f); Game1.playSound("smallSelect"); //this.onFarm = true; AnimalBeingPurchased = new FarmAnimal(textureComponent.hoverText, GetNewId(), Game1.player.UniqueMultiplayerID); PriceOfAnimal = int32; //this.newAnimalHome = ((AnimalHouse)Game1.player.currentLocation).getBuilding(); //this.animalBeingPurchased.name = "John" + new Random().NextDouble(); //this.animalBeingPurchased.home = this.newAnimalHome; //this.animalBeingPurchased.homeLocation = new Vector2((float)this.newAnimalHome.tileX, (float)this.newAnimalHome.tileY); //this.animalBeingPurchased.setRandomPosition(this.animalBeingPurchased.home.indoors); //(this.newAnimalHome.indoors as AnimalHouse).animals.Add(this.animalBeingPurchased.myID, this.animalBeingPurchased); //(this.newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(this.animalBeingPurchased.myID); //this.newAnimalHome = (Building)null; //this.namingAnimal = false; //Game1.player.money -= this.priceOfAnimal; //Game1.exitActiveMenu(); NamingAnimal = true; } else { Game1.addHUDMessage(new HUDMessage("Not Enough Money", Color.Red, 3500f)); } } } }
private Dialogue next; // null if no further dialogue in this chain public Dialogue(string speaker, string sprite, string side, string body, string[] flags, Dialogue next) : base(speaker, sprite, side, body, flags) { this.next = next; }
// SETTING A BOUNTY NAME private void SetBountyPlayerName(Player player, Options selection, Dialogue dialogue, object contextData) { if (selection == Options.Cancel || dialogue.ValueMessage.Length == 0) { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have cancelled the bounty request."); return; } var bountyPlayerName = dialogue.ValueMessage; // Check who is setting the bounty var playerName = player.Name; // Check that the bounty target is online Player bountyPlayer = Server.GetPlayerByName(bountyPlayerName.ToLower()); //Check that this player can be found if (bountyPlayerName == "" || bountyPlayer == null) { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : That person is not currently available. You must wait until they awaken to set a bounty on their head, my Lord."); return; } // Add the name to the listing foreach (var bounty in bountyList) { // PrintToChat(bounty[0] + " " + bounty[1] + " " + bounty[2] + " " + bounty[3]); if (bounty[0] == playerName.ToLower() && bounty[1].ToLower() == bountyPlayerName.ToLower() && bounty[4] == "active") { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You already have an active bounty on this person's head!"); return; } if (bounty[0] == playerName.ToLower() && bounty[4] != "active") { //Add targets name here bounty[1] = bountyPlayerName.ToLower(); // Tell the player PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have added [00FF00]" + Capitalise(bountyPlayerName) + "[FFFFFF]'s name to the bounty you are creating."); // Save the data SaveBountyListData(); // Load the next Popup! player.ShowInputPopup("Set Bounty Details", "What resource are you offering as a reward?", "", "Confirm", "Cancel", (options, dialogue1, data) => SetBountyResourceType(player, options, dialogue1, data)); return; } } // Create a new bounty listing bountyList.Add(CreateEmptyBountyListing()); // Add the player's name to the bounty listing var lastRecord = bountyList.Count - 1; bountyList[lastRecord][0] = playerName.ToLower(); // Add the target's name to the bounty bountyList[lastRecord][1] = bountyPlayerName.ToLower(); // Tell the player PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have added [00FF00]" + Capitalise(bountyPlayerName) + "[FFFFFF]'s name to the bounty you are creating."); // Save the data SaveBountyListData(); // Load the next Popup! player.ShowInputPopup("Set Bounty Details", "What resource are you offering as a reward?", "", "Confirm", "Cancel", (options, dialogue1, data) => SetBountyResourceType(player, options, dialogue1, data)); }
private void OnWizardCreate() { // Validate the original dialogues if (originalDialogues == null || originalDialogues.Count == 0) { EditorUtility.DisplayDialog("Error", "You need to specify at least one original dialogue", "OK"); } foreach (Dialogue dia in originalDialogues) { if (dia == null || dia.Lines == null || dia.Lines.Count == 0) { EditorUtility.DisplayDialog("Error", "An empty dialogue was specified", "OK"); return; } } List <LocalizedDialogue> localizedDialogues = new List <LocalizedDialogue>(); string path = EditorUtility.OpenFilePanelWithFilters("Open dialogue translations file", "", new string[] { "Text file", "txt" }); if (path.Length != 0) { using (StreamReader reader = new StreamReader(path)) { LocalizedDialogue currentDialogue = CreateInstance <LocalizedDialogue>(); currentDialogue.Lines = new List <LocalizedDialogueLine>(); localizedDialogues.Add(currentDialogue); Regex regex = new Regex(@"^(.+?)(?: *):(?: *)(.*)$"); LocalizedDialogueLine lastLine = null; int emptyLineCounter = 0; while (!reader.EndOfStream) { string line = reader.ReadLine(); if (line.StartsWith("//")) { emptyLineCounter = 0; continue; } if (line.Trim().Length == 0) { emptyLineCounter++; } else { if (emptyLineCounter >= 2) { currentDialogue = CreateInstance <LocalizedDialogue>(); currentDialogue.Lines = new List <LocalizedDialogueLine>(); localizedDialogues.Add(currentDialogue); lastLine = null; } if (regex.IsMatch(line)) { Match m = regex.Match(line); // We don't care about the character name because it will be taken from the original string lineContent = m.Groups[2].Value; LocalizedDialogueLine localizedLine = new LocalizedDialogueLine(); localizedLine.Text = lineContent; lastLine = localizedLine; currentDialogue.Lines.Add(localizedLine); } else { if (lastLine == null) { EditorUtility.DisplayDialog("Format incorrect", "The file didn't comply with the format", "OK"); return; } // Trim whitespaces to ensure that there are none before or after the line break character string textContent = lastLine.Text.Trim(); textContent += "\n"; textContent += line.Trim(); lastLine.Text = textContent; } emptyLineCounter = 0; } } } } // Validate the number of dialogues and lines if (originalDialogues.Count != localizedDialogues.Count) { EditorUtility.DisplayDialog("Error", "The number of dialogues in the input file mismatch with the original dialogues specified", "OK"); return; } for (int i = 0; i < originalDialogues.Count; i++) { if (originalDialogues[i].Lines.Count != localizedDialogues[i].Lines.Count) { EditorUtility.DisplayDialog("Error", "The number of lines in the input file mismatch with the original dialogues specified", "OK"); return; } } // If the code reaches here it means that we can save the localizations now. string baseFolder = "Resources/" + localeSettings.baseFolder + "/" + locale.langCode + "/Dialogue"; string targetDirectory = CreateIntermediateFolders(baseFolder); AssetDatabase.StartAssetEditing(); for (int i = 0; i < originalDialogues.Count; i++) { Dialogue dia = originalDialogues[i]; LocalizedDialogue localized = localizedDialogues[i]; if (string.IsNullOrEmpty(dia.translationKey)) { dia.translationKey = "dialogue-" + ShortGuid.NewGuid(); } localized.translationKey = dia.translationKey; for (int x = 0; x < dia.Lines.Count; x++) { if (string.IsNullOrEmpty(dia.Lines[x].translationKey)) { dia.Lines[x].translationKey = "line-" + ShortGuid.NewGuid(); } localized.Lines[x].original = dia.Lines[x]; localized.Lines[x].translationKey = dia.Lines[x].translationKey; } AssetDatabase.CreateAsset(localized, targetDirectory + "/" + localized.translationKey + ".asset"); } AssetDatabase.StopAssetEditing(); AssetDatabase.SaveAssets(); }
private string GetRandomSay(Dialogue dialogue) { return(dialogue.says[Random.Range(0, dialogue.says.Length)]); }
public void EditTranslation(string key, string locale, Dialogue newDialogue, bool isDialogue, bool refreshKeys) { if (!this.LanguageEntries.TryGetValue(Tuple.Create(key, locale), out var translationEntry)) { throw new InvalidOperationException("Attempted edit on nonexistent key."); } var languageDoc = new XmlDocument(); languageDoc.Load(translationEntry.FilePath); using (var fs = new FileStream(translationEntry.FilePath, FileMode.Create)) { var editedNode = languageDoc.SelectSingleNode($"data/Dialogue[@Key='{key}']"); var originalIsDialogue = editedNode != null; if (editedNode == null) { editedNode = languageDoc.SelectSingleNode($"data/Text[@Key='{key}']"); } if (editedNode == null) { throw new InvalidOperationException("Attempted edit on nonexistent key."); } editedNode.Attributes["Value"].Value = newDialogue.Text; if (isDialogue) { if (originalIsDialogue) { editedNode.Attributes["Face"].Value = newDialogue.Face.ToFace().ToString(); editedNode.Attributes["Mono"].Value = newDialogue.Face.Mono ? "True" : "False"; } else { var newNode = languageDoc.CreateElement("Dialogue"); newNode.Attributes.Append(editedNode.Attributes["Key"]); newNode.Attributes.Append(editedNode.Attributes["Value"]); var faceAttribute = languageDoc.CreateAttribute("Face"); faceAttribute.Value = newDialogue.Face.ToFace().ToString(); newNode.Attributes.Append(faceAttribute); var monoAttribute = languageDoc.CreateAttribute("Mono"); monoAttribute.Value = newDialogue.Face.Mono ? "True" : "False"; newNode.Attributes.Append(monoAttribute); editedNode.ParentNode.ReplaceChild(newNode, editedNode); } } else if (originalIsDialogue) { var newNode = languageDoc.CreateElement("Text"); newNode.Attributes.Append(editedNode.Attributes["Key"]); newNode.Attributes.Append(editedNode.Attributes["Value"]); editedNode.ParentNode.ReplaceChild(newNode, editedNode); } using (var xw = XmlWriter.Create(fs, new XmlWriterSettings { Indent = true })) { languageDoc.WriteTo(xw); } } if (refreshKeys) { this.ReloadTranslationKeys(); } }
private List <Message> GetDialogueMessages(string _EventName) { Dialogue dialogue = Dialogues.Find(x => x.EventName.Contains(_EventName)); return(dialogue.Messages); }
//SETTING A BOUNTY AMOUNT private void SetBountyAmountOfResource(Player player, Options selection, Dialogue dialogue, object contextData) { if (selection == Options.Cancel || dialogue.ValueMessage.Length == 0) { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have cancelled the bounty request."); return; } var playerName = player.Name.ToLower(); // Convert to a single string (in case of many args) var amountEntered = dialogue.ValueMessage; // Make sure that a Number was entered int amount; bool acceptable = Int32.TryParse(amountEntered, out amount); if (!acceptable) { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : That amount was not recognised. The bounty request was cancelled."); return; } //If the number is too little or too much if (amount <= 0 || amount > 1000) { PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : The amount entered must be between 1 and 1000."); return; } // Check if I have already set an amiount foreach (var bounty in bountyList) { if (bounty[0] == playerName.ToLower()) { if (bounty[4] != "active") { // Add the resource to the existing bounty request bounty[3] = amount.ToString(); PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have set the amount to [00FF00]" + amount.ToString() + "[FFFFFF] for the bounty you are creating."); SaveBountyListData(); // Load the next Popup! AskThePlayerToConfirmTheBounty(player, bounty[0], bounty[1], bounty[2], bounty[3]); return; } } } // Create a new bounty to add this resource bountyList.Add(CreateEmptyBountyListing()); // Add the player's name to the bounty listing var lastRecord = bountyList.Count - 1; bountyList[lastRecord][0] = playerName.ToLower(); // Add the amount bountyList[lastRecord][3] = amount.ToString(); // Tell the player PrintToChat(player, "[FF0000]Assassin's Guild[FFFFFF] : You have set the amount to [00FF00]" + amount.ToString() + "[FFFFFF] for the bounty you are creating."); //// Save the data SaveBountyListData(); // Load the next Popup! AskThePlayerToConfirmTheBounty(player, bountyList[lastRecord][0], bountyList[lastRecord][1], bountyList[lastRecord][2], bountyList[lastRecord][3]); }
private void ClosePopup(Player player, Options selection, Dialogue dialogue, object contextData) { //Do nothing }
//Dialogue Interactions public void CookDialogue() { bool PlayerReceivedFood = Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().ReceivedFoodFromMinerva; if (PlayerReceivedFood) { Dialogue.ShowEndDialogueMessage("*I already gave you some food... Wait until " + (Main.dayTime ? "dinner" : "lunch") + " time for more.*", false); return; } string[] PossibleFoods = new string[] { "Soup", "Cooked Fish", "Cooked Shrimp", "Pumpkin Pie", "Sashimi", "Grub Soup", "Nevermind" }; Player player = Main.player[Main.myPlayer]; int CountPlayerFood = player.inventory.Where(x => x.buffType == Terraria.ID.BuffID.WellFed).Sum(x => x.stack); if (player.position.Y >= Main.worldSurface * 16) { PossibleFoods[0] = ""; } if (player.Center.X / 16 >= 250 && player.Center.X / 16 <= Main.maxTilesX / 250) { PossibleFoods[2] = ""; } if (!Main.halloween) { PossibleFoods[3] = ""; } if (!NPC.AnyNPCs(Terraria.ID.NPCID.TravellingMerchant)) { PossibleFoods[4] = ""; } if (!player.ZoneJungle) { PossibleFoods[5] = ""; } bool GotFood = false; int ItemToGet = 0; switch (Dialogue.ShowDialogueWithOptions("*That is what I can cook for you right now:*", PossibleFoods)) { case 0: { ItemToGet = Terraria.ID.ItemID.BowlofSoup; Dialogue.ShowDialogueWithContinue("*I hope you enjoy It... The mushroom and the goldfish are fresh.*"); GotFood = true; } break; case 1: { ItemToGet = Terraria.ID.ItemID.CookedFish; Dialogue.ShowDialogueWithContinue("*The fish were caught last morning... I hope they're at your taste.*"); GotFood = true; } break; case 2: { ItemToGet = Terraria.ID.ItemID.CookedShrimp; Dialogue.ShowDialogueWithContinue("*The shrimps were caught some time ago and are fresh... Enjoy your meal.*"); GotFood = true; } break; case 3: { ItemToGet = Terraria.ID.ItemID.PumpkinPie; Dialogue.ShowDialogueWithContinue("*The pie is still fresh... I hope you like It.*"); GotFood = true; } break; case 4: { ItemToGet = Terraria.ID.ItemID.Sashimi; Dialogue.ShowDialogueWithContinue("*I'm not really experienced with that... So I kind of bought that from the Travelling Merchant, instead.*"); GotFood = true; } break; case 5: { ItemToGet = Terraria.ID.ItemID.GrubSoup; Dialogue.ShowDialogueWithContinue("*Probably is not as horrible as you may think... Tell me what do you think when you eat. Me? Of course I wont put any of that on my mouth!*"); GotFood = true; } break; case 6: Dialogue.ShowEndDialogueMessage("*...Then why did you ask for food...*", false); break; } if (GotFood) { Vector2 LeaderPos = player.Center; player.GetModPlayer <PlayerMod>().ReceivedFoodFromMinerva = true; if (CountPlayerFood > 10) { Dialogue.ShowDialogueWithContinue("*You still got a lot of food with you. Eat them before asking me for more.*"); } else { player.GetItem(Main.myPlayer, Main.item[Item.NewItem(player.getRect(), ItemToGet, 3, true)]); } //Deliver also to other teams close by. for (int i = 0; i < 255; i++) { Player player2 = Main.player[i]; if (!player2.active) { continue; } if (player2.whoAmI == player.whoAmI || (Math.Abs(player2.Center.X - LeaderPos.X) < 1000 && Math.Abs(player2.Center.Y - LeaderPos.Y) < 800)) { foreach (TerraGuardian tg in player2.GetModPlayer <PlayerMod>().GetAllGuardianFollowers) { if (tg.Active) { if (tg.Inventory.Where(x => x.buffType == Terraria.ID.BuffID.WellFed).Sum(x => x.stack) <= 10) { if (tg.ID == Minerva && tg.ModID == MainMod.mod.Name && ItemToGet == Terraria.ID.ItemID.GrubSoup) { tg.GetItem(Terraria.ID.ItemID.BowlofSoup, 3); } else { tg.GetItem(ItemToGet, 3); } } } } } } Dialogue.ShowEndDialogueMessage("*I... Also gave some food to your companions... If you don't mind...*", false); } }
public static Dialogue dialogueExcel;//对话表 void Awake() { _dialogueManager = this; dialogueExcel = Resources.Load <Dialogue>("Excel/Dialogue"); }
public void PlayDialogues(Dialogue msg) { PlayDialogues(new Dialogue[] { msg }); }
public void TriggerDialogue(Dialogue dialogue, Sprite npcSprite) { FindObjectOfType <DialogueManager>().StartDialogue(dialogue, npcSprite); }
internal static void configSay(string name, string voice, string text, int rate = -1, float pitch = -1, float volume = -1) { Task.Run(() => { currentVoice = VoiceId.FindValue(voice); tmppath = Path.Combine(PelicanTTSMod._helper.DirectoryPath, "TTS"); if (pc == null) { pc = AWSHandler.getPollyClient(); } bool mumbling = PelicanTTSMod.config.MumbleDialogues; text = text.Replace("< ", " ").Replace("` ", " ").Replace("> ", " ").Replace('^', ' ').Replace(Environment.NewLine, " ").Replace("$s", "").Replace("$h", "").Replace("$g", "").Replace("$e", "").Replace("$u", "").Replace("$b", "").Replace("$8", "").Replace("$l", "").Replace("$q", "").Replace("$9", "").Replace("$a", "").Replace("$7", "").Replace("<", "").Replace("$r", "").Replace("[", "<").Replace("]", ">"); if (mumbling) { text = @"<speak><amazon:effect phonation='soft'><amazon:effect vocal-tract-length='-20%'>" + Dialogue.convertToDwarvish(text) + @"</amazon:effect></amazon:effect></speak>"; } else { text = @"<speak><amazon:auto-breaths><amazon:effect phonation='soft'><prosody rate='" + (rate == -1 ? PelicanTTSMod.config.Rate : rate) + "%'>" + text + @"</prosody></amazon:effect></amazon:auto-breaths></speak>"; } int hash = text.GetHashCode(); if (!Directory.Exists(Path.Combine(tmppath, name))) { Directory.CreateDirectory(Path.Combine(tmppath, name)); } string file = Path.Combine(Path.Combine(tmppath, name), "speech_" + currentVoice.Value + (mumbling ? "_mumble_" : "_") + hash + ".wav"); SoundEffect nextSpeech = null; if (!File.Exists(file)) { SynthesizeSpeechRequest sreq = new SynthesizeSpeechRequest(); sreq.Text = text; sreq.TextType = TextType.Ssml; sreq.OutputFormat = OutputFormat.Ogg_vorbis; sreq.VoiceId = currentVoice; SynthesizeSpeechResponse sres = pc.SynthesizeSpeech(sreq); using (var memStream = new MemoryStream()) { sres.AudioStream.CopyTo(memStream); nextSpeech = Convert(memStream, file); } } using (FileStream stream = new FileStream(file, FileMode.Open)) nextSpeech = SoundEffect.FromStream(stream); if (currentSpeech != null) { currentSpeech.Stop(); } currentSpeech = nextSpeech.CreateInstance(); speak = false; currentSpeech.Pitch = (mumbling ? 0.5f : pitch == -1 ? PelicanTTSMod.config.Voices[name].Pitch : pitch); currentSpeech.Volume = volume == -1 ? PelicanTTSMod.config.Volume : volume; currentSpeech.Play(); }); }
public void chat(GameObject dialogue) { dialogueCS = dialogue.GetComponent <Dialogue>(); dialogueCS.Dialoguing(npcNum); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (Game1.globalFade || this.freeze) { return; } if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose()) { if (this.onFarm) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForReturnToShopMenu), 0.02f); Game1.playSound("smallSelect"); } else { Game1.exitActiveMenu(); Game1.playSound("bigDeSelect"); } } if (this.onFarm) { Vector2 tile = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize)); Building buildingAt = currentFarm.getBuildingAt(tile); if (buildingAt != null && !this.namingAnimal) { if (buildingAt.buildingType.Contains(this.animalBeingPurchased.buildingTypeILiveIn.Value)) { if ((buildingAt.indoors.Value as AnimalHouse).isFull()) { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11321", new object[0])); } else if (this.animalBeingPurchased.harvestType.Value != 2) { this.namingAnimal = true; this.newAnimalHome = buildingAt; if (this.animalBeingPurchased.sound.Value != null && Game1.soundBank != null) { ICue expr_15B = Game1.soundBank.GetCue(this.animalBeingPurchased.sound.Value); expr_15B.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201))); expr_15B.Play(); } this.textBox.OnEnterPressed += this.e; this.textBox.Text = this.animalBeingPurchased.displayName; Game1.keyboardDispatcher.Subscriber = this.textBox; if (Game1.options.SnappyMenus) { this.currentlySnappedComponent = base.getComponentWithID(104); this.snapCursorToCurrentSnappedComponent(); } } else if (Game1.player.Money >= this.priceOfAnimal) { this.newAnimalHome = buildingAt; this.animalBeingPurchased.home = this.newAnimalHome; this.animalBeingPurchased.homeLocation.Value = new Vector2((float)this.newAnimalHome.tileX.Value, (float)this.newAnimalHome.tileY.Value); this.animalBeingPurchased.setRandomPosition(this.animalBeingPurchased.home.indoors.Value); (this.newAnimalHome.indoors.Value as AnimalHouse).animals.Add(this.animalBeingPurchased.myID.Value, this.animalBeingPurchased); (this.newAnimalHome.indoors.Value as AnimalHouse).animalsThatLiveHere.Add(this.animalBeingPurchased.myID.Value); this.newAnimalHome = null; this.namingAnimal = false; if (this.animalBeingPurchased.sound.Value != null && Game1.soundBank != null) { ICue expr_2DC = Game1.soundBank.GetCue(this.animalBeingPurchased.sound.Value); expr_2DC.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201))); expr_2DC.Play(); } Game1.player.Money -= this.priceOfAnimal; Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11324", new object[] { this.animalBeingPurchased.displayType }), Color.LimeGreen, 3500f)); this.animalBeingPurchased = new FarmAnimal(this.animalBeingPurchased.type.Value, ModEntry.ModHelper.Multiplayer.GetNewID(), Game1.player.UniqueMultiplayerID); } else if (Game1.player.Money < this.priceOfAnimal) { Game1.dayTimeMoneyBox.moneyShakeTimer = 1000; } } else { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11326", new object[] { this.animalBeingPurchased.displayType })); } } if (this.namingAnimal) { if (this.doneNamingButton.containsPoint(x, y)) { this.textBoxEnter(this.textBox); Game1.playSound("smallSelect"); } else if (this.namingAnimal && this.randomButton.containsPoint(x, y)) { this.animalBeingPurchased.Name = Dialogue.randomName(); this.animalBeingPurchased.displayName = this.animalBeingPurchased.Name; this.textBox.Text = this.animalBeingPurchased.displayName; this.randomButton.scale = this.randomButton.baseScale; Game1.playSound("drumkit6"); } this.textBox.Update(); return; } } else { if (this.previousFarmButton.containsPoint(x, y)) { currentFarm = framework.swapFarm(currentFarm); this.populateAnimalStock(); this.previousFarmButton.scale = this.previousFarmButton.baseScale; } if (this.nextFarmButton.containsPoint(x, y)) { currentFarm = framework.swapFarm(currentFarm); this.populateAnimalStock(); this.nextFarmButton.scale = this.nextFarmButton.baseScale; } foreach (ClickableTextureComponent current in this.animalsToPurchase) { if (current.containsPoint(x, y) && (current.item as Object).Type == null) { int num = current.item.salePrice(); if (Game1.player.Money >= num) { Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f); Game1.playSound("smallSelect"); this.onFarm = true; this.animalBeingPurchased = new FarmAnimal(current.hoverText, ModEntry.ModHelper.Multiplayer.GetNewID(), Game1.player.UniqueMultiplayerID); this.priceOfAnimal = num; } else { Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11325", new object[0]), Color.Red, 3500f)); } } } } }
// Update is called once per frame public void StartDialogue(Dialogue dialogue) { dialogue_animator.SetBool("IsOpen", true); next_animator.SetBool("Next", false); panel_animator.SetInteger("image", 0); image_animator.SetInteger("yash_mood", 0); nameText.text = dialogue.name; sentences.Clear(); switch (Global.Yash_story) { case 0: start = 0; end = 10; Global.Yash_story = 1; break; case 1: // do something if (Global.Lu_story == 0) { start = 9; end = 10; } if (Global.Daniele_story == 0) { start = 9; end = 10; } else { start = 9; end = 10; if (Global.been_to_hell_and_back == true) { if (Global.Lu_story == 1) { start = 10; end = 22; Global.Yash_story = 2; } else { start = 22; end = 32; } } } break; case 2: break; default: break; } for (int i = start; i < end; i++) { sentences.Enqueue(dialogue.sentences.GetValue(i).ToString()); } }
public void changeDialogue(Dialogue dialogue) { defaultDialogue = dialogue; }
// All dialogue is "written" here public void SetupDialogue() { Transform camTarget = transform.parent.Find("CamTarget"); dialogue = new Dialogue(); dialogue.SetSteps( new Step[] { //0 new Step(camTarget, "Don't touch me.", new Option[] { new Option("I broke that- I mean, that fuse box over there broke.", 14, delegate() { return(fusebox.broken && !atFuseBox); }), new Option("What are you doing?", 1), new Option("Can I use your ladder?", 9, delegate() { return(!noLadder); }), new Option("Can I borrow your fishing rod?", 3, delegate() { return(ratRod); }), new Option("Are there any rats down here?", 19, delegate() { return(cook.wantsIngredients); }), new Option("Did you realize there is a dead whale in the sewer?", 21, delegate() { return(Game.script.GetComponent <Level1>().seenWhale); }), new Option("Sorry.", -1) } ), // 1 new Step(camTarget, "Fishing.", new Option[] { new Option("Shouldn't you be working?", 4), new Option("What can you catch down here?", 2), new Option("Can I borrow your fishing rod?", 3, delegate() { return(ratRod); }), } ), // 2 new Step(camTarget, "Fish. Also hepatitis.", new Option[] { new Option("Shouldn't you be working?", 4), new Option("Can I borrow your fishing rod?", 3, delegate() { return(ratRod); }), new Option("I have another question.", 0), new Option("I gotta go.", -1) } ), // 3 new Step(camTarget, "I'm using it.", new Option[] { new Option("Shouldn't you be working?", 4), new Option("I have another question.", 0), new Option("Ok. I'll leave then.", -1) } ), // 4 new Step(camTarget, "I'm a maintenance guy. Ain't nothing broken, so there ain't nothing to maintain.", new Option[] { new Option("Isn't maintenance more about preventing things from breaking?", 8), new Option("What if something broke right now?", 5), new Option("I have another question.", 0), new Option("Ok. I'll leave then.", -1) } ), // 5 new Step(camTarget, "I guess I'd have to go fix it wouldn't I?", new Option[] { new Option("I have another question.", 0), new Option("Ok, I'm going to go.", -1) } ), // 6 new Step(camTarget, "I don't eat them. I just like to watch them plead with their God for another chance at life.", new Option[] { new Option("That seems kind of cruel.", 7) } ), // 7 new Step(camTarget, "These fish are die-hard \"Toddlers & Tiaras\" fans. They deserve it.", new Option[] { new Option("Can I borrow your fishing rod?", 3), new Option("Bye.", -1) } ), // 8 new Step(camTarget, "Right now I'm preventing myself from breaking your face. How's that for maintenance?", new Option[] { new Option("What if something broke right now?", 5), new Option("I have another question.", 0), new Option("I think I'll leave you alone.", -1) } ), // 9 new Step(camTarget, "I'm using it.", new Option[] { new Option("Why don't you sit on something else?", 12), new Option("I just need to use it for a second.", 10) } ), // 10 new Step(camTarget, "I tell you what, you get me a can of Pancake Stew, you can do whatever you want with this ladder.", new Option[] { new Option("What's Pancake Stew?", 11), new Option("Where can I find one?", 17), new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I'll try to find one.", -1) }, delegate() { wantsStew = true; } ), // 11 new Step(camTarget, "That's a stupid question.", new Option[] { new Option("Where can I find one?", 17), new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I'll try to find one.", -1) } ), // 12 new Step(camTarget, "How about I sit on your face?", 13), // 13 new Step(camTarget, "That didn't come out right.", new Option[] { new Option("I just need to use it for a second.", 10), new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I'll leave you alone.", -1) } ), // 14 new Step(camTarget, "Dern it. Why can't people read sticky notes?", delegate() { // drop rod Game.dialogueManager.StopDialogue(); StartCoroutine(MoveToFix()); }, true), // 15 new Step(camTarget, "What do you want?", new Option[] { new Option("Do you actually need to use that ladder?", 16, delegate() { return(!noLadder); }), new Option("Did you realize there is a dead whale in the sewer?", 21, delegate() { return(Game.script.GetComponent <Level1>().seenWhale); }), new Option("Nothing.", -1) } ), // 16 new Step(camTarget, "Don't tell me how to do my job. I don't tell you how to be a dumbass.", new Option[] { new Option("I just need to use it for a second.", 10), new Option("I'll leave you alone.", -1) } ), // 17 new Step(camTarget, "One of the inmates is a hoarder. Got anything you could ask for. He sold me a bucket of cat feces once.", new Option[] { new Option("What did you need that for?", 18), new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I'll go talk to him.", -1) } ), // 18 new Step(camTarget, "That's a stupid question.", new Option[] { new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I'll go find some Pancake Stew", -1) } ), // 19 new Step(camTarget, "There's a rat who lives in the other side of the sewer. He's a real bastard.", new Option[] { new Option("Do you know how I can capture it?", 20), new Option("There's a whale blocking that side.", 21), new Option("I have another question.", 0), new Option("I gotta go.", -1) } ), // 20 new Step(camTarget, "What are you, a dumbass? Put some cheese on a fishing rod.", new Option[] { new Option("Can I borrow your fishing rod?", 3), new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I gotta go.", -1) }, delegate() { ratRod = true; } ), // 21 new Step(camTarget, "I tried to move it, but it's too big. What I need to do is flush a whale-sized object into the sewers to push it out of the way.", 22), // 22 new Step(camTarget, "But I don't care.", new Option[] { new Option("I have another question.", 0, delegate() { return(!atFuseBox); }), new Option("I gotta go.", -1) } ) }); }
private void Start() { activeDialogue = defaultDialogue; }
// Validates a single script. ValidationMessage[] ValidateFile(TextAsset script, Context analysisContext, out CheckerResult.State result) { // The list of messages we got from the compiler. var messageList = new List <ValidationMessage>(); // A dummy variable storage; it won't be used, but Dialogue // needs it. var variableStorage = new Yarn.MemoryVariableStore(); // The Dialog object is the compiler. var dialog = new Dialogue(variableStorage); // Whether compilation failed or not; this will be // set to true if any error messages are returned. bool failed = false; // Called when we get an error message. Convert this // message into a ValidationMessage and store it; // additionally, mark that this file failed compilation dialog.LogErrorMessage = delegate(string message) { var msg = new ValidationMessage(); msg.type = MessageType.Error; msg.message = message; messageList.Add(msg); // any errors means this validation failed failed = true; }; // Called when we get an error message. Convert this // message into a ValidationMessage and store it dialog.LogDebugMessage = delegate(string message) { var msg = new ValidationMessage(); msg.type = MessageType.Info; msg.message = message; messageList.Add(msg); }; // Attempt to compile this script. Any exceptions will result // in an error message try { dialog.LoadString(script.text, script.name); } catch (System.Exception e) { dialog.LogErrorMessage(e.Message); } // Once compilation has finished, run the analysis on it dialog.Analyse(analysisContext); // Did it succeed or not? if (failed) { result = CheckerResult.State.Failed; } else { result = CheckerResult.State.Passed; } // All done. return(messageList.ToArray()); }
void OnDialogueEnd(Dialogue d) { Debug.Log("Got the message " + d.name); gameObject.SetActive(true); }
public void StartDialogue(string ConversionID) { _dialogue = dialogueRepo.GetConversation(ConversionID); TypeSentence(); }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Interact")) { Ray interactionRay; interactionRay = Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2)); RaycastHit hitInfo; if (Physics.Raycast(interactionRay, out hitInfo, 10)) { switch (hitInfo.collider.tag) { case "NPC": Dialogue dlg = hitInfo.transform.GetComponent <Dialogue>(); if (dlg != null) { dlg.showDlg = true; Time.timeScale = 0; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; } Debug.Log("Talk to NPC is Triggered"); break; case "Item": Debug.Log("Pick up Item"); ItemHandler handler = hitInfo.transform.GetComponent <ItemHandler>(); if (handler != null) { handler.Oncollection(); } break; case "Treasure": Debug.Log("Surprise Mimic Attack"); Chest chest = hitInfo.transform.GetComponent <Chest>(); if (chest != null) { chest.showChest = true; LinearInventory.showInv = true; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; Time.timeScale = 0; } break; case "Shop": Shop shop = hitInfo.transform.GetComponent <Shop>(); if (shop != null) { shop.showShop = true; LinearInventory.showInv = true; Cursor.visible = true; Cursor.lockState = CursorLockMode.None; Time.timeScale = 0; } Debug.Log("See Something You Like?"); break; } /* * if (hitInfo.collider.CompareTag("NPC")) * { * Debug.Log("Talk to NPC is Triggered"); * } * if (hitInfo.collider.tag == "Item") * { * Debug.Log("Pick up Item"); * } */ } } }