public void take() { if (Item_Selection_Window != null) { var stacked_items = Supply_Window.active_stacked_items(); actor.gain_item(stacked_items[Item_Selection_Window.index].acquire_item()); if (Item_Selection_Window.item_count == 1 || !can_take) { Global.game_system.play_se(System_Sounds.Cancel); cancel_selecting_take(); if (!can_take) { cancel_trading(); } } else { Global.game_system.play_se(System_Sounds.Confirm); } Traded = true; // Try to equip if (Item_Window.equipped == 0) { actor.setup_items(false); Item_Window.refresh_equipped_tag(); } refresh(); supply_window_index_changed(); } else { if (Supply_Window.can_take_active_item(this.actor)) { var item_data = Supply_Window.active_item.acquire_item(); actor.gain_item(item_data); if (!can_take) { Global.game_system.play_se(System_Sounds.Cancel); cancel_trading(); } else { Global.game_system.play_se(System_Sounds.Confirm); } Traded = true; // Try to equip if (Item_Window.equipped == 0) { actor.setup_items(false); Item_Window.refresh_equipped_tag(); } refresh(); supply_window_index_changed(); } else { Global.game_system.play_se(System_Sounds.Buzzer); } } }
public void cancel_trading() { create_command_window(Supply_Command_Window.All); var command = Restocking ? Supply_Command_Window.Restock : (Giving ? Supply_Command_Window.Give : Supply_Command_Window.Take); Command_Window.index = (int)command - 1; if (Taking) { Command_Window.current_cursor_loc = Supply_Window.current_cursor_loc - new Vector2(0, 16 * Supply_Window.scroll); } else { Command_Window.current_cursor_loc = Item_Window.current_cursor_loc; } //Item_Window.active = false; // unneeded since this window is about to be replaced //Debug Supply_Window.active = false; Giving = false; Taking = false; Restocking = false; Item_Window.restore_equipped(); unit.actor.staff_fix(); refresh_item_window(); HelpFooter.refresh(this.unit, null); }
public void give() { TactileLibrary.Item_Data item_data = actor.items[Item_Window.index]; if (!actor.can_give(item_data)) { Global.game_system.play_se(System_Sounds.Buzzer); return; } Global.game_battalions.add_item_to_convoy(actor.items[Item_Window.index]); bool giving_equipped = Item_Window.index == actor.equipped - 1; actor.discard_item(Item_Window.index); // If can't give anymore if (!can_give) { Global.game_system.play_se(System_Sounds.Cancel); cancel_trading(); } else { Global.game_system.play_se(System_Sounds.Confirm); } Traded = true; if (Item_Window.index < Item_Window.equipped || Item_Window.equipped == 0) { actor.setup_items(false); Item_Window.refresh_equipped_tag(); } refresh(); item_window_index_changed(); // Add jumping to the correct page and probably jumping to the correct line for the item here //Debug? Supply_Window.jump_to(item_data); }
private void update_unit_inventory(bool active) { if (active) { if (is_help_active) { if (Item_Window.is_canceled()) { close_help(); } } else if (giving) { if (Item_Window.is_canceled()) { Global.game_system.play_se(System_Sounds.Cancel); close(); } else if (Item_Window.is_selected()) { give(); } else if (Item_Window.getting_help()) { open_help(); } } } }
protected override void update_item_window() { int item_index = Item_Window.index; Item_Window.update(Giving || Restocking); if (item_index != Item_Window.index) { item_window_index_changed(); } }
protected override void draw_command_windows(SpriteBatch spriteBatch) { if (!Giving) { Item_Window.draw(spriteBatch); Supply_Window.draw(spriteBatch); } else { Supply_Window.draw(spriteBatch); Item_Window.draw(spriteBatch); } }
public override void close_help() { if (Giving) { Item_Window.close_help(); } else { if (Item_Selection_Window != null) { Item_Selection_Window.close_help(); } else { Supply_Window.close_help(); } } }
protected override void new_item_window() { int index = Item_Window == null ? 0 : Item_Window.index; if (Item_Window != null) { Item_Window.restore_equipped(); } Item_Window = new Window_Command_Item_Supply( unit.actor.id, new Vector2( 8, Config.WINDOW_HEIGHT - (Global.ActorConfig.NumItems + 2) * 16), Restocking); if (Item_Window.num_items() > 0) { Item_Window.immediate_index = index; } Item_Window.active = Giving || Restocking; }
public override void open_help() { if (Giving || Restocking) { Item_Window.open_help(); } else if (Taking) { if (Item_Selection_Window != null) { Item_Selection_Window.open_help(); } else { Supply_Window.open_help(); } } else { } }