--------------------------------------------------------------------
function ResetGame()
  print("RESET GAME...")
  Particle:Release()
  Audio:StopMusic("")
  Audio:Release()
end

function ResumeGame()
  OpenInventory()
  OpenTopMenu()   
  if s.sys_game_start == 1 then
    s.sys_menu_hide = 1
    -- music menu
    Audio:ResumeAllPausedSound()
    Audio:StopMusic("")
    PlayMusic(s.sys_game_music,1,0)
    GoTo(s.sys_prev_scene)
  else
    ResetGame()
    SaveMgr:LoadSlot(0)
    Audio:PlayMusic("")
  end  
  s.sys_game_start = 1
end
--------------------------------------------------------------------
local function UpdateStarsHints()
  names = s["sys_hints_stars_names"]
  particles = names:split(",")
  for k,v in pairs(particles) do
    Particle:Remove(v, nil)
  end
  PlayHintLooped()
end
--------------------------------------------------------------------
function Update()
  UpdateTasks()
  Widgets.menu_top.UpdateCaption()
end
--------------------------------------------------------------------
function GlobalSceneStateChange()
  UpdateStarsHints()
end
--------------------------------------------------------------------
function GlobalOnSceneEnter(view)
  ShowGameHint(view)
  PlayHintLooped()
  if view:GetName() ~= "s00_0000_menu" and UI:WidgetExists("MainMenu") then
    --Widget("MainMenu"):SetVisible(false)
    UI:DelWidget("MainMenu")
  end
end
--------------------------------------------------------------------
function GlobalOnSceneExit(view)
  if UI:WidgetExists("item_big") then
    Widgets.Inventory.HideBigPanel() end
  if UI:WidgetExists("message_box") and Widget("message_box"):IsVisible() then
    Widget("message_box"):SetVisible(false) end
 end
--------------------------------------------------------------------
function OnNewGameStart()
  states["ho_punish_particle_name"] = Config["ho_punish_particle_name"]
  states["hint_gate_particle"]      = Config["hint_gate_particle"]
  
  states["ch_hero_name"]      = "ch01_heroine"
  states["ch_porter_name"]    = "ch03_porter"
  states["ch_irene_name"]     = "ch04_irene"
  states["ch_policeman_name"] = "ch05_policeman"
  states["ch_tramp_name"]     = "ch06_tramp"
  states["ch_menekot_name"]   = "ch13_malik"
  states["ch_assassin_name"]  = "ch15_assassin"
  states["ch_menekot1_name"]   = "ch13_malik"
  states["ch_hero_name"]      = "ch01_heroine"
  states["ch_mulaj_name"]    = "ch11_trader"
  states["ch_shaman_name"]    = "ch24_shaman"
  states["ch_muezzin_name"]     = "ch12_muezzin"
  states["ch_sile_name"]   = "ch10_sile_00"
  states["ch_samia_name"] = "ch28_samia"
  states["ch_nahas_name"] = "ch19_spy_00"
  states["ch_aristocrat_name"]     = "ch22_aristocrat"
  states["ch_guardian_name"]   = "ch20_guardian"
end
--------------------------------------------------------------------
function GlobalOnClick()
  --UpdateStarsHints()
end
--------------------------------------------------------------------
function GlobalOnItem()
  UpdateStarsHints()
end
--------------------------------------------------------------------
function GamePostLoad() 
  states["sys_block_esc"] = 0
end
--------------------------------------------------------------------
