//
// Attract-Mode Front-End : "Vertical Arcade" layout
// Made by 배고픈마리오 (CSOne)
// Ver.2.1 (2022.03.20) Auto Rotated Screen 
// Ver.2.0 (2021.02.17) Vewlix Cabinet added 
// Ver.1.1 (2019.12.22)
// Ver.1.0 (2019.12.19)

local orderx = 0;
class UserConfig { 
</ label="글꼴(게임목록)", help="화면에 표시되는 글자 폰트를 변경할 수 있습니다.", options="TmonMonsori,TT,Font,NanumGothicBold,User1,User2,User3", order=orderx++ /> select_font1="TmonMonsori";
</ label="글꼴(시계)", help="화면에 표시되는 글자 폰트를 변경할 수 있습니다.", options="TmonMonsori,TT,Font,NanumGothicBold,User1,User2,User3", order=orderx++ /> select_font2="TmonMonsori";
</ label="화면 늘리기", help="게임기통의 화면을 강제를 늘리려면 Yes를 원본비율로 표시하려면 No를 선택하세요. 'No' is original rate.", options="Yes,No", order=orderx++ /> enable_stretch="Yes";
</ label="모니터 스캔라인", help="게임기통 화면에 스캔라인 효과를 주거나 끌수 있습니다.", options="On,Off", order=orderx++ /> enable_scanline="On";
</ label="조작키 안내", help="조작키 설명 이미지를 선택할 수 있습니다.", options="XBOX360,PS Pad,Keyboard,off", order=orderx++ /> select_Keyinfo="XBOX360";
</ label="즐겨찾기 아이콘", help="즐겨찾기 아이콘을 목록전체에 표시할지 말지 선택할 수 있습니다.", options="On,Off", order=orderx++ /> enable_Fav_icon="On";
} 

local my_config = fe.get_config();
fe.layout.font=my_config["select_font1"];
fe.layout.width=1080;
fe.layout.height=1920;
fe.layout.orient=RotateScreen.Left
local blip = fe.layout.height;
local flx = fe.layout.width;
local fly = fe.layout.height;
local flw = fe.layout.width;
local flh = fe.layout.height;


// 레이아웃 비율조절 

//fe.layout.preserve_aspect_ratio = true;

#fe.load_module("animate");
fe.load_module( "animate_old" );
fe.add_image( "bg_black.png", 0, 0, 1080, 1920);
fe.add_image( "bg_white.png", 80, 0, 920, 260);


// 캐비넷 상단 로고 페이드인 전환효과
local marqueeBkg0=fe.add_image( "cab_body_Vewlix_Top_RED.png", 143, 50, 806, 184 );
marqueeBkg0.alpha = 230;

::OBJECTS <- {
marquee = fe.add_artwork( "marquee", 143, 50, 806, 184 ),
}
    local move_marquee1 = {
 	when = Transition.ToNewSelection, property = "alpha", start = 0, end = 255, time = 800
    }
    animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee1 ) );
OBJECTS.marquee.trigger = Transition.EndNavigation;


// 미리보기 동영상 화면늘리기 or 화면비율유지

local snap = fe.add_artwork( "snap", 321, 286, 453, 808 );

if ( my_config["enable_scanline"] == "On" )
{
fe.add_image( "scanline2.png", 320, 286, 453, 810);
}

if ( my_config["enable_stretch"] == "No" )
{
snap.preserve_aspect_ratio = true;
}
snap.trigger = Transition.EndNavigation;

	
// 캐비넷 이미지, 디스플레이 타이틀

fe.add_image( "bg2.png", 0, 0, 1080, 1920);
//local displayName = fe.add_image ("systems/[DisplayName]",155, 0, 600, 219);


//선택박스
local box_select= fe.add_image( "bg_white.png", 25, 1577, 1030, 37 )
local box_select_effect = {
	//when = Transition.EndNavigation,
	property = "alpha",
	start = 0,
	end = 255,
	time = 250,
	delay = 0
	tween = Tween.Linear,
	pulse = true,
	}
