public void AddPet(CPet pet) { if (!IsPetFull) { Pets[GetPetsCount()] = pet; } else { PetManger.AddPet(PlayerManager.CurrentPlayer.Name, pet); ConsoleUtil.WriteColor("펫쉘로 보내졌습니다."); ConsoleUtil.Pause(); } }
public static void CreatePlayerFile(GamzaPlayer player) { CheckPlayerDir(player.Name); InventoryManager.initEmptyInventory(player.Name); PetManger.InitEmptyFile(player.Name); var path = $"{Dir}/{player.Name}/profile{Suffix}"; Stream ws = new FileStream(path, FileMode.OpenOrCreate); BinaryFormatter serializer = new BinaryFormatter(); serializer.Serialize(ws, player); ws.Close(); // FileStream file = new FileStream(path, FileMode.OpenOrCreate); // XmlSerializer formatter = new XmlSerializer(typeof(GamzaPlayer)); // formatter.Serialize(file, player); // // file.Close(); }
public static void MainMenu() { var q = new List <SelectableQuestion>() { new SelectableQuestion("캐릭터 확인하기"), new SelectableQuestion("캐릭터 바꾸기"), new SelectableQuestion("인벤토리 확인하기"), new SelectableQuestion("펫 확인하기"), new SelectableQuestion("펫 추가하기"), new SelectableQuestion("펫쉘 확인하기"), new SelectableQuestion("모의전투"), new SelectableQuestion("회복하기"), new SelectableQuestion("HP포션 받기"), new SelectableQuestion("종료") }; var answer = ConsoleUtil.AskSelectableQuestion("무엇을 하시겠습니까", q); switch (answer) { case 0: PlayerManager.PrintCurrnetPlayerInfo(); ConsoleUtil.Pause(); break; case 1: SelectPlayer(); break; case 2: InventoryManager.DisplayCurrentInventory(); break; case 3: if (PlayerManager.CurrentPlayer.GetPetsCount() == 0) { Console.Clear(); ConsoleUtil.WriteColor("펫이 없습니다."); ConsoleUtil.Pause(); break; } else { var pets = new List <SelectableQuestion>(); for (int i = 0; i < PlayerManager.CurrentPlayer.GetPetsCount(); i++) { pets.Add(new SelectableQuestion(PlayerManager.CurrentPlayer.Pets[i].Name)); } var index = ConsoleUtil.AskSelectableQuestion("펫", pets); PetManger.ShowPetInfo(PlayerManager.CurrentPlayer.Pets[index]); ConsoleUtil.Pause(); break; } case 4: SelectStartPet(); break; case 5: PetManger.DisplayPet(); break; case 6: var monster = Roads.beginnersForest.SummonMonster(); BattleManager.StartBattle(monster); break; case 7: PlayerManager.CurrentPlayer.HealPets(false); break; case 8: PlayerManager.CurrentInventory.AddItem(new HpPotion(), 1); break; case 9: Environment.Exit(0); break; } }