Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@LukmanaAfif
LukmanaAfif / AccelByteMatchmakingLogic.cs
Created January 8, 2021 02:31
AccelByte Sample Game Unity - Matchmaking Logic
#region AccelByte MatchMaking Functions
/// <summary>
/// Find match function by calling lobby matchmaking
/// Get latencies from available game server regions from Quality of Service
/// Latencies can be used for matchmaking to determine which region has the lowest latency
/// </summary>
private void FindMatch()
{
if (connectToLocal)
{
@LukmanaAfif
LukmanaAfif / AccelByteAuthenticationLogic.cs
Created January 8, 2021 02:28
AccelByte Sample Game Unity - Auth Logic
public void Start()
{
if (useSteam)
{
#if UNITY_STANDALONE && !DISABLESTEAMWORKS
isUsingOtherPlatform = true;
loginType = E_LoginType.Steam;
UIHandlerAuthComponent.loginPanel.gameObject.SetActive(false);
Debug.Log("Valid ABUSER:"+abUser.Session.IsValid());
Debug.Log("Valid Steam Auth:" + steamAuth.isActiveAndEnabled);
@LukmanaAfif
LukmanaAfif / AccelByteChatLogic.cs
Created January 8, 2021 02:23
AccelByte Sample Game Unity - Lobby, Party, and Chat Logic
#region AccelByte Chat Functions
public void SendChatMessage()
{
if (string.IsNullOrEmpty(UIHandlerLobbyComponent.messageInputField.text))
WriteWarningInChatBox("Please enter write your message");
else if (string.IsNullOrEmpty(activePlayerChatUserId))
WriteWarningInChatBox("Please select player or party to chat");
else if (!UIHandlerLobbyComponent.partyChatButton.interactable)
SendPartyChat();
else
@LukmanaAfif
LukmanaAfif / AccelByteLeaderboardLogic.cs
Created May 18, 2020 04:31
AccelByte Leaderboard Logic Codes - Variables
public class AccelByteLeaderboardLogic : MonoBehaviour
{
private GameObject UIHandler;
private UILeaderboardComponent UIHandlerLeaderboardComponent;
private UIElementHandler UIElementHandler;
private Leaderboard abLeaderboard;
private IDictionary<string, RankData> playerRankList;
private string lastPlayerRank;
@LukmanaAfif
LukmanaAfif / AccelbyteServerSDKConfig.json
Created February 5, 2020 10:17
Accelbyte Server SDK Config File
{
"PublisherNamespace": "accelbyte",
"Namespace": "lightfantastic",
"BaseUrl": "https://sampleaddress.io",
"DSMServerUrl": "https://sampleaddress.io/dsm",
"IamServerUrl": "https://sampleaddress.io/iam",
"ClientId": "clientid",
"ClientSecret": "clientsecret",
"RedirectUri": "redirecturi"
}
@LukmanaAfif
LukmanaAfif / AccelbyteSDKConfig.json
Created February 5, 2020 10:12
Accelbyte SDK Config File
{
"PublisherNamespace": "accelbyte",
"Namespace": "lightfantastic",
"UseSessionManagement": true,
"BaseUrl": "https://sampleaddress.io",
"LoginServerUrl": "https://sampleaddress.io",
"IamServerUrl": "https://sampleaddress.io/iam",
"PlatformServerUrl": "https://sampleaddress.io/platform",
"BasicServerUrl": "https://sampleaddress.io/basic",
"LobbyServerUrl": "wss://sampleaddress.io/lobby/",
@LukmanaAfif
LukmanaAfif / AccelByteAuthenticationLogic.cs
Last active January 7, 2020 03:28
Login with Launcher
private const string AUTHORIZATION_CODE_ENVIRONMENT_VARIABLE = "JUSTICE_AUTHORIZATION_CODE";
//Attempts to login with launcher
public void LoginWithLauncher()
{
// Check if auth code is available from launcher
string authCode = Environment.GetEnvironmentVariable(AUTHORIZATION_CODE_ENVIRONMENT_VARIABLE);
if (authCode != null)
{