From 088b9012e85445d14f98366009bc7ae10dec973d Mon Sep 17 00:00:00 2001 From: Ino Date: Fri, 11 Jul 2025 05:07:38 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EB=BD=91=EA=B8=B0=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=20=EC=A4=91...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Editor/GetServerTables.cs | 1 + .../Editor/Resources/.CloudScript.js | 108 ++++++++++++++++++ .../Table/Server/server_GachaConfig.txt | 46 ++++++++ .../Table/Server/server_GachaConfig.txt.meta | 7 ++ Assets/Script/Server/ServerClass.cs | 4 + Assets/Script/Server/ServerInfo.cs | 37 ++++++ Assets/Script/UI/Gacha/btn_gacha.cs | 9 +- 7 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 Assets/ResWork/Table/Server/server_GachaConfig.txt create mode 100644 Assets/ResWork/Table/Server/server_GachaConfig.txt.meta diff --git a/Assets/Editor/GetServerTables.cs b/Assets/Editor/GetServerTables.cs index baa3146d3..ac49cecea 100644 --- a/Assets/Editor/GetServerTables.cs +++ b/Assets/Editor/GetServerTables.cs @@ -20,6 +20,7 @@ public class GetServerTables Get_ServerTable("PetList", new List { "e_AttackType", "n_DefaultATK", "n_DefaultDEF", "n_DefaultM_DEF", "n_DefaultHP", "f_PetStatRate", "f_AttackRange", "s_PetAttackPrefab", "f_PetMoveSPD", "f_PetAttackSPD", "n_PetActiveSkill", "n_PetPassiveSkill", "s_PetPrefab", "f_Scale", "f_UIScale", "f_UIOffSet_y" }); Get_ServerTable("OptionConfig", new List { "e_OptionType", "f_ExtraValue1", "f_ExtraValue2", "f_ExtraValue3", "f_ExtraValue4" }); Get_ServerTable("CollectionList", new List { "e_FirstRewardType", "n_FirstRewardValue", "n_FirstRewardCount", "e_RepeatRewardType", "n_RepeatRewardValue", "n_RepeatRewardCount" }); + Get_ServerTable("GachaConfig", new List { "n_Title", "s_Banner" }); } static void Get_ServerTable(string path, List except) diff --git a/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js b/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js index ae773ab4a..f9ae9c960 100644 --- a/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js +++ b/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js @@ -1763,6 +1763,54 @@ handlers.Save_Collection_GetAll = function(args) } return Get_Return(1); } + +handlers.Save_Gacha = function(args) +{ + var readonlydata = Get_UserReadOnlyData(); + var error = Get_Error(readonlydata, args.Token); + if (error < 0) return Get_Return(error); + + var urod = Get_JsonUserData(readonlydata); + var table = Get_MissionTable(); + var gachatable = Get_GachaConfigTable(); + var gachaData = Get_GachaConfigTable().find(f=>f.n_ID == args.GachaID); + + var gachaType = 0; + if (Check_ItemAmount(urod, gachaData.n_GachaTicketID, args.Count)) + { // 뽑기권이 충분하면 뽑기권만 + gachaType = 1; + Use_Item(table, urod, gachaData.n_GachaTicketID, args.Count); + } + else if (Get_ItemAmount(urod, gachaData.n_GachaTicketID) > 0) + { + var ticketAmount = Get_ItemAmount(urod, gachaData.n_GachaTicketID); + var remaincount = args.Count - ticketAmount; + var needgem = parseInt(remaincount * gachaData.n_GachaPrice); + if (Check_ItemAmount(urod, gachaData.n_GachaGoodsID, needgem)) + { + gachaType = 1; + Use_Item(table, urod, gachaData.n_GachaTicketID, ticketAmount); + Use_Item(table, urod, gachaData.n_GachaTicketID, needgem); + } + } + else + { + var need = args.Count * gachaData.n_GachaPrice; + if (Check_ItemAmount(urod, gachaData.n_GachaGoodsID, need)) + { + gachaType = 1; + Use_Item(table, urod, gachaData.n_GachaTicketID, need); + } + } + + if (gachaType == 1) + { + var items = []; + + return Get_Return(0, { gacha : items }); + } + return Get_Return(1); +} /////////////////////////////////// 서버 처리 handlers.Write_UnityInApp = function(args) @@ -21902,6 +21950,66 @@ function Get_CollectionTable() ] } +function Get_GachaConfigTable() +{ + return [ + { + "n_ID": "10001", + "b_StageLv": "True", + "n_GachaPrice": "50", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "401", + "n_NormalRandombag": "30001", + "n_Extra10_Randombag": "30001", + "n_PickupReward": "20001", + "n_RepeatRewardPoint": "100" + }, + { + "n_ID": "10002", + "b_StageLv": "True", + "n_GachaPrice": "40", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "402", + "n_NormalRandombag": "30002", + "n_Extra10_Randombag": "30002", + "n_PickupReward": "20002", + "n_RepeatRewardPoint": "100" + }, + { + "n_ID": "10003", + "b_StageLv": "True", + "n_GachaPrice": "30", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "403", + "n_NormalRandombag": "30003", + "n_Extra10_Randombag": "30003", + "n_PickupReward": "20003", + "n_RepeatRewardPoint": "100" + }, + { + "n_ID": "10004", + "b_StageLv": "False", + "n_GachaPrice": "100", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "404", + "n_NormalRandombag": "30004", + "n_Extra10_Randombag": "30004", + "n_PickupReward": "20004", + "n_RepeatRewardPoint": "200" + } + ] +} + + + + + + + + + + + diff --git a/Assets/ResWork/Table/Server/server_GachaConfig.txt b/Assets/ResWork/Table/Server/server_GachaConfig.txt new file mode 100644 index 000000000..e3b05665d --- /dev/null +++ b/Assets/ResWork/Table/Server/server_GachaConfig.txt @@ -0,0 +1,46 @@ +[ + { + "n_ID": "10001", + "b_StageLv": "True", + "n_GachaPrice": "50", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "401", + "n_NormalRandombag": "30001", + "n_Extra10_Randombag": "30001", + "n_PickupReward": "20001", + "n_RepeatRewardPoint": "100" + }, + { + "n_ID": "10002", + "b_StageLv": "True", + "n_GachaPrice": "40", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "402", + "n_NormalRandombag": "30002", + "n_Extra10_Randombag": "30002", + "n_PickupReward": "20002", + "n_RepeatRewardPoint": "100" + }, + { + "n_ID": "10003", + "b_StageLv": "True", + "n_GachaPrice": "30", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "403", + "n_NormalRandombag": "30003", + "n_Extra10_Randombag": "30003", + "n_PickupReward": "20003", + "n_RepeatRewardPoint": "100" + }, + { + "n_ID": "10004", + "b_StageLv": "False", + "n_GachaPrice": "100", + "n_GachaGoodsID": "1", + "n_GachaTicketID": "404", + "n_NormalRandombag": "30004", + "n_Extra10_Randombag": "30004", + "n_PickupReward": "20004", + "n_RepeatRewardPoint": "200" + } +] \ No newline at end of file diff --git a/Assets/ResWork/Table/Server/server_GachaConfig.txt.meta b/Assets/ResWork/Table/Server/server_GachaConfig.txt.meta new file mode 100644 index 000000000..42a70c1d5 --- /dev/null +++ b/Assets/ResWork/Table/Server/server_GachaConfig.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7feaaa9565615bb4e95782d8fd889191 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Script/Server/ServerClass.cs b/Assets/Script/Server/ServerClass.cs index 69caf88d3..38a83115c 100644 --- a/Assets/Script/Server/ServerClass.cs +++ b/Assets/Script/Server/ServerClass.cs @@ -3003,4 +3003,8 @@ public class SC_CollectionResultData { public int id, addvalue; } +public class SC_GachaResult +{ + public List gacha; +} #endregion \ No newline at end of file diff --git a/Assets/Script/Server/ServerInfo.cs b/Assets/Script/Server/ServerInfo.cs index 14ab4c2b3..17e95013f 100644 --- a/Assets/Script/Server/ServerInfo.cs +++ b/Assets/Script/Server/ServerInfo.cs @@ -2011,6 +2011,43 @@ public class ServerInfo : MyCoroutine Set_Coroutine(() => { Save_Collection_GetAll(condition, eMenuCategory, _act); }, 2f); }); } + + public void Save_Gacha(int id, 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, + GachaID = id, + Count = count, + } + }, + 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(JsonConvert.DeserializeObject(str_result)); break; + case 1: ToastUI.Ins.Set(388); break; + } + } + else + Set_Coroutine(() => { Save_Gacha(id, count, _act); }, 2f); + }, + fail => + { + Set_Coroutine(() => { Save_Gacha(id, count, _act); }, 2f); + }); + } #endregion #region 우편 diff --git a/Assets/Script/UI/Gacha/btn_gacha.cs b/Assets/Script/UI/Gacha/btn_gacha.cs index 91e17e509..df042653b 100644 --- a/Assets/Script/UI/Gacha/btn_gacha.cs +++ b/Assets/Script/UI/Gacha/btn_gacha.cs @@ -5,13 +5,13 @@ using UnityEngine; public class btn_gacha : MonoBehaviour { - public TextMeshProUGUI[] texts; // 0 0회 뽑기 + public TextMeshProUGUI[] texts; // 0 {0}회 뽑기 public MoneyForm[] moneyForms; enum eGachaBtnType { OnlyTicket, TicketAndCash, OnlyCash, CantGacha } GachaConfigTableData m_Data; - public ObscuredInt _count; + ObscuredInt _count; public int m_Count { get { return _count; } @@ -68,6 +68,11 @@ public class btn_gacha : MonoBehaviour public void OnClick_Gacha() { + ServerInfo.Ins.Save_Gacha(m_Data.n_ID, m_Count, result => + { + + }); + return; var sdata = ServerInfo.Ins.m_ServerData; switch (Get_BtnType()) {