v2 엔티티 업데이트, v2 순위표 관련 타이틀 아이디로 종속 등

This commit is contained in:
Ino 2025-01-29 16:19:50 +09:00
parent c18d4519c8
commit 9ba1789fcb
4 changed files with 62 additions and 63 deletions

View File

@ -51,6 +51,7 @@ handlers.aaTest = function(args)
//]}); //]});
/* /*
// https://learn.microsoft.com/en-us/rest/api/playfab/server/account-management/get-player-profile?view=playfab-rest#playerprofileviewconstraints
var playerprofile = server.GetPlayerCombinedInfo({ PlayFabId: currentPlayerId, var playerprofile = server.GetPlayerCombinedInfo({ PlayFabId: currentPlayerId,
"InfoRequestParameters": "InfoRequestParameters":
{ {
@ -58,7 +59,9 @@ handlers.aaTest = function(args)
"ProfileConstraints": "ProfileConstraints":
{ {
"ShowTotalValueToDateInUsd": true, "ShowTotalValueToDateInUsd": true,
"ShowDisplayName": true "ShowDisplayName": true,
//"ShowStatistics": true, // 순위표 (레거시)
//"ShowLinkedAccounts": true, // 연결된 계정 (커스텀, 구글, 애플 등)
} }
} }
}); });
@ -70,7 +73,18 @@ handlers.aaTest = function(args)
log.info(parseInt(price * 50)); log.info(parseInt(price * 50));
} }
else else
log.info('<27><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>'); log.info('no cash buy');
*/
/*
// 타이틀 Id 찾는 법
// currentPlayerId == master Id
// playerprofile.TitlePlayerAccounts[currentPlayerId].Id == title Id (★)
var playerprofile = entity.GetTitlePlayersFromMasterPlayerAccountIds({ MasterPlayerAccountIds: [currentPlayerId]});
var titleId = playerprofile.TitlePlayerAccounts[currentPlayerId].Id;
// 순위표 v2 지우는 법
progression.DeleteLeaderboardEntries({ Name: "Rank_Maze", EntityIds: [titleId]});
*/ */
} }
@ -400,7 +414,7 @@ handlers.Save_Rank = function(args)
Entries : Entries :
[ [
{ {
"EntityId": currentPlayerId, "EntityId": args.EntityID,
"Metadata": args.Metadata, "Metadata": args.Metadata,
"Scores": args.Scores "Scores": args.Scores
} }
@ -450,7 +464,16 @@ handlers.Check_CanBuyInapp = function(args)
handlers.Del_TitlePlayer = function(args) handlers.Del_TitlePlayer = function(args)
{ {
if(!CheckNullOrEmpty(args.Agree)) if(!CheckNullOrEmpty(args.Agree))
{
var playerprofile = entity.GetTitlePlayersFromMasterPlayerAccountIds({ MasterPlayerAccountIds: [currentPlayerId]});
var titleId = playerprofile.TitlePlayerAccounts[currentPlayerId].Id;
log.info("순위표를 지웁니다.");
progression.DeleteLeaderboardEntries({ Name: "Rank_Maze", EntityIds: [titleId]});
log.info("타이틀 계정을 지웁니다.");
server.DeletePlayer({PlayFabId: currentPlayerId}); server.DeletePlayer({PlayFabId: currentPlayerId});
}
} }
@ -833,6 +856,7 @@ handlers.GetOtherData = function(args)
function Get_Inventory() function Get_Inventory()
{ {
return server.GetUserInventory({ PlayFabId: currentPlayerId }); return server.GetUserInventory({ PlayFabId: currentPlayerId });

View File

@ -1,3 +1,4 @@
using PlayFab.ProgressionModels;
using TMPro; using TMPro;
using UnityEngine.UI; using UnityEngine.UI;
@ -9,5 +10,13 @@ public class RankCard_Maze : CardBase
public override void Set<T>(T _base) public override void Set<T>(T _base)
{ {
base.Set(_base); base.Set(_base);
EntityLeaderboardEntry data = _base as EntityLeaderboardEntry;
texts[0].text = data.Rank > 3 ? data.Rank.ToString() : "";
images[0].enabled = data.Rank <= 3;
if (images[0].enabled)
images[0].sprite = UIAtlasMgr.Ins.Get_Sprite(DSUtil.Format("rank{0}", data.Rank));
texts[1].text = data.DisplayName;
texts[2].text = $"F{data.Scores[0]}";
//images[1].sprite = data.Metadata;
} }
} }

View File

@ -22,7 +22,11 @@ public class MapData : MonoBehaviour
} }
public MapZoneData Get_MapZoneData(int index) { return m_MapZoneData[index]; } public MapZoneData Get_MapZoneData(int index) { return m_MapZoneData[index]; }
public void Set_MazeMap(int index) { DSUtil.InActivateGameObjects(gos_map, index); } public void Set_MazeMap(int index)
{
DSUtil.InActivateGameObjects(gos_map, index);
Set_MazeNextPortal(index, false);
}
public void Set_MazeNextPortal(int index, bool active) public void Set_MazeNextPortal(int index, bool active)
{ {
var mzd = Get_MapZoneData(index); var mzd = Get_MapZoneData(index);

View File

@ -11,7 +11,6 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking; using UnityEngine.Networking;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
using StatisticUpdate = PlayFab.ClientModels.StatisticUpdate;
public class ServerInfo : MyCoroutine public class ServerInfo : MyCoroutine
{ {
@ -374,7 +373,8 @@ public class ServerInfo : MyCoroutine
} }
void SetFirstName(Action<bool> _servercomplete, bool newuser) void SetFirstName(Action<bool> _servercomplete, bool newuser)
{ {
UpdateUserTitleDisplayName(DSUtil.Format("마녀{0}", Random.Range(100000, 1000000)), var nick = DSUtil.Format("마녀{0}", Random.Range(100000, 1000000));
UpdateUserTitleDisplayName(nick,
() => { _servercomplete(newuser); }, () => { _servercomplete(newuser); },
() => { SetFirstName(_servercomplete, newuser); }); () => { SetFirstName(_servercomplete, newuser); });
} }
@ -411,15 +411,25 @@ public class ServerInfo : MyCoroutine
NetWait.Ins.Set(true); NetWait.Ins.Set(true);
PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest { DisplayName = _name }, PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest { DisplayName = _name },
result => result =>
{ { // 홈페이지에 이름 남김
NetWait.Ins.Set(false);
PlayFabProfilesAPI.SetDisplayName(new PlayFab.ProfilesModels.SetDisplayNameRequest { DisplayName = _name, },
result =>
{ // 내부 엔티티에 이름 남김 (랭킹에서 보임)
NetWait.Ins.Set(false); NetWait.Ins.Set(false);
UserName = _name; UserName = _name;
_success(); _success?.Invoke();
}, },
error => error =>
{ {
NetWait.Ins.Set(false); NetWait.Ins.Set(false);
_fail(); _fail?.Invoke();
});
},
error =>
{
NetWait.Ins.Set(false);
_fail?.Invoke();
}); });
} }
public void UpdateAvatarUrl(bool _shownetwait, Action _success, Action _fail) public void UpdateAvatarUrl(bool _shownetwait, Action _success, Action _fail)
@ -467,25 +477,25 @@ public class ServerInfo : MyCoroutine
FunctionParameter = new FunctionParameter = new
{ {
LeaderboardName = leaderboard, LeaderboardName = leaderboard,
Metadata = "메타 데이터", EntityID = m_LoginInfo.AuthenticationContext.EntityId,
Metadata = $"{m_ServerData.Get_EqiupmentEquip(eItem.PCCostume)}",
Scores = scores, Scores = scores,
} }
}, },
result => result =>
{ {
Debug.Log(result); //Debug.Log(result);
}, },
fail => fail =>
{ {
Debug.Log(fail); //Debug.Log(fail);
}); });
} }
public void Get_MyRank(string leaderboard, Action<EntityLeaderboardEntry> my) public void Get_MyRank(string leaderboard, Action<EntityLeaderboardEntry> my)
{ {
NetWait.Ins.Set(true); NetWait.Ins.Set(true);
PlayFabProgressionAPI.GetLeaderboardAroundEntity(new GetLeaderboardAroundEntityRequest PlayFabProgressionAPI.GetLeaderboardAroundEntity(new GetLeaderboardAroundEntityRequest
{ LeaderboardName = leaderboard, MaxSurroundingEntries = 1, { LeaderboardName = leaderboard, MaxSurroundingEntries = 1 },
Entity = new PlayFab.ProgressionModels.EntityKey { Id = m_LoginInfo.PlayFabId, Type = "title_player_account" } },
result => result =>
{ {
NetWait.Ins.Set(false); NetWait.Ins.Set(false);
@ -494,7 +504,7 @@ public class ServerInfo : MyCoroutine
for (int i = 0; i < result.Rankings.Count; i++) for (int i = 0; i < result.Rankings.Count; i++)
{ {
var temp = result.Rankings[i]; var temp = result.Rankings[i];
if (temp.Entity.Id.Equals(m_LoginInfo.PlayFabId)) if (temp.Entity.Id.Equals(m_LoginInfo.AuthenticationContext.EntityId))
{ {
my(temp); my(temp);
break; break;
@ -534,54 +544,6 @@ public class ServerInfo : MyCoroutine
NetWait.Ins.Set(false); NetWait.Ins.Set(false);
FailCheck(error, "랭킹 정보 획득 실패"); FailCheck(error, "랭킹 정보 획득 실패");
}); });
//var MyProfileConstraints = new PlayerProfileViewConstraints { ShowDisplayName = true, ShowAvatarUrl = true };
//PlayFabClientAPI.GetLeaderboard(new GetLeaderboardRequest { StatisticName = leaderboard, MaxResultsCount = 100, ProfileConstraints = MyProfileConstraints },
// result =>
// {
// if (result.Leaderboard != null && result.Leaderboard.Count > 0)
// {
// var my = result.Leaderboard.Find(f => f.PlayFabId.Equals(m_LoginInfo.PlayFabId));
// if (my == null)
// {
// PlayFabClientAPI.GetLeaderboardAroundPlayer(new GetLeaderboardAroundPlayerRequest { StatisticName = leaderboard, PlayFabId = m_LoginInfo.PlayFabId, ProfileConstraints = MyProfileConstraints, MaxResultsCount = getaround100 ? 100 : 1 },
// result_around =>
// {
// if (result_around.Leaderboard != null && result_around.Leaderboard.Count > 0)
// {
// NetWait.Ins.Set(false);
// _my(result_around.Leaderboard.Find(f => f.PlayFabId.Equals(m_LoginInfo.PlayFabId)));
// if (getaround100) _act100(result_around.Leaderboard);
// else _act100(result.Leaderboard);
// }
// },
// error_around =>
// {
// NetWait.Ins.Set(false);
// ToastUI.Ins.Set(143);
// _my(new PlayerLeaderboardEntry { PlayFabId = m_LoginInfo.PlayFabId, DisplayName = UserName, Position = 99998, StatValue = 0, Profile = new PlayerProfileModel { AvatarUrl = m_ServerData.Get_EqiupmentEquip(eItem.PC).ToString() } });
// _act100(new List<PlayerLeaderboardEntry>());
// });
// }
// else
// {
// NetWait.Ins.Set(false);
// _my(my);
// _act100(result.Leaderboard);
// }
// }
// else
// {
// NetWait.Ins.Set(false);
// ToastUI.Ins.Set(143);
// _my(new PlayerLeaderboardEntry { PlayFabId = m_LoginInfo.PlayFabId, DisplayName = UserName, Position = 99998, StatValue = 0, Profile = new PlayerProfileModel { AvatarUrl = m_ServerData.Get_EqiupmentEquip(eItem.PC).ToString() } });
// _act100(new List<PlayerLeaderboardEntry>());
// }
// },
// fail =>
// {
// NetWait.Ins.Set(false);
// FailCheck(fail, "랭킹 정보 획득 실패");
// });
} }
public void Get_OtherUserInfo(string _playfabid, Action<ServerData> _act) public void Get_OtherUserInfo(string _playfabid, Action<ServerData> _act)
{ {