setfocusfunc("StartPause")
loadresource("data\\menu.png","menu",1000002);
loadresource("data\\pt.png","pt",1000003);
loadresource("data\\ingamebg.png","ingamebg",1000004);
loadresource("data\\options.png","options",1000005);
loadresource("data\\help.png","help",1000007);
loadresource("data\\buttons.png","buttons",1000017);
loadresource("data\\star.png","star",1000018);
loadresource("data\\exit.png","exitgame",100001);
loadresource("data\\rc.png","randomclick",100002);
loadresource("data\\message.png","message",1000024);
loadresource("data\\pb.png","pb",1000026);
loadresource("data\\messageinfo.png","messageinfo",1000027);
loadresource("data\\skip.png","skip",2000027);
loadresource("data\\help.png","helpbtn",2000028);
loadresource("data\\m&i.png","m&i",2000028);
loadresource("data\\developers.jpg","developers",14);
addglobalobjecttogame( -303033,"star",-100,-100,"",0,0,8,8);--particl star
addglobalobjecttogame( -313031,"randomclick",200,200,"",0,0,560,232);
addglobalobjecttogame( -303030,"buttons",0,0,"",0,1008,16,16);--Окно закрывающее весь экран при многократном клике


AddGlobalFade(-303032,0.9);
set_visible_object(-303030,false);
set_visible_object(-303031,false);
set_visible_object(-313031,false);
set_visible_object(-303032,false);
--------------------------------------------------Меню игры-------------------------------------------------------------------------------
--------------------------------------------------Меню игры-------------------------------------------------------------------------------
------Окошко Настройки----------------------------------------------------------------------------------
OptionsWnd={}
OptionsWnd["img"]="options";
OptionsWnd["posX"]   =229.0;
OptionsWnd["posY"]   =143.0;
OptionsWnd["posXimg"]=0.0;
OptionsWnd["posYimg"]=0.0;
OptionsWnd["width"]  =512.0;
OptionsWnd["height"] =538.0;
-------Слайдер---------------------------------------------------------------------------------
EffectSlider={}
EffectSlider["posX"]       =366.0;
EffectSlider["posY"]       =397.0;
EffectSlider["maxshift"]     =247.0;
EffectSlider["posXimg"]    =0.0;
EffectSlider["posYimg"]    =129.0;
EffectSlider["width"]      =40.0;
EffectSlider["height"]     =53.0;
EffectSlider["offsetx"]    =0.0;
EffectSlider["offsety"]   =0.0;
EffectSlider["func"]     ="effect";
-- addSlidertomenupage(2,2,366,300,247,0,129,40,53,0,0);--шарик "Звуковые эффекты"
-- addSlidertomenupage(2,3,366,397,247,0,129,40,53,0,0);--шарик "Громкость Музыки"
-------Слайдер---------------------------------------------------------------------------------
MusicSlider={}
MusicSlider["posX"]       =366.0;
MusicSlider["posY"]       =300.0;
MusicSlider["maxshift"]     =247.0;
MusicSlider["posXimg"]    =0.0;  
MusicSlider["posYimg"]    =129.0;
MusicSlider["width"]      =40.0; 
MusicSlider["height"]     =53.0; 
MusicSlider["offsetx"]    =0.0;  
MusicSlider["offsety"]     =0.0;  
MusicSlider["func"]     ="musuk";
--------Кнопка перехода в полноэкранный режим--------------------------------------------------------------------------------       
FullScrean={}
FullScrean["posX"]       =515.0;
FullScrean["posY"]       =534.0;
FullScrean["posXimg"]    =0.0;
FullScrean["posYimg"]    =177.0;
FullScrean["width"]      =40.0;
FullScrean["height"]     =35.0;
FullScrean["offsetx"]      =0.0;
FullScrean["offsety"]     =35.0;
FullScrean["func"]       ="tofullscrean";
--------Кнопка Ок--------------------------------------------------------------------------------   
OptionsOK={}
OptionsOK["posX"]       =616.0;
OptionsOK["posY"]       =522.0;
OptionsOK["posXimg"]    =50.0;
OptionsOK["posYimg"]    =143.0;
OptionsOK["width"]      =46.0;
OptionsOK["height"]     =32.0;
OptionsOK["offsetx"]      =0.0;
OptionsOK["offsety"]     =0.0;
--OptionsOK["func"]       ="tofullscrean";
-------Выделение кнопки ок---------------------------------------------------------------------------------   
OptionsOKSelect={}
OptionsOKSelect["img"]      ="buttons";
OptionsOKSelect["posX"]       =628.0;
OptionsOKSelect["posY"]       =508.0;
OptionsOKSelect["posXimg"]    =42.0;
OptionsOKSelect["posYimg"]    =130.0;
OptionsOKSelect["width"]      =61.0;
OptionsOKSelect["height"]     =61.0;
OptionsOKSelect["func"]     ="close_options";
---------Внутри игровое меню-------------------------------------------------------------------------------   
IngameBG={}
IngameBG["img"]      ="ingamebg";
IngameBG["posX"]       =318.0;
IngameBG["posY"]       =184.0;
IngameBG["posXimg"]    =0.0;
IngameBG["posYimg"]    =0.0;
IngameBG["width"]      =373.0;
IngameBG["height"]     =325.0;
---------Вернутся в игру-------------------------------------------------------------------------------   
BackToGame={}
BackToGame["posX"]       =393.0;
BackToGame["posY"]       =215.0;
BackToGame["posXimg"]    =23.0;
BackToGame["posYimg"]    =317.0;
BackToGame["width"]      =242.0;
BackToGame["height"]     =46.0;
BackToGame["offsetx"]      =0.0;
BackToGame["offsety"]     =0.0;
----------Вернутся в игру выделение------------------------------------------------------------------------------ 
BackToGameSelect={}
BackToGameSelect["img"]      ="buttons";
BackToGameSelect["posX"]       =370.0;
BackToGameSelect["posY"]       =211.0;
BackToGameSelect["posXimg"]    =466.0;
BackToGameSelect["posYimg"]    =468.0;
BackToGameSelect["width"]      =285.0;
BackToGameSelect["height"]     =57.0;
BackToGameSelect["func"]     ="back";
----------Переход в опции------------------------------------------------------------------------------ 
ToOptions={}
ToOptions["posX"]       =426.0;
ToOptions["posY"]       =320.0;
ToOptions["posXimg"]    =12.0;
ToOptions["posYimg"]    =443.0;
ToOptions["width"]      =156.0;
ToOptions["height"]     =46.0;
ToOptions["offsetx"]      =0.0;
ToOptions["offsety"]     =0.0;
----------Переход в опции выделение------------------------------------------------------------------------------ 
ToOptionsSelect={}
ToOptionsSelect["img"]      ="buttons";
ToOptionsSelect["posX"]       =370.0;
ToOptionsSelect["posY"]       =315.0;
ToOptionsSelect["posXimg"]    =466.0;
ToOptionsSelect["posYimg"]    =468.0;
ToOptionsSelect["width"]      =285.0;
ToOptionsSelect["height"]     =57.0;
ToOptionsSelect["func"]     ="options";
----------Сохранить и выйти------------------------------------------------------------------------------ 
SaveAndExit={}
SaveAndExit["posX"]       =382.0;
SaveAndExit["posY"]       =419.0;
SaveAndExit["posXimg"]    =192.0;
SaveAndExit["posYimg"]    =446.0;
SaveAndExit["width"]      =268.0;
SaveAndExit["height"]     =44.0;
SaveAndExit["offsetx"]    =0.0;
SaveAndExit["offsety"]     =0.0;
-----------Сохранить и выйти выделение----------------------------------------------------------------------------- 
SaveAndExitSelect={}
SaveAndExitSelect["img"]      ="buttons";
SaveAndExitSelect["posX"]       =370.0;
SaveAndExitSelect["posY"]       =412.0;
SaveAndExitSelect["posXimg"]    =466.0;
SaveAndExitSelect["posYimg"]    =468.0;
SaveAndExitSelect["width"]      =285.0;
SaveAndExitSelect["height"]     =57.0;
SaveAndExitSelect["func"]       ="save_exit";
---------------------------------------------------------------------------------------- 
------------------Кнопка разработчики----------------------------------------------------------------------
ToDevWnd={}
ToDevWnd["posX"]       =388.0;
ToDevWnd["posY"]       =600.0;
ToDevWnd["posXimg"]    =55.0;
ToDevWnd["posYimg"]    =262.0;
ToDevWnd["width"]      =189.0;
ToDevWnd["height"]     =47.0;
ToDevWnd["offsetx"]    =0.0;
ToDevWnd["offsety"]   =0.0;
------------------Выделение кнопки разработчики----------------------------------------------------------------------
ToDevWndSelect={}
ToDevWndSelect["img"]      ="buttons";
ToDevWndSelect["posX"]       =380.0;
ToDevWndSelect["posY"]       =592.0;
ToDevWndSelect["posXimg"]    =46.0;
ToDevWndSelect["posYimg"]    =197.0;
ToDevWndSelect["width"]      =204.0;
ToDevWndSelect["height"]     =59.0;
ToDevWndSelect["func"]       ="todevelopers";
---------------Окошко Разработчики---------------------------------------------
 