animation.add( PropertyAnimation( box_select, box_select_effect ) );


// 게임 리스트 박스 (게임번호, 게임이름)

local listbox1_1 = fe.add_listbox( 19, 1351, 70, 493 );
listbox1_1.charsize = 18;
listbox1_1.set_sel_rgb(251, 43, 2);
listbox1_1.set_rgb(72,72,72);
listbox1_1.selbg_alpha = 0;
listbox1_1.align = Align.Right;
listbox1_1.font=my_config["select_font1"];
listbox1_1.format_string = "[ListEntry]";
local listbox1_2 = fe.add_listbox( 19, 1353, 70, 493 );
listbox1_2.charsize = 18;
listbox1_2.set_sel_rgb(251, 43, 2);
listbox1_2.set_rgb(72,72,72);
listbox1_2.selbg_alpha = 0;
listbox1_2.align = Align.Right;
listbox1_2.font=my_config["select_font1"];
listbox1_2.format_string = "[ListEntry]";
local listbox1_3 = fe.add_listbox( 21, 1353, 70, 493 );
listbox1_3.charsize = 18;
listbox1_3.set_sel_rgb(251, 43, 2);
listbox1_3.set_rgb(72,72,72);
listbox1_3.selbg_alpha = 0;
listbox1_3.align = Align.Right;
listbox1_3.font=my_config["select_font1"];
listbox1_3.format_string = "[ListEntry]";
local listbox1_4 = fe.add_listbox( 21, 1351, 70, 493 );
listbox1_4.charsize = 18;
listbox1_4.set_sel_rgb(251, 43, 2);
listbox1_4.set_rgb(72,72,72);
listbox1_4.selbg_alpha = 0;
listbox1_4.align = Align.Right;
listbox1_4.font=my_config["select_font1"];
listbox1_4.format_string = "[ListEntry]";

local listbox1 = fe.add_listbox( 20, 1352, 70, 493 );
listbox1.charsize = 18;
listbox1.set_sel_rgb( 255 243, 20 );
listbox1.set_rgb( 255, 255, 255 );
listbox1.selbg_alpha = 0;
listbox1.align = Align.Right;
listbox1.font=my_config["select_font1"];
listbox1.format_string = "[ListEntry]";

local listbox2_1 = fe.add_listbox( 89, 1351, 450, 493 );
listbox2_1.charsize = 18;
listbox2_1.set_sel_rgb(251, 43, 2);
listbox2_1.set_rgb(72,72,72);
listbox2_1.selbg_alpha = 0;
listbox2_1.align = Align.Left;
listbox2_1.font=my_config["select_font1"];;
listbox2_1.format_string = "[Title]";
local listbox2_2 = fe.add_listbox( 91, 1351, 450, 493 );
listbox2_2.charsize = 18;
listbox2_2.set_sel_rgb(251, 43, 2);
listbox2_2.set_rgb(72,72,72);
listbox2_2.selbg_alpha = 0;
listbox2_2.align = Align.Left;
listbox2_2.font=my_config["select_font1"];;
listbox2_2.format_string = "[Title]";
local listbox2_3 = fe.add_listbox( 91, 1353, 450, 493 );
listbox2_3.charsize = 18;
listbox2_3.set_sel_rgb(251, 43, 2);
listbox2_3.set_rgb(72,72,72);
listbox2_3.selbg_alpha = 0;
listbox2_3.align = Align.Left;
listbox2_3.font=my_config["select_font1"];;
listbox2_3.format_string = "[Title]";
local listbox2_4 = fe.add_listbox( 89, 1353, 450, 493 );
listbox2_4.charsize = 18;
listbox2_4.set_sel_rgb(251, 43, 2);
listbox2_4.set_rgb(72,72,72);
listbox2_4.selbg_alpha = 0;
listbox2_4.align = Align.Left;
listbox2_4.font=my_config["select_font1"];;
listbox2_4.format_string = "[Title]";

