수상한 미궁 랭킹 저장까지

This commit is contained in:
Ino 2025-01-28 15:46:25 +09:00
parent bdfaf6f726
commit 16b5bc2b42
9 changed files with 79 additions and 34 deletions

View File

@ -51,7 +51,6 @@ messageinfo 엄청 느린 버그
- 결과 화면 (승리 보상 지급)
수상한 미궁
- 맵 벽과 플레이 사이 더 멀게 만들자
- 맵 벽과 플레이 사이 더 멀게 만들자 (카메라가 벽 밖에 안 나가게)
- 결과 화면 (보상 지급)
- 랭킹 (플레이팹 v2 연결)
- 랭킹 화면

View File

@ -394,6 +394,19 @@ handlers.GuideQuestComplete = function(args)
}
}
handlers.Save_Rank = function(args)
{
progression.UpdateLeaderboardEntries({PlayFabId: currentPlayerId, LeaderboardName: args.LeaderboardName,
Entries :
[
{
"EntityId": currentPlayerId,
"Metadata": args.Metadata,
"Scores": args.Scores
}
]});
}
handlers.SaveToStageRank = function(args)
{
var error = Get_Error(args.Token);

View File

@ -19,5 +19,5 @@ MonoBehaviour:
EdExPath:
LocalCloudScriptPath: C:/Git/nn_himminji/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js
PanelIsShown: 0
curMainMenuIdx: 0
curMainMenuIdx: 4
curSubMenuIdx: 0

View File

@ -24,6 +24,7 @@ public class Skill_MultiShot : ProjectileBase
{
yield return null;
m_LifeTime -= Time.deltaTime;
if (DSUtil.CheckNull(m_ProjecTileData.shooter)) break;
transform.position = m_ProjecTileData.shooter.Get_Center_position();
}

View File

@ -1,6 +1,7 @@
using CodeStage.AntiCheat.ObscuredTypes;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
@ -8,12 +9,16 @@ public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
public Action<float> act_Time;
public Action<int> act_MobDieCount;
private ObscuredFloat _Time;
public float m_Time
public float m_TotalTime;
Dictionary<int, ObscuredFloat> dic_time = new Dictionary<int, ObscuredFloat>();
public void Set_Time(int floor, float time)
{
get { return _Time; }
set { _Time = value; _Time.RandomizeCryptoKey(); }
if (!dic_time.ContainsKey(MyValue.MyChoiceMapData.n_DungeonLv))
dic_time.Add(MyValue.MyChoiceMapData.n_DungeonLv, 0f);
dic_time[MyValue.MyChoiceMapData.n_DungeonLv] = time;
dic_time[MyValue.MyChoiceMapData.n_DungeonLv].RandomizeCryptoKey();
}
public float Get_Time(int floor) { return dic_time.ContainsKey(floor) ? dic_time[floor] : 0f; }
private ObscuredInt _MaxDieMobCount;
public int m_MaxDieMobCount
@ -37,6 +42,13 @@ public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
}
eDungeon m_Dungeon;
bool bTotalTimeUpdate = false;
private void Update()
{
if (bTotalTimeUpdate)
m_TotalTime += Time.deltaTime;
}
public void Stop_Dungeon(bool? win)
{
@ -47,11 +59,12 @@ public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
}
IEnumerator Co_Update_Time()
{
while (m_Time > 0f)
while (dic_time[MyValue.MyChoiceMapData.n_DungeonLv] > 0f)
{
yield return null;
m_Time -= Time.deltaTime;
act_Time?.Invoke(m_Time);
dic_time[MyValue.MyChoiceMapData.n_DungeonLv] -= Time.deltaTime;
dic_time[MyValue.MyChoiceMapData.n_DungeonLv].RandomizeCryptoKey();
act_Time?.Invoke(dic_time[MyValue.MyChoiceMapData.n_DungeonLv]);
}
// 시간 오버
@ -63,6 +76,7 @@ public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
act_MobDieCount?.Invoke(m_DieCount);
if (m_DieCount == m_MaxDieMobCount)
{
bTotalTimeUpdate = false;
switch (m_Dungeon)
{
case eDungeon.d1_Mimic: Stop_Dungeon(true); break;
@ -93,7 +107,12 @@ public class DungeonInfo : MonoBehaviourSingletonTemplate<DungeonInfo>
public void Start_Dungeon(bool first)
{
m_DieCount = 0;
if (first) m_MazeClear = 0;
if (first)
{
m_TotalTime = 0f;
m_MazeClear = 0;
}
bTotalTimeUpdate = true;
m_Dungeon = MyValue.MyChoiceMapData.Get_MapData().e_Dungeon;
switch (m_Dungeon)

View File

@ -446,31 +446,38 @@ public class ServerInfo : MyCoroutine
fail => { });
}
void Set_MyRank(Action _act)
public void Get_RankDefinition(string leaderboard)
{
PlayFabClientAPI.GetLeaderboardAroundPlayer(new GetLeaderboardAroundPlayerRequest { StatisticName = "Stage", MaxResultsCount = 1 },
PlayFabProgressionAPI.GetLeaderboardDefinition(new GetLeaderboardDefinitionRequest { Name = leaderboard },
result =>
{
_act?.Invoke();
},
fail =>
{
_act?.Invoke();
});
}
public void Save_Rank(string leaderboard, int _v)
{
var req = new UpdatePlayerStatisticsRequest { Statistics = new List<StatisticUpdate>() };
req.Statistics.Add(new StatisticUpdate { StatisticName = leaderboard, Value = _v });
PlayFabClientAPI.UpdatePlayerStatistics(req,
result =>
{
// 정상 등록 아무것도 안함
Debug.Log(result);
},
error =>
{
Set_Coroutine(() => { Save_Rank(leaderboard, _v); }, 2f);
Debug.Log(error);
});
}
public void Save_Rank(string leaderboard, List<string> scores)
{
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
{
FunctionName = "Save_Rank",
GeneratePlayStreamEvent = true,
FunctionParameter = new
{
LeaderboardName = leaderboard,
Metadata = "메타 데이터",
Scores = scores,
}
},
result =>
{
Debug.Log(result);
},
fail =>
{
Debug.Log(fail);
});
}
public void Get_MyRank(string leaderboard, Action<EntityLeaderboardEntry> my)

View File

@ -1,3 +1,4 @@
using System.Collections.Generic;
using TMPro;
public class DungeonResult_Maze : DungeonResultBase
@ -9,13 +10,18 @@ public class DungeonResult_Maze : DungeonResultBase
base.Set(win);
var sdata = ServerInfo.Ins.m_ServerData;
var curFloor = sdata.Get_DungeonLv(eDungeon.d2_Maze);
var nextFloor = MyValue.MyChoiceMapData.n_DungeonLv;
var nextFloor = MyValue.MyChoiceMapData.n_DungeonLv - 1; // 현재 층은 실패했으니 아랫층
texts[0].text = DSUtil.Format("기존 층수 : {0}\n\n최고 층수 : {1}", curFloor, nextFloor);
if (nextFloor > curFloor)
{
sdata.Set_DungeonLv(eDungeon.d2_Maze, nextFloor);
ServerInfo.Ins.Write(null, false);
var maxTime = MyValue.MyChoiceMapData.Get_DungeonMapData_orNull().f_Time;
var floorTime = DungeonInfo.Ins.Get_Time(nextFloor);
ServerInfo.Ins.Save_Rank("Rank_Maze",
new List<string> { nextFloor.ToString(), ((int)(maxTime - floorTime)).ToString(), "0" });
}
}
}

View File

@ -14,7 +14,7 @@ public class Ingame_Dungeon : MonoBehaviour
for (int i = 0; i < ingame_Dungeons.Length; i++)
ingame_Dungeons[i].gameObject.SetActive(false);
ingame_Dungeons[MyValue.MyChoiceMapData.Get_DungeonIndex()].Set_DungeonInfo(maxMobCount);
DungeonInfo.Ins.m_Time = time;
DungeonInfo.Ins.Set_Time(MyValue.MyChoiceMapData.n_DungeonLv, time);
DungeonInfo.Ins.act_Time = Set_TextTime;
}

View File

@ -53,7 +53,7 @@ public class StageResult : BackKeyAdd
m_TweenPosition.enabled = true;
m_TweenPosition.ResetToBeginning();
m_TweenPosition.Play(true);
ServerInfo.Ins.Save_Rank("Level", afterLv);
//ServerInfo.Ins.Save_Rank("Level", afterLv);
}
else
m_TweenPosition.enabled = false;