public void NewChoice(string words, string option1, string option2, string option3) { dialogue = new DialogueClass(words); monologue = false; newDialogue = true; finished = false; displayText = ""; // Choice 1 and choice 2 are required. Choice 3 is optional. Max of 3 choices choice1 = new ChoiceClass(option1, 1); choice2 = new ChoiceClass(option2, 2); choice3 = new ChoiceClass(option3, 3); }
//並び替え用numberが大きいほうが配列番号が小さくなる public int CompareTo(object obj) { ChoiceClass choice = (ChoiceClass)obj; if (number > choice.number) { return(-1); } else if (number < choice.number) { return(1); } return(0); }
//選択可能マスを追加 void AddChoicePos(Vector3Int pos) { //存在しない場所なら if (!playerTask.gameTask.InIfStageData(pos)) { return; } //選択不可な場所なら int mapId = Array.IndexOf(playerTask.gameTask.Special.ChoiceObject, playerTask.gameTask.stageData[pos.x][pos.y][pos.z]); if (mapId == -1) { return; } ChoiceClass choiceObject = new ChoiceClass(pos, playerTask.gameTask.stageData[pos.x][pos.y][pos.z]); choiceObjects.Add(choiceObject); }
static void Main() { Console.CursorVisible = false; DialogMode dialog = new DialogMode(); List <Level> Levels = new List <Level>(); int map_level = 0; int info_log = 0; bool combat = false; // Wczytanie muzyczek z pliku Music _music = new Music(); _music.PlaySong("TravelMusic"); // inicjacja poziomow try { // szukanie wszystkich map string[] dirs = Directory.GetFiles(@"C:\Users\hefaj\source\repos\RPG-Kob\RPG-Kob\maps", "mapa_*"); //Console.WriteLine("Liczba wczytanych map {0}.", dirs.Length); // ładowanie do pamieci wszystkich map foreach (string dir in dirs) { //Console.WriteLine("level"); Levels.Add(new Level(dir)); } } catch (Exception e) { Console.WriteLine("Błąd: {0}", e.ToString()); Environment.Exit(0); } if (Levels.Count == 0) { Environment.Exit(0); } // okno wyboru klasy ChoiceClass cc = new ChoiceClass(); Stats s = cc.Select(); cc = null; // inicjacja gracza Player gracz = new Player("Student", Levels[map_level].Player_loc, s); //dialog.Print(0); //dialog.Print(1); //dialog.Print(2); Console.Clear(); //glowna petla while (true) { // wyswiwtlanie aktywnej mapy Levels[map_level].ShowMap(); // print info log Show_info_log(info_log); // print dostepne akcje Show_all_action(); // wybor akcji //string c = Console.ReadKey(); ConsoleKeyInfo c = Console.ReadKey(); switch (c.Key) { case ConsoleKey.W: info_log = Levels[map_level].Player_Move(new Point(0, -1), gracz); break; case ConsoleKey.S: info_log = Levels[map_level].Player_Move(new Point(0, 1), gracz); break; case ConsoleKey.A: info_log = Levels[map_level].Player_Move(new Point(-1, 0), gracz); break; case ConsoleKey.D: info_log = Levels[map_level].Player_Move(new Point(1, 0), gracz); break; case ConsoleKey.I: while (true) { Console.Clear(); gracz.Stats(); info_log = gracz.Inventory(); Console.WriteLine("(x) Wyłącz plecak"); string o = Console.ReadLine(); if (o == "x") { break; } int i = 0; if (int.TryParse(o, out i)) { gracz.Use_Item(o, combat); } } break; case ConsoleKey.P: gracz.Get_Exp(30); break; case ConsoleKey.M: if (music) { music = !music; } else { //System.Threading.Tasks.Task.Run((Action)PlaySong); music = !music; _music.PlaySong("TravelMusic"); } break; default: { info_log = 0; break; } } if (info_log == 1) { Environment.Exit(0); } //info_log == 2 nic nie robi else if (info_log == 3) { Dictionary <ConsoleKey, Point> loc = new Dictionary <ConsoleKey, Point> { { ConsoleKey.W, new Point(0, -1) }, { ConsoleKey.S, new Point(0, 1) }, { ConsoleKey.A, new Point(-1, 0) }, { ConsoleKey.D, new Point(1, 0) } }; /*dodanie itemu graczowi*/ // pobranie itemu Item item = Levels[map_level].Find_Item(gracz.Get_Loc + loc[c.Key]); //Console.WriteLine(item.Name); gracz.Add_Item(item); } else if (info_log == 4) { /*bitka*/ combat = true; FightMode _arena = new FightMode(gracz, c.Key, Levels[map_level]); combat = false; } else if (info_log == 5) { map_level++; } else if (info_log == 6) { map_level--; } else if (info_log == 7) { Game_Over(); } Console.Clear(); } }