public MainWindow() { InitializeComponent(); pokemon = new Pokemon() { name = "妙蛙種子", hp = 20, powerUpCandy = 2 }; master = new PokemonMaster() { name = "帽子哥", powerUpCandy = 5, evolveCandy = 10 }; // 呼叫繪製視窗的函式 Render(); }
private void Awake() { Instance = this; trainerList = new Dictionary<string, PokemonTrainer>(); usersLocation = Application.dataPath + "/PokemonUsers.json"; pokemonDatabase = Application.dataPath + "/PokemonDatabase.json"; Debug.Log(File.Exists(pokemonDatabase)); if (File.Exists(pokemonDatabase)) { pokemonDictionary = JsonConvert.DeserializeObject<Dictionary<string, Pokemon>>(File.ReadAllText(pokemonDatabase)); } else { StartCoroutine(UIController.Instance.DisplayErrorMessage("No pokemon database detected in root directoy. Bot will not run without it. The application will now close.", true)); } if (File.Exists(usersLocation)) { trainerList = JsonConvert.DeserializeObject<Dictionary<string, PokemonTrainer>>(File.ReadAllText(usersLocation)); } else File.Create(usersLocation); }