서버 -> 클라 공통적으로 시간 넘기기, 우편함 개별 받기
This commit is contained in:
parent
5a5e9f60a9
commit
4628cc1786
|
|
@ -37,7 +37,6 @@ handlers.aaTest = function(args)
|
|||
//log.info(now.getDate());
|
||||
|
||||
//var curTime = new Date();
|
||||
//log.info(curTime);
|
||||
//var t1 = new Date(curTime.setHours(curTime.getHours() + 1));
|
||||
//log.info(t1);
|
||||
//var t2 = new Date(t1.setDate(t1.getDate() + 1));
|
||||
|
|
@ -164,19 +163,7 @@ handlers.Get_MailList = function(args)
|
|||
{
|
||||
var error = Get_Error(args.Token);
|
||||
var userdata = server.GetUserData({ PlayFabId: currentPlayerId, Keys: ["Mail"] }).Data;
|
||||
if (!CheckNullOrEmpty(userdata.Mail))
|
||||
{
|
||||
return {
|
||||
error: error,
|
||||
Mail: JSON.parse(userdata.Mail.Value)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return {
|
||||
error: error
|
||||
}
|
||||
}
|
||||
return Get_Return(error, { Mail: JSON.parse(userdata.Mail.Value) });
|
||||
}
|
||||
handlers.Get_MailReward = function(args)
|
||||
{
|
||||
|
|
@ -186,6 +173,7 @@ handlers.Get_MailReward = function(args)
|
|||
var userdata = server.GetUserData({ PlayFabId: currentPlayerId, Keys: ["Mail"] }).Data;
|
||||
if (!CheckNullOrEmpty(userdata.Mail))
|
||||
{
|
||||
var urod = Get_JsonUserData();
|
||||
var mailjson = JSON.parse(userdata.Mail.Value);
|
||||
var existmail = false;
|
||||
var getdate = new Date(args.RemainTime);
|
||||
|
|
@ -195,34 +183,24 @@ handlers.Get_MailReward = function(args)
|
|||
if (maildate.getTime() === getdate.getTime())
|
||||
{
|
||||
existmail = true;
|
||||
Add_Item(urod, mailjson[i].ItemID, mailjson[i].Amount);
|
||||
delete mailjson[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
mailjson = mailjson.filter(function(x) { return x !== null }); // null 모두 지우기
|
||||
|
||||
if(existmail)
|
||||
if (existmail)
|
||||
{
|
||||
server.UpdateUserData({ PlayFabId: currentPlayerId, Permission: "Public", Data: {"Mail": JSON.stringify(mailjson)} });
|
||||
|
||||
return {
|
||||
error : error,
|
||||
Mail: mailjson
|
||||
};
|
||||
Set_JsonUserData(urod);
|
||||
return Get_Return(error, { Mail: mailjson } );
|
||||
}
|
||||
else
|
||||
{
|
||||
return {
|
||||
error : 3
|
||||
}
|
||||
}
|
||||
return Get_Return(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
return {
|
||||
error : 3
|
||||
}
|
||||
}
|
||||
return Get_Return(3);
|
||||
}
|
||||
handlers.Get_AllMail = function(args)
|
||||
{
|
||||
|
|
@ -250,11 +228,7 @@ handlers.Get_AllMail = function(args)
|
|||
handlers.Get_UserInfo = function (args)
|
||||
{
|
||||
var urod = server.GetUserReadOnlyData({ PlayFabId: currentPlayerId }).Data;
|
||||
|
||||
return {
|
||||
error: Get_Error(args.Token),
|
||||
GetUserReadOnlyData: urod
|
||||
};
|
||||
return Get_Return(Get_Error(args.Token), { GetUserReadOnlyData: urod });
|
||||
}
|
||||
handlers.Get_OtherUserInfo = function (args)
|
||||
{
|
||||
|
|
@ -295,6 +269,35 @@ function Set_JsonUserData(urod)
|
|||
{
|
||||
server.UpdateUserReadOnlyData({ PlayFabId: currentPlayerId, Permission: "Public", Data: {"UserInfo": JSON.stringify(urod)} });
|
||||
}
|
||||
function Get_Return(errorval, add) {
|
||||
var rtn = {
|
||||
error: errorval,
|
||||
time: Get_CurKoreaTime()
|
||||
};
|
||||
|
||||
if (add && typeof add === 'object' && !Array.isArray(add)) {
|
||||
for (var key in add) {
|
||||
if (add.hasOwnProperty(key)) {
|
||||
rtn[key] = add[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.info(rtn.error + ", " + rtn.time);
|
||||
return rtn;
|
||||
|
||||
/*
|
||||
var result = Get_Return(0, { gold: 1000, name: "player1" });
|
||||
|
||||
결과:
|
||||
{
|
||||
error: 0,
|
||||
time: "2025-06-16T10:30:00.000Z", // 예시
|
||||
gold: 1000,
|
||||
name: "player1"
|
||||
}
|
||||
*/
|
||||
}
|
||||
function Add_Item(urod, itemid, amount, isCheat)
|
||||
{
|
||||
if (!urod.Item[itemid])
|
||||
|
|
@ -389,9 +392,7 @@ handlers.Save_StageResult = function(args) {
|
|||
|
||||
Set_JsonUserData(urod);
|
||||
|
||||
return {
|
||||
error: 0
|
||||
};
|
||||
return Get_Return(0);
|
||||
}
|
||||
|
||||
handlers.Save_PC_Stat = function(args)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -30,7 +30,11 @@ public class ServerMailData
|
|||
}
|
||||
#endregion
|
||||
|
||||
public class SC_MyError { public int error; }
|
||||
public class SC_CommonResult
|
||||
{
|
||||
public int error;
|
||||
public DateTime time;
|
||||
}
|
||||
public class SC_MyResult { public int result; }
|
||||
|
||||
public partial class ServerData
|
||||
|
|
|
|||
|
|
@ -180,8 +180,14 @@ public class ServerInfo : MyCoroutine
|
|||
}
|
||||
int MyErrorCheck(string _result)
|
||||
{
|
||||
var myError = JsonUtility.FromJson<SC_MyError>(_result);
|
||||
IsChatBan = myError.error == 1;
|
||||
var myError = JsonConvert.DeserializeObject<SC_CommonResult>(_result);
|
||||
|
||||
if (myError.time.Year < 2025)
|
||||
Popup.Ins.Set(ePopupType.One, 999900000);
|
||||
else
|
||||
ServerTime = myError.time;
|
||||
|
||||
//IsChatBan = myError.error == 1;
|
||||
switch (myError.error)
|
||||
{
|
||||
case -1: Show_QuitPopup(ePopupType.One, 139); break;
|
||||
|
|
@ -980,7 +986,6 @@ public class ServerInfo : MyCoroutine
|
|||
}
|
||||
public void Get_MailReward(string _remaintime, Action<int> _act)
|
||||
{
|
||||
Init_ServerSave();
|
||||
NetWait.Ins.Set(true);
|
||||
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ public class MailCard : CardBase
|
|||
ToastUI.Ins.Set(144);
|
||||
break;
|
||||
default:
|
||||
var lst = MailUI.Ins.Get_MailReward(new List<ItemSimpleData> { new ItemSimpleData { itemid = id, amount = amount } });
|
||||
sinfo.Write(() => { ObtainItemUI.Ins.Set(lst); });
|
||||
ObtainItemUI.Ins.Set(new ItemSimpleData { itemid = id, amount = amount });
|
||||
sinfo.m_ServerData.Add_Item(id, amount);
|
||||
break;
|
||||
}
|
||||
MailUI.Ins.Del_Mail(m_ServerMailData);
|
||||
|
|
|
|||
Loading…
Reference in New Issue