local listbox2 = fe.add_listbox( 90, 1352, 450, 493 );
listbox2.charsize = 18;
listbox2.set_sel_rgb( 255, 243, 20 );
listbox2.set_rgb( 240, 240, 240 );
listbox2.selbg_alpha = 0;
listbox2.align = Align.Left;
listbox2.font=my_config["select_font1"];;
listbox2.format_string = "[Title]";

local listbox3_1 = fe.add_listbox( 389, 1351, 80, 493 );
listbox3_1.charsize = 18;
listbox3_1.set_sel_rgb( 251, 43, 2);
listbox3_1.set_rgb(72,72,72);
listbox3_1.selbg_alpha = 0;
listbox3_1.align = Align.Left;
listbox3_1.font=my_config["select_font1"];;
listbox3_1.format_string = "[Players]인용";
local listbox3_2 = fe.add_listbox( 389, 1353, 80, 493 );
listbox3_2.charsize = 18;
listbox3_2.set_sel_rgb( 251, 43, 2);
listbox3_2.set_rgb(72,72,72);
listbox3_2.selbg_alpha = 0;
listbox3_2.align = Align.Left;
listbox3_2.font=my_config["select_font1"];;
listbox3_2.format_string = "[Players]인용";
local listbox3_3 = fe.add_listbox( 391, 1353, 80, 493 );
listbox3_3.charsize = 18;
listbox3_3.set_sel_rgb( 251, 43, 2);
listbox3_3.set_rgb(72,72,72);
listbox3_3.selbg_alpha = 0;
listbox3_3.align = Align.Left;
listbox3_3.font=my_config["select_font1"];;
listbox3_3.format_string = "[Players]인용";
local listbox3_4 = fe.add_listbox( 391, 1351, 80, 493 );
listbox3_4.charsize = 18;
listbox3_4.set_sel_rgb( 251, 43, 2);
listbox3_4.set_rgb(72,72,72);
listbox3_4.selbg_alpha = 0;
listbox3_4.align = Align.Left;
listbox3_4.font=my_config["select_font1"];;
listbox3_4.format_string = "[Players]인용";

local listbox3 = fe.add_listbox( 390, 1352, 80, 493 );
listbox3.charsize = 18;
listbox3.set_sel_rgb( 255, 243, 20 );
listbox3.set_rgb( 240, 240, 240 );
listbox3.selbg_alpha = 0;
listbox3.align = Align.Left;
listbox3.font=my_config["select_font1"];;
listbox3.format_string = "[Players]인용";

local listbox4_1 = fe.add_listbox( 449, 1351, 90, 493 );
listbox4_1.charsize = 18;
listbox4_1.set_sel_rgb( 251, 43, 2);
listbox4_1.set_rgb(72,72,72);
listbox4_1.selbg_alpha = 0;
listbox4_1.align = Align.Left;
listbox4_1.font=my_config["select_font1"];;
listbox4_1.format_string = "[Year]년";
local listbox4_2 = fe.add_listbox( 449, 1353, 90, 493 );
listbox4_2.charsize = 18;
listbox4_2.set_sel_rgb( 251, 43, 2);
listbox4_2.set_rgb(72,72,72);
listbox4_2.selbg_alpha = 0;
listbox4_2.align = Align.Left;
listbox4_2.font=my_config["select_font1"];;
listbox4_2.format_string = "[Year]년";
local listbox4_3 = fe.add_listbox( 451, 1353, 90, 493 );
listbox4_3.charsize = 18;
listbox4_3.set_sel_rgb( 251, 43, 2);
listbox4_3.set_rgb(72,72,72);
listbox4_3.selbg_alpha = 0;
listbox4_3.align = Align.Left;
listbox4_3.font=my_config["select_font1"];;
listbox4_3.format_string = "[Year]년";
local listbox4_4 = fe.add_listbox( 451, 1351, 90, 493 );
listbox4_4.charsize = 18;
listbox4_4.set_sel_rgb( 251, 43, 2);
listbox4_4.set_rgb(72,72,72);
listbox4_4.selbg_alpha = 0;
listbox4_4.align = Align.Left;
listbox4_4.font=my_config["select_font1"];;
listbox4_4.format_string = "[Year]년";

