Skip to content

Instantly share code, notes, and snippets.

@LukmanaAfif
LukmanaAfif / AccelByteMatchmakingLogic.cs
Created Jan 8, 2021
AccelByte Sample Game Unity - Matchmaking Logic
View AccelByteMatchmakingLogic.cs
#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 Jan 8, 2021
AccelByte Sample Game Unity - Auth Logic
View AccelByteAuthenticationLogic.cs
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 Jan 8, 2021
AccelByte Sample Game Unity - Lobby, Party, and Chat Logic
View AccelByteChatLogic.cs
#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
AccelByte Leaderboard Logic Codes - Variables
View AccelByteLeaderboardLogic.cs
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 Feb 5, 2020
Accelbyte Server SDK Config File
View AccelbyteServerSDKConfig.json
{
"PublisherNamespace": "accelbyte",
"Namespace": "lightfantastic",
"BaseUrl": "https://sampleaddress.io",
"DSMServerUrl": "https://sampleaddress.io/dsm",
"IamServerUrl": "https://sampleaddress.io/iam",
"ClientId": "clientid",
"ClientSecret": "clientsecret",
"RedirectUri": "redirecturi"
}
View AccelbyteSDKConfig.json
{
"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/",
View AccelByteAuthenticationLogic.cs
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)
{