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 give() { TactileLibrary.Item_Data item_data = actor.items[Item_Window.index]; if (!can_give || !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]); actor.discard_item(Item_Window.index); if (can_give) { Global.game_system.play_se(System_Sounds.Confirm); } else { Global.game_system.play_se(System_Sounds.Cancel); } Traded = true; 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); if (can_give) { Item_Window.active = true; } else { switch_giving(); } }
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); }
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(); } } }
public void take() { if (!can_take) { Global.game_system.play_se(System_Sounds.Buzzer); return; } 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) { Global.game_system.play_se(System_Sounds.Cancel); cancel_selecting_take(); } else { Global.game_system.play_se(System_Sounds.Confirm); } Traded = true; 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); Global.game_system.play_se(System_Sounds.Confirm); Traded = true; refresh(); supply_window_index_changed(); } else { Global.game_system.play_se(System_Sounds.Buzzer); } } }
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 { } }
private void update_taking(bool active) { if (active) { if (selecting_take) { if (is_help_active) { if (Item_Selection_Window.is_canceled()) { close_help(); } } else { if (Item_Selection_Window.is_canceled()) { Global.game_system.play_se(System_Sounds.Cancel); cancel_selecting_take(); } else if (Item_Selection_Window.is_selected()) { take(); } else if (Item_Selection_Window.getting_help()) { open_help(); } } } else if (taking) { if (is_help_active) { if (Supply_Window.is_canceled()) { close_help(); } } else { if (Supply_Window.is_canceled()) { Global.game_system.play_se(System_Sounds.Cancel); cancel_trading(); } else if (Supply_Window.is_selected()) { if (Constants.Gameplay.CONVOY_ITEMS_STACK == Convoy_Stack_Types.Full) { select_take(); } else { take(); } } else if (Global.Input.triggered(Inputs.X) && Constants.Gameplay.CONVOY_ITEMS_STACK == Convoy_Stack_Types.Full) { take(); } else if (Supply_Window.getting_help()) { open_help(); } } } } }
protected override void update_ui(bool active) { if (active) { if (Global.Input.triggered(Inputs.X) || SwitchButton.consume_trigger(MouseButtons.Left) || SwitchButton.consume_trigger(TouchGestures.Tap)) { Global.game_system.play_se(System_Sounds.Menu_Move2); switch_giving(); HardSwitch = this.giving; Supply_Window.show_type_icon(); return; } } if (active && this.taking && this.can_give) { // Pressed left on the first weapon type // Press right on the last weapon type if (Global.game_system.Supply_Item_Type == 0 && Global.Input.repeated(Inputs.Left)) { Global.game_system.play_se(System_Sounds.Menu_Move2); Supply_Window.change_page(0); switch_giving(); Supply_Window.hide_type_icon(); return; } else if (Global.game_system.Supply_Item_Type == Supply_Window.supply_type_count - 1 && Global.Input.repeated(Inputs.Right)) { Global.game_system.play_se(System_Sounds.Menu_Move2); Supply_Window.change_page(0); switch_giving(); Supply_Window.hide_type_icon(); return; } } int item_index = Item_Window.index; base.update_ui(active); if (this.giving && item_index == Item_Window.index) { if (Global.Input.repeated(Inputs.Left)) { Global.game_system.play_se(System_Sounds.Menu_Move2); if (!HardSwitch) { Supply_Window.change_page(Supply_Window.supply_type_count - 1); } switch_giving(); } else if (Global.Input.repeated(Inputs.Right)) { Global.game_system.play_se(System_Sounds.Menu_Move2); if (!HardSwitch) { Supply_Window.change_page(0); } switch_giving(); } } }