public override void Interact(Entity actor) { if (!IsPlayer(actor)) { return; } Character c = actor as Character; Choice[] choices = new Choice[5]; choices[0] = new Choice("Offer 10", delegate() { Pray(10, c); }); choices[1] = new Choice("Offer 50", delegate() { Pray(50, c); }); choices[2] = new Choice("Offer 100", delegate() { Pray(100, c); }); choices[3] = new Choice("Offer 500", delegate() { Pray(500, c); }); choices[4] = new Choice("Go away", null); ChoiceWindow.Open("Sanctuary", "You are in front of a sanctuary. Try to donnate something and maybe gods will give you something back", choices); }
void LoadFromEventList(Rect windowSize) { if (eventList.majorEvents.Count > 0) { eventWindows.Clear(); for (int i = 0; i < eventList.majorEvents.Count; i++) { EventWindow newWindow = CreateInstance <EventWindow>(); newWindow.windowRect = new Rect(250, 0, windowSize.width - 250, windowSize.height); newWindow.EventName = eventList.majorEvents[i].eventName; newWindow.Description = eventList.majorEvents[i].eventDescription; if (eventList.majorEvents[i].choices.Count > 0) { for (int j = 0; j < eventList.majorEvents[i].choices.Count; j++) { ChoiceWindow newChoice = CreateInstance <ChoiceWindow>(); newChoice.Init(new Rect(6, 160, 252, 280)); newChoice.choiceName = eventList.majorEvents[i].choices[j].choiceName; newChoice.changeStatBy = eventList.majorEvents[i].choices[j].statChanges; newChoice.statsToChange = eventList.majorEvents[i].choices[j].statsToChange; newChoice.LoadFromFile(); newWindow.choices.Add(newChoice); } } eventWindows.Add(newWindow); } currentWindow = eventWindows[0]; } }
public void DrawWindow() { windowTitle = eventName = EditorGUILayout.TextField(eventName); eventDescription = EditorGUILayout.TextArea(eventDescription, GUILayout.Height(100)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Add Choice")) { ChoiceWindow temp = CreateInstance <ChoiceWindow>(); temp.Init(new Rect(6, 160, 252, 280)); choices.Add(temp); ChoiceAdded = true; } if (GUILayout.Button("Remove All")) { choices.Clear(); AllRemoved = true; } GUILayout.EndHorizontal(); using (GUILayout.HorizontalScope scope = new GUILayout.HorizontalScope()) { for (int i = 0; i < choices.Count; i++) { if (i > 0) { choices[i].windowRect.x = choices[i - 1].windowRect.x + choices[i - 1].windowRect.width + 5; } choices[i].DrawWindow(); } } }
public override void Interact(Entity actor) { if (!IsPlayer(actor)) { return; } Choice[] choices = new Choice[4]; choices[0] = new Choice("Buy health potion (" + healthPotionCost + " gold)", delegate() { Inventory i = Player.Instance.GetCharacter().GetInventory(); Item gold = Player.Instance.GetCharacter().GetGold(); if (gold.Get(healthPotionCost)) { i.AddItem(new Item("Health potion", 1)); } else { InformationWindow.ShowInformation("No money", "You are to poor to pay for health potion!", false); } }); choices[1] = new Choice("Buy stamina potion (" + staminaPotionCost + " gold)", delegate() { Inventory i = Player.Instance.GetCharacter().GetInventory(); Item gold = Player.Instance.GetCharacter().GetGold(); if (gold.Get(staminaPotionCost)) { i.AddItem(new Item("Stamina potion", 1)); } else { InformationWindow.ShowInformation("No money", "You are to poor to pay for stamina potion!", false); } }); choices[2] = new Choice("Buy better equipment (" + equipmentCost + " gold)", delegate() { Item gold = Player.Instance.GetCharacter().GetGold(); if (gold.Get(equipmentCost)) { Attribute damage = Player.Instance.GetCharacter().GetDamage(); damage.IncreaseMaxValue(equipmentQuality); damage.ResetValue(); } else { InformationWindow.ShowInformation("No money", "You are to poor to pay for new equipment potion!", false); } }); choices[3] = new Choice("Go away", null); ChoiceWindow.Open("City", "You are in the city of Patrunacs", choices); }
public static void Open(string title, string description, Choice[] choices) { Event e = new Event(); e.SetOnEventTriggerMethod(delegate() { ChoiceWindow window = ObjectPool.Get <ChoiceWindow>(); window.SetTitle(title); window.SetDescription(description); window.SetChoices(choices); }); }
public void Choice(string c1, string c2) { StartCoroutine(Choise()); IEnumerator Choise() { ChoiceWindow choice = MessageSystem.GetChoise(); yield return(choice.Choice(c1, c2)); LuaScript.instance.Resume(); yield break; } }
public dynamic CreateChoiceWindow(string msg, string btnLeft = null, string btnRight = null, string btnCancel = null) { var window = new ChoiceWindow() { Owner = App.Current.MainWindow, Message = msg }; window.BtnLeft = btnLeft ?? window.BtnLeft; window.BtnCancel = btnCancel ?? window.BtnCancel; window.BtnRight = btnRight ?? window.BtnRight; return(window); }
public int DoChoice(string msg, string btnLeft = null, string btnRight = null, string btnCancel = null) { var window = new ChoiceWindow() { Owner = App.Current.MainWindow, Message = msg }; window.BtnLeft = btnLeft ?? window.BtnLeft; window.BtnCancel = btnCancel ?? window.BtnCancel; window.BtnRight = btnRight ?? window.BtnRight; window.ShowDialog(); return(window.ClickedBtn); }
private string ChooseImageSavePath() { var filepaths = FileLocator.MakeAlbumImagePathlist(Mapper.Map <Album>(Album)); if (filepaths.Count == 1) { return(filepaths[0]); } var choice = new ChoiceWindow(); choice.SetChoiceList(filepaths); choice.ShowDialog(); return(choice.ChoiceResult); }
public void SetChoice(ChoiceWindow window, Choice choice) { SetText(choice.GetTitle()); Button btn = GetComponent <Button>(); btn.onClick.RemoveAllListeners(); if (choice.HasTrigger()) { btn.onClick.AddListener(choice.Trigger); } else { btn.onClick.AddListener(window.Close); } }
public override void Interact(Entity actor) { if (!IsPlayer(actor)) { return; } Choice[] choices = new Choice[3]; choices[0] = new Choice("Training (" + trainingGoldRequired + " gold)", delegate() { Player p = Player.Instance; Item gold = p.GetCharacter().GetGold(); if (gold.Get(trainingGoldRequired)) { p.Training(1); trainingGoldRequired += 10; } else { InformationWindow.ShowInformation("No money", "You are to poor to pay for training!", false); } }); choices[1] = new Choice("Rest (" + restGoldRequired + " gold)", delegate() { Player p = Player.Instance; Item gold = p.GetCharacter().GetGold(); if (gold.Get(restGoldRequired)) { p.GetCharacter().GetHealth().ResetValue(); p.GetCharacter().GetStamina().ResetValue(); } else { InformationWindow.ShowInformation("No money", "You are to poor to pay for training!", false); } }); choices[2] = new Choice("Go away", null); ChoiceWindow.Open("Castle", ToString(), choices); }
public IEnumerator Talk() { MessageWindow messageWindow = MessageSystem.GetWindow(); ChoiceWindow choiceWindow = MessageSystem.GetChoise(); InteractableStart(); yield return(StartCoroutine(messageWindow.ShowClick("ひと晩" + roomCharge + "ゴールドですが\nおとまりになられますか"))); yield return(StartCoroutine(choiceWindow.Choice())); int choiceResult = choiceWindow.Result(); if (choiceResult == 1) { if (GameController.Instance.money <= 0) { yield return(StartCoroutine(messageWindow.ShowClick("お金が たりないようです"))); messageWindow.Close(); InteractableEnd(); yield break; } yield return(StartCoroutine(messageWindow.ShowClick("それでは ごゆっくり おやすみください"))); GameController.Instance.money -= roomCharge; Stay(); yield return(StartCoroutine(SceneFader.FadeSceneOut())); yield return(StartCoroutine(SceneFader.FadeSceneIn())); yield return(StartCoroutine(messageWindow.ShowClick("おはようございます。ではいってらっしゃいませ"))); } else { yield return(StartCoroutine(messageWindow.ShowClick("お気をつけて 旅をつづけられますように"))); } messageWindow.Close(); InteractableEnd(); yield break; }
public int ChoiceResult() { ChoiceWindow choice = MessageSystem.GetChoise(); return(choice.Result()); }
private async void MoveAlbum() { if (_albumToMove == null) { MessageBox.Show("Please select album to move"); return; } await _albumService.MoveAlbumToPerformerAsync(_albumToMove.Id, SelectedPerformer.Id); var album = Mapper.Map <Album>(_albumToMove); var performer = Mapper.Map <Performer>(_selectedPerformer); _albumToMovePerformer.Albums.Remove(_albumToMove); _albumToMovePerformer.UpdateAlbumCollectionRate(_rateCalculator); _albumToMove.Performer = performer; _albumToMove.LocateImagePath(); if (MessageBox.Show("Do you want to move all corresponding files as well?", "Confirmation", MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes) { await InsertAlbumToCollectionAsync(_albumToMove); return; } var pathlist = FileLocator.MakePerformerImagePathlist(performer); var path = string.Empty; if (pathlist.Count == 1) { path = Path.GetDirectoryName(pathlist.First()); } else { var choice = new ChoiceWindow(); choice.SetChoiceList(pathlist.Select(p => Path.GetDirectoryName(p))); choice.ShowDialog(); path = choice.ChoiceResult; Directory.CreateDirectory(path); } // move album cover image file var albumPath = FileLocator.GetAlbumImagePath(album); if (albumPath != string.Empty) { File.Move(albumPath, $"{path}\\{Path.GetFileName(albumPath)}"); _albumToMove.LocateImagePath(); } // move folder with song files var albumFolder = FileLocator.FindAlbumPath(album); if (albumFolder != string.Empty) { var destinationFolder = $"{Path.GetDirectoryName(path)}\\{new DirectoryInfo(albumFolder).Name}"; if (Path.GetPathRoot(albumFolder) == Path.GetPathRoot(path)) { Directory.Move(albumFolder, destinationFolder); } // !!!!! .NET, are you kidding me? ((( else { Directory.CreateDirectory(destinationFolder); foreach (string dir in Directory.GetDirectories(albumFolder, "*", SearchOption.AllDirectories)) { Directory.CreateDirectory(Path.Combine(destinationFolder, dir.Substring(albumFolder.Length + 1))); } foreach (string file in Directory.GetFiles(albumFolder, "*", SearchOption.AllDirectories)) { File.Copy(file, Path.Combine(destinationFolder, file.Substring(albumFolder.Length + 1))); } Directory.Delete(albumFolder, true); } } await InsertAlbumToCollectionAsync(_albumToMove); _albumToMove = null; _albumToMovePerformer = null; }