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

SetState(kPause, true);

MakeDialog {
    name = "AvatarUnlockedDialog";

    Bitmap {
        name = "bmpBgAlpha";
        image = "gpx/screens/transparent_background";
        x = 0; y = 0;
        alpha = true;
    };

    wndMove {
        x = kCenter; y = kCenter;
        w = kMax; h = kMax;

        wndAvatarUnlocked {
            x = 0; y = 0;
            w = kMax; h = kMax;

            avatar_cat_x = 575;
            avatar_cat_y = 130; 
            avatar_dog_x = 570;
            avatar_dog_y = 170;

            Bitmap {
                name = "bmpPanel";
                image = "gpx/screens/panel03";
                x = kCenter; y = kCenter;

                clsText {
                    name = "lblAvatarUp";
                    label= "lblAvatarUp";
                    font = Font42;
                    Scale = 0.5;
                    Space = -15;
                    x = 27; y = 3;
                    w = 310; h = 80;
                    flags = kVAlignCenter + kHAlignCenter;
                };
                clsText {
                    name = "lblUnlockedUp";
                    label= "lblUnlockedUp";
                    font = Font420;
                    Scale = 0.5;
                    Space = -10;
                    x = 27; y = 43;
                    w = 310; h = 80;
                    flags = kVAlignCenter + kHAlignCenter;
                };

                Text {
                    name = "lblAvatarUnlockContent";
                    label = "lblAvatarUnlockContent";
                    font = Font14;
                    x = 27; y = 95;
                    w = 310; h = 80;
                    flags = kVAlignCenter + kHAlignCenter;
                };

                SetStyle(PausedButtonStyle),
                Button {
                    name = "btnSwitchAvatar";
                    label = "btnSwitchAvatar";
                    x = 87; y = 179;
                    scale = 0.6;
                    command = function()
                        PopModal("AvatarUnlockedDialog");

                        gEnterNameValue = gsw_getCurrentUserString("swtName","");
                        gTypeAvatar = gfn_getCurrentUserAvatar();
				        gRegisterMode = "cancel";
                        name = DoModal("scripts/register_user.lua");
                        if (not(name == nil)) then
                            gsw_changeCurrentUserName(name);
                            gnf_changeAvatar(gTypeAvatar);
                        end

                        SetState(kPause, false);
                    end
                };
                Button {
                    name = "btnContinue";
                    label = "continue";
                    x = 87; y = 217;
                    scale = 0.6;
                    command = function()
                        PopModal("AvatarUnlockedDialog");
                        SetState(kPause, false);
                    end
                };
            };
        };
    };
}
