PromptHeading = ID_TUTORIAL_8_OFFSET + 1
g_currentprompt = 0;
g_counter = 0;
Tweaks.numyearsin24hours = 0;

-------------------------------------------------------------------------------------------------
-- INITIALISE_Level. Standard level event
-------------------------------------------------------------------------------------------------
function EVENTINITIALISE_Level()
	-- load the building and business file
	C_RunScript("scripts\\maps\\shoppingmap.lua");
	C_RunScript("scripts\\tutorial8\\initialpref.lua");
end;

-------------------------------------------------------------------------------------------------
-- Level. Standard level event.
-------------------------------------------------------------------------------------------------
function EVENT_Level()
	-- create an initial prompt
	C_TriggerEvent("BlockCam", 1, KENTUCKY_AVENUE);

	Interface.DisableAllControls();
	Interface.DisableAll3DPicking();
--	Interface.DisableCameraControl();

	-- create the initial prompt
	CreatePrompt(1);
end;

function CATCHEVENT_InterfacePromptDismiss(a)

	if g_currentprompt == 9 then
		return 0;
	end;

	if g_currentprompt == 8 then
		return 0;
	end;

	if g_currentprompt == 7 then
		Game.Unpause();
	else
		CreatePrompt(a);
	end;

end;

function CATCHEVENT_TutorialEvent(a)

	if g_currentprompt == 12 then
		Interface.DismissPrompt();
	end;

	if g_currentprompt == 10 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_TOGGLE_VIEW);
	end;

	if a == TUT_END_BUILD and g_currentprompt == 9 then
		CreatePrompt(10);
	end;

	if a == TUT_MPP_GREENBUTTON_3 and g_currentprompt == 9 then
		Interface.DisableControl(TUT_MPP_GREENBUTTON_3);
		Interface.DismissPrompt();
		Interface.EnableControlAndChildren(TUT_BUILD_PANEL);
		Interface.DisableControl(TUT_BUILD_CANCEL);
	end;

	if a == TUT_END_BUILD and g_currentprompt == 8 then
		CreatePrompt(9);		
	end;

	if a == TUT_MPP_GREENBUTTON_3 and g_currentprompt == 8 then
		Interface.DisableControl(TUT_MPP_GREENBUTTON_3);
		Interface.DismissPrompt();
		Interface.EnableControlAndChildren(TUT_BUILD_PANEL);
		Interface.DisableControl(TUT_BUILD_CANCEL);
	end;

	if a == TUT_END_BUILD and g_currentprompt == 7 then
		CreatePrompt(8);		
	end;


	if a == TUT_MPP_GREENBUTTON_3 and g_currentprompt == 7 then
		Interface.DisableControl(TUT_MPP_GREENBUTTON_3);
		Interface.DismissPrompt();
		Interface.EnableControlAndChildren(TUT_BUILD_PANEL);
		Interface.DisableControl(TUT_BUILD_CANCEL);
	end;

	if a == TUT_BUILD_ACCEPT and g_currentprompt == 7 then
		Interface.DismissPrompt();
	end;

	if g_currentprompt == 3 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_AERIAL_BUTTON_4);
	end;

	if g_currentprompt == 2 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_TOGGLE_VIEW);
	end;



end;

function CATCHEVENT_Picked3D(a)
	if a == 1 and g_currentprompt == 6 then
		Interface.DismissPrompt();
	end;

	if a == 0 and g_currentprompt == 4 then
		Interface.DismissPrompt();
		Interface.DisableAll3DPicking();
	end;

end;

-- prompt manager
function CreatePrompt(a)
	g_currentprompt = a;
	body = a+PromptHeading;
	if a == 1 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"There are a lot of citizens on this block who have to travel to get their shopping. I'm sure they would love to be able to shop more locally.", a+1);
	elseif a == 2 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"First, let's go and see what the people want. Click on the Compass Button to go to Strategic View.", a+1);
		Interface.EnableControl(TUT_TOGGLE_VIEW);
		Interface.AddArrow(534, 461);
	elseif a == 3 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Click on Poll...", a+1);
		Interface.PositionPrompt(0,155);
		Interface.EnableControl(TUT_AERIAL_BUTTON_4);
		Interface.AddArrow( 29, 146 );
	elseif a == 4 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"In poll mode, all apartments flash. There appears to be a large apartment on Kentucky Avenue. Click on Kentucky Avenue.", a+1);
		Interface.EnableBlockPicking(KENTUCKY_AVENUE);
		Interface.AddArrow(366,133);
	elseif a == 5 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"At the top of the list are the items the most popular items. If you build stores that supply these goods you should be able to steal some of the customers away from Marvin Gardens.", a+1);
		Interface.AddArrow( 180, 100 );
	elseif a == 6 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Let's go back to Kentucky Avenue. Double click it.", a+1);
		Interface.EnableBlockPicking(KENTUCKY_AVENUE);
		Interface.AddArrow(366,133);
	elseif a == 7 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Now let's build a store. Remember, it would be best to supply goods that the people want. People needed bread, so lets build a bakers first...", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_3);
		Interface.SetTutorialType(0);
		Interface.SetTutorialUse(1);
		Interface.PositionPrompt(0,-140);
	elseif a == 8 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"You will also have more success if you build another of the high demand stores. Drinks were high on the list, so lets build a Bar. Remember, a Bar is a night time store, so it wont open until the evening...", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_3);
		Interface.SetTutorialType(0);
		Interface.SetTutorialUse(12);
	elseif a == 9 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"The more commodities you supply, the more customers will choose your shopping centre. The other commodity in demand was Fruit and Vegetables. Lets build a Greengrocers to cater for that...", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_3);
		Interface.SetTutorialType(0);
		Interface.SetTutorialUse(4);
	elseif a == 10 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"There you go. Now lets have a look at how the people are responding in strategic view. If you are supplying a wider variety of popular goods closer to where the people live, they will prefer to come and shop at your businesses.", a+1);
		Interface.EnableControl(TUT_TOGGLE_VIEW);
		Interface.AddArrow(534, 461);
	elseif a == 11 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"If you wait a short while you should see more people shopping around Kentucky Avenue...", a+1);
		Interface.PositionPrompt(0,150);
		Interface.AddArrow(366,133);
	elseif a == 12 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"Feel free to build some more. Go to Options and choose Quit when you've had your fill.", a+1);
	else
		Game.End(true); 
	end;
end;


