public override string getUserName(long farmerId) { if (!peers.ContainsLeft(farmerId)) { return(null); } GalaxyID user = new GalaxyID(peers[farmerId]); return(GalaxyInstance.Friends().GetFriendPersonaName(user)); }
public virtual void RequestFriendLobbyData() { uint count = GalaxyInstance.Friends().GetFriendCount(); for (uint i = 0u; i < count; i++) { GalaxyID friend = GalaxyInstance.Friends().GetFriendByIndex(i); GalaxyInstance.Friends().RequestRichPresence(friend); } }
/* Sets users rich presence visible to other user in friend list * Note: Rich presence can use following keys: * "status" displayed to other users in friend list, * "metadata" that describes the status to other instances of the game, * "connect" is basically a connection string that can be used by other players to join the game*/ public void SetRichPresence(string key, string value) { Debug.Log("Trying to set rich presence key " + key + " value " + value); try { GalaxyInstance.Friends().SetRichPresence(key, value); Debug.Log("Rich presence " + key + " set to value " + value); } catch (GalaxyInstance.Error e) { Debug.Log("Failed to set rich presence key " + key + " value " + value + " for reason " + e); } }
// Sends game invitation to user for the currently entered lobby public void SendInvitation(GalaxyID userID) { string connectionString = "--JoinLobby=" + currentLobbyID.ToString(); Debug.Log("Trying to send invitation to " + userID + " Connection string: " + connectionString); try { GalaxyInstance.Friends().SendInvitation(userID, connectionString); Debug.Log("Sent invitation to: " + userID + " Connection string: " + connectionString); } catch (GalaxyInstance.Error e) { Debug.LogWarning("Could not send invitation to: " + userID + " Connection string: " + connectionString + " for reason: " + e); } }
// 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); } }
// Gets a GalaxyID of friend user using his/her index on current user friends list public GalaxyID GetFriendByIndex(uint index) { Debug.Log("Trying to get friend " + index + " Galaxy ID"); GalaxyID galaxyID = null; Debug.Assert(friendListListener.retrieved); try { galaxyID = GalaxyInstance.Friends().GetFriendByIndex(index); Debug.Log("Friend " + index + " Galaxy ID: " + galaxyID); } catch (GalaxyInstance.Error e) { Debug.LogError("Failed to get friend by index " + index + " for reason " + e); } return(galaxyID); }
// Gets the state of a user specified by his/her GalaxyID public PersonaState GetFriendPersonaState(GalaxyID galaxyID) { Debug.Log("Trying to get friend " + galaxyID + " state"); PersonaState state = PersonaState.PERSONA_STATE_OFFLINE; Debug.Assert(friendListListener.retrieved); try { state = GalaxyInstance.Friends().GetFriendPersonaState(galaxyID); Debug.Log("Friend " + galaxyID + " state: " + state); } catch (GalaxyInstance.Error e) { Debug.LogError("Failed to get friend " + galaxyID + " for reason " + e); } return(state); }
// Gets the username of a user specified by his/her GalaxyID public string GetFriendPersonaName(GalaxyID galaxyID) { Debug.Log("Trying to get friend " + galaxyID + " name"); string name = ""; Debug.Assert(friendListListener.retrieved); try { name = GalaxyInstance.Friends().GetFriendPersonaName(galaxyID); Debug.Log("Friend " + galaxyID + " name: " + name); } catch (GalaxyInstance.Error e) { Debug.LogError("Failed to get friend " + galaxyID + " for reason " + e); } return(name); }
// Gets the count of current user friends list public uint GetFriendCount() { Debug.Log("Trying to get friend list count"); uint friendListCount = 0; Debug.Assert(friendListListener.retrieved); try { friendListCount = GalaxyInstance.Friends().GetFriendCount(); Debug.Log("Friend list count " + friendListCount); } catch (GalaxyInstance.Error e) { Debug.LogError("Failed to retrieve friend list count " + e); } return(friendListCount); }
protected override string getHostUserName() { return(GalaxyInstance.Friends().GetFriendPersonaName(serverId)); }
public virtual void ShowInviteDialog(object lobby) { GalaxyInstance.Friends().ShowOverlayInviteDialog("-connect-lobby-" + Convert.ToString((ulong)lobby)); }