diff --git a/Assets/AddressableAssetsData/Android/addressables_content_state.bin b/Assets/AddressableAssetsData/Android/addressables_content_state.bin index 7cf08bc..9d1bc10 100644 Binary files a/Assets/AddressableAssetsData/Android/addressables_content_state.bin and b/Assets/AddressableAssetsData/Android/addressables_content_state.bin differ diff --git a/Assets/Resources/VersionCode.txt b/Assets/Resources/VersionCode.txt index bf0d87a..7813681 100644 --- a/Assets/Resources/VersionCode.txt +++ b/Assets/Resources/VersionCode.txt @@ -1 +1 @@ -4 \ No newline at end of file +5 \ No newline at end of file diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 5729b22..ac82b13 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -21854,6 +21854,7 @@ GameObject: - component: {fileID: 500962030} - component: {fileID: 500962029} - component: {fileID: 500962031} + - component: {fileID: 500962032} m_Layer: 0 m_Name: Infos m_TagString: Untagged @@ -22015,6 +22016,19 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4177bc10460c0264eb933d4c43a6f313, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &500962032 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 500962021} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 36517ed5b97a5fc43b782b438a60e64d, type: 3} + m_Name: + m_EditorClassIdentifier: + webhookUrl: https://discord.com/api/webhooks/1458685956029939905/mjzyM7JuC7KWIjR4INNpGNCUK2EKanBace1nuwd114E5VIicTvrB3IKHSuI22ID0AtlP --- !u!1 &503960960 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AttachToGameObject/DiscordWebhookSender.cs b/Assets/Scripts/AttachToGameObject/DiscordWebhookSender.cs new file mode 100644 index 0000000..9916742 --- /dev/null +++ b/Assets/Scripts/AttachToGameObject/DiscordWebhookSender.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using UnityEngine.Networking; +using System.Collections; + +public class DiscordWebhookSender : MonoBehaviourSingletonTemplate +{ + [SerializeField] private string webhookUrl; + + public void Send_Message(string message) + { + StartCoroutine(SendCoroutine(message)); + } + + IEnumerator SendCoroutine(string message) + { + string json = "{\"content\":\"" + message + "\"}"; + //Debug.Log("DiscordWebhookSender : " + json); + + using (UnityWebRequest request = new UnityWebRequest(webhookUrl, "POST")) + { + byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(json); + request.uploadHandler = new UploadHandlerRaw(bodyRaw); + request.downloadHandler = new DownloadHandlerBuffer(); + request.SetRequestHeader("Content-Type", "application/json"); + + yield return request.SendWebRequest(); + + //Debug.Log("DiscordWebhookSender Result : " + request.result); + if (request.result != UnityWebRequest.Result.Success) + Debug.LogError("Discord Error: " + request.error); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/AttachToGameObject/DiscordWebhookSender.cs.meta b/Assets/Scripts/AttachToGameObject/DiscordWebhookSender.cs.meta new file mode 100644 index 0000000..c0885d2 --- /dev/null +++ b/Assets/Scripts/AttachToGameObject/DiscordWebhookSender.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 36517ed5b97a5fc43b782b438a60e64d \ No newline at end of file diff --git a/Assets/Scripts/AttachToGameObject/InappInfo.cs b/Assets/Scripts/AttachToGameObject/InappInfo.cs index 1c76685..641a4fd 100644 --- a/Assets/Scripts/AttachToGameObject/InappInfo.cs +++ b/Assets/Scripts/AttachToGameObject/InappInfo.cs @@ -3,11 +3,13 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using Newtonsoft.Json; using OneStore.Auth; using OneStore.Common; using OneStore.Purchasing; using UnityEngine; using UnityEngine.Purchasing; +using UnityEngine.Purchasing.MiniJSON; public class InappInfo : MonoBehaviourSingletonTemplate { @@ -107,9 +109,18 @@ public class InappInfo : MonoBehaviourSingletonTemplate private void OnPurchaseConfirmed(Order order) { //NetWait.Ins.Set(false); - Debug.Log($"Purchase confirmed: {order.CartOrdered.Items().First().Product.definition.id}"); + var id = order.CartOrdered.Items().First().Product.definition.id; + var data = table_shop.Ins.Get_Data(id); + //Debug.Log($"Purchase confirmed : {id}"); + var json = JsonUtility.FromJson(order.Info.Receipt); + //Debug.Log($"order.Info.Receipt : {json.Payload}"); + +#if UNITY_ANDROID && !UNITY_EDITOR + DiscordWebhookSender.Ins.Send_Message($"[Google]{id} / {DSUtil.GetThousandCommaText(data.n_Price)}원 / {json.Payload}"); +#endif act_success?.Invoke(); } + class OrderReceipt { public string Payload; } private void OnPurchaseFailed(FailedOrder order) { @@ -168,6 +179,10 @@ public class InappInfo : MonoBehaviourSingletonTemplate act_success(); else SaveMgr.Ins.list_inapp.Add(purchase.ProductId); + + var data = table_shop.Ins.Get_Data(purchase.ProductId); + DiscordWebhookSender.Ins.Send_Message($"[OneStore, {Application.productName}, {purchase.PackageName}]" + + $"{purchase.ProductId} / {DSUtil.GetThousandCommaText(data.n_Price)}원 / {purchase.PurchaseToken}"); } public void OnManageRecurringProduct(IapResult iapResult, PurchaseData purchase, RecurringAction action) diff --git a/Assets/Scripts/AttachToGameObject/SaveMgr.cs b/Assets/Scripts/AttachToGameObject/SaveMgr.cs index aff0218..b0fd432 100644 --- a/Assets/Scripts/AttachToGameObject/SaveMgr.cs +++ b/Assets/Scripts/AttachToGameObject/SaveMgr.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using GUPS.AntiCheat.Protected; using Newtonsoft.Json; +using OneStore.Common; using UnityEngine; public class SaveMgr : MonoBehaviourSingletonTemplate diff --git a/Assets/Scripts/Editor/AutoBuild.cs b/Assets/Scripts/Editor/AutoBuild.cs index bd26b61..ddd03b9 100644 --- a/Assets/Scripts/Editor/AutoBuild.cs +++ b/Assets/Scripts/Editor/AutoBuild.cs @@ -87,7 +87,7 @@ public static class AutoBuild //PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel23; EditorUserBuildSettings.buildAppBundle = false; - BuildStart("AndroidData/NightWard_Test_OneStore_" + Application.version + "_(" + PlayerSettings.Android.bundleVersionCode + ").apk", BuildTarget.Android); + BuildStart("AndroidData/NightWard_OneStore_" + Application.version + "_(" + PlayerSettings.Android.bundleVersionCode + ").apk", BuildTarget.Android); EmptySymbol(); } [MenuItem("AutoBuild/Build Live AAB")]