Пример #1
0
        private void trade(Supply_Command_Window selectedOption)
        {
            switch (selectedOption)
            {
            case (Supply_Command_Window.Give):
                if (can_give)
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    Item_Window.active             = true;
                    Item_Window.current_cursor_loc = Command_Window.current_cursor_loc;
                    create_command_window(Supply_Command_Window.Give);
                    Giving = true;
                    item_window_index_changed();
                }
                else
                {
                    Global.game_system.play_se(System_Sounds.Buzzer);
                }
                break;

            case (Supply_Command_Window.Take):
                if (can_take)
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    Supply_Window.active             = true;
                    Supply_Window.current_cursor_loc =
                        Command_Window.current_cursor_loc +
                        new Vector2(0, 16 * Supply_Window.scroll);
                    create_command_window(Supply_Command_Window.Take);
                    //Supply_Window.refresh_cursor_loc(false); //Debug
                    Taking = true;
                    supply_window_index_changed();
                }
                else
                {
                    Global.game_system.play_se(System_Sounds.Buzzer);
                }
                break;

            case (Supply_Command_Window.Restock):
                if (can_restock)
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    Restocking = true;
                    refresh_item_window();
                    Item_Window.active             = true;
                    Item_Window.current_cursor_loc = Command_Window.current_cursor_loc;
                    create_command_window(Supply_Command_Window.Restock);
                    item_window_index_changed();
                }
                else
                {
                    Global.game_system.play_se(System_Sounds.Buzzer);
                }
                break;
            }
        }
Пример #2
0
        private void create_command_window(Supply_Command_Window type)
        {
            List <string> commands;

            switch (type)
            {
            case Supply_Command_Window.Give:
                commands = new List <string> {
                    "Give"
                };
                break;

            case Supply_Command_Window.Take:
                commands = new List <string> {
                    "Take"
                };
                break;

            case Supply_Command_Window.Restock:
                commands = new List <string> {
                    "Restock"
                };
                break;

            default:
                if (this.restock_blocked)
                {
                    commands = new List <string> {
                        "Give", "Take"
                    }
                }
                ;
                else
                {
                    commands = new List <string> {
                        "Give", "Restock", "Take"
                    }
                };
                break;
            }
            int     width = 56;
            int     i     = Math.Max(0, (int)type - 1);
            Vector2 loc   = new Vector2(
                (64 + 12) + ((i % 2) * (width - 16)),
                (36 - 2) + ((i / 2) * 16));

            //Vector2 loc = new Vector2( //Debug
            //    (64 + 36),
            //    (36 - 2));
            Command_Window = new Window_Command(loc, width, commands);
            Command_Window.set_columns(this.restock_blocked ? 1 : 2);
            Command_Window.glow_width      = width - 8;
            Command_Window.glow            = true;
            Command_Window.bar_offset      = new Vector2(-8, 0);
            Command_Window.text_offset     = new Vector2(0, -4);
            Command_Window.size_offset     = new Vector2(-8, -8);
            Command_Window.greyed_cursor   = type != Supply_Command_Window.All;
            Command_Window.active          = type == Supply_Command_Window.All;
            Command_Window.texture         = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Preparations_Item_Options_Window");
            Command_Window.immediate_index = 0;
            Command_Window.color_override  = 0;
            Command_Window.stereoscopic    = Config.CONVOY_WINDOW_DEPTH;
        }