local listbox4 = fe.add_listbox( 450, 1352, 90, 493 );
listbox4.charsize = 18;
listbox4.set_sel_rgb( 255, 243, 20 );
listbox4.set_rgb( 240, 240, 240 );
listbox4.selbg_alpha = 0;
listbox4.align = Align.Left;
listbox4.font=my_config["select_font1"];;
listbox4.format_string = "[Year]년";

local listbox5_1 = fe.add_listbox( 529, 1351, 190, 493 );
listbox5_1.charsize = 18;
listbox5_1.set_sel_rgb( 251, 43, 2);
listbox5_1.set_rgb(72,72,72);
listbox5_1.selbg_alpha = 0;
listbox5_1.align = Align.Left;
listbox5_1.font=my_config["select_font1"];;
listbox5_1.format_string = "[Manufacturer]";
local listbox5_2 = fe.add_listbox( 529, 1353, 190, 493 );
listbox5_2.charsize = 18;
listbox5_2.set_sel_rgb( 251, 43, 2);
listbox5_2.set_rgb(72,72,72);
listbox5_2.selbg_alpha = 0;
listbox5_2.align = Align.Left;
listbox5_2.font=my_config["select_font1"];;
listbox5_2.format_string = "[Manufacturer]";
local listbox5_3 = fe.add_listbox( 531, 1353, 190, 493 );
listbox5_3.charsize = 18;
listbox5_3.set_sel_rgb( 251, 43, 2);
listbox5_3.set_rgb(72,72,72);
listbox5_3.selbg_alpha = 0;
listbox5_3.align = Align.Left;
listbox5_3.font=my_config["select_font1"];;
listbox5_3.format_string = "[Manufacturer]";
local listbox5_4 = fe.add_listbox( 531, 1351, 190, 493 );
listbox5_4.charsize = 18;
listbox5_4.set_sel_rgb( 251, 43, 2);
listbox5_4.set_rgb(72,72,72);
listbox5_4.selbg_alpha = 0;
listbox5_4.align = Align.Left;
listbox5_4.font=my_config["select_font1"];;
listbox5_4.format_string = "[Manufacturer]";

local listbox5 = fe.add_listbox( 530, 1352, 190, 493 );
listbox5.charsize = 18;
listbox5.set_sel_rgb( 255, 243, 20 );
listbox5.set_rgb( 240, 240, 240 );
listbox5.selbg_alpha = 0;
listbox5.align = Align.Left;
listbox5.font=my_config["select_font1"];;
listbox5.format_string = "[Manufacturer]";


// 즐겨찾기 아이콘 표시
function getFavs(index_offset){
  if(fe.game_info( Info.Favourite, index_offset ) == "1") return "star.gif";
  else return "";
}
function getFavs2(index_offset){
  if(fe.game_info( Info.Favourite, index_offset ) == "1") return "★";
  else return "";
}


if ( my_config["enable_Fav_icon"] == "On" )
{
local listFav = fe.add_listbox( 7, 1352, 20, 493 );
listFav.charsize = 18;
listFav.set_sel_rgb( 255, 255, 0 );
listFav.set_rgb( 255, 255, 0 );
listFav.selbg_alpha = 0;
listFav.align = Align.Left;
listFav.format_string = "[!getFavs2]";
}

local romFav = fe.add_image(getFavs(0), 0, 1567, 50, 48 );

fe.add_transition_callback( "update_my_list" );
function update_my_list( ttype, var, ttime )
{
    if(ttype == Transition.ToNewSelection){
        romFav.file_name = getFavs(var);
    }
    return false;
}

fe.add_signal_handler( "updateFavs" );
function updateFavs( signal_str )
{
    if(signal_str == "add_favourite"){
        if(romFav.file_name != "") romFav.file_name = "";
        else romFav.file_name = "star.gif";
    }
}



// 현재시각, 선택한 즐겨찾기명, 게임개수, 게임장르, 제작년도, 에뮬기종 표시

local clockb = fe.add_text( "", 640, 1116, 220, 24 );
clockb.align = Align.Centre;
clockb.font=my_config["select_font2"];
clockb.set_rgb( 240, 240, 240 );