DevelopersWND={}
DevelopersWND["img"]      ="developers";
DevelopersWND["posX"]       =0.0;
DevelopersWND["posY"]       =0.0;
DevelopersWND["posXimg"]    =0.0;
DevelopersWND["posYimg"]    =0.0;
DevelopersWND["width"]      =1024.0;
DevelopersWND["height"]     =768.0;
-------------Кнопка Ок---------------------------------------------------------------------------
DevelopersWNDOk={}
DevelopersWNDOk["img"]      ="buttons";
DevelopersWNDOk["posX"]       =873.0;
DevelopersWNDOk["posY"]       =653.0;
DevelopersWNDOk["posXimg"]    =910.0;
DevelopersWNDOk["posYimg"]    =216.0;
DevelopersWNDOk["width"]      =77.0;
DevelopersWNDOk["height"]     =36.0; 
-------------Выделение для кнопки Ок---------------------------------------------------------------------------
DevelopersWNDOkSelect={}
DevelopersWNDOkSelect["img"]      ="buttons";
DevelopersWNDOkSelect["posX"]       =873.0;
DevelopersWNDOkSelect["posY"]       =653.0;
DevelopersWNDOkSelect["posXimg"]    =911.0;
DevelopersWNDOkSelect["posYimg"]    =383.0;
DevelopersWNDOkSelect["width"]      =77.0;
DevelopersWNDOkSelect["height"]     =36.0;
DevelopersWNDOkSelect["func"]       ="backtooptions";
----------------------------------------------------------------------------------------
-------------Выделение для кнопки Ок---------------------------------------------------------------------------
 ExitMenuBG={}
