

function OnSceneEnter()

    local minigame = s01_0505_photopuzzle.s01_0505_photopuzzle.L00_0200_puzzle01
    minigame.game_name = "s01_0505_photopuzzle"
    
    OldInterfaceMap.SetCuttentModule(s01_0505_photopuzzle)
    OldInterfaceMap.SetSceneUpdateFunction("SceneUpdate", minigame) 
    OldInterfaceMap.SetSceneEventFunction("SceneEvent", minigame) 
    
    indexed = {}
    for i = 1, minigame.sCount do
        indexed[#indexed+1] = "seq_mk_puzzle"..i
    end
    
    indexed[#indexed+1] = "puzzle1_reg_back"
    indexed[#indexed+1] = "spr_puzzle1_top"
    
    OldInterfaceMap.SetIndexedElements(indexed)
    
    
    --  config
    minigame.canConnectWith = {}
    
    
    minigame.canConnectWith["seq_mk_puzzle1"]  =  {"seq_mk_puzzle2",    "seq_mk_puzzle5"}
    minigame.canConnectWith["seq_mk_puzzle2"]  =  {"seq_mk_puzzle3",    "seq_mk_puzzle6"}
    minigame.canConnectWith["seq_mk_puzzle3"]  =  {"seq_mk_puzzle4",    "seq_mk_puzzle7"}
    minigame.canConnectWith["seq_mk_puzzle4"]  =  {"seq_mk_puzzle8"}   
    minigame.canConnectWith["seq_mk_puzzle5"]  =  {"seq_mk_puzzle6",    "seq_mk_puzzle9"} 
    minigame.canConnectWith["seq_mk_puzzle6"]  =  {"seq_mk_puzzle7",    "seq_mk_puzzle10"}
    minigame.canConnectWith["seq_mk_puzzle7"]  =  {"seq_mk_puzzle8",    "seq_mk_puzzle11"}
    minigame.canConnectWith["seq_mk_puzzle8"]  =  {"seq_mk_puzzle12"}
    minigame.canConnectWith["seq_mk_puzzle9"]  =  {"seq_mk_puzzle10"}
    minigame.canConnectWith["seq_mk_puzzle10"] =  {"seq_mk_puzzle11"}
    minigame.canConnectWith["seq_mk_puzzle11"] =  {"seq_mk_puzzle12"}   
    
    minigame.connectSound       =   "snd_s01_0505_photopuzzle_match"
    minigame.pickUpPieceSound   =   "snd_s01_0505_pick_up_piece"
    minigame.dropPieceSound     =   ""
    minigame.rotateSound        =   "snd_s01_0505_rotate1"   
      
    
    minigame.sCount=12
    minigame.twoSides = false
    
    minigame.SetSolvedFunction(function()  
        s.s01_0505_photopuzzle_solved=1
        Talk("com_s01_0505_01_hero")
        Sleep(2000)
		Delete("i_photopieces")
        Take("i_photo_complete")
       	Sound("snd_go_s01_0501_hold")
		FadeOut(0)
        GoTo("s01_0501_hold",false,true)  
    end)

    minigame:Open_L00_0200()   
    
    SetMinigameResolver(function()        
        minigame:solvedFunction()
    end)        
	
	Sleep(1000)
    Talk("abt_i_photopieces_hero")
	SetState("sys_block_esc",0)
end
