------------------------------------------------------------------
--								--
--			KoRi's Messages				--
--								--
------------------------------------------------------------------


UI.PageMessages=
{	
	keyBinds={},
	GUI=
	{	
		lap="0",
		darkerpane=
		{
			classname = "static",
			left = 15, top = 240, width = 90, height = 120,
			color = "0 0 0 128", zorder = 50,						
			halign=UIALIGN_CENTER, 
			fontsize = 10,
		},
		
		RC1text=
		{
			classname = "static",
			left = 20, top = 240, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,				
			fontsize =10,
		},
		
		RC2text=
		{
			classname = "static",
			left = 20, top = 252, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,				
			fontsize =10,
		},
		
		RC3text=
		{
			classname = "static",
			left = 20, top = 264, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,				
			fontsize =10,
		},
		
		RC4text=
		{
			classname = "static",
			left = 20, top = 276, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		RC5text=
		{
			classname = "static",
			left = 20, top = 288, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		RC6text=
		{
			classname = "static",
			left = 20, top = 300, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		RC7text=
		{
			classname = "static",
			left = 20, top = 312, width = 80, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		RC8text=
		{
			classname = "static",
			left = 20, top = 324, width = 75, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		RC9text=
		{
			classname = "static",
			left = 20, top = 336, width = 75, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		RC10text=
		{
			classname = "static",
			left = 20, top = 348, width = 75, height = 12,
			color = "0 0 0 0", zorder = 55,
			halign = UIALIGN_LEFT,					
			fontsize =10,
		},
		
		OnActivate = function(Sender)
			local ActionList = Game:GetActions();
			local LocalkeyBinds=UI.PageMessages.keyBinds;
			for i=0, 9 do
				LocalkeyBinds[i]={};
				for j, Action in ActionList do
					if (Action and Action.actionmaps[1]) then
						local bindings = Input:GetBinding(Action.actionmaps[1], Action.id);
						if(bindings[1] and (bindings[1].key == tostring(i)))then
							LocalkeyBinds[i].first = Action;
							Input:BindActionMultipleMaps(Action.name, "" , 0);
						end
						if(bindings[2] and bindings[2].key == tostring(i))then
							LocalkeyBinds[i].second = Action;     
							Input:BindActionMultipleMaps(Action.name, "" , 1);
						end
					end
				end
			end
			UI.PageMessages.keyBinds=LocalkeyBinds;
			UI:DeactivateScreen("BackScreen");
			UI.PageMessages.GUI.lap="0";
			Game:EnableUIOverlay(1, 0);
			UI.PageMessages.GUI.RC1text:SetText("1. Radio Commands");
			UI.PageMessages.GUI.RC2text:SetText("2. Group Radio Comm.");
			UI.PageMessages.GUI.RC3text:SetText("3. Responses/Reports");
			UI.PageMessages.GUI.RC4text:SetText("4. $4Incoming!");
			UI.PageMessages.GUI.RC5text:SetText("");
			UI.PageMessages.GUI.RC6text:SetText("o. Exit");
			UI.PageMessages.GUI.RC7text:SetText("");
			UI.PageMessages.GUI.RC8text:SetText("");
			UI.PageMessages.GUI.RC9text:SetText("");
			UI.PageMessages.GUI.RC10text:SetText("");
			UI:HideMouseCursor();
		end,
		
		OnDeactivate = function(Sender)
			local LocalkeyBinds=UI.PageMessages.keyBinds;
			for i=0, 9 do
				if(LocalkeyBinds[i].first)then
					Input:BindActionMultipleMaps(LocalkeyBinds[i].first.name, tostring(i), 0);
				end 
				if(LocalkeyBinds[i].second)then
					Input:BindActionMultipleMaps(LocalkeyBinds[i].second.name, tostring(i), 1);
				end
			end
			Game:EnableUIOverlay(0, 0);
		end,
		
		OnUpdate = function(Sender)
			local szKeyName = Input:GetXKeyPressedName();
			if (szKeyName and ((tostring(szKeyName)=="esc") or (tostring(szKeyName)=="o") or ((tostring(szKeyName)>="1") and (tostring(szKeyName)<="9")))) then
				if UI.PageMessages.GUI.lap=="0" then
					if tostring(szKeyName)== "1" then
						UI.PageMessages.GUI.lap="1";
						UI.PageMessages.GUI.RC1text:SetText("1. Cover Me!");
						UI.PageMessages.GUI.RC2text:SetText("2. Meet at RV Point!");
						UI.PageMessages.GUI.RC3text:SetText("3. Hold This Position");
						UI.PageMessages.GUI.RC4text:SetText("4. Regroup Team!");
						UI.PageMessages.GUI.RC5text:SetText("5. Follow Me!");
						UI.PageMessages.GUI.RC6text:SetText("6. Taking fire!");
						UI.PageMessages.GUI.RC8text:SetText("o. Exit");
					elseif tostring(szKeyName)== "2" then
						UI.PageMessages.GUI.lap="2";
						UI.PageMessages.GUI.RC1text:SetText("1. Let's Go!");
						UI.PageMessages.GUI.RC2text:SetText("2. Fall Back!");
						UI.PageMessages.GUI.RC3text:SetText("3. Stick Together!");
						UI.PageMessages.GUI.RC4text:SetText("4. Get in Position!");
						UI.PageMessages.GUI.RC5text:SetText("5. Storm the Front");
						UI.PageMessages.GUI.RC6text:SetText("6. Follow My Comm!");
						UI.PageMessages.GUI.RC7text:SetText("7. GoGoGo!");
						UI.PageMessages.GUI.RC8text:SetText("8. Fire in the Hole");
						UI.PageMessages.GUI.RC10text:SetText("o. Exit");
					elseif tostring(szKeyName)== "3" then
						UI.PageMessages.GUI.lap="3";
						UI.PageMessages.GUI.RC1text:SetText("1. Roger That!");
						UI.PageMessages.GUI.RC2text:SetText("2. Enemy Spotted");
						UI.PageMessages.GUI.RC3text:SetText("3. Need Backup!");
						UI.PageMessages.GUI.RC4text:SetText("4. Sector Clear!");
						UI.PageMessages.GUI.RC5text:SetText("5. I'm in Position!");
						UI.PageMessages.GUI.RC6text:SetText("6. I'm hit!");
						UI.PageMessages.GUI.RC7text:SetText("7. It's gonna Blow!");
						UI.PageMessages.GUI.RC8text:SetText("8. Negative!");
						UI.PageMessages.GUI.RC9text:SetText("9. Enemy Down!");
						UI.PageMessages.GUI.RC10text:SetText("o. Exit");
					elseif tostring(szKeyName)== "4" then
						UI.PageMessages.GUI.lap="4";
						UI.PageMessages.GUI.RC1text:SetText("1. BACK LEFT!");
						UI.PageMessages.GUI.RC2text:SetText("2. BACK!");
						UI.PageMessages.GUI.RC3text:SetText("3. BACK RIGHT!");
						UI.PageMessages.GUI.RC4text:SetText("4. LEFT!");
						UI.PageMessages.GUI.RC5text:SetText("5. Cover the Flag!");
						UI.PageMessages.GUI.RC6text:SetText("6. RIGHT!");
						UI.PageMessages.GUI.RC7text:SetText("7. FRONT LEFT!");
						UI.PageMessages.GUI.RC8text:SetText("8. FRONT CENTER!");
						UI.PageMessages.GUI.RC9text:SetText("9. FRONT RIGHT!");
						UI.PageMessages.GUI.RC10text:SetText("o. Exit");
					elseif szKeyName=="o" then 
						UI.PageMessages.GUI.OnDeactivate();
					end
				elseif UI.PageMessages.GUI.lap=="1" then
					if tostring(szKeyName)== "1" then	
						Client:SendCommand("PLY ccover");
						System:ExecuteCommand("sayteam Cover me!");						
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "2" then 
						Client:SendCommand("PLY meet");
						System:ExecuteCommand("sayteam Meet at the Rendez-Vous Point!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "3" then 
						Client:SendCommand("PLY posit");
						System:ExecuteCommand("sayteam Hold This Position!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "4" then 
						Client:SendCommand("PLY regrp");
						System:ExecuteCommand("sayteam Regroup, Team!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "5" then
						Client:SendCommand("PLY follow");
						System:ExecuteCommand("sayteam Follow Me!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "6" then 
						Client:SendCommand("PLY fireas");
						System:ExecuteCommand("sayteam Taking Fire, Need Assistance!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif szKeyName=="o" then 
						UI.PageMessages.GUI.OnDeactivate();
					end
				elseif UI.PageMessages.GUI.lap=="2" then
					if tostring(szKeyName)== "1" then	
						Client:SendCommand("PLY go");
						System:ExecuteCommand("sayteam Ok, Let's GO!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "2" then 
						Client:SendCommand("PLY fallbck");
						System:ExecuteCommand("sayteam Team, Fall Back!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "3" then 
						Client:SendCommand("PLY stcktog");
						System:ExecuteCommand("sayteam Stick Together, Team!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "4" then 
						Client:SendCommand("PLY cgpos");
						System:ExecuteCommand("sayteam Get in Position!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "5" then 
						Client:SendCommand("PLY stormf");
						System:ExecuteCommand("sayteam Storm the Front!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "6" then 
						Client:SendCommand("PLY cfollow");
						System:ExecuteCommand("sayteam OK Team, Follow My Command!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "7" then 
						Client:SendCommand("PLY cgo");
						System:ExecuteCommand("sayteam GO!GO!GO!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "8" then 
						Client:SendCommand("PLY cfireh");
						System:ExecuteCommand("sayteam Fire in the Hole!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif szKeyName=="o" then 
						UI.PageMessages.GUI.OnDeactivate();
					end
					
				elseif UI.PageMessages.GUI.lap=="3" then
					if tostring(szKeyName)== "1" then	
						local rnd=random(1,2);
						if (rnd < 2) then 
							Client:SendCommand("PLY caffirm");
							System:ExecuteCommand("sayteam Affirmative!");
						else 	Client:SendCommand("PLY roger");
							System:ExecuteCommand("sayteam Roger That!");
						end
						UI.PageMessages.GUI.OnDeactivate();	
					elseif tostring(szKeyName)== "2" then 
						Client:SendCommand("PLY cenemy");
						System:ExecuteCommand("sayteam Enemy Spotted!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "3" then 
						Client:SendCommand("PLY cbackup");
						System:ExecuteCommand("sayteam Need Backup!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "4" then 
						Client:SendCommand("PLY clear");
						System:ExecuteCommand("sayteam Sector Clear!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "5" then 
						Client:SendCommand("PLY cinpos");
						System:ExecuteCommand("sayteam I'm in Position!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "6" then 
						Client:SendCommand("PLY hiiass");
						System:ExecuteCommand("sayteam I'm hit, Need Assistance!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "7" then 
						Client:SendCommand("PLY blow");
						System:ExecuteCommand("sayteam Get out of there, it's gonna blow!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "8" then 
						Client:SendCommand("PLY negat");
						System:ExecuteCommand("sayteam Negative!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "9" then 
						Client:SendCommand("PLY enemy");
						System:ExecuteCommand("sayteam Enemy Down!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif szKeyName=="o" then 
						UI.PageMessages.GUI.OnDeactivate();
					end
				elseif UI.PageMessages.GUI.lap=="4" then
					if tostring(szKeyName)== "1" then	
--						Client:SendCommand("PLY xxx");	xxx=not wavs yet
						System:ExecuteCommand("sayteam Incoming from BACK LEFT!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "2" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from BACK!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "3" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from BACK RIGHT!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "4" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from LEFT!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "5" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Cover the flag!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "6" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from RIGHT!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "7" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from FRONT LEFT!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "8" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from FRONT CENTER!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif tostring(szKeyName)== "9" then 
--						Client:SendCommand("PLY xxx");
						System:ExecuteCommand("sayteam Incoming from FRONT RIGHT!");
						UI.PageMessages.GUI.OnDeactivate();
					elseif szKeyName=="o" then 
						UI.PageMessages.GUI.OnDeactivate();
					end
				end
			end
		end,
	},
};

UI:CreateScreenFromTable("Messages",UI.PageMessages.GUI);