ExitMenuBG["img"]      ="exitgame";
ExitMenuBG["posX"]       =173.0;
ExitMenuBG["posY"]       =146.0
ExitMenuBG["posXimg"]    =0.0;
ExitMenuBG["posYimg"]    =0.0;
ExitMenuBG["width"]      =512.0;
ExitMenuBG["height"]     =323.0;

ExitMenuOk={} 
ExitMenuOk["posX"]       =459.0;
ExitMenuOk["posY"]       =408.0;
ExitMenuOk["posXimg"]    =885.0;
ExitMenuOk["posYimg"]    =480.0;
ExitMenuOk["width"]      =116.0;
ExitMenuOk["height"]     =34.0;
ExitMenuOk["offsetx"]    =0.0;
ExitMenuOk["offsety"]   =0.0;

ExitMenuOkSelect={} 
ExitMenuOkSelect["img"]      ="buttons";
ExitMenuOkSelect["posX"]       =451.0;
ExitMenuOkSelect["posY"]       =401.0;
ExitMenuOkSelect["posXimg"]    =885.0;
ExitMenuOkSelect["posYimg"]    =426.0;
ExitMenuOkSelect["width"]      =133.0;
ExitMenuOkSelect["height"]     =48.0;
ExitMenuOkSelect["func"]       ="gameexit";

