--============================================================================
--  register_user.lua
--  Copyright (c) 2010, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------
require("scripts/style.lua");

function closeQuickPlay()
    SwapToModal("scripts/loading.lua");
end

function onQuickPlay_ModeSelected(namePanel, difficulty)
    if namePanel == "PanelClassic" then
        gGameMode = "Classic";
    elseif namePanel == "PanelBlitz" then
        gGameMode = "Blitz";
    elseif namePanel == "PanelStrategy" then
        gGameMode = "Strategy";
    elseif namePanel == "PanelCradleRome" then
        gGameMode = "Rome";
    elseif namePanel == "PanelJoker" then
        gGameMode = "Joker";
    else
        gGameMode = "";
    end

    if (gGameMode ~= "") then
        gGameDifficulty = difficulty;

        SetState(kPause, false);
        gfn_onQuickPlayButton_Play();
    end
end

function PanelModeGame(panel)
    local st_easy = GetTag(panel, "st_easy");
    local st_medium = GetTag(panel, "st_medium");
    local st_hard = GetTag(panel, "st_hard");
    if (not st_easy) then
        st_easy = 0;
    end
    if (not st_medium) then
        st_medium = 0;
    end
    if (not st_hard) then
        st_hard = 0;
    end

    return Group {
        clsPanelModeGame {
            name = panel.name;
            x = panel.x; y = panel.y;
            w = panel.w; h = panel.h;

            st_easy = st_easy;
            st_medium = st_medium;
            st_hard = st_hard;

            Bitmap {
                image = panel.image;
                name = panel.name.."_bitmap";

                Text {
                    name = "lblTitle";
                    font = Font23;
                    x = 63; y = 19;
                    w = 370; h = 35;
                    flags = kHAlignCenter + kVAlignCenter;
                    label = panel.title;
                };
                Text {
                    name = "lblContent";
                    font = Font16;
                    x = 68; y = 72;
                    w = 170; h = 100;
                    flags = kHAlignCenter + kVAlignCenter;
                    label = panel.content;
                };

                -- Button Easy.
                SetStyle(PausedButtonStyle);
                Bitmap {
                    name = "btnDifficulty1_off";
                    image = QuickPlayButtonGpx[4];
                    x = 261; y = 68;
                    w = 328; h = 60;
                    scale = 0.6;

                    Text {
                        name = "lblDifficulty1";
                        font = Font18;
                        w = kMax; h = kMax;
                        flags = kHAlignCenter + kVAlignCenter;
                        label = "lblDifficulty1";
                        x = 0; y = 0;
                        scale = 0.60;
                    };
                };
                Button {
                    name = "btnDifficulty1";
                    label = "lblDifficulty1";
                    x = 261; y = 68;
                    scale = 0.6;
                    graphics = QuickPlayButtonGpx;
                    command = function()
                        onQuickPlay_ModeSelected(panel.name, "easy");
                    end
                };


                -- Button Medium.
                Bitmap {
                    name = "btnDifficulty2_off";
                    image = QuickPlayButtonGpx[4];
                    x = 261; y = 104;
                    w = 328; h = 60;
                    scale = 0.6;

                    Text {
                        name = "lblDifficulty2";
                        font = Font18;
                        w = kMax; h = kMax;
                        flags = kHAlignCenter + kVAlignCenter;
                        label = "lblDifficulty2";
                        x = 0; y = 0;
                        scale = 0.6;
                    };
                };
                Button {
                    name = "btnDifficulty2";
                    x = 261; y = 104;
                    scale = 0.6;
                    graphics = QuickPlayButtonGpx;
                    label = "lblDifficulty2";
                    command = function()
                        onQuickPlay_ModeSelected(panel.name, "medium");
                    end
                };

                -- Button Hard.
                Bitmap {
                    name = "btnDifficulty3_off";
                    image = QuickPlayButtonGpx[4];
                    x = 261; y = 141;
                    w = 328; h = 60;
                    scale = 0.6;

                    Text {
                        name = "lblDifficulty3";
                        font = Font18;
                        w = kMax; h = kMax;
                        flags = kHAlignCenter + kVAlignCenter;
                        label = "lblDifficulty3";
                        x = 0; y = 0;
                        scale = 0.6;
                    };
                };
                Button {
                    name = "btnDifficulty3";
                    label = "lblDifficulty3";
                    x = 261; y = 141;
                    graphics = QuickPlayButtonGpx;
                    scale = 0.6;
                    command = function()
                        onQuickPlay_ModeSelected(panel.name, "hard");
                    end
                };

                -- Padlocks.
                Bitmap {
                    name = "bmpDifficulty1_lock1";
                    image = "gpx/screens/locked_icon";
                    x = 342; y = 66;
                    scale = 0.65;
                };
                Bitmap {
                    name = "bmpDifficulty2_lock1";
                    image = "gpx/screens/locked_icon";
                    x = 342; y = 102;
                    scale = 0.65;
                };
                Bitmap {
                    name = "bmpDifficulty3_lock1";
                    image = "gpx/screens/locked_icon";
                    x = 342; y = 140;
                    scale = 0.65;
                };
            };
        };
    }
