/// <summary> /// Initialize savegame windows /// </summary> public void InitializeWindows() { // Make help window helpWindow = new WindowHelp(); helpWindow.SetText(helpText); // Make save file window savefileWindows = new WindowSaveFile[4]; for (int i = 0; i < 4; i++) { savefileWindows[i] = new WindowSaveFile(i, MakeFilename(i), container); } // Select last file to be operated fileIndex = InGame.Temp.LastFileIndex; savefileWindows[fileIndex].IsSelected = true; // Loading is now possible isLoadingReady = true; }
/// <summary> /// Frame Update (when buy window is active) /// </summary> void UpdateBuy() { // Set status window item statusWindow.Item = buyWindow.Item; // If B button was pressed if (Input.RMTrigger.B) { // Play cancel SE InGame.System.SoundPlay(Data.System.CancelSoundEffect); // Change windows to initial mode commandWindow.IsActive = true; dummyWindow.IsVisible = true; buyWindow.IsActive = false; buyWindow.IsVisible = false; statusWindow.IsVisible = false; statusWindow.Item = null; // Erase help text helpWindow.SetText(""); return; } // If C button was pressed if (Input.RMTrigger.C) { // Get item item = buyWindow.Item; // If item is invalid, or price is higher than money possessed if (item == null || item.Price > InGame.Party.Gold) { // Play buzzer SE InGame.System.SoundPlay(Data.System.BuzzerSoundEffect); return; } // Get items in possession count int _number = 0; switch (item.GetType().Name) { case "Item": _number = InGame.Party.ItemNumber(item.Id); break; case "Weapon": _number = InGame.Party.WeaponNumber(item.Id); break; case "Armor": _number = InGame.Party.ArmorNumber(item.Id); break; } // If 99 items are already in possession if (_number == 99) { // Play buzzer SE InGame.System.SoundPlay(Data.System.BuzzerSoundEffect); return; } // Play decision SE InGame.System.SoundPlay(Data.System.DecisionSoundEffect); // Calculate maximum amount possible to buy int _max = item.Price == 0 ? 99 : InGame.Party.Gold / item.Price; _max = Math.Min(_max, 99 - _number); // Change windows to quantity input mode buyWindow.IsActive = false; buyWindow.IsVisible = false; numberWindow.Set(item, _max, item.Price); numberWindow.IsActive = true; numberWindow.IsVisible = true; } }