/* Checks current user singed in status
     * NOTE: Signed in means that the user is signed in to GOG Galaxy client (he does not have to have working internet connection). */
    public bool IsSignedIn(bool silent = false)
    {
        bool signedIn = false;

        if (!silent)
        {
            Debug.Log("Checking SignedIn status...");
        }
        try
        {
            signedIn = GalaxyInstance.User().SignedIn();
            if (!silent)
            {
                Debug.Log("User SignedIn: " + signedIn);
            }
        }
        catch (GalaxyInstance.Error e)
        {
            if (!silent)
            {
                Debug.LogWarning("Could not check user signed in status for reason " + e);
            }
        }
        return(signedIn);
    }
    /* Checks if user is logged on
     * NOTE: Logged on means that the user is signed in to GOG Galaxy client and he does have working internet connection */
    public bool IsLoggedOn(bool silent = false)
    {
        bool isLoggedOn = false;

        if (!silent)
        {
            Debug.Log("Checking LoggedOn status...");
        }

        try
        {
            isLoggedOn = GalaxyInstance.User().IsLoggedOn();
            if (!silent)
            {
                Debug.Log("User logged on: " + isLoggedOn);
            }
        }
        catch (GalaxyInstance.Error e)
        {
            if (!silent)
            {
                Debug.LogWarning("Could not check user logged on status for reason " + e);
            }
        }

        return(isLoggedOn);
    }
示例#3
0
 protected override void connectImpl()
 {
     this.client = new GalaxySocket(ModCore.multiplayer.protocolVersion);
     GalaxyInstance.User().GetGalaxyID();
     this.client.JoinLobby(this.lobbyId);
     ModCore.monitor.Log("Success on generating modded galaxy client.");
 }
示例#4
0
 public GalaxySocket(string protocolVersion)
 {
     this.protocolVersion         = protocolVersion;
     lobbyData["protocolVersion"] = protocolVersion;
     selfId = GalaxyInstance.User().GetGalaxyID();
     galaxyLobbyEnterCallback   = new GalaxyLobbyEnteredListener(onGalaxyLobbyEnter);
     galaxyLobbyCreatedCallback = new GalaxyLobbyCreatedListener(onGalaxyLobbyCreated);
 }
示例#5
0
 public override void initialize()
 {
     Console.WriteLine("Starting Galaxy server");
     host = GalaxyInstance.User().GetGalaxyID();
     galaxyPersonaDataChangedListener = new GalaxyPersonaDataChangedListener(onPersonaDataChanged);
     server = new GalaxySocket("1.5.1");
     server.CreateLobby(Game1.options.serverPrivacy, (uint)(Game1.multiplayer.playerLimit * 2));
 }
 void AssignSharedFileIDToUser(string fileName, ulong sharedFileID)
 {
     try
     {
         GalaxyInstance.User().SetUserData(fileName, sharedFileID.ToString());
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.LogWarning("Could not assign file " + fileName + " to user for reason " + e);
     }
 }
 public override void OnFileShareSuccess(string fileName, ulong sharedFileID)
 {
     try
     {
         GalaxyInstance.User().SetUserData(fileName, sharedFileID.ToString());
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.LogWarning("Could not assign file " + fileName + " to user for reason " + e);
     }
     Debug.Log("File " + fileName + " was shared and assigned ID " + sharedFileID);
 }
示例#8
0
 /* Signs the current user in to Galaxy services
  * NOTE: This call is asynchronus. Sign in result is received by AuthListener. */
 public void SignInGalaxy()
 {
     Debug.Log("Signing user in using Galaxy client...");
     try
     {
         GalaxyInstance.User().SignInGalaxy();
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.LogWarning("SignInGalaxy failed for reason " + e);
     }
 }
示例#9
0
 /* Signs the current user out from Galaxy services */
 public void SignOut()
 {
     Debug.Log("Singing user out...");
     try
     {
         GalaxyInstance.User().SignOut();
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.LogWarning("SignOut failed for reason " + e);
     }
 }
 /* Signs the current user in to Galaxy services
  * NOTE: This call is asynchronus. Sign in result is received by AuthListener. */
 private void SignIn()
 {
     Debug.Log("Signing user in...");
     try
     {
         GalaxyInstance.User().SignIn();
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.LogWarning("SignIn failed for reason " + e);
     }
 }
示例#11
0
 public void SignInCredentials(string username, string password)
 {
     Debug.Log("Signing user in using credentials...");
     try
     {
         GalaxyInstance.User().SignInCredentials(username, password);
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.LogWarning("SignInCredentials failed for reason " + e);
     }
 }
 /* Downloads a file share */
 public void DownloadSharedFileFromUser(GalaxyID userID, string fileName)
 {
     specificUserDataListener.sharedFileID = GetSharedFileIDFromUser(userID, fileName);
     try
     {
         GalaxyInstance.User().RequestUserData(userID);
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.Log("Could not request user data for reason " + e);
     }
 }
