dofile('data/Lua/Screens/DialogYesNo.lua')

function SetCaptions(screen)
	text_title = CreateTextEntity("WindowText28", GetString("Q_DELETE"))
    text_title:AttachTo( screen:GetObject('YesNoScreen') )
	text_title:SetScale(1)
	text_title:SetZ(190)
	text_title:SetXY(10, -70)
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
    
    -- destroy this screen
    if dialog then
        dialog:SetAllowInput(false)
        dialog:ScreenDestroy()
        dialog = nil
    end        
    
    if title == 'yes' then
        local player = GetGameManager():GetCurrPlayer()
        if player then
            GetGameManager():DeletePlayer(player:GetName())
            local first_player = GetGameManager():GetPlayerIndex(0)
            if first_player then
                GetGameManager():SetCurrPlayer( first_player:GetName() )
            end
        end -- if player then
    end
    
    if title == 'no' then
    end

    players_screen:Go()
    players_screen:SetAllowInput(true)
    
    UpdateUserPlayersScreen(true)
end
