-
Notifications
You must be signed in to change notification settings - Fork 963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTMP Get other player id #1453
Comments
any news about that? I'm looking for the participant id. |
I fixed the issue. I wanted to get Social.localUser.id and send to other
player.
15 Tem 2017 12:49 tarihinde "SamMcfly" <notifications@github.com> yazdı:
any news about that?
I'm looking for the participant id.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AV52dFgpLs4ZOImDjltEoVc5uKvXTnjKks5sOIsWgaJpZM4Kcn8o>
.
|
Do you know how could i get the opponent user name? |
You need to get social.localuser.name (or username i forget this method :))
on first player. You need to convert string to bytes[]. After converting
bytes, you will send other player. Other player needs to convert bytes[] to
string
15 Tem 2017 19:01 tarihinde "SamMcfly" <notifications@github.com> yazdı:
Do you know how could i get the opponent user name?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AV52dFLFH3TOZ779g8QxWxSk_PTmPQUaks5sOOJpgaJpZM4Kcn8o>
.
|
Is it the only way? a simpler solution must exist. Because when i receive an invitation from another player, i create a pop up notification in game that shows the opponent Username with this:
|
I searched so many sources but it looks like this is the only way
16 Tem 2017 11:28 tarihinde "SamMcfly" <notifications@github.com> yazdı:
Is it the only way? a simpler solution must exist.
Because when i receive an invitation from another player, i create a pop up
notification in game that shows the opponent Username with this:
string opponentUserName = mIncomingInvitation.Inviter.DisplayName;
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AV52dIsgZVBvtfAcmwP9LtyCXw66swgzks5sOcmegaJpZM4Kcn8o>
.
|
Okay, thanks! So i came to this for sending the user name to the other player:
But after how could i receive the other opponent message? |
You need to use getstring method like getbytes
16 Tem 2017 18:20 tarihinde "SamMcfly" <notifications@github.com> yazdı:
… Okay, thanks!
So i came to this for sending the user name to the other player:
PlayerUserName = PlayGamesPlatform.Instance.RealTime.GetSelf().DisplayName;
var PlayerUserNameBytes = System.Text.Encoding.UTF8.GetBytes(PlayerUserName);
bool reliable = true; PlayGamesPlatform.Instance.
RealTime.SendMessageToAll(reliable, PlayerUserNameBytes);
But after how could i receive the other opponent message?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AV52dMrFosg-fGN1R0ZZpUXcR7OEADvLks5sOiowgaJpZM4Kcn8o>
.
|
Do you have a sample of code to achieve that? because i'm trying but nothing worked. :/ Thanks a lot! |
private List<byte> usernameBytes;
/* Send Username*/
public void SendUsername(string username)
{
usernameBytes.Clear ();
char[] characters = username.ToCharArray();
usernameBytes.AddRange(Encoding.GetEncoding ("UTF-8").GetBytes (characters
));
byte[] messageToSend= usernameBytes.ToArray ();
PlayGamesPlatform.Instance.RealTime.SendMessageToAll (true, messageToSend);
}
/* Get Username */
public void OnRealTimeMessageReceived (bool isReliable, string senderId,
byte[] data)
{
if (senderId != PlayGamesPlatform.Instance.RealTime.GetSelf
().ParticipantId) {
string username = System.Text.Encoding.UTF8.GetString (data);
}
}
i hope it helps
2017-07-17 12:17 GMT+03:00 SamMcfly <notifications@github.com>:
… Do you have a sample of code to achieve that? because i'm trying but
nothing worked. :/
Thanks a lot!
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AV52dNzNR4UnXpQpIOXdkZ43fSfsPdgKks5sOyakgaJpZM4Kcn8o>
.
|
Thank you for sharing your code! But i've got an error at this line:
Errors are :
How could i fix that? |
I don't know :D try to add this lines but if it is not work, I don't know
any solution
using System.Collections.Generic;
using System.Text;
using System.Collections;
2017-07-19 17:38 GMT+03:00 SamMcfly <notifications@github.com>:
… Thank you for sharing your code!
But i've got an error at this line:
usernameBytes.AddRange(Encoding.GetEncoding ("UTF-8").GetBytes
(characters));
Errors are :
-
error CS0103: The name `Encoding' does not exist in the current context
-
error CS1502: The best overloaded method match for
`System.Collections.Generic.List.AddRange(System.Collections.Generic.IEnumerable)'
has some invalid arguments
-
error CS1503: Argument #1' cannot convertobject' expression to type
`System.Collections.Generic.IEnumerable'
How could i fix that?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1453 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AV52dPsAKC2phv9AxeWQXHaBGDiW9UaFks5sPhT0gaJpZM4Kcn8o>
.
|
Thank you! i miss the |
Hi. I have own username, score etc. system. I want get other player's id (not participantid, Social.localuser.id) for authenticate user from my web server. Everythink has been normal so far. I'm sending id in bytes but other player can't acces correct id. For example if my id is : 12345678, other player is getting 000012. How can I fix that ? Sorry for my bad english :)
This is ID sending part of script
Other Script
The text was updated successfully, but these errors were encountered: