// ================
// BATTLEZONE SHELL
// ================

//
// CREATE THE NAME DIALOG
//
CreateControl("GameName", "STATIC")
{
	// inherit root STATIC's dimensions
	Geometry("PARENTWIDTH", "PARENTHEIGHT");
	ColorGroup("BACKGROUND");
	Style("MODAL");

	CreateControl("Name", "STATIC")
	{
		ColorGroup("MAGENTA");
		Geometry("HCENTRE", "VCENTRE");
		Position(0, 5);
		Size(200, 140);
		BorderSize(10);
		BevelSize(5);
		TabSize(150, 10);
		Style("OUTLINE", "TABROOT");
		Title("Game Info");
		TitleFont("MEDIUM");

		//
		// create the name title
		// 
		CreateControl("NameTitle", "STATIC")
		{
			Geometry("LEFT", "TOP");
			Position(-5, 0);
			Size(40, 10);
			Font("MEDIUM");
			Text("Name");
			JustifyText("LEFT");
			Style("TRANSPARENT");
		}

		//
		// create the name edit box
		//
		CreateControl("NameEdit", "EDIT")
		{
			ColorGroup("BLACKBLUE");
			Geometry("LEFT", "TOP");
			Position(0, 20);
			Size(200, 10);
			BorderSize(5);
			BevelSize(5);
			Style("ROLLOVER", "OUTLINE");
			Font("SMALL");
			UseVar("network.session.namebox");
			Cursor("Highlight");
			NotifyParent("Edit::Enter", "Okay");
			MaxLength(33);	// 32 characters + 1 for the end
		}	

		//
		// create the password title
		//
		CreateControl("PasswordTitle", "STATIC")
		{
			Geometry("LEFT", "TOP");
			Position(-5, 40);
			Size(80, 10);
			Font("MEDIUM");
			Text("Password");
			JustifyText("LEFT");
			Style("TRANSPARENT");
		}

		//
		// create the password edit box
		//
		CreateControl("PasswordEdit", "EDIT")
		{
			ColorGroup("BLACKBLUE");
			Geometry("LEFT", "TOP");
			Position(0, 60);
			Size(200, 10);
			BorderSize(5);
			BevelSize(5);
			Style("ROLLOVER", "OUTLINE");
			Font("SMALL");
			UseVar("network.session.password");
			Cursor("Highlight");
			NotifyParent("Edit::Enter", "Okay");
			MaxLength(21);	// 21 characters + 1 for the end
		}	

		//
		// create the server message title
		//
		CreateControl("ServerMsg", "STATIC")
		{
			Geometry("LEFT", "TOP");
			Position(-5, 80);
			Size(200, 10);
			Font("MEDIUM");
			Text("Server Message");
			JustifyText("LEFT");
			Style("TRANSPARENT");
		}

		//
		// create the server message edit box
		//
		CreateControl("ServerMsgEdit", "EDIT")
		{
			ColorGroup("BLACKBLUE");
			Geometry("LEFT", "TOP");
			Position(0, 100);
			Size(200, 10);
			BorderSize(5);
			BevelSize(5);
			Style("ROLLOVER", "OUTLINE");
			Font("SMALL");
			UseVar("network.session.servermsg");
			Cursor("Highlight");
			NotifyParent("Edit::Enter", "Okay");
			MaxLength(250);	// limit to reasonable length
		}	

		//
		// create the Launch button
		//
		CreateControl("Okay", "BUTTON")
		{
			ColorGroup("BLACKBLUE");
			Geometry("RIGHT", "BOTTOM");
			Position(-10, -5);
			Size(70, 0);
			BorderSize(10);
			BevelSize(5);
			Font("SMALL");
			JustifyText("CENTER");
			Text("OK");
			Style("ROLLOVER", "OUTLINE");
			Cursor("Highlight");
			NotifyParent("Button::Press", "Okay");
		}	

		//
		// create the cancel button
		//
		CreateControl("Cancel", "BUTTON")
		{
			ColorGroup("BLACKBLUE");
			Geometry("Left", "BOTTOM");
			Position(10, -5);
			Size(70, 0);
			BorderSize(10);
			BevelSize(5);
			Font("SMALL");
			JustifyText("CENTER");
			Text("Cancel");
			Style("ROLLOVER", "OUTLINE");
			Cursor("Highlight");
			NotifyParent("Button::Press", "Cancel");

		}	

		OnEvent("Control::Activate")
		{
			Cmd("network.session.listoff");
			Cmd("network.session.servermsg 'BattleStrat Z required. http://www.gamenewz.net/bs BS is a mod for BZONE. Faster play, 7 new vehicles, 6+ new weapons, enhanced graphics. You will get bad assets if you join this game without BS installed.'");
			Cmd("network.session.namebox '[MOD]BStrat Z Gamenewz.net/bs'");

		}

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

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

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

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