1846 lines
66 KiB
C#
1846 lines
66 KiB
C#
using CodeStage.AntiCheat.Storage;
|
|
//using Firebase.Analytics;
|
|
using MiniJSON;
|
|
using Newtonsoft.Json;
|
|
using PlayFab;
|
|
using PlayFab.ClientModels;
|
|
using PlayFab.ProgressionModels;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
using static InvBaseItem;
|
|
using Random = UnityEngine.Random;
|
|
|
|
public class ServerInfo : MyCoroutine
|
|
{
|
|
private static ServerInfo _ins;
|
|
public static ServerInfo Ins { get { if (_ins == null) { _ins = new GameObject("ServerInfo").AddComponent<ServerInfo>(); DontDestroyOnLoad(_ins.gameObject); } return _ins; } }
|
|
public static DateTime ServerTime;
|
|
|
|
public LoginResult m_LoginInfo;
|
|
public ServerData m_ServerData;
|
|
public string UserName, UserID;
|
|
public int VersionCode;
|
|
|
|
bool ServerTimeUpdate = false;
|
|
int WriteCount = 0;
|
|
float WriteDelayTime = 0f;
|
|
public float m_relogintime = 0f, m_serverTimeRefresh = 0f;
|
|
public bool IsChatBan;
|
|
DateTime AppPauseTime;
|
|
|
|
public SC_ServerStatus m_SC_ServerStatus;
|
|
|
|
string Server_Dev_ID = "D1149";
|
|
string Server_Live_ID = "CD90A";
|
|
public bool IsLiveServer() { return PlayFabSettings.TitleId.Equals(Server_Live_ID); }
|
|
|
|
List<string> list_log = new List<string>();
|
|
|
|
private void Awake()
|
|
{
|
|
PlayFabSettings.TitleId = Server_Live_ID;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
ServerTime = ServerTime.AddSeconds(Time.unscaledDeltaTime);
|
|
m_relogintime += Time.unscaledDeltaTime;
|
|
if (m_relogintime > 43200f) // 12시간
|
|
{
|
|
m_relogintime = 0f;
|
|
Login(null, () =>
|
|
{
|
|
m_relogintime = 43000f; // 실패 시, 200초 뒤에 다시 시도
|
|
});
|
|
}
|
|
|
|
// 인터넷 연결 체크
|
|
if (Application.internetReachability == NetworkReachability.NotReachable)
|
|
return;
|
|
|
|
if (ServerTimeUpdate)
|
|
{
|
|
m_serverTimeRefresh += Time.unscaledDeltaTime;
|
|
if (m_serverTimeRefresh > 300f) // 5분
|
|
{
|
|
m_serverTimeRefresh = 0f;
|
|
//Get_ServerTime(null); // TODO 정인호 : 시간 동기화
|
|
}
|
|
}
|
|
|
|
if (WriteDelayTime > 0f)
|
|
{
|
|
WriteDelayTime -= Time.unscaledDeltaTime;
|
|
if (WriteDelayTime <= 0f)
|
|
Write(null, false);
|
|
}
|
|
}
|
|
|
|
private void OnApplicationPause(bool pause)
|
|
{
|
|
#if UNITY_EDITOR
|
|
if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "StatTest") return;
|
|
#endif
|
|
|
|
if (pause)
|
|
{
|
|
AppPauseTime = ServerTime;
|
|
}
|
|
else
|
|
{
|
|
if (InGameInfo.Ins != null)
|
|
{
|
|
OffLineReward.m_Sec = (int)(ServerTime - AppPauseTime).TotalSeconds;
|
|
Check_OfflineReward();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ServerSave()
|
|
{
|
|
++WriteCount;
|
|
if (WriteCount > 10)
|
|
WriteDelayTime = 5f;
|
|
}
|
|
void Init_ServerSave()
|
|
{
|
|
m_ServerData.LastTime = ServerTime;
|
|
WriteCount = 0;
|
|
WriteDelayTime = 0f;
|
|
Send_Log();
|
|
}
|
|
|
|
public void Check_OfflineReward()
|
|
{
|
|
// TODO 정인호 : 비접속 시간만큼 시간 차감
|
|
m_ServerData.Sub_AllFarmSlotTime(OffLineReward.m_Sec); // 실제 사용 데이터
|
|
m_ServerData.Sub_AllFarmShopTime(OffLineReward.m_Sec); // 실제 사용 데이터
|
|
|
|
//m_ServerData.Sub_AllGambleADTime(OffLineReward.m_Sec); // 광고 뽑기
|
|
m_ServerData.Sub_ShopADTime(-1, OffLineReward.m_Sec); // 상점 광고
|
|
//m_ServerData.Sub_Common(eCommon.CloverShopResetTime, OffLineReward.m_Sec); // 클로버 상점 초기화 시간
|
|
|
|
//if (OffLineReward.m_Sec >= 300)
|
|
// GameUI.Ins.LobbyUI.Get_OffLineReward().Set();
|
|
//else
|
|
//{
|
|
// OffLineReward.m_Sec = 0;
|
|
// OffLineReward.m_Sec.RandomizeCryptoKey();
|
|
//}
|
|
|
|
OffLineReward.m_Sec = 0; // 위 주석으로 인해 일단 넣어둠
|
|
}
|
|
|
|
public void Show_UpdateAppPopup()
|
|
{
|
|
#if UNITY_ANDROID
|
|
Popup.Ins.Set(ePopupType.One, 138,
|
|
() =>
|
|
{
|
|
#if FGB_OneStore
|
|
Application.OpenURL(MyValue.OnestoreURL);
|
|
#else
|
|
Application.OpenURL("market://details?id=" + Application.identifier);
|
|
#endif
|
|
DSUtil.Quit();
|
|
}, DSUtil.Quit);
|
|
|
|
#else
|
|
Popup.Ins.Set(ePopupType.One, 138,
|
|
() =>
|
|
{
|
|
Application.OpenURL("itms-apps://itunes.apple.com/app/id6444575874");
|
|
DSUtil.Quit();
|
|
}, DSUtil.Quit);
|
|
#endif
|
|
}
|
|
|
|
void FailCheck(PlayFabError _error, string _msg)
|
|
{
|
|
if (_error != null)
|
|
{
|
|
switch (_error.Error)
|
|
{
|
|
default:
|
|
Popup.Ins.Set(ePopupType.One, -2, null, null, _msg);
|
|
Debug.Log(_msg + "\n" + _error.Error + "\n" + _error.GenerateErrorReport());
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
void FailCheck(ExecuteCloudScriptResult _result, string _msg)
|
|
{
|
|
if (_result != null && _result.Error != null)
|
|
{
|
|
Popup.Ins.Set(ePopupType.One, -2, null, null, _msg);
|
|
Debug.Log(_msg + "\n\n" + _result.Error.Error + "\n" + _result.Error.Message);
|
|
}
|
|
}
|
|
int MyErrorCheck(string _result)
|
|
{
|
|
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;
|
|
case -2: Show_QuitPopup(ePopupType.One, 140); break;
|
|
case -99: Show_QuitPopup(ePopupType.One, 141); break;
|
|
case 2: break;
|
|
}
|
|
return myError.error;
|
|
}
|
|
void Show_ServerCheckPopup()
|
|
{
|
|
Show_QuitPopup(ePopupType.Check, 142, () =>
|
|
{
|
|
DSUtil.Quit();
|
|
Application.OpenURL("https://cafe.naver.com/lwstory");
|
|
});
|
|
}
|
|
void Show_QuitPopup(ePopupType _type, int _msgkey, Action _ok = null)
|
|
{
|
|
Time.timeScale = 0f;
|
|
ServerTimeUpdate = false;
|
|
WriteDelayTime = float.MaxValue;
|
|
Popup.Ins.Set(_type, _msgkey, _ok == null ? DSUtil.Quit : _ok, DSUtil.Quit);
|
|
}
|
|
|
|
public void Login(Action<bool> _servercomplete, Action _fail = null)
|
|
{
|
|
PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest { CustomId = UserID, CreateAccount = true, InfoRequestParameters = new GetPlayerCombinedInfoRequestParams { GetPlayerProfile = true } },
|
|
loginresult =>
|
|
{
|
|
m_LoginInfo = loginresult;
|
|
if (m_LoginInfo.InfoResultPayload != null && m_LoginInfo.InfoResultPayload.PlayerProfile != null)
|
|
UserName = m_LoginInfo.InfoResultPayload.PlayerProfile.DisplayName;
|
|
ServerSave_LoginToken(() => { Get_TitleData(_servercomplete); }, _fail);
|
|
},
|
|
error =>
|
|
{
|
|
FailCheck(error, "서버 로그인 실패");
|
|
_fail?.Invoke();
|
|
});
|
|
}
|
|
|
|
// 서버에서 전달
|
|
//public void Get_ServerTime(Action<bool> _servercomplete)
|
|
//{
|
|
// PlayFabClientAPI.GetTime(new GetTimeRequest(),
|
|
// success =>
|
|
// {
|
|
// ServerTime = success.Time.AddHours(MyValue.UTC);
|
|
// ServerTimeUpdate = true;
|
|
// if (_servercomplete != null)
|
|
// Get_TitleData(_servercomplete);
|
|
// },
|
|
// fail =>
|
|
// {
|
|
// Get_ServerTime(_servercomplete);
|
|
// Debug.Log("서버 시간 받아오기 실패 : " + fail.ErrorMessage);
|
|
// });
|
|
//}
|
|
|
|
void Get_TitleData(Action<bool> _servercomplete)
|
|
{
|
|
PlayFabClientAPI.GetTitleData(new GetTitleDataRequest(),
|
|
ack =>
|
|
{
|
|
m_SC_ServerStatus = JsonConvert.DeserializeObject<SC_ServerStatus>(ack.Data["ServerStatus"].ToString());
|
|
Set_HotTime(m_SC_ServerStatus.HotTime);
|
|
|
|
// 버전 체크하기
|
|
var verJson = JsonConvert.DeserializeObject<List<SC_Version>>(ack.Data["Version"].ToString());
|
|
var ver = verJson.Find(f => f.Version.Equals(Application.version));
|
|
if (ack.Data.ContainsKey("PassIDs") && ack.Data["PassIDs"] != null)
|
|
{
|
|
var PassIDs = ack.Data["PassIDs"].ToString();
|
|
if (!string.IsNullOrEmpty(PassIDs))
|
|
{
|
|
var split = PassIDs.Split(',');
|
|
for (int i = 0; i < split.Length; i++)
|
|
{
|
|
if (m_LoginInfo.PlayFabId.Equals(split[i]))
|
|
{
|
|
ver.VersionStatus = "live";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (PlayFabSettings.TitleId.Equals(Server_Dev_ID) && ver != null)
|
|
ver.VersionStatus = "live";
|
|
|
|
if (ver != null)
|
|
{
|
|
switch (ver.VersionStatus)
|
|
{
|
|
case "dev":
|
|
PlayFabSettings.TitleId = Server_Dev_ID;
|
|
Login(_servercomplete);
|
|
return;
|
|
|
|
case "check":
|
|
Show_ServerCheckPopup();
|
|
return;
|
|
|
|
default:
|
|
Get_UserInfo(_servercomplete);
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Show_UpdateAppPopup();
|
|
return;
|
|
}
|
|
},
|
|
fail =>
|
|
{
|
|
FailCheck(fail, "서버 점검 체크 실패");
|
|
});
|
|
}
|
|
|
|
public void Set_HotTime(string _hottime)
|
|
{
|
|
if (!string.IsNullOrEmpty(_hottime) && _hottime.Contains(","))
|
|
{
|
|
var hottime = _hottime.Split(',');
|
|
var hotstart = hottime[0].Split('-');
|
|
if (hotstart.Length == 4)
|
|
m_SC_ServerStatus.HotTimeStart = new DateTime(int.Parse(hotstart[0]), int.Parse(hotstart[1]), int.Parse(hotstart[2]), int.Parse(hotstart[3]), 0, 0);
|
|
var hotend = hottime[1].Split('-');
|
|
if (hotend.Length == 4)
|
|
m_SC_ServerStatus.HotTimeEnd = new DateTime(int.Parse(hotend[0]), int.Parse(hotend[1]), int.Parse(hotend[2]), int.Parse(hotend[3]), 0, 0);
|
|
}
|
|
}
|
|
|
|
void Get_UserInfo(Action<bool> _servercomplete)
|
|
{
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new { Token = m_LoginInfo.EntityToken.EntityToken }
|
|
},
|
|
urod =>
|
|
{
|
|
if (!DSUtil.CheckNull(urod) && !DSUtil.CheckNull(urod.FunctionResult) && MyErrorCheck(urod.FunctionResult.ToString()) > -1)
|
|
{
|
|
//try
|
|
{
|
|
Dictionary<string, object> jsonData = Json.Deserialize(urod.FunctionResult.ToString()) as Dictionary<string, object>;
|
|
var gurod = Json.Serialize(jsonData["GetUserReadOnlyData"]);
|
|
var gurodjson = Json.Deserialize(gurod) as Dictionary<string, object>;
|
|
bool newUser = false;
|
|
|
|
if (gurodjson.ContainsKey("UserInfo"))
|
|
{ // 기존 유저
|
|
var userinfo = Json.Serialize(gurodjson["UserInfo"]);
|
|
var userinfojson = Json.Deserialize(userinfo) as Dictionary<string, object>;
|
|
ServerData_Read Read = JsonConvert.DeserializeObject<ServerData_Read>(userinfojson["Value"].ToString());
|
|
m_ServerData = Read.Get_ServerData(false);
|
|
|
|
OffLineReward.m_Sec = (int)(ServerTime - m_ServerData.LastTime).TotalSeconds;
|
|
}
|
|
else
|
|
{ // 신규 유저
|
|
m_ServerData = new ServerData();
|
|
newUser = true;
|
|
}
|
|
|
|
DataCheckMgr.Ins.Set();
|
|
OptionInfo.Ins.Set_UI();
|
|
|
|
// 서버 데이터 가져오기 완료
|
|
if (newUser) // 기본 데이터 서버에 저장하고 닉네임 만들기
|
|
Write(() => { SetFirstName(_servercomplete, true); });
|
|
else
|
|
_servercomplete(false);
|
|
}
|
|
//catch
|
|
//{
|
|
// Popup.Ins.Set(ePopupType.Two, "유저 정보를 읽지 못했습니다.\n문의하시겠습니까?", OptionInfo.Ins.OnClick_Help, DSUtil.Quit);
|
|
//}
|
|
}
|
|
else
|
|
FailCheck(urod, "유저 정보 받아오기 실패");
|
|
},
|
|
fail =>
|
|
{
|
|
FailCheck(fail, "유저 정보 받아오기 실패");
|
|
});
|
|
}
|
|
void SetFirstName(Action<bool> _servercomplete, bool newuser)
|
|
{
|
|
var nick = DSUtil.Format("힘민지{0}", Random.Range(100000, 1000000));
|
|
UpdateUserTitleDisplayName(nick,
|
|
() => { _servercomplete(newuser); },
|
|
() => { SetFirstName(_servercomplete, newuser); });
|
|
}
|
|
|
|
public void ServerSave_LoginToken(Action _act, Action _fail = null)
|
|
{
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
_act();
|
|
else
|
|
{
|
|
FailCheck(result, "토큰 저장 fail");
|
|
_fail?.Invoke();
|
|
}
|
|
},
|
|
fail =>
|
|
{
|
|
FailCheck(fail, "토큰 저장 실패");
|
|
_fail?.Invoke();
|
|
});
|
|
}
|
|
public void UpdateUserTitleDisplayName(string _name, Action _success, Action _fail)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.UpdateUserTitleDisplayName(new UpdateUserTitleDisplayNameRequest { DisplayName = _name },
|
|
result =>
|
|
{ // 홈페이지에 이름 남김
|
|
NetWait.Ins.Set(false);
|
|
PlayFabProfilesAPI.SetDisplayName(new PlayFab.ProfilesModels.SetDisplayNameRequest { DisplayName = _name, },
|
|
result =>
|
|
{ // 내부 엔티티에 이름 남김 (랭킹에서 보임)
|
|
NetWait.Ins.Set(false);
|
|
UserName = _name;
|
|
_success?.Invoke();
|
|
},
|
|
error =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
_fail?.Invoke();
|
|
});
|
|
},
|
|
error =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
_fail?.Invoke();
|
|
});
|
|
}
|
|
public void UpdateAvatarUrl(bool _shownetwait, Action _success, Action _fail)
|
|
{
|
|
NetWait.Ins.Set(_shownetwait);
|
|
// 얼굴(0) | 칭호(1)
|
|
string mydata = DSUtil.Format("{0}", m_ServerData.Get_EqiupmentEquip(eItem.PC));
|
|
PlayFabClientAPI.UpdateAvatarUrl(new UpdateAvatarUrlRequest { ImageUrl = mydata },
|
|
result =>
|
|
{
|
|
if (_shownetwait) NetWait.Ins.Set(false);
|
|
_success?.Invoke();
|
|
},
|
|
error =>
|
|
{
|
|
if (_shownetwait) NetWait.Ins.Set(false);
|
|
_fail?.Invoke();
|
|
});
|
|
}
|
|
public void Get_News(Action<List<TitleNewsItem>> _act)
|
|
{
|
|
PlayFabClientAPI.GetTitleNews(new GetTitleNewsRequest(),
|
|
result => { _act?.Invoke(result.News); },
|
|
fail => { });
|
|
}
|
|
|
|
public void Get_RankDefinition(string leaderboard)
|
|
{
|
|
PlayFabProgressionAPI.GetLeaderboardDefinition(new GetLeaderboardDefinitionRequest { Name = leaderboard },
|
|
result =>
|
|
{
|
|
Debug.Log(result);
|
|
},
|
|
error =>
|
|
{
|
|
Debug.Log(error);
|
|
});
|
|
}
|
|
public void Save_Rank(string leaderboard, List<string> scores)
|
|
{
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
LeaderboardName = leaderboard,
|
|
EntityID = m_LoginInfo.AuthenticationContext.EntityId,
|
|
Metadata = $"{m_ServerData.Get_EqiupmentEquip(eItem.PCCostume)}",
|
|
Scores = scores,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
Debug.Log(result);
|
|
},
|
|
fail =>
|
|
{
|
|
Debug.Log(fail.ErrorMessage);
|
|
});
|
|
}
|
|
public void Get_MyRank(string leaderboard, Action<EntityLeaderboardEntry> my)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabProgressionAPI.GetLeaderboardAroundEntity(new GetLeaderboardAroundEntityRequest
|
|
{ LeaderboardName = leaderboard, MaxSurroundingEntries = 1 },
|
|
result =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
if (!DSUtil.CheckNull(result) && result.Rankings.Count > 0)
|
|
{
|
|
for (int i = 0; i < result.Rankings.Count; i++)
|
|
{
|
|
var temp = result.Rankings[i];
|
|
if (temp.Entity.Id.Equals(m_LoginInfo.AuthenticationContext.EntityId))
|
|
{
|
|
my(temp);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ToastUI.Ins.Set(143);
|
|
my(null);
|
|
}
|
|
},
|
|
error =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(error, "내 랭킹 정보 획득 실패");
|
|
});
|
|
}
|
|
public void Get_Rank(string leaderboard, Action<List<EntityLeaderboardEntry>> _act100, uint pagesize = 100)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabProgressionAPI.GetLeaderboard(new GetEntityLeaderboardRequest { LeaderboardName = leaderboard, PageSize = pagesize },
|
|
result =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
_act100?.Invoke(result.Rankings);
|
|
}, error =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(error, "랭킹 정보 획득 실패");
|
|
});
|
|
}
|
|
public void Get_OtherUserInfo(string _playfabid, Action<ServerData> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new { Token = m_LoginInfo.EntityToken.EntityToken, ID = _playfabid }
|
|
},
|
|
urod =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
if (MyErrorCheck(urod.FunctionResult.ToString()) > -1)
|
|
{
|
|
Dictionary<string, object> jsonData = Json.Deserialize(urod.FunctionResult.ToString()) as Dictionary<string, object>;
|
|
var gurod = Json.Serialize(jsonData["GetUserReadOnlyData"]);
|
|
var gurodjson = Json.Deserialize(gurod) as Dictionary<string, object>;
|
|
|
|
if (gurodjson.ContainsKey("UserInfo"))
|
|
{ // 기존 유저
|
|
var userinfo = Json.Serialize(gurodjson["UserInfo"]);
|
|
var userinfojson = Json.Deserialize(userinfo) as Dictionary<string, object>;
|
|
ServerData_Read Read = JsonConvert.DeserializeObject<ServerData_Read>(userinfojson["Value"].ToString());
|
|
_act?.Invoke(Read.Get_ServerData(false));
|
|
}
|
|
else
|
|
{ // 정보가 없는 유저
|
|
_act?.Invoke(new ServerData());
|
|
}
|
|
}
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(fail, "다른 유저 정보 받아오기 실패");
|
|
});
|
|
}
|
|
|
|
public void Write_UnityInApp(string _productid, Action _act)
|
|
{
|
|
Init_ServerSave();
|
|
FirebaseAnalyticsEvent_Inapp(_productid);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ProductID = _productid,
|
|
IsEditor = Application.isEditor,
|
|
AllData = m_ServerData.Get_ServerRead()
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
if (MyErrorCheck(result.FunctionResult.ToString()) > -1)
|
|
_act?.Invoke();
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Write_UnityInApp(_productid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Write_UnityInApp(_productid, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Write_Onestore(Gaa.PurchaseData _pd, Action _act)
|
|
{
|
|
Init_ServerSave();
|
|
FirebaseAnalyticsEvent_Inapp(_pd.productId);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ProductID = _pd.productId,
|
|
Receipt = _pd.purchaseToken,
|
|
AllData = m_ServerData.Get_ServerRead()
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
if (MyErrorCheck(result.FunctionResult.ToString()) > -1)
|
|
_act?.Invoke();
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Write_Onestore(_pd, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Write_Onestore(_pd, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Write(Action _act, bool _netwait = true)
|
|
{
|
|
NetWait.Ins.Set(_netwait);
|
|
Init_ServerSave();
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = "ServerSave_AllData",
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
AllData = m_ServerData.Get_ServerRead(),
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
if (MyErrorCheck(result.FunctionResult.ToString()) > -1)
|
|
{
|
|
if (_netwait) NetWait.Ins.Set(false);
|
|
_act?.Invoke();
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Write(_act, _netwait); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Write(_act, _netwait); }, 2f);
|
|
});
|
|
}
|
|
public void SendMail_Daily(bool _isKing, bool _isGod)
|
|
{
|
|
Init_ServerSave();
|
|
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
AllData = m_ServerData.Get_ServerRead(),
|
|
IsKing = _isKing,
|
|
IsGod = _isGod,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
}
|
|
else
|
|
Set_Coroutine(() => { SendMail_Daily(_isKing, _isGod); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { SendMail_Daily(_isKing, _isGod); }, 2f);
|
|
});
|
|
}
|
|
public void Check_Token(Action success)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = "Check_CanBuyInapp",
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
success?.Invoke();
|
|
else
|
|
NetWait.Ins.Set(false);
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
});
|
|
}
|
|
public void GuideQuestComplete(Action success)
|
|
{
|
|
Init_ServerSave();
|
|
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
AllData = m_ServerData.Get_ServerRead(),
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
success();
|
|
else
|
|
Set_Coroutine(() => { GuideQuestComplete(success); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { GuideQuestComplete(success); }, 2f);
|
|
});
|
|
}
|
|
|
|
public bool IsNewUser() { return string.IsNullOrEmpty(UserName); }
|
|
|
|
#region 신규 서버
|
|
public void Save_CheatItem(int itemid, double amount, Action _act = null)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ID = itemid,
|
|
Amount = amount
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
_act?.Invoke();
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_CheatItem(itemid, amount, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_CheatItem(itemid, amount, _act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_StageResult(Action _act = null)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
Dictionary<string, int> items = new Dictionary<string, int>();
|
|
var dropitem = DropItemInfo.Ins.m_StageDropData.Get_Item();
|
|
foreach (var item in dropitem)
|
|
items.Add(item.Key.ToString(), item.Value.GetDecrypted());
|
|
|
|
Dictionary<string, int> MobKill = new Dictionary<string, int>();
|
|
var mob = DropItemInfo.Ins.Get_Mob();
|
|
foreach (var item in mob)
|
|
MobKill.Add(item.Key.ToString(), item.Value.GetDecrypted());
|
|
|
|
Dictionary<string, int> EliteKill = new Dictionary<string, int>();
|
|
var elite = DropItemInfo.Ins.Get_Elite();
|
|
foreach (var item in elite)
|
|
EliteKill.Add(item.Key.ToString(), item.Value.GetDecrypted());
|
|
|
|
Dictionary<string, int> BossKill = new Dictionary<string, int>();
|
|
var boss = DropItemInfo.Ins.Get_Boss();
|
|
foreach (var item in boss)
|
|
BossKill.Add(item.Key.ToString(), item.Value.GetDecrypted());
|
|
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
Exp = DropItemInfo.Ins.m_StageDropData.GetExp.GetDecrypted(),
|
|
Item = items,
|
|
Mob = MobKill,
|
|
Elite = EliteKill,
|
|
Boss = BossKill
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
//case 1: ToastUI.Ins.Set(999900001); break;
|
|
//default: ToastUI.Ins.Set(999900002); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_StageResult(_act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_StageResult(_act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_PC_Stat(List<int> usepoint, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
UsePoint = usepoint,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900001); break;
|
|
default: ToastUI.Ins.Set(999900002); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_Stat(usepoint, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_Stat(usepoint, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_StatInit(Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
switch (error)
|
|
{
|
|
case 0: case 1: // 성공
|
|
var myresult = JsonUtility.FromJson<SC_PCStatInit>(str_result);
|
|
m_ServerData.Use_Item(1, myresult.gem);
|
|
if (myresult.gem == 0) m_ServerData.Set_Common(eCommon.FirstStatInit, 1);
|
|
_act?.Invoke();
|
|
break;
|
|
default: ToastUI.Ins.Set(388); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_StatInit(_act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_StatInit(_act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_PC_Ability(int abilityID, int nbattletype, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
AbilityID = abilityID,
|
|
nBattleType = nbattletype,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900003); break;
|
|
case 2: ToastUI.Ins.Set(388); break;
|
|
case 3: ToastUI.Ins.Set(999900004); break;
|
|
case 4: ToastUI.Ins.Set(999900005); break;
|
|
case 5: ToastUI.Ins.Set(235); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_Ability(abilityID, nbattletype, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_Ability(abilityID, nbattletype, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_AbilityInit(eBattleType battleType, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
BattleType = battleType,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
switch (error)
|
|
{
|
|
case 0:
|
|
var myresult = JsonUtility.FromJson<SC_PCStatInit>(str_result);
|
|
m_ServerData.Use_Item(1, myresult.gem);
|
|
_act?.Invoke();
|
|
break;
|
|
case 1: ToastUI.Ins.Set(999900005); break;
|
|
case 2: ToastUI.Ins.Set(388); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_AbilityInit(battleType, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_AbilityInit(battleType, _act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_PC_BuyJob(int jobid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
JobID = jobid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900005); break;
|
|
case 2: ToastUI.Ins.Set(388); break;
|
|
case 3: ToastUI.Ins.Set(999900006); break;
|
|
case 4: ToastUI.Ins.Set(999900007); break;
|
|
case 5: ToastUI.Ins.Set(999900008); break;
|
|
case 6: ToastUI.Ins.Set(263); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_BuyJob(jobid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_BuyJob(jobid, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_EquipJob(int jobid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
JobID = jobid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900009); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_EquipJob(jobid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_EquipJob(jobid, _act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_PC_AwakenLvUp(eStat stat, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
AwakenStat = stat,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
// (0 성공, 1 실패(재화 id 없음), 2 실패 (재화 부족), 3 실패 (더 이상 강화 불가))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900005); break;
|
|
case 2: ToastUI.Ins.Set(388); break;
|
|
case 3: ToastUI.Ins.Set(236); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_AwakenLvUp(stat, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_AwakenLvUp(stat, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_Awaken(eStat stat, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
AwakenStat = stat,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
// (0 성공, 1 실패(재화 id 없음), 2 실패 (재화 부족), 3, 실패 (각성 레벨 부족), 4 실패 (더 이상 각성 불가))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900005); break;
|
|
case 2: ToastUI.Ins.Set(388); break;
|
|
case 3: ToastUI.Ins.Set(263); break;
|
|
case 4: ToastUI.Ins.Set(999900010); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_Awaken(stat, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_Awaken(stat, _act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_PC_LimitLvUp(Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var error = MyErrorCheck(result.FunctionResult.ToString());
|
|
// (0 성공, 1 실패(PC Lv 부족), 2 실패 (각성 Lv 부족), 3 실패 (각성 재료 id 없음), 4 실패 (더 이상 초월 불가))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(264); break;
|
|
case 2: ToastUI.Ins.Set(263); break;
|
|
case 3: ToastUI.Ins.Set(999900005); break;
|
|
case 4: ToastUI.Ins.Set(999900010); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_LimitLvUp(_act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_LimitLvUp(_act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_LimitSlotOptionChange(string preset, Action<SC_LimitOptionResult> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
Preset = preset
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (열린 슬롯 없음), 2 실패 (재화 부족), 3 실패 (각성 재료 id 없음))
|
|
switch (error)
|
|
{
|
|
case 0:
|
|
{
|
|
var options = JsonConvert.DeserializeObject<SC_LimitOptionResult>(str_result);
|
|
_act?.Invoke(options);
|
|
break;
|
|
}
|
|
case 1: ToastUI.Ins.Set(999900011); break;
|
|
case 2: ToastUI.Ins.Set(388); break;
|
|
case 3: ToastUI.Ins.Set(999900005); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_LimitSlotOptionChange(preset, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_LimitSlotOptionChange(preset, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_LimitSlotLock(string preset, int slot, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
Preset = preset,
|
|
Slot = slot,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (열린 슬롯이 아님))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900012); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_LimitSlotLock(preset, slot, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_LimitSlotLock(preset, slot, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_PC_LimitPreset(int preset, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
Preset = preset,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 나머지는 잘못된 요청)
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
default: ToastUI.Ins.Set(999900002); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_PC_LimitPreset(preset, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_PC_LimitPreset(preset, _act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_Equipment_Craft(int itemid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (재료 부족), 2 실패 (제작할 수 없는 아이템))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(388); break;
|
|
case 2: ToastUI.Ins.Set(999900013); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_Equipment_Craft(itemid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_Equipment_Craft(itemid, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_Equipment_Equip(int itemid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (없는 아이템), 2 실패 (이미 착용 중))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900014); break;
|
|
case 2: ToastUI.Ins.Set(999900015); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_Equipment_Equip(itemid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_Equipment_Equip(itemid, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_Equipment_Smelting(int itemid, Action<int> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (재료 부족), 2 실패 (최고 레벨), 3 실패 (없는 아이템), 4 실패 (제련 확률 실패))
|
|
switch (error)
|
|
{
|
|
case 1: ToastUI.Ins.Set(999900016); break;
|
|
case 2: ToastUI.Ins.Set(999900003); break;
|
|
case 3: ToastUI.Ins.Set(999900014); break;
|
|
case 4: ToastUI.Ins.Set(999900017); break;
|
|
}
|
|
_act?.Invoke(error);
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_Equipment_Smelting(itemid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_Equipment_Smelting(itemid, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_Equipment_Decomposition(int itemid, int count, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
Count = count,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (분해 갯수 0), 2 실패 (가진 갯수와 분해 갯수 에러), 3 실패 (없는 아이템))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900018); break;
|
|
case 2: ToastUI.Ins.Set(999900019); break;
|
|
case 3: ToastUI.Ins.Set(999900014); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_Equipment_Decomposition(itemid, count, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_Equipment_Decomposition(itemid, count, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_EquipItem_SlotLvUp(int itemid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (없는 아이템), 2 실패 (이미 착용 중))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(388); break;
|
|
case 2: ToastUI.Ins.Set(999900003); break;
|
|
case 3: ToastUI.Ins.Set(999900014); break;
|
|
case 4: ToastUI.Ins.Set(999900020); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_EquipItem_SlotLvUp(itemid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_EquipItem_SlotLvUp(itemid, _act); }, 2f);
|
|
});
|
|
}
|
|
public void Save_EquipItem_SlotLvUpInit(int itemid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (초기화 할 필요 없음), 3 실패 (없는 아이템), 4 실패 (업그레이드 정보 없는 파츠))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(999900021); break;
|
|
//case 2: ToastUI.Ins.Set(999900003); break; 없음
|
|
case 3: ToastUI.Ins.Set(999900014); break;
|
|
case 4: ToastUI.Ins.Set(999900020); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_EquipItem_SlotLvUpInit(itemid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_EquipItem_SlotLvUpInit(itemid, _act); }, 2f);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// itemid : 인챈트 할 착용 아이템 id
|
|
/// </summary>
|
|
public void Save_EquipItem_Enchant(int itemid, int eid, int slot, Action<SC_EnchantEquipItemResult> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
ItemID = itemid,
|
|
EnchantID = eid,
|
|
Slot = slot
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (잠긴 인챈트 슬롯), 3 실패 (없는 아이템), 4 실패 (업그레이드 정보 없는 파츠))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(JsonConvert.DeserializeObject<SC_EnchantEquipItemResult>(str_result)); break;
|
|
case 1: ToastUI.Ins.Set(999900012); break;
|
|
case 2: ToastUI.Ins.Set(999900022); break;
|
|
case 3: ToastUI.Ins.Set(999900014); break;
|
|
case 4: ToastUI.Ins.Set(999900020); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_EquipItem_Enchant(itemid, eid, slot, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_EquipItem_Enchant(itemid, eid, slot, _act); }, 2f);
|
|
});
|
|
}
|
|
|
|
public void Save_Enchant_LvUp(int eid, Action _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
EnchantID = eid,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
var str_result = result.FunctionResult.ToString();
|
|
var error = MyErrorCheck(str_result);
|
|
// (0 성공, 1 실패 (잠긴 인챈트 슬롯), 3 실패 (없는 아이템), 4 실패 (업그레이드 정보 없는 파츠))
|
|
switch (error)
|
|
{
|
|
case 0: _act?.Invoke(); break;
|
|
case 1: ToastUI.Ins.Set(388); break;
|
|
case 2: ToastUI.Ins.Set(999900003); break;
|
|
}
|
|
}
|
|
else
|
|
Set_Coroutine(() => { Save_Enchant_LvUp(eid, _act); }, 2f);
|
|
},
|
|
fail =>
|
|
{
|
|
Set_Coroutine(() => { Save_Enchant_LvUp(eid, _act); }, 2f);
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
#region 우편
|
|
public void Get_MailList(bool _netwait, Action<SC_Mail> _act)
|
|
{
|
|
if (NewGameUI.isIns) NewGameUI.Ins.gos_noti[0].SetActive(false);
|
|
NetWait.Ins.Set(_netwait);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (_netwait) NetWait.Ins.Set(false);
|
|
if (result.Error == null)
|
|
{
|
|
var str_result = result.FunctionResult.ToString();
|
|
if (MyErrorCheck(str_result) > -1)
|
|
{
|
|
var maildata = JsonUtility.FromJson<SC_Mail>(str_result);
|
|
if (maildata != null)
|
|
{
|
|
for (int i = 0; i < maildata.Mail.Count; i++)
|
|
{
|
|
DateTime.TryParse(maildata.Mail[i].RemainTime, out maildata.Mail[i].RemnantTime);
|
|
}
|
|
maildata.Mail.RemoveAll(f => (f.RemnantTime - ServerTime).TotalSeconds < 0); // 시간 지난 우편 정리
|
|
|
|
_act?.Invoke(maildata);
|
|
if (NewGameUI.isIns) NewGameUI.Ins.gos_noti[0].SetActive(maildata.Mail.Count > 0);
|
|
}
|
|
else
|
|
_act?.Invoke(null);
|
|
}
|
|
}
|
|
else
|
|
_act?.Invoke(null);
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
_act?.Invoke(null);
|
|
});
|
|
}
|
|
public void Get_MailReward(string _remaintime, Action<int> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
RemainTime = _remaintime,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
if (result.Error == null)
|
|
{
|
|
int error = MyErrorCheck(result.FunctionResult.ToString());
|
|
if (error > -1)
|
|
_act(error);
|
|
}
|
|
else
|
|
FailCheck(result, "우편 획득 실패");
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(fail, "우편 획득 fail");
|
|
});
|
|
}
|
|
public void Get_AllMail(Action<SC_Mail> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
if (result.Error == null)
|
|
{
|
|
var str_result = result.FunctionResult.ToString();
|
|
int error = MyErrorCheck(str_result);
|
|
if (error > -1 && error != 3)
|
|
{
|
|
var maildata = JsonUtility.FromJson<SC_Mail>(str_result);
|
|
if (maildata != null)
|
|
{
|
|
for (int i = 0; i < maildata.Mail.Count; i++)
|
|
DateTime.TryParse(maildata.Mail[i].RemainTime, out maildata.Mail[i].RemnantTime);
|
|
|
|
maildata.Mail.RemoveAll(f => (f.RemnantTime - ServerTime).TotalSeconds < 0); // 시간 지난 우편 정리
|
|
_act?.Invoke(maildata);
|
|
}
|
|
else
|
|
ToastUI.Ins.Set(147);
|
|
}
|
|
}
|
|
else
|
|
FailCheck(result, "우편 모두 받기 실패");
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(fail, "우편 모두 받기 fail");
|
|
});
|
|
}
|
|
#endregion
|
|
#region 타이틀 플레이어 제거
|
|
public void Del_TitlePlayer()
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = "Del_TitlePlayer",
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new { Agree = true }
|
|
},
|
|
result =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
Time.timeScale = 0f;
|
|
ObscuredPrefs.DeleteKey(MyValue.OptionKey_UserType);
|
|
Popup.Ins.Set(ePopupType.One, 148, DSUtil.Quit, DSUtil.Quit);
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
Popup.Ins.Set(ePopupType.One, 149, null, null, fail.ErrorMessage);
|
|
});
|
|
}
|
|
#endregion
|
|
#region 쿠폰 사용
|
|
public void Use_Coupon(string _coupon, Action<int, Dictionary<string, object>> _act)
|
|
{
|
|
NetWait.Ins.Set(true);
|
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
|
{
|
|
FunctionName = MethodBase.GetCurrentMethod().Name,
|
|
GeneratePlayStreamEvent = true,
|
|
FunctionParameter = new
|
|
{
|
|
Token = m_LoginInfo.EntityToken.EntityToken,
|
|
Coupon = _coupon
|
|
}
|
|
},
|
|
result =>
|
|
{
|
|
if (result.Error == null)
|
|
{
|
|
int error = MyErrorCheck(result.FunctionResult.ToString());
|
|
if (error > -1)
|
|
{
|
|
Dictionary<string, object> jsonData = Json.Deserialize(result.FunctionResult.ToString()) as Dictionary<string, object>;
|
|
_act?.Invoke(error, jsonData);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(result, "쿠폰 사용 실패");
|
|
}
|
|
},
|
|
fail =>
|
|
{
|
|
NetWait.Ins.Set(false);
|
|
FailCheck(fail, "쿠폰 사용 fail");
|
|
});
|
|
}
|
|
#endregion
|
|
|
|
public void FirebaseAnalyticsEvent(string _event)
|
|
{
|
|
//FirebaseAnalytics.LogEvent(_event);
|
|
}
|
|
void FirebaseAnalyticsEvent_Inapp(string _productid)
|
|
{
|
|
//var split = _productid.Split('.');
|
|
//Add_Log(1, split[split.Length - 1]);
|
|
}
|
|
|
|
#region 로그 서버로 전송
|
|
[Serializable]
|
|
class LogServerFrom { public int head; public string str1, str2; }
|
|
class ListStringToJson { public List<string> list; }
|
|
public void Add_Log(int head, string _msg)
|
|
{
|
|
if (m_LoginInfo == null) return;
|
|
|
|
_msg = DSUtil.Format("{0}{1:00}{2:00},{3:00}{4:00}{5:00},{6}", ServerTime.Year, ServerTime.Month, ServerTime.Day, ServerTime.Hour, ServerTime.Minute, ServerTime.Second, _msg);
|
|
list_log.Add(JsonUtility.ToJson(new LogServerFrom
|
|
{
|
|
head = head,
|
|
str1 = m_LoginInfo.PlayFabId,
|
|
str2 = _msg
|
|
}));
|
|
return;
|
|
}
|
|
|
|
void Send_Log() { if (list_log.Count > 0) StartCoroutine(Co_Http_Log()); }
|
|
|
|
IEnumerator Co_Http_Log()
|
|
{
|
|
//using (UnityWebRequest http = UnityWebRequest.Post("http://localhost:34561/data", json))
|
|
using (UnityWebRequest http = UnityWebRequest.PostWwwForm(m_SC_ServerStatus.URL_LogServer, string.Empty))
|
|
{
|
|
var json = JsonUtility.ToJson(new ListStringToJson { list = list_log });
|
|
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes(json);
|
|
http.uploadHandler = new UploadHandlerRaw(jsonToSend);
|
|
http.downloadHandler = new DownloadHandlerBuffer();
|
|
http.SetRequestHeader("Content-Type", "application/json");
|
|
yield return http.SendWebRequest();
|
|
|
|
if (!http.isDone)
|
|
{
|
|
if (http.error != null)
|
|
Debug.Log(http.error);
|
|
Send_Log();
|
|
}
|
|
else
|
|
list_log.Clear();
|
|
http.Dispose();
|
|
}
|
|
}
|
|
#endregion
|
|
} |