end

MakeDialog {
    name = "QuickPlayDialog";

    wndQuickPlay {
        x = 0; y = 0;
        w = 1024; h = 768;

        ToolTip_Position = {
            264; 178;
            264; 208;
            264; 240;
            743; 178;
            743; 208;
            743; 240;
            264; 377;
            264; 409;
            264; 441;
            743; 377;
            743; 409;
            743; 441;
            497; 577;
            497; 609;
            497; 639;
        };

        Bitmap {
            image = "gpx/screens/newplayer_background";
            name = "bmpPanelBg";
            x = 0; y = 0;
            autoscale = true;
        };

        clsText {
            name = "lblTitle";
            font = Font60White;
            flags = kHAlignCenter + kVAlignCenter;
            label = "lblQuickPlayTitle";
            x = kCenter; y = 10;
            w = 400; h = 70;
            Scale = 0.6;
            Space = -10;
        };

        PanelModeGame {
            name = "PanelClassic";
            image = "gpx/screens/quickplay_panel01";
            title = "lblClassicTitle";
            content = "lblClassicContent";
            x = 51; y = 79;
            w = 448; h = 196;

            --st_medium = 0;
            --st_hard = 0;
        };

        PanelModeGame {
            name = "PanelBlitz";
            image = "gpx/screens/quickplay_panel02";
            title = "lblBlitzTitle";
            content = "lblBlitzContent";
            x = 520; y = 79;
            w = 448; h = 196;
        };

        PanelModeGame {
            name = "PanelStrategy";
            image = "gpx/screens/quickplay_panel03";
            title = "lblStrategyTitle";
            content = "lblStrategyContent";
            x = 51; y = 281;
            w = 448; h = 196;
        };

        PanelModeGame {
            name = "PanelCradleRome";
            image = "gpx/screens/quickplay_panel04";
            title = "lblCradleRomeTitle";
            content = "lblCradleRomeContent";
            x = 520; y = 281;
            w = 448; h = 196;
        };

        PanelModeGame {
            name = "PanelJoker";
            image = "gpx/screens/quickplay_panel05";
            title = "lblJokerTitle";
            content = "lblJokerContent";
            x = 280; y = 481;
            w = 448; h = 196;
        };

        SetStyle(OptionButtonStyle);
        Button {
            name = "btnBack";
            label = 'btnBack';
            x = 445; y = 695;
            command = function()
                gfn_onQuickPlayButton_Back();
            end
        };

        Bitmap {
            name = "gpxToolTip";
            image = "gpx/screens/tooltip";
            x = 265; y = 170; w = 199; h = 66;

            Text {
                label = "High Score";
                x = 13; y = 21; w = 165; h = 14;
                font = Font13;
                flags = kHAlignCenter + kVAlignCenter;
            };

            Text {
                name = "txtScore";
                x = 13; y = 36; w = 165; h = 20;
                font = Font20;
                flags = kHAlignCenter + kVAlignCenter;
            };
        };
    };
};

