pc 스탯 초기화, money ui 갱신 등
This commit is contained in:
parent
029901437d
commit
2df008418f
|
|
@ -295,6 +295,26 @@ 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 Add_Item(urod, itemid, amount, isCheat)
|
||||||
|
{
|
||||||
|
if (!urod.Item[itemid])
|
||||||
|
urod.Item[itemid] = [0,0,0];
|
||||||
|
urod.Item[itemid][0] += amount;
|
||||||
|
if (!isCheat) urod.Item[itemid][1] += amount; // 총 획득량
|
||||||
|
}
|
||||||
|
function Use_Item(urod, itemid, amount)
|
||||||
|
{
|
||||||
|
if (urod.Item[itemid])
|
||||||
|
{
|
||||||
|
if (urod.Item[itemid][0] >= amount)
|
||||||
|
{
|
||||||
|
urod.Item[itemid][0] -= amount;
|
||||||
|
urod.Item[itemid][2] += amount; // 총 사용량
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
function Add_MissionCount(purpose, conditionvalue, count, setValue) {
|
function Add_MissionCount(purpose, conditionvalue, count, setValue) {
|
||||||
if (count <= 0) return;
|
if (count <= 0) return;
|
||||||
|
|
||||||
|
|
@ -335,6 +355,14 @@ function Get_Exp(lv) {
|
||||||
var exp = Math.pow(base, 1.05 + Math.sqrt(lv * 0.0000000001));
|
var exp = Math.pow(base, 1.05 + Math.sqrt(lv * 0.0000000001));
|
||||||
return Math.max(Math.floor(exp), 0);
|
return Math.max(Math.floor(exp), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlers.Save_CheatItem = function(args)
|
||||||
|
{
|
||||||
|
var urod = Get_JsonUserData();
|
||||||
|
Add_Item(urod, args.ID, args.Amount, true);
|
||||||
|
Set_JsonUserData(urod);
|
||||||
|
}
|
||||||
|
|
||||||
handlers.Save_StageResult = function(args) {
|
handlers.Save_StageResult = function(args) {
|
||||||
var error = Get_Error(args.Token);
|
var error = Get_Error(args.Token);
|
||||||
if (error < 0) return { error: error };
|
if (error < 0) return { error: error };
|
||||||
|
|
@ -397,7 +425,36 @@ handlers.Save_PC_Stat = function(args)
|
||||||
} else {
|
} else {
|
||||||
return { error: 1 }; // not enough points
|
return { error: 1 }; // not enough points
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
handlers.Save_PC_StatInit = function(args)
|
||||||
|
{
|
||||||
|
var error = Get_Error(args.Token);
|
||||||
|
if (error < 0) return { error: error };
|
||||||
|
|
||||||
|
var urod = Get_JsonUserData();
|
||||||
|
var rtnerror = 2; // 실패 (재화 부족)
|
||||||
|
var useGem = 100;
|
||||||
|
if (urod.Common[8] == 0)
|
||||||
|
{ // 최초 무료
|
||||||
|
urod.Common[8] = 1;
|
||||||
|
rtnerror = 1;
|
||||||
|
useGem = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Use_Item(urod, 1, useGem))
|
||||||
|
rtnerror = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtnerror >= 0 && rtnerror < 2)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < 4; i++)
|
||||||
|
urod.PC.Stat[i] = 0;
|
||||||
|
Set_JsonUserData(urod);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { error: rtnerror, gem: useGem };
|
||||||
|
}
|
||||||
/////////////////////////////////// 서버 처리
|
/////////////////////////////////// 서버 처리
|
||||||
|
|
||||||
handlers.Write_UnityInApp = function(args)
|
handlers.Write_UnityInApp = function(args)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -136,9 +136,8 @@ public class MessageInfo : MenuBase
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var sdata = ServerInfo.Ins.m_ServerData;
|
var sdata = ServerInfo.Ins.m_ServerData;
|
||||||
var title = table_title.Ins.Get_TitleName(sdata.Get_Common(eCommon.Title));
|
// 타입(0) | 플레이팹ID(1) | 얼굴아이콘(2) | 이름(3) | 메시지(4)
|
||||||
// 타입(0) | 플레이팹ID(1) | 얼굴아이콘(2) | 칭호와 이름(3) | 메시지(4)
|
sendMsg = DSUtil.Format("{0}|{1}|{2}|{3}|{4}", _type, ServerInfo.Ins.m_LoginInfo.PlayFabId, sdata.Get_EqiupmentEquip(eItem.PC), ServerInfo.Ins.UserName, ChattingCheckWords.ConvertChat(_msg));
|
||||||
sendMsg = DSUtil.Format("{0}|{1}|{2}|{3} {4}|{5}", _type, ServerInfo.Ins.m_LoginInfo.PlayFabId, sdata.Get_EqiupmentEquip(eItem.PC), title, ServerInfo.Ins.UserName, ChattingCheckWords.ConvertChat(_msg));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ws.Send(sendMsg);
|
ws.Send(sendMsg);
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,6 @@ public partial class ServerData
|
||||||
Add_SkillLv(1); // 최초 스킬 하나 지급
|
Add_SkillLv(1); // 최초 스킬 하나 지급
|
||||||
|
|
||||||
Common = new List<ObscuredInt>(); for (eCommon i = 0; i < eCommon.Max; i++) Common.Add(0);
|
Common = new List<ObscuredInt>(); for (eCommon i = 0; i < eCommon.Max; i++) Common.Add(0);
|
||||||
Set_Common(eCommon.Title, 1);
|
|
||||||
|
|
||||||
Book = new List<ServerData_Book>();
|
Book = new List<ServerData_Book>();
|
||||||
var booktabledata = table_book.Ins.Get_DataList();
|
var booktabledata = table_book.Ins.Get_DataList();
|
||||||
|
|
@ -2007,6 +2006,7 @@ public partial class ServerData
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TopMoney.isIns) TopMoney.Ins.Set();
|
if (TopMoney.isIns) TopMoney.Ins.Set();
|
||||||
|
MoneyForm.Refresh_MoneyForms();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eItem.Weapon:
|
case eItem.Weapon:
|
||||||
|
|
@ -2650,6 +2650,12 @@ public class SD_PC
|
||||||
Stat[i].RandomizeCryptoKey();
|
Stat[i].RandomizeCryptoKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool CanResetStat()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Stat.Count; i++)
|
||||||
|
if (Stat[i] > 0) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public int Get_Stat(eStat stat) { return Stat[dic_StatIndex[stat]]; }
|
public int Get_Stat(eStat stat) { return Stat[dic_StatIndex[stat]]; }
|
||||||
public int Get_UsePoint() { return Stat.Select(stat => (int)stat).Sum(); }
|
public int Get_UsePoint() { return Stat.Select(stat => (int)stat).Sum(); }
|
||||||
public int Get_Point() { return (Lv - 1) * 5 - Get_UsePoint(); }
|
public int Get_Point() { return (Lv - 1) * 5 - Get_UsePoint(); }
|
||||||
|
|
@ -2859,3 +2865,10 @@ public class SD_FarmSlot_Read
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 서버 응답 클래스
|
||||||
|
public class SC_PCStatInit
|
||||||
|
{
|
||||||
|
public int gem;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
@ -749,6 +749,36 @@ public class ServerInfo : MyCoroutine
|
||||||
public bool IsNewUser() { return string.IsNullOrEmpty(UserName); }
|
public bool IsNewUser() { return string.IsNullOrEmpty(UserName); }
|
||||||
|
|
||||||
#region 신규 서버
|
#region 신규 서버
|
||||||
|
public void Save_CheatItem(int itemid, double amount, Action _act = null)
|
||||||
|
{
|
||||||
|
NetWait.Ins.Set(true);
|
||||||
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||||
|
{
|
||||||
|
FunctionName = "Save_CheatItem",
|
||||||
|
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)
|
public void Save_StageResult(Action _act = null)
|
||||||
{
|
{
|
||||||
NetWait.Ins.Set(true);
|
NetWait.Ins.Set(true);
|
||||||
|
|
@ -824,6 +854,43 @@ public class ServerInfo : MyCoroutine
|
||||||
Set_Coroutine(() => { Save_PC_Stat(usepoint, _act); }, 2f);
|
Set_Coroutine(() => { Save_PC_Stat(usepoint, _act); }, 2f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public void Save_PC_StatInit(Action _act)
|
||||||
|
{
|
||||||
|
NetWait.Ins.Set(true);
|
||||||
|
PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest
|
||||||
|
{
|
||||||
|
FunctionName = "Save_PC_StatInit",
|
||||||
|
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);
|
||||||
|
_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);
|
||||||
|
});
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 우편
|
#region 우편
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class MoneyForm : MonoBehaviour
|
public class MoneyForm : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public static List<MoneyForm> moneyForms = new List<MoneyForm>();
|
||||||
|
public static void Add_MoneyForm(MoneyForm moneyForm)
|
||||||
|
{
|
||||||
|
if (!moneyForms.Contains(moneyForm))
|
||||||
|
moneyForms.Add(moneyForm);
|
||||||
|
}
|
||||||
|
public static void Refresh_MoneyForms()
|
||||||
|
{
|
||||||
|
moneyForms.ForEach(static moneyForm => { if (moneyForm != null) moneyForm.Refresh(); });
|
||||||
|
}
|
||||||
|
|
||||||
public Image icon;
|
public Image icon;
|
||||||
public TextMeshProUGUI amount;
|
public TextMeshProUGUI amount;
|
||||||
|
|
||||||
|
|
@ -16,6 +28,7 @@ public class MoneyForm : MonoBehaviour
|
||||||
gameObject.SetActive(true);
|
gameObject.SetActive(true);
|
||||||
m_itemid = id;
|
m_itemid = id;
|
||||||
Refresh();
|
Refresh();
|
||||||
|
Add_MoneyForm(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
|
|
|
||||||
|
|
@ -91,10 +91,17 @@ public class PCInfoStatMgrUI : uScrollViewMgr
|
||||||
{
|
{
|
||||||
m_StatResetUI.Set(() =>
|
m_StatResetUI.Set(() =>
|
||||||
{
|
{
|
||||||
var sdata = ServerInfo.Ins.m_ServerData;
|
ServerInfo.Ins.Save_PC_StatInit(() =>
|
||||||
sdata.PC.Reset_Stat();
|
{
|
||||||
Set_UI();
|
if (ServerInfo.Ins.m_ServerData.PC.CanResetStat())
|
||||||
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
{
|
||||||
|
ServerInfo.Ins.m_ServerData.PC.Reset_Stat();
|
||||||
|
Set_UI();
|
||||||
|
MyValue.Get_ActorStatInfoorNull(eRole.PC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ToastUI.Ins.Set(400);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class StatResetUI : BackKeyAdd
|
public class StatResetUI : BackKeyAdd
|
||||||
{
|
{
|
||||||
|
|
@ -13,7 +12,10 @@ public class StatResetUI : BackKeyAdd
|
||||||
|
|
||||||
act_OK = ok;
|
act_OK = ok;
|
||||||
|
|
||||||
m_MoneyForm.amount.text = "최초 무료 or 1";
|
if (ServerInfo.Ins.m_ServerData.Common[8] == 0)
|
||||||
|
m_MoneyForm.amount.text = table_localtext.Ins.Get_Text(152);
|
||||||
|
else
|
||||||
|
m_MoneyForm.amount.text = "100";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClick_OK()
|
public void OnClick_OK()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
|
|
||||||
public class ErrorLogHookManager : MonoBehaviour
|
public class ErrorLogHookManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -50,7 +46,7 @@ public partial class SROptions
|
||||||
public double Amount { get { return _amount; } set { _amount = value; } }
|
public double Amount { get { return _amount; } set { _amount = value; } }
|
||||||
public void Add_Item()
|
public void Add_Item()
|
||||||
{
|
{
|
||||||
ServerInfo.Ins.m_ServerData.Add_Item(ID, Amount);
|
ServerInfo.Ins.Save_CheatItem(ID, Amount, () => { ServerInfo.Ins.m_ServerData.Add_Item(ID, Amount); });
|
||||||
}
|
}
|
||||||
public void Init_Daily()
|
public void Init_Daily()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ public enum eStat
|
||||||
public enum eFarmerStat { MoveSpeed, DanceCoolTime }
|
public enum eFarmerStat { MoveSpeed, DanceCoolTime }
|
||||||
public enum eCommon
|
public enum eCommon
|
||||||
{
|
{
|
||||||
Agree, Noti, NightNoti, DOY_Day, DOY_Week, DOY_Month, PlayTime, Auto, Title, ADRemove, GuideStep, GuideCount,
|
Agree, Noti, NightNoti, DOY_Day, DOY_Week, DOY_Month, PlayTime, Auto, FirstStatInit, ADRemove, GuideStep, GuideCount,
|
||||||
|
|
||||||
NickChange, X2, CloverShopResetTime, CloverShopID_Weapon, CloverShopID_Ring, CloverShopID_Neck, CloverShopID_Boots, CloverShopID_Fairy, CloverShopID_Magic, CloverShopID_Pet, InAppBuyCount, FieldFirstFree,
|
NickChange, X2, CloverShopResetTime, CloverShopID_Weapon, CloverShopID_Ring, CloverShopID_Neck, CloverShopID_Boots, CloverShopID_Fairy, CloverShopID_Magic, CloverShopID_Pet, InAppBuyCount, FieldFirstFree,
|
||||||
Roullette_Ticket, Roullette_Count, Roullette_ADCount, Roullette_LuckyCount, AttendanceStep, AttendanceDOY,
|
Roullette_Ticket, Roullette_Count, Roullette_ADCount, Roullette_LuckyCount, AttendanceStep, AttendanceDOY,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue