ULoginPro different platform versions

Useful Tutorials.
Post Reply
User avatar
CyberTroll
New Member
New Member
Posts: 4
Joined: Wed Apr 22, 2020 2:23 am

This tutorial spoon-feeds the enhancement of the initialization phase of the ULoginPro system with the capability to have different versions for different platforms at the same time. Why? Maybe you have encountered and fixed a bug, or added a feature on one specific platform and would like to change the version for it, but don't want to disable the "check game version" option in "GameData" and would like to still have the other versions on other platforms functional.

This is how.
Replace the line 504 in bl_LoginPro.cs

Code: Select all

using (UnityWebRequest w = UnityWebRequest.Get(bl_LoginProDataBase.Instance.GetUrl(bl_LoginProDataBase.URLType.Init))
With

Code: Select all

using (UnityWebRequest w = UnityWebRequest.Get(bl_LoginProDataBase.Instance.GetUrl(bl_LoginProDataBase.URLType.Init) + "?platform=" + Application.platform))
You are halfway through!

Now modify the provided PHP scripts accordingly.
Append these lines to the top of bl_Common.php, either to the top of $GameVersion of below it. Doesn't matter.

Code: Select all

$EditorGameVersion = "1.1";
$WindowsGameVersion = "1.1";
$MacOSGameVersion = "1.1";
$iOSGameVersion = "1.1";
$ANDROIDGameVersion = "1.1";
$LinuxGameVersion = "1.1";
$PS4GameVersion = "1.1";
$XBONEGameVersion = "1.1";
$GameVersion = "1.0";
Your former build v1.0 will remain functional as well as the updated v1.1, and the $GameVersion can be removed once you make sure all the players have updated their client to the new system. Or, you could just leave it.
Last but not least. Replace this line in bl_Init.php

Code: Select all

echo get_client_ip() . "|" . $GameVersion;
With

Code: Select all

/*
	Gets an Integer32 resembling the client's platform conforming to Unity's standards.
	//
	// Summary:
	//     In the Unity editor on macOS.
	OSXEditor = 0,
	//
	// Summary:
	//     In the player on macOS.
	OSXPlayer = 1,
	//
	// Summary:
	//     In the player on Windows.
	WindowsPlayer = 2,
	//
	// Summary:
	//     In the web player on macOS.
	OSXWebPlayer = 3,
	//
	// Summary:
	//     In the Dashboard widget on macOS.
	OSXDashboardPlayer = 4,
	//
	// Summary:
	//     In the web player on Windows.
	WindowsWebPlayer = 5,
	//
	// Summary:
	//     In the Unity editor on Windows.
	WindowsEditor = 7,
	//
	// Summary:
	//     In the player on the iPhone.
	IPhonePlayer = 8,
	PS3 = 9,
	XBOX360 = 10,
	//
	// Summary:
	//     In the player on Android devices.
	Android = 11,
	NaCl = 12,
	//
	// Summary:
	//     In the player on Linux.
	LinuxPlayer = 13,
	FlashPlayer = 15,
	//
	// Summary:
	//     In the Unity editor on Linux.
	LinuxEditor = 16,
	//
	// Summary:
	//     In the player on WebGL
	WebGLPlayer = 17,
	MetroPlayerX86 = 18,
	//
	// Summary:
	//     In the player on Windows Store Apps when CPU architecture is X86.
	WSAPlayerX86 = 18,
	MetroPlayerX64 = 19,
	//
	// Summary:
	//     In the player on Windows Store Apps when CPU architecture is X64.
	WSAPlayerX64 = 19,
	MetroPlayerARM = 20,
	//
	// Summary:
	//     In the player on Windows Store Apps when CPU architecture is ARM.
	WSAPlayerARM = 20,
	WP8Player = 21,
	BB10Player = 22,
	BlackBerryPlayer = 22,
	TizenPlayer = 23,
	PSP2 = 24,
	//
	// Summary:
	//     In the player on the Playstation 4.
	PS4 = 25,
	PSM = 26,
	//
	// Summary:
	//     In the player on Xbox One.
	XboxOne = 27,
	SamsungTVPlayer = 28,
	WiiU = 30,
	//
	// Summary:
	//     In the player on the Apple's tvOS.
	tvOS = 31,
	//
	// Summary:
	//     In the player on Nintendo Switch.
	Switch = 32,
	Lumin = 33,
	//
	// Summary:
	//     In the player on Stadia.
	Stadia = 34
*/

$client_platform = strip_tags($_GET["platform"]);

$ClientGameVersion = "";

if (isset($client_platform))
{
	if ($client_platform != "")
	{
		if ($client_platform == "OSXPlayer")
			$ClientGameVersion = $MacOSGameVersion;
		else if ($client_platform == "WindowsPlayer")
			$ClientGameVersion = $WindowsGameVersion;
		else if ($client_platform == "WindowsEditor")
			$ClientGameVersion = $EditorGameVersion;
		else if ($client_platform == "IPhonePlayer")
			$ClientGameVersion = $iOSGameVersion;
		else if ($client_platform == "Android")
			$ClientGameVersion = $ANDROIDGameVersion;
		else if ($client_platform == "LinuxPlayer")
			$ClientGameVersion = $LinuxGameVersion;
		else if ($client_platform == "PS4")
			$ClientGameVersion = $PS4GameVersion;
		else if ($client_platform == "XboxOne")
			$ClientGameVersion = $XBONEGameVersion;
	} else {
		$ClientGameVersion = $GameVersion;
	}
} else {
	$ClientGameVersion = $GameVersion;
}

echo get_client_ip() . "|" . $ClientGameVersion;
You may customize it whichever way you want. Have fun and thanks Lovatto for this awesome template!
Post Reply