Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VIKszpedisön
Manage
Activity
Members
Labels
Plan
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
DevTeam
VIKszpedisön
Commits
bb2fb579
Commit
bb2fb579
authored
3 years ago
by
benxidosz
Browse files
Options
Downloads
Patches
Plain Diff
minden fasza
parent
f5483d64
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs
+10
-13
10 additions, 13 deletions
Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs
with
10 additions
and
13 deletions
Assets/Scripts/PlayFabConn/PlayFabGetLeaderboard.cs
+
10
−
13
View file @
bb2fb579
using
System
;
using
System.Collections
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Security.Cryptography
;
using
PlayFab
;
using
PlayFab
;
using
PlayFab.ClientModels
;
using
PlayFab.ClientModels
;
using
UnityEngine
;
using
UnityEngine
;
...
@@ -13,6 +15,7 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
...
@@ -13,6 +15,7 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
[
SerializeField
]
private
GameObject
rowPrefab
;
[
SerializeField
]
private
GameObject
rowPrefab
;
public
bool
loggedIn
=
false
;
public
bool
loggedIn
=
false
;
private
bool
leaderboardGotten
=
false
;
private
bool
leaderboardGotten
=
false
;
private
bool
myDataGotten
=
false
;
private
int
datasRecived
=
0
;
private
int
datasRecived
=
0
;
private
string
LocalPlayer_PlayFabId
=
"NotSet"
;
private
string
LocalPlayer_PlayFabId
=
"NotSet"
;
private
Dictionary
<
string
,
Dictionary
<
string
,
string
>>
playerList
;
private
Dictionary
<
string
,
Dictionary
<
string
,
string
>>
playerList
;
...
@@ -74,13 +77,16 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
...
@@ -74,13 +77,16 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
leaderboardGotten
=
false
;
leaderboardGotten
=
false
;
var
request
=
new
GetLeaderboardRequest
{
var
request
=
new
GetLeaderboardRequest
{
StatisticName
=
"Score"
,
StatisticName
=
"Score"
,
StartPosition
=
0
MaxResultsCount
=
10
0
};
};
PlayFabClientAPI
.
GetLeaderboard
(
request
,
PlayFabClientAPI
.
GetLeaderboard
(
request
,
result
=>
{
result
=>
{
foreach
(
var
item
in
result
.
Leaderboard
)
{
foreach
(
var
item
in
result
.
Leaderboard
)
{
playerList
.
Add
(
item
.
PlayFabId
,
new
Dictionary
<
string
,
string
>());
playerList
.
Add
(
item
.
PlayFabId
,
new
Dictionary
<
string
,
string
>());
playerList
[
item
.
PlayFabId
].
Add
(
"Score"
,
item
.
StatValue
.
ToString
());
playerList
[
item
.
PlayFabId
].
Add
(
"Score"
,
item
.
StatValue
.
ToString
());
playerList
[
item
.
PlayFabId
].
Add
(
"Rank"
,
(
item
.
Position
+
1
).
ToString
());
if
(
item
.
PlayFabId
.
Equals
(
LocalPlayer_PlayFabId
))
Debug
.
Log
(
"Bastard"
);
}
}
leaderboardGotten
=
true
;
leaderboardGotten
=
true
;
...
@@ -132,21 +138,15 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
...
@@ -132,21 +138,15 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
hasPlayer
=
true
;
hasPlayer
=
true
;
var
datas
=
player
.
Value
;
var
datas
=
player
.
Value
;
AppendTableRow
(
datas
[
"Name"
],
datas
[
"Color"
],
datas
[
"Score"
]);
AppendTableRow
(
datas
[
"Rank"
],
datas
[
"Name"
],
datas
[
"Color"
],
datas
[
"Score"
]);
i
++;
i
++;
}
}
if
(!
hasPlayer
)
{
var
datas
=
playerList
[
LocalPlayer_PlayFabId
];
AppendTableRow
(
datas
[
"Name"
],
datas
[
"Color"
],
datas
[
"Score"
]);
}
}
}
void
AppendTableRow
(
string
playerName
,
string
color
,
string
score
)
{
void
AppendTableRow
(
string
rank
,
string
playerName
,
string
color
,
string
score
)
{
GameObject
row
=
Instantiate
(
rowPrefab
,
table
);
GameObject
row
=
Instantiate
(
rowPrefab
,
table
);
Text
[]
texts
=
row
.
GetComponentsInChildren
<
Text
>();
Text
[]
texts
=
row
.
GetComponentsInChildren
<
Text
>();
Image
image
=
row
.
GetComponentInChildren
<
Image
>();
Image
image
=
row
.
GetComponentInChildren
<
Image
>();
texts
[
0
].
text
=
playerName
;
texts
[
0
].
text
=
$"
{
rank
}
.
{
playerName
}
"
;
texts
[
1
].
text
=
score
;
texts
[
1
].
text
=
score
;
Color
tmpColor
=
Color
.
magenta
;
Color
tmpColor
=
Color
.
magenta
;
if
(
"red"
.
Equals
(
color
))
{
if
(
"red"
.
Equals
(
color
))
{
...
@@ -163,7 +163,4 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
...
@@ -163,7 +163,4 @@ public class PlayFabGetLeaderboard : MonoBehaviour {
image
.
color
=
tmpColor
;
image
.
color
=
tmpColor
;
}
}
public
void
SendPlayerData
()
{
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment