// Shows overlay dialogs for game invites to the currently entered lobby
    public void ShowOverlayInviteDialog()
    {
        string connectionString = "--JoinLobby=" + currentLobbyID.ToString();

        Debug.Log("Trying to open overlay invite dialog");
        try
        {
            GalaxyInstance.Friends().ShowOverlayInviteDialog(connectionString);
            Debug.Log("Showing Galaxy overlay invite dialog");
        }
        catch (GalaxyInstance.Error e)
        {
            Debug.LogWarning("Could not show Galaxy overlay invite dialog for reason: " + e);
        }
    }
Пример #2
0
 protected virtual void onReceiveConnection(GalaxyID peer)
 {
     if (!gameServer.isUserBanned(peer.ToString()))
     {
         Console.WriteLine("{0} connected", peer);
         onConnect(getConnectionId(peer));
         gameServer.sendAvailableFarmhands(createUserID(peer), delegate(OutgoingMessage msg)
         {
             sendMessage(peer, msg);
         });
     }
 }
Пример #3
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);
     }
 }
Пример #4
0
 private void LobbyListRetrieved(uint count)
 {
     Debug.Log(count + " lobbies OnLobbyList");
     if (count == 0)
     {
         GameObject.Find("OnlineBrowserScreen").GetComponent <OnlineBrowserController>().DisplayLobbyList(lobbyList);
     }
     else
     {
         for (uint i = 0; i < count; i++)
         {
             GalaxyID lobbyID = GalaxyInstance.Matchmaking().GetLobbyByIndex(i);
             lobbyList.Add(lobbyID);
             Debug.Log("Requesting lobby data for lobby " + i + " with lobbyID " + lobbyID.ToString());
             matchmaking.RequestLobbyData(lobbyID);
         }
     }
 }
Пример #5
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);
    }
Пример #6
0
 public override void OnLobbyList(uint count, LobbyListResult result)
 {
     if (result != LobbyListResult.LOBBY_LIST_RESULT_SUCCESS)
     {
         Debug.LogWarning("OnLobbyList failure reason: " + result);
         return;
     }
     Debug.Log(count + " lobbies OnLobbyList");
     matchmaking.lobbyCount = count;
     if (count == 0)
     {
         GameObject.Find("OnlineBrowserScreen").GetComponent <OnlineBrowserController>().DisplayLobbyList(null);
         return;
     }
     for (uint i = 0; i < count; i++)
     {
         GalaxyID lobbyID = GalaxyInstance.Matchmaking().GetLobbyByIndex(i);
         Debug.Log("Requesting lobby data for lobby " + i + " with lobbyID " + lobbyID.ToString());
         matchmaking.RequestLobbyData(lobbyID);
     }
 }