서버 -> 클라 공통적으로 시간 넘기기, 우편함 개별 받기
This commit is contained in:
parent
5a5e9f60a9
commit
4628cc1786
|
|
@ -37,7 +37,6 @@ handlers.aaTest = function(args)
|
||||||
//log.info(now.getDate());
|
//log.info(now.getDate());
|
||||||
|
|
||||||
//var curTime = new Date();
|
//var curTime = new Date();
|
||||||
//log.info(curTime);
|
|
||||||
//var t1 = new Date(curTime.setHours(curTime.getHours() + 1));
|
//var t1 = new Date(curTime.setHours(curTime.getHours() + 1));
|
||||||
//log.info(t1);
|
//log.info(t1);
|
||||||
//var t2 = new Date(t1.setDate(t1.getDate() + 1));
|
//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 error = Get_Error(args.Token);
|
||||||
var userdata = server.GetUserData({ PlayFabId: currentPlayerId, Keys: ["Mail"] }).Data;
|
var userdata = server.GetUserData({ PlayFabId: currentPlayerId, Keys: ["Mail"] }).Data;
|
||||||
if (!CheckNullOrEmpty(userdata.Mail))
|
return Get_Return(error, { Mail: JSON.parse(userdata.Mail.Value) });
|
||||||
{
|
|
||||||
return {
|
|
||||||
error: error,
|
|
||||||
Mail: JSON.parse(userdata.Mail.Value)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
error: error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
handlers.Get_MailReward = function(args)
|
handlers.Get_MailReward = function(args)
|
||||||
{
|
{
|
||||||
|
|
@ -186,6 +173,7 @@ handlers.Get_MailReward = function(args)
|
||||||
var userdata = server.GetUserData({ PlayFabId: currentPlayerId, Keys: ["Mail"] }).Data;
|
var userdata = server.GetUserData({ PlayFabId: currentPlayerId, Keys: ["Mail"] }).Data;
|
||||||
if (!CheckNullOrEmpty(userdata.Mail))
|
if (!CheckNullOrEmpty(userdata.Mail))
|
||||||
{
|
{
|
||||||
|
var urod = Get_JsonUserData();
|
||||||
var mailjson = JSON.parse(userdata.Mail.Value);
|
var mailjson = JSON.parse(userdata.Mail.Value);
|
||||||
var existmail = false;
|
var existmail = false;
|
||||||
var getdate = new Date(args.RemainTime);
|
var getdate = new Date(args.RemainTime);
|
||||||
|
|
@ -195,34 +183,24 @@ handlers.Get_MailReward = function(args)
|
||||||
if (maildate.getTime() === getdate.getTime())
|
if (maildate.getTime() === getdate.getTime())
|
||||||
{
|
{
|
||||||
existmail = true;
|
existmail = true;
|
||||||
|
Add_Item(urod, mailjson[i].ItemID, mailjson[i].Amount);
|
||||||
delete mailjson[i];
|
delete mailjson[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mailjson = mailjson.filter(function(x) { return x !== null }); // null 모두 지우기
|
mailjson = mailjson.filter(function(x) { return x !== null }); // null 모두 지우기
|
||||||
|
|
||||||
if(existmail)
|
if (existmail)
|
||||||
{
|
{
|
||||||
server.UpdateUserData({ PlayFabId: currentPlayerId, Permission: "Public", Data: {"Mail": JSON.stringify(mailjson)} });
|
server.UpdateUserData({ PlayFabId: currentPlayerId, Permission: "Public", Data: {"Mail": JSON.stringify(mailjson)} });
|
||||||
|
Set_JsonUserData(urod);
|
||||||
return {
|
return Get_Return(error, { Mail: mailjson } );
|
||||||
error : error,
|
|
||||||
Mail: mailjson
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
return Get_Return(3);
|
||||||
return {
|
|
||||||
error : 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
return Get_Return(3);
|
||||||
return {
|
|
||||||
error : 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
handlers.Get_AllMail = function(args)
|
handlers.Get_AllMail = function(args)
|
||||||
{
|
{
|
||||||
|
|
@ -250,11 +228,7 @@ handlers.Get_AllMail = function(args)
|
||||||
handlers.Get_UserInfo = function (args)
|
handlers.Get_UserInfo = function (args)
|
||||||
{
|
{
|
||||||
var urod = server.GetUserReadOnlyData({ PlayFabId: currentPlayerId }).Data;
|
var urod = server.GetUserReadOnlyData({ PlayFabId: currentPlayerId }).Data;
|
||||||
|
return Get_Return(Get_Error(args.Token), { GetUserReadOnlyData: urod });
|
||||||
return {
|
|
||||||
error: Get_Error(args.Token),
|
|
||||||
GetUserReadOnlyData: urod
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
handlers.Get_OtherUserInfo = function (args)
|
handlers.Get_OtherUserInfo = function (args)
|
||||||
{
|
{
|
||||||
|
|
@ -295,6 +269,35 @@ function Set_JsonUserData(urod)
|
||||||
{
|
{
|
||||||
server.UpdateUserReadOnlyData({ PlayFabId: currentPlayerId, Permission: "Public", Data: {"UserInfo": JSON.stringify(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)
|
function Add_Item(urod, itemid, amount, isCheat)
|
||||||
{
|
{
|
||||||
if (!urod.Item[itemid])
|
if (!urod.Item[itemid])
|
||||||
|
|
@ -389,9 +392,7 @@ handlers.Save_StageResult = function(args) {
|
||||||
|
|
||||||
Set_JsonUserData(urod);
|
Set_JsonUserData(urod);
|
||||||
|
|
||||||
return {
|
return Get_Return(0);
|
||||||
error: 0
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handlers.Save_PC_Stat = function(args)
|
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
|
#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 class SC_MyResult { public int result; }
|
||||||
|
|
||||||
public partial class ServerData
|
public partial class ServerData
|
||||||
|
|
|
||||||
|
|
@ -180,8 +180,14 @@ public class ServerInfo : MyCoroutine
|
||||||
}
|
}
|
||||||
int MyErrorCheck(string _result)
|
int MyErrorCheck(string _result)
|
||||||
{
|
{
|
||||||
var myError = JsonUtility.FromJson<SC_MyError>(_result);
|
var myError = JsonConvert.DeserializeObject<SC_CommonResult>(_result);
|
||||||
IsChatBan = myError.error == 1;
|
|
||||||
|
if (myError.time.Year < 2025)
|
||||||
|
Popup.Ins.Set(ePopupType.One, 999900000);
|
||||||
|
else
|
||||||
|
ServerTime = myError.time;
|
||||||
|
|
||||||
|
//IsChatBan = myError.error == 1;
|
||||||
switch (myError.error)
|
switch (myError.error)
|
||||||
{
|
{
|
||||||
case -1: Show_QuitPopup(ePopupType.One, 139); break;
|
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)
|
public void Get_MailReward(string _remaintime, Action<int> _act)
|
||||||
{
|
{
|
||||||
Init_ServerSave();
|
|
||||||
NetWait.Ins.Set(true);
|
NetWait.Ins.Set(true);
|
||||||
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ public class MailCard : CardBase
|
||||||
ToastUI.Ins.Set(144);
|
ToastUI.Ins.Set(144);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var lst = MailUI.Ins.Get_MailReward(new List<ItemSimpleData> { new ItemSimpleData { itemid = id, amount = amount } });
|
ObtainItemUI.Ins.Set(new ItemSimpleData { itemid = id, amount = amount });
|
||||||
sinfo.Write(() => { ObtainItemUI.Ins.Set(lst); });
|
sinfo.m_ServerData.Add_Item(id, amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MailUI.Ins.Del_Mail(m_ServerMailData);
|
MailUI.Ins.Del_Mail(m_ServerMailData);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue