IEnumerator ChangeStoryRoutine(int page) { graphicRaycaster.enabled = false; //Fade out if (page != 0) { outDirector.Play(); yield return(new WaitForSeconds((float)outDirector.playableAsset.duration)); } //Change StoryText selectedPage = storySequence[page]; narrationText.text = selectedPage.text; if (selectedPage.who == "") { whoCanvasGroup.alpha = 0; } else { whoCanvasGroup.alpha = 1; whoText.text = selectedPage.who; } bgImage.sprite = selectedPage.backgroundImage; //Fade in inDirector.Play(); yield return(new WaitForSeconds((float)inDirector.playableAsset.duration)); graphicRaycaster.enabled = true; }
public static int GetInputValueHandlingExceptions(int factor, int minValue, int maxValue) { int selectedValue = 0; try { selectedValue = Int16.Parse(StoryText.GetInputValue()); } catch (FormatException ex) { BattleText.SelectValueHandlingExceptionsText(); selectedValue = GetInputValueHandlingExceptions(factor, minValue, maxValue); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (selectedValue > maxValue) { StoryText.EnterAValueFromTheMaximumToTheMinimumText(minValue, maxValue); selectedValue = GetInputValueHandlingExceptions(factor, minValue, maxValue); } if (selectedValue < minValue) { StoryText.EnterAValueFromTheMaximumToTheMinimumText(minValue, maxValue); selectedValue = GetInputValueHandlingExceptions(factor, minValue, maxValue); } return(selectedValue - factor); }
public static Hero ChooseTheDifficultyLevelOfTheGame(string name, Hero hero) { int difficulty = 0, difficultyDurability; do { StoryText.SelectDiffcultyLevel(); difficulty = GetInputValueHandlingExceptions(0, 1, 3); Console.WriteLine(); if (difficulty == 1) { difficulty = 3; difficultyDurability = 10; break; } if (difficulty == 2) { difficulty = 2; difficultyDurability = 5; break; } if (difficulty == 3) { difficulty = 1; difficultyDurability = 2; break; } } while (true); return(hero = new Hero(name, difficulty, difficultyDurability, 1)); }
public void UpdatePrompt(StoryText text, Action <int> callback, string characterIndex = "") { textMeshPro.gameObject.SetActive(true); button.enabled = true; textMeshPro.text = text.ProcessText(); SetTextSettings(text); if (GameState.Instance.characters.ContainsKey(characterIndex)) { Character target = GameState.Instance.characters[characterIndex]; GetComponent <InfoView>().SetInfo(target); } List <Color> ColorMapping = text.MapColor(attributesLookup); CharTweener _tweener = textMeshPro.GetCharTweener(); var sequence = DOTween.Sequence(); for (var i = 0; i < textMeshPro.text.Length; i++) { _tweener.DOColor(i, ColorMapping[i], 0.1f); } ActivateButton(text.settings, callback); }
public static void CompanionAtackEnemyPresentation(List <Hero> enemies) { int enemyNumber = 1; Console.Clear(); Console.WriteLine("Wrogowie, których może zaatakować bohater."); foreach (Hero enemy in enemies) { Console.WriteLine(); Console.WriteLine(enemy.Name); Console.WriteLine(); Console.Write($"Stan wroga: "); HeroColorText(enemy); Console.WriteLine($"Życie: {enemy.Life}"); Console.WriteLine($"Wytrzymałość: {enemy.Durability}"); Console.WriteLine(""); Console.WriteLine(); enemyNumber++; Console.WriteLine(); } StoryText.SelectWayDisplayDelay(i); }
// Four Square constructor public DialogueChoice(StoryText prompt, List <DialogueChoiceOption> textOptions) { this.type = DialogueChoiceType.fourSquare; this.prompt = prompt; this.choiceid = prompt.textID; this.options = textOptions; }
public async Task HandleAsync(SendStory command) { var user = await _userRepository.GetAsync(command.UserId); if (user is null) { throw new UserNotFoundException(command.UserId); } if (user.Locked) { throw new UserLockedException(command.UserId); } var author = Author.Create(user); var storyText = new StoryText(command.Text); _storyTextPolicy.Verify(storyText); var now = _dateTimeProvider.Get(); var visibility = command.VisibleFrom.HasValue && command.VisibleTo.HasValue ? new Visibility(command.VisibleFrom.Value, command.VisibleTo.Value, command.Highlighted) : Visibility.Default(now); var storyId = command.StoryId == default ? _idGenerator.Generate() : command.StoryId; var story = new Story(storyId, author, command.Title, storyText, command.Tags, now, visibility); await _storyRepository.AddAsync(story); _storyRequestStorage.SetStoryId(command.Id, story.Id); await _messageBroker.PublishAsync(new StorySent(story.Id, new StorySent.AuthorModel(author.Id, author.Name), story.Title, story.Tags, story.CreatedAt, new StorySent.VisibilityModel(story.Visibility.From, story.Visibility.To, story.Visibility.Highlighted))); }
private void LoadLevel(int levelNumber, ServiceProvider sp) { if (hero.IsLife) { switch (levelNumber) { case 1: hero = levels.LoadLevel1(hero); LoadLevel(2, sp); break; case 2: hero = levels.LoadLevel2(hero); LoadLevel(3, sp); break; case 3: companion = new Hero(); hero = levels.LoadLevel3(hero, companion); LoadLevel(4, sp); break; case 4: hero = levels.LoadLevel4(hero, companion); break; } } else { Console.Clear(); StoryText.EndOfTheGame(); StoryText.SelectWayDisplayDelay(4); } }
public static DialogueChoice CreateYouTellChoice(Character beingTalkedTo, string weaponText = "", string locationText = "", Character affinity = null) { // You tell <character> that __ likes <string> StoryText tell; if (weaponText != "") { tell = new StoryText("YouTell", "c:0 tell c:1 that ____ likes w:0", new List <Character> { CharacterLibrary.PLAYER, beingTalkedTo }, null, new List <string> { weaponText }); } else if (locationText != "") { tell = new StoryText("YouTell", "c:0 tell c:1 that ____ loves being s:0", new List <Character> { CharacterLibrary.PLAYER, beingTalkedTo }, new List <string> { locationText }); } else { tell = new StoryText("YouTell", "c:0 tell c:1 that ____ hates c:2", new List <Character> { CharacterLibrary.PLAYER, beingTalkedTo, affinity }); } return(new DialogueChoice(tell, GameState.Instance.GetAliveCharacters())); }
public Hero LoadLevel4(Hero hero, Hero hero2) { GameObject gameObject = new GameObject(); TheBeginningOfTheLevel("4"); StoryText.HeroCondition(hero); StoryText.HeroCondition(hero2); StoryText.SelectWayDisplayDelay(1); Level4Text.AfterTheVictoriousBattleWithOgres(); gameObject.Campfire(10, hero); gameObject.Campfire(10, hero2); StoryText.HeroCondition(hero); StoryText.HeroCondition(hero2); Level4Text.FindingASword(); hero.Inventory[1] = new Weapon(5, 20, 10, "Sword"); hero2.Inventory[1] = new Weapon(5, 20, 10, "Sword"); StoryText.SelectWayDisplayDelay(1); StoryText.HeroCondition(hero); StoryText.HeroCondition(hero2); return(hero); }
public static void VictoryInBattle() { Console.Clear(); Console.WriteLine("Zwycięstwo!"); StoryText.SelectWayDisplayDelay(i); }
public static void WeaponDestroyed(Weapon weapon) { Console.Clear(); Console.WriteLine("Twoja broń {0}, uległa zniszczeniu!", weapon.WeponName); StoryText.SelectWayDisplayDelay(i); }
public static void StateOfArms(Weapon weapon) { Console.Clear(); Console.WriteLine($"Po stracie punktu broń ma wytrzymałość: {weapon.Hardness}"); StoryText.SelectWayDisplayDelay(i); }
public static void TheWeaponDoesNotHurt() { Console.Clear(); Console.WriteLine("Broń nie czyni krzywdy przeciwnikowi, za to traci 1 punkt wytrzymałości."); StoryText.SelectWayDisplayDelay(i); }
public override void WriteStory(StoryText storyText) { if (storyText?.Story == null) { return; } WriteLine(storyText.Story); }
public static void OpponentDefeated() { Console.Clear(); Console.WriteLine("Przeciwnik pokonany."); Console.WriteLine(); StoryText.SelectWayDisplayDelay(i); }
public static void InformationWeaponDestroyed() { Console.Clear(); Console.WriteLine("Twoja broń uległa zniszczeniu, nie możesz atakowć."); Console.WriteLine(); StoryText.SelectWayDisplayDelay(i); }
public static void HeroRandomAttack(List <Hero> heroes, List <Hero> enemies, int j, int selectedEnemy) { Console.Clear(); Console.WriteLine($"{heroes[j].Name}, atkuje losowo wybranego przeciwnika {enemies[selectedEnemy].Name}"); Console.WriteLine(); StoryText.SelectWayDisplayDelay(i); }
// Two Square constructor but only one options public DialogueChoice(StoryText prompt, DialogueChoiceOption firstOption) { this.type = DialogueChoiceType.twoSquare; this.prompt = prompt; this.choiceid = prompt.textID; this.options = new List <DialogueChoiceOption> { firstOption }; }
public static void WriteStory(StoryText storyText) { if (storyText?.Story == null) { return; } WriteLine("Story: " + storyText.Story); }
private static void LoadStickScene() { Console.Clear(); Console.SetCursorPosition(0, 0); GraphicGameObjects.DrawStick(20, 0); GraphicGameObjects.WriteLineSetCursorPosition(20, 22, "Stick"); StoryText.SelectWayDisplayDelay(4); Console.Clear(); }
public static void NoWeapon() { Console.Clear(); Console.WriteLine(); Console.WriteLine("Nie posiadasz żadnej broni, nie możesz atakowac. Atakuje ten kto ma broń."); Console.WriteLine(); StoryText.SelectWayDisplayDelay(i); }
public IEnumerator DisplayStoryText(StoryText story) { storyText.gameObject.SetActive(true); storyText.AnimatePrompt(story, SetChoice); yield return(new WaitUntil(() => choice != -1)); storyText.gameObject.SetActive(false); ResetChoice(); }
// Yes No constructor public DialogueChoice(StoryText prompt) { this.type = DialogueChoiceType.yesNo; this.prompt = prompt; this.choiceid = prompt.textID; this.options = new List <DialogueChoiceOption> { new DialogueChoiceOption("yes", DialogueChoiceOption.YES), new DialogueChoiceOption("no", DialogueChoiceOption.NO) }; }
public static void DurabilityDownZero(Hero hero) { Console.Clear(); Console.Write("Bohater "); HeroColorText(hero); Console.WriteLine("Stacił wytrzymałość, brkuje mu sił, żeby atakować."); Console.WriteLine(); StoryText.SelectWayDisplayDelay(i); }
public void AnimatePrompt(StoryText text, Action <int> callback, string characterIndex = "") { textMeshPro.gameObject.SetActive(true); if (button != null) { button.gameObject.SetActive(false); } var sequence = text.settings.byWord ? AnimatePerWord(text, callback) : AnimatePerCharacter(text, callback, characterIndex); }
public override void WriteStory(StoryText storyText) { if (storyText?.Story == null) { return; } foreach (var reporter in _reporters) { reporter.WriteStory(storyText); } }
void Start() { reptiles = new GameObject[4]; Leo = GameObject.Find("/Canvas/Bearded DragonPT"); // Petco Rico = GameObject.Find("/Canvas/IguanaPT"); // Petco Neo = GameObject.Find("/Canvas/Leopard GeckoPT"); // Petco Ted = GameObject.Find("/Canvas/Bearded DragonB"); // Bred Ned = GameObject.Find("/Canvas/IguanaB"); // Bred Shred = GameObject.Find("/Canvas/Leopard GeckoB"); // Bred storytext = GameObject.Find("StoryText"); st = storytext.GetComponent <StoryText>(); }
private string SetYourName() { StoryText.GiveTheNameOfTheHero(); string name = StoryText.GetInputValue(); if (string.IsNullOrWhiteSpace(name)) { name = SetYourName(); } return(name); }
/// <summary> /// Put the user supplied words into the original story text and apply rich text formatting /// </summary> public void CreateFinishedMadLib() { //pull in user entries and add them back into the story text for (int i = wordsToEnter.Count - 1; i >= 0; i--) { StoryText = StoryText.Remove(wordsToEnter[i].Index, wordsToEnter[i].Length); StoryText = StoryText.Insert(wordsToEnter[i].Index, UserSuppliedWords[i]); } //Surround story text with RTF opening and closing tags and replace new lines with RTF paragraphs //This allows the styled text to display correctly in the application. StoryText = @"{\rtf1 " + Regex.Replace(StoryText, @"\r\n", @"\par ") + "}"; }