示例#13
0
 /* Downloads a shared file by the userID of the file owner and its name
  * This function will set the fileName var in the specificUserDataListener,
  * set the userID var in the sharedFileDownloadListener, and request data
  * of the file owner so that we can grab the fileSharedID */
 public void DownloadSharedFileByUserIdAndFileName(GalaxyID userID, string fileName)
 {
     specificUserDataListener.fileName = fileName;
     sharedFileDownloadListener.userID = userID.ToString();
     try
     {
         GalaxyInstance.User().RequestUserData(userID, specificUserDataListener);
     }
     catch (GalaxyInstance.Error e)
     {
         Debug.Log("Could not request user data for reason " + e);
     }
 }
 // Token: 0x06000027 RID: 39 RVA: 0x000027A8 File Offset: 0x000009A8
 public static void initialize()
 {
     if (!GOGHelper.gogEnabled)
     {
         return;
     }
     try
     {
         GalaxyInstance.Init("8767653913349277", "58be5c2e55d7f535cf8c4b6bbc09d185de90b152c8c42703cc13502465f0d04a");
         GalaxyInstance.User().SignIn();
     }
     catch (Exception)
     {
     }
 }
        public override void OnAuthSuccess()
        {
            Debug.Log("Successfully signed in");

            myGalaxyID = GalaxyInstance.User().GetGalaxyID();

            GalaxyManager.Instance.StartStatsAndAchievements();
            GalaxyManager.Instance.StartFriends();

            if (GalaxyManager.Instance.IsLoggedOn())
            {
                GalaxyManager.Instance.StartLeaderboards();
                GalaxyManager.Instance.StartInvitations();
                GalaxyManager.Instance.StartStorage();
            }
        }
示例#16
0
 private void onEncryptedAppTicketResponse(EncryptedAppTicketResponse_t response, bool ioFailure)
 {
     if (response.m_eResult == EResult.k_EResultOK)
     {
         byte[] ticket = new byte[1024];
         SteamUser.GetEncryptedAppTicket(ticket, 1024, out uint ticketSize);
         Console.WriteLine("Signing into GalaxySDK");
         GalaxyInstance.User().SignInSteam(ticket, ticketSize, SteamFriends.GetPersonaName());
         ConnectionProgress++;
     }
     else
     {
         Console.WriteLine("Failed to retrieve encrypted app ticket: " + response.m_eResult + ", " + ioFailure.ToString());
         ConnectionFinished = true;
     }
 }
示例#17
0
 public void Initialize()
 {
     try
     {
         GalaxyInstance.Init(new InitParams("48767653913349277", "58be5c2e55d7f535cf8c4b6bbc09d185de90b152c8c42703cc13502465f0d04a"));
         authListener        = new AuthListener(onGalaxyAuthSuccess, onGalaxyAuthFailure, onGalaxyAuthLost);
         stateChangeListener = new OperationalStateChangeListener(onGalaxyStateChange);
         GalaxyInstance.User().SignInGalaxy(requireOnline: true);
         active = true;
         ConnectionProgress++;
     }
     catch (Exception value)
     {
         Console.WriteLine(value);
         ConnectionFinished = true;
     }
 }
    // Gets GalaxyID of the second player in currently entered lobby
    public GalaxyID GetSecondPlayerID()
    {
        Debug.Log("Trying to get second player ID");
        GalaxyID        secondPlayerID = null;
        List <GalaxyID> membersList    = GetAllLobbyMembers();

        Debug.Assert(membersList.Count == 2);
        if (membersList[0] != GalaxyInstance.User().GetGalaxyID())
        {
            secondPlayerID = membersList[0];
        }
        else
        {
            secondPlayerID = membersList[1];
        }
        Debug.Log("Second player ID " + secondPlayerID);
        return(secondPlayerID);
    }
示例#19
0
    /* Gets a SharedFileID for a file with a specified name. This uses the User
     * interface to read and return a value of a specified user data key. */
    public ulong GetSharedFileIDFromUser(GalaxyID userID, string fileName)
    {
        ulong sharedFileID = 0;

        if (fileName == null)
        {
            return(sharedFileID);
        }
        try
        {
            sharedFileID = ulong.Parse(GalaxyInstance.User().GetUserData(fileName, userID));
        }
        catch (GalaxyInstance.Error e)
        {
            Debug.Log("Could not get SharedFileID for file " + fileName + " for user " + userID.ToString() + " for reason " + e);
        }
        fileName = null;
        return(sharedFileID);
    }
示例#20
0
 public override string getUserID()
 {
     return(Convert.ToString(GalaxyInstance.User().GetGalaxyID().ToUint64()));
 }
示例#21
0
 protected override void connectImpl()
 {
     client = new GalaxySocket("1.5.1");
     GalaxyInstance.User().GetGalaxyID();
     client.JoinLobby(lobbyId, onReceiveError);
 }
示例#22
0
 protected override void connectImpl()
 {
     client = new GalaxySocket(Game1.multiplayer.protocolVersion);
     GalaxyInstance.User().GetGalaxyID();
     client.JoinLobby(lobbyId);
 }