-- s.m_s03_tilepieces_shown == 0


function OnSceneEnter()


    print("s03_0105_table :: OnSceneEnter()")
    local minigame = s03_0105_table.s03_0105_table.L00_0200_puzzle01
    minigame.game_name = "s03_0105_table"
    OldInterfaceMap.SetCuttentModule(s03_0105_table)
    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] = "spr_puzzle1_top"
    OldInterfaceMap.SetIndexedElements(indexed)
    
    
    --  config
    minigame.canConnectWith = {}
    

    minigame.canConnectWith["seq_mk_puzzle1"]  =  {"seq_mk_puzzle5", "seq_mk_puzzle8", "seq_mk_puzzle6", "seq_mk_puzzle2"}   
    minigame.canConnectWith["seq_mk_puzzle2"]  =  {"seq_mk_puzzle6",    "seq_mk_puzzle3"} 
    minigame.canConnectWith["seq_mk_puzzle3"]  =  {  "seq_mk_puzzle6",    "seq_mk_puzzle7",    "seq_mk_puzzle4"}    
    minigame.canConnectWith["seq_mk_puzzle4"]  =  {   "seq_mk_puzzle7",  "seq_mk_puzzle12"}
    minigame.canConnectWith["seq_mk_puzzle5"]  =  {}
    minigame.canConnectWith["seq_mk_puzzle6"]  =  { "seq_mk_puzzle7",   "seq_mk_puzzle11",   "seq_mk_puzzle10",   "seq_mk_puzzle8"}
    minigame.canConnectWith["seq_mk_puzzle7"]  =  { "seq_mk_puzzle12",    "seq_mk_puzzle11"}
    minigame.canConnectWith["seq_mk_puzzle8"]  =  { "seq_mk_puzzle9" } 
    minigame.canConnectWith["seq_mk_puzzle9"] =   {"seq_mk_puzzle10"}
    minigame.canConnectWith["seq_mk_puzzle10"] =  { "seq_mk_puzzle11"}  
    minigame.canConnectWith["seq_mk_puzzle11"] =  {"seq_mk_puzzle10", "seq_mk_puzzle12"}    
    minigame.canConnectWith["seq_mk_puzzle12"] =  {}

    
    minigame.connectSound       =   "snd_s03_0105_connect_pieces"
    minigame.pickUpPieceSound   =   "snd_s03_0105_pick_up_piece"
    minigame.dropPieceSound     =   ""
    minigame.rotateSound        =   "snd_s03_0105_rotate1"   
    minigame.flipPieceSound     =   "snd_s03_0105_flip" 
    -- PlaySound("snd_s03_0105_drop_piece")
       
    
    minigame.OnItemCallback = function (item)

    end
        
    minigame.isVisible = function ()
        return s.m_s03_tilepieces_shown == 1 and s.s03_0105_table_solved_puzzle == 0
    end

    minigame.sCount=12
    minigame.twoSides = true
    
    minigame.SetSolvedFunction(function()  

        s.s03_0105_table_solved_puzzle = 1
		s.s03_0105_tilepieces_solved=1
		Widgets.notes_window.AddEntry(16)
        Talk("com_s03_0105_01_hero")
        Drop("i_tilepieces")
    end)

    minigame:Open_L00_0200() 
    
    SetMinigameResolver(function()        
        minigame:solvedFunction()
    end)   
    
end


-- Take("i_tilepieces")
-- Take("i_leaf_glue")


--  print(s.i_tilepieces)
