// ================
// BATTLEZONE CLASSIC SHELL - Create Game Edit Popup
// Made by General BlackDragon
// ================

//
// CREATE THE NAME DIALOG
//
CreateControl("GameName", "STATIC")
{
	// inherit root STATIC's dimensions
	Geometry("HCENTRE", "VCENTRE");
	ColorGroup("WHITE");
	Style("MODAL");
	Size(236, 125);
	Image("popup3.tga", 20, 2, 492, 252);

	CreateControl("Text", "STATIC")
	{
		Geometry("LEFT", "TOP");
		ColorGroup("LISTBOX");
		Position(10, 12);
		Size(100, 9);
		Style("TRANSPARENT", "INERT");
		Font("SMALL");
		JustifyText("CENTER");
		Text("Game Name");
	}
	CreateControl("Text", "STATIC")
	{
		Geometry("LEFT", "TOP");
		ColorGroup("LISTBOX");
		Position(10, 41);
		Size(100, 9);
		Style("TRANSPARENT", "INERT");
		Font("SMALL");
		JustifyText("CENTER");
		Text("Password");
	}
	CreateControl("Text", "STATIC")
	{
		Geometry("LEFT", "TOP");
		ColorGroup("LISTBOX");
		Position(10, 70);
		Size(100, 9);
		Style("TRANSPARENT", "INERT");
		Font("SMALL");
		JustifyText("CENTER");
		Text("Game Message");
	}

	//
	// create the name edit box
	//
	CreateControl("NameEdit", "EDIT")
	{
		ColorGroup("BZCTEXTBOX");
		Geometry("LEFT", "TOP");
		Position(120, 10);
		Size(110, 12);
		//Style("ROLLOVER", "OUTLINE");
		Font("SMALL");
		UseVar("network.session.namebox");
		//Cursor("IBeam");
		NotifyParent("Edit::Enter", "Okay");
		MaxLength(33);	// 32 characters + 1 for the end
	}	

	//
	// create the password edit box
	//
	CreateControl("PasswordEdit", "EDIT")
	{
		ColorGroup("BZCTEXTBOX");
		Geometry("LEFT", "TOP");
		Position(120, 39);
		Size(110, 12);
		//Style("ROLLOVER", "OUTLINE");
		Font("SMALL");
		UseVar("network.session.password");
		//Cursor("IBeam");
		NotifyParent("Edit::Enter", "Okay");
		MaxLength(21);	// 21 characters + 1 for the end
	}	

	//
	// create the server message edit box
	//
	CreateControl("ServerMsgEdit", "EDIT")
	{
		ColorGroup("BZCTEXTBOX");
		Geometry("LEFT", "TOP");
		Position(120, 67);
		Size(110, 12);
		//Style("ROLLOVER", "OUTLINE");
		Font("SMALL");
		UseVar("network.session.servermsg");
		//Cursor("IBeam");
		NotifyParent("Edit::Enter", "Okay");
		MaxLength(250);	// limit to reasonable length
	}	

	//
	// create the Launch button
	//
	CreateControl("Okay", "BUTTON")
	{
		ColorGroup("BZCBUTTON");
		Geometry("LEFT", "BOTTOM");
		Position(0, -2);
		Size(118, 29);
		Style("ROLLOVER");
		Cursor("Highlight");
		Image("ButtonSmL.tga", 0, 0, 118, 29);
		NotifyParent("Button::Press", "Okay");

		CreateControl("Text", "STATIC")
		{
			Geometry("LEFT", "TOP");
			Position(19, 9);
			Size(80, 12);
			ColorGroup("BZCBUTTON");
			Font("SMALL");
			Style("INERT");
			JustifyText("CENTER");
			Text("Ok");
		}
	}	

	//
	// create the cancel button
	//
	CreateControl("Cancel", "BUTTON")
	{
		ColorGroup("BZCBUTTON");
		Geometry("RIGHT", "BOTTOM");
		Position(0, -2);
		Size(118, 29);
		Style("ROLLOVER");
		Cursor("Highlight");
		Image("ButtonSmR.tga", 0, 0, 118, 29);
		NotifyParent("Button::Press", "Cancel");

		CreateControl("Text", "STATIC")
		{
			Geometry("LEFT", "TOP");
			Position(19, 9);
			Size(80, 12);
			ColorGroup("BZCBUTTON");
			Font("SMALL");
			Style("INERT");
			JustifyText("CENTER");
			Text("Cancel");
		}
	}	

//		CreateControl("Tips1", "STATIC")
//		{
//			Geometry("LEFT", "Bottom");
//			Position(5, -45);
//			Size(200, 10);
//			Font("SMALL");
//			Text("Tip: if hosting a game from behind a firewall,");
//			JustifyText("LEFT");
//			Style("TRANSPARENT","INERT","VSLIDER");
//		}
//		CreateControl("Tips2", "STATIC")
//		{
//			Geometry("LEFT", "Bottom");
//			Position(5, -35);
//			Size(200, 10);
//			Font("SMALL");
//			Text("please read the nettips.txt file installed to your");
//			JustifyText("LEFT");
//			Style("TRANSPARENT","INERT","VSLIDER");
//		}
//		CreateControl("Tips3", "STATIC")
//		{
//			Geometry("LEFT", "Bottom");
//			Position(5, -25);
//			Size(200, 10);
//			Font("SMALL");
//			Text("BZ2 directory for a list of ports you must open.");
//			JustifyText("LEFT");
//			Style("TRANSPARENT","INERT","VSLIDER");
//		}


	OnEvent("Control::Activate")
	{
		Cmd("network.session.listoff");
		Cmd("network.forceupnpon");
	}

	OnEvent("Control::Deactivate")
	{
		Cmd("network.session.liston");
	}

	//
	// handle the Okay event
	//
	OnEvent("Okay")
	{
		Deactivate("|ShellMultiVehicle");
		Deactivate("|GameName");
		Deactivate("|ShellMulti");
		//Deactivate("|ShellMultiIrc");
		//Deactivate("|ShellMultJoin");

		Cmd("network.irceditline '/leave Creating a Game'");
		Cmd("network.chatline.ircentered");

		Cmd("network.session.create");
		Cmd("shell.multi.createGame");
		//		Activate("|ShellMultiOption");
		//Activate("|Communications");
	}	

	//
	// handle the Cancel event
	//
	OnEvent("Cancel")
	{
		Deactivate("|GameName");
		Activate("|ShellMultiJoin");
		Cmd("network.session.autorefreshon");
		Cmd("network.forceupnpoff");
	}
}