ExitMenuToMenu={} 
ExitMenuToMenu["posX"]       =272.0;
ExitMenuToMenu["posY"]       =408.0;
ExitMenuToMenu["posXimg"]    =760.0;
ExitMenuToMenu["posYimg"]    =480.0;
ExitMenuToMenu["width"]      =116.0;
ExitMenuToMenu["height"]     =34.0;
ExitMenuToMenu["offsetx"]    =0.0;
ExitMenuToMenu["offsety"]   =0.0;


ExitMenuToMenuSelect={}
ExitMenuToMenuSelect["img"]      ="buttons";
ExitMenuToMenuSelect["posX"]       =264.0;
ExitMenuToMenuSelect["posY"]       =401.0;
ExitMenuToMenuSelect["posXimg"]    =885.0;
ExitMenuToMenuSelect["posYimg"]    =426.0;
ExitMenuToMenuSelect["width"]      =133.0;
ExitMenuToMenuSelect["height"]     =48.0;
ExitMenuToMenuSelect["func"]       ="backgame";


HintTime={}
HintTime["time"] = 60;

AddOptions();
AddIngameMemu();
local showhelp=false;
local click=0;
local helpload=false;

backpage=-1;
ingame_options=false;
complete=false;
gamepause = false;
-- function MessageFromMenu(nCount,Param1)
-- if Param1==2000029 then
  -- help();
-- return;end;
-- showoptons(0);
-- return;end;
-- function StartPause()
-- messagebox("1")
  -- speciale_action(2,11111);
-- end;
-- function StartPause()
-- messagebox("1")
  -- speciale_action(2,11111);
-- end;
function StartPause()
-- set_visible_object(-303031,true);
-- speciale_action(4,-303031);
--set_visible_object(11111,true);
-- speciale_action(4,11111);
pause_state=true;
end;
function MessageFromMenu(nCount,Param1)
showoptons(0);
return;end;
function MessageProc(event,id,selectedid)
if event==1 then
return; end;
--/////////////////////////////////Обробатываем нажатие на ескейп/////////////////////////////////////////////
if event==2 then
    showoptons(0);  
return; end;
  --////////////////////////////////////////////////////////////////////////////////////////////////////////////  
if event==3 then
  playeffect("34");
    if selectedid~=0 then
      SelectRandomRadar(selectedid);
    return;end; 
    SelectRandom();
        return;end;
--////////////////////////////////////////////////////////////////////////////////////////////////////////////    
end
function showoptons(param)
  playeffect("chpok");
  --speciale_action(2,-2);
  ingame_options = not ingame_options;
  show_ingame_menu(ingame_options);
end;
--////////////////////////////////////////////////////////////////////////////////////////////////////////////
function close_options()
  playeffect("chpok");
  options_menu(false);
end
function back()
  playeffect("chpok");
  showoptons(false);
  pause_state=false;
  --set_visible_object(11111,false);
end
function help()
  --messagebox("Pres Help");
  show_help(true);

  --if not showhelp then 
    --showhelp=true;
    --show_help(showhelp);
    -- speciale_action(2,-22);--скрываем обьект, помощь
    --show_ingame_menu(false);  
  --return;end;
  
  --if  showhelp then
    --showhelp=false;
    --show_help(showhelp);
    -- speciale_action(2,-22);--скрываем обьект, помощь
    --show_ingame_menu(true);    
  --return;end;  
  
end
function options()
  playeffect("chpok");
  options_menu(true);
end
function save_exit()
  playeffect("chpok");
  savegame(SaveLevel());
  setstatemenu();
  pause_state=false;
  --set_visible_object(11111,false);
  --showoptons();
  --pause(false);
end
------------------------------------------------------------------------------------------------------- 
function setpouse(value)

end
---------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------- 
function gameexit(value)
  
  savegame(SaveLevel());
  exitgame();
end
---------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------- 
function backgame(value)
  savegame(SaveLevel());
  setstatemenu();  
  pause_state=false;
  --set_visible_object(11111,false);
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
function todevelopers()
  switch_ingame_menu(4)
end
------------------------------------------------------------------------------------------------------- 
function backtooptions()
  switch_ingame_menu(2)
end