function update_clock( ttime ){
  local now = date();
  clockb.msg = format("%02d", now.hour) + " 시 " + format("%02d", now.min )+ " 분";
}
  fe.add_ticks_callback( this, "update_clock" );

local listcc = fe.add_text( "플레이 횟수 : " + "[PlayedCount]", 240, 1116, 220, 24 );
listcc.font=my_config["select_font2"];
listcc.set_rgb( 240, 240, 240 );
listcc.align = Align.Centre;

local listdd = fe.add_text("[!filter]", 440, 1116, 220, 24 );
listdd.font=my_config["select_font2"];
listdd.set_rgb( 240, 240, 240 );
listdd.align = Align.Centre;

// Change filter name to upper case
 function filter(){
	local text = fe.filters[fe.list.filter_index].name;

                if (text == "Favourites")
                text = "즐겨찾기"
		        if (text == "All")
                text = "전체게임"
				if (text == "Fighting")
                text = "대전격투게임"
                if (text == "Shooting")
                text = "슈팅게임"
		        if (text == "GunShooter")
                text = "건슈팅게임"
				if (text == "Action")
                text = "액션게임"
                if (text == "BeltAction")
                text = "벨트스크롤액션"
		        if (text == "Racing")
                text = "레이싱게임"
				if (text == "Puzzle")
                text = "퍼즐오락게임"
                if (text == "Board")
                text = "보드게임"
		        if (text == "Quiz")
                text = "퀴즈게임"
				if (text == "Rhythm")
                text = "리듬게임"
		        if (text == "RPG")
                text = "롤플레잉게임"
				if (text == "Adventure")
                text = "어드벤처게임"
                if (text == "1980s")
                text = "1980년대 게임"
		        if (text == "1990s")
                text = "1990년대 게임"
				if (text == "2000s")
                text = "2000년대 게임"
				if (text == "2010s")
                text = "2010년대 게임"
		return text.toupper();
 }


// 게임표지 페이드인 전환효과
::OBJECTS <- {
flyer = fe.add_artwork( "flyer", 685, 1370, 370, 450 ),
}
    local move_flyer1 = {
 	when = Transition.ToNewSelection, property = "alpha", start = 0, end = 255, time = 500
    }
    animation.add( PropertyAnimation( OBJECTS.flyer, move_flyer1 ) );
OBJECTS.flyer.trigger = Transition.EndNavigation;


//모니터 회전방향 안내 아이콘
local rotation_icon = fe.add_image("[Rotation].png",855, 890, 66, 66);
local rotation_ani = { when = Transition.ToNewSelection, property = "rotation", start = -90, end = 0, loop = false, time = 180, delay = 0 }
local rotation_ani2 = { when = Transition.ToNewList, property = "rotation", start = -90, end = 0, loop = false, time = 180, delay = 100 }
animation.add( PropertyAnimation( rotation_icon, rotation_ani ) );
animation.add( PropertyAnimation( rotation_icon, rotation_ani2 ) );

local rotation_icon2 = fe.add_image("[AltTitle].png",855, 890, 66, 66);
local rotation_ani3 = { when = Transition.ToNewSelection, property = "rotation", start = 90, end = 0, loop = false, time = 180, delay = 0 }
local rotation_ani4 = { when = Transition.ToNewList, property = "rotation", start = 90, end = 0, loop = false, time = 180, delay = 100 }
animation.add( PropertyAnimation( rotation_icon2, rotation_ani3 ) );
animation.add( PropertyAnimation( rotation_icon2, rotation_ani4 ) );


// 조작키 안내
local key_info = fe.add_image(FeConfigDirectory+"menu-art/common/" + "key_" + my_config["select_Keyinfo"] + "_[Status]" + ".png", 65, 1846, 950, 76 );
local move_transition8 = { when = Transition.ToNewList, property = "y", start = fly+200, end = 1846, tween = "cubic", time = 600 }
animation.add( PropertyAnimation( key_info, move_transition8 ) );