├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── PresetManager.asset ├── NetworkManager.asset ├── XRSettings.asset ├── VersionControlSettings.asset ├── TimeManager.asset ├── EditorBuildSettings.asset ├── VFXManager.asset ├── AudioManager.asset ├── TagManager.asset ├── UnityConnectSettings.asset ├── PackageManagerSettings.asset ├── EditorSettings.asset ├── MemorySettings.asset ├── DynamicsManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset ├── SceneTemplateSettings.json ├── QualitySettings.asset └── InputManager.asset ├── .vsconfig ├── .gitignore ├── Packages ├── com.bananaparty.yandexgames │ ├── Tests │ │ ├── Runtime │ │ │ ├── ShortcutTests.cs.meta │ │ │ ├── LeaderboardTests.cs │ │ │ ├── BananaParty.YandexGames.Tests.asmdef.meta │ │ │ ├── SdkTests.cs.meta │ │ │ ├── StickyAdTests.cs.meta │ │ │ ├── VideoAdTests.cs.meta │ │ │ ├── InterstitialAdTests.cs.meta │ │ │ ├── LeaderboardTests.cs.meta │ │ │ ├── PlayerAccountTests.cs.meta │ │ │ ├── PlayerPrefsTests.cs.meta │ │ │ ├── ReviewPopupTests.cs.meta │ │ │ ├── BananaParty.YandexGames.Tests.asmdef │ │ │ ├── StickyAdTests.cs │ │ │ ├── ShortcutTests.cs │ │ │ ├── ReviewPopupTests.cs │ │ │ ├── PlayerPrefsTests.cs │ │ │ ├── VideoAdTests.cs │ │ │ ├── InterstitialAdTests.cs │ │ │ ├── PlayerAccountTests.cs │ │ │ └── SdkTests.cs │ │ └── Runtime.meta │ ├── Samples │ │ ├── Playtesting │ │ │ ├── ProductCatalogPanel.cs │ │ │ ├── PlaytestingScene.unity.meta │ │ │ ├── BananaParty.YandexGames.Samples.Playtesting.asmdef.meta │ │ │ ├── ApplicationAliveIndicator.anim.meta │ │ │ ├── ProductPanel.cs.meta │ │ │ ├── WebEventSystem.cs.meta │ │ │ ├── PlaytestingCanvas.cs.meta │ │ │ ├── ProductCatalogPanel.cs.meta │ │ │ ├── PurchasedProductPanel.cs.meta │ │ │ ├── PurchasedProductListPanel.cs.meta │ │ │ ├── BananaParty.YandexGames.Samples.Playtesting.asmdef │ │ │ ├── WebEventSystem.cs │ │ │ ├── PurchasedProductPanel.cs │ │ │ ├── ProductPanel.cs │ │ │ ├── PurchasedProductListPanel.cs │ │ │ └── PlaytestingCanvas.cs │ │ └── Playtesting.meta │ ├── LICENSE.md.meta │ ├── README.md.meta │ ├── CHANGELOG.md.meta │ ├── package.json.meta │ ├── Runtime.meta │ ├── Samples.meta │ ├── Tests.meta │ ├── Runtime │ │ ├── PlayerAccount │ │ │ ├── ProfilePictureSize.cs │ │ │ ├── PlayerAccount.cs.meta │ │ │ ├── ProfilePictureSize.cs.meta │ │ │ ├── PlayerAccountProfileDataResponse.cs.meta │ │ │ ├── PlayerAccountProfileDataResponse.cs │ │ │ └── PlayerAccount.cs │ │ ├── Billing.meta │ │ ├── Tools.meta │ │ ├── Utility.meta │ │ ├── Advertising.meta │ │ ├── Leaderboard.meta │ │ ├── PlayerAccount.meta │ │ ├── BananaParty.YandexGames.asmdef.meta │ │ ├── Billing │ │ │ ├── Billing.cs.meta │ │ │ ├── GetProductCatalogResponse.cs │ │ │ ├── CatalogProduct.cs.meta │ │ │ ├── PurchasedProduct.cs.meta │ │ │ ├── PurchaseProductResponse.cs.meta │ │ │ ├── GetProductCatalogResponse.cs.meta │ │ │ ├── GetPurchasedProductsResponse.cs.meta │ │ │ ├── PurchaseProductResponse.cs │ │ │ ├── GetPurchasedProductsResponse.cs │ │ │ ├── PurchasedProduct.cs │ │ │ ├── CatalogProduct.cs │ │ │ └── Billing.cs │ │ ├── Tools │ │ │ ├── Shortcut.cs.meta │ │ │ ├── ReviewPopup.cs.meta │ │ │ ├── ReviewPopup.cs │ │ │ └── Shortcut.cs │ │ ├── YandexGamesSdk.cs.meta │ │ ├── Advertising │ │ │ ├── StickyAd.cs.meta │ │ │ ├── VideoAd.cs.meta │ │ │ ├── InterstitialAd.cs.meta │ │ │ ├── StickyAd.cs │ │ │ ├── InterstitialAd.cs │ │ │ └── VideoAd.cs │ │ ├── Utility │ │ │ ├── PlayerPrefs.cs.meta │ │ │ ├── RemoteImage.cs.meta │ │ │ ├── RemoteImage.cs │ │ │ └── PlayerPrefs.cs │ │ ├── Leaderboard │ │ │ ├── Leaderboard.cs.meta │ │ │ ├── LeaderboardEntryResponse.cs.meta │ │ │ ├── LeaderboardGetEntriesResponse.cs.meta │ │ │ ├── LeaderboardDescriptionResponse.cs.meta │ │ │ ├── LeaderboardEntryResponse.cs │ │ │ ├── LeaderboardGetEntriesResponse.cs │ │ │ ├── LeaderboardDescriptionResponse.cs │ │ │ └── Leaderboard.cs │ │ ├── YandexGamesEnvironment.cs.meta │ │ ├── BananaParty.YandexGames.asmdef │ │ ├── YandexGamesEnvironment.cs │ │ ├── YandexGamesPlugin.jslib.meta │ │ └── YandexGamesSdk.cs │ ├── package.json │ ├── LICENSE.md │ ├── README.md │ └── CHANGELOG.md ├── manifest.json └── packages-lock.json ├── Assets ├── WebGLTemplates │ ├── FullscreenWindow │ │ ├── thumbnail.png │ │ ├── sdk.js.meta │ │ ├── index.html.meta │ │ ├── thumbnail.png.meta │ │ └── index.html │ └── FullscreenWindow.meta ├── EmptySceneForTestRunner.unity.meta ├── WebGLTemplates.meta └── EmptySceneForTestRunner.unity ├── UnityEngine.TestRunner.csproj.user ├── README.md ├── LICENSE.md └── .editorconfig /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2022.3.20f1 2 | m_EditorVersionWithRevision: 2022.3.20f1 (61c2feb0970d) 3 | -------------------------------------------------------------------------------- /.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Library/ 2 | /Temp/ 3 | /obj/ 4 | /Logs/ 5 | /UserSettings/ 6 | /Builds/ 7 | /*.sln 8 | /*.csproj 9 | /.vscode/ 10 | /.vs/ 11 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/ShortcutTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38a029dbde3744819ccbada4336bfc69 3 | timeCreated: 1693491573 -------------------------------------------------------------------------------- /Assets/WebGLTemplates/FullscreenWindow/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forcepusher/YandexGamesUnity/HEAD/Assets/WebGLTemplates/FullscreenWindow/thumbnail.png -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/LeaderboardTests.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forcepusher/YandexGamesUnity/HEAD/Packages/com.bananaparty.yandexgames/Tests/Runtime/LeaderboardTests.cs -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/ProductCatalogPanel.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forcepusher/YandexGamesUnity/HEAD/Packages/com.bananaparty.yandexgames/Samples/Playtesting/ProductCatalogPanel.cs -------------------------------------------------------------------------------- /Assets/EmptySceneForTestRunner.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d61dce48825a14b4da3be78ee049cdba 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19bff9dee9d40c34c97c3beda88ebefa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/FullscreenWindow/sdk.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ebde82a2130c0747b44140ce77d1645 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/FullscreenWindow/index.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5563791809a261e438b7000b5255b02d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4710949007238214ca0b71fe43c8449a 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 553a4def54581134c84915d5ba871831 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/FullscreenWindow/thumbnail.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e4ed4700e90bc840baac9ebce5f22b2 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87a6a9adca4317148b4369679b71b1ec 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/FullscreenWindow.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 795dd0b11b684da4598e6511a9081dd2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df00cfee7d601be42a1845b1edd4f27b 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d47153bb5bbf03542968507ec6ac253a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 658f6182f600d714d8aaf6b57610d452 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f19746a261f7ff4db5dd4b5b5064109 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount/ProfilePictureSize.cs: -------------------------------------------------------------------------------- 1 | namespace BananaParty.YandexGames 2 | { 3 | public enum ProfilePictureSize 4 | { 5 | small, 6 | medium, 7 | large 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ea3c18d257505a488e9d30139fc2ab9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Tools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 48e3abd10d8b5ab47b8c4012464fd508 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79ebf302bfce4ec428d1a1d5bf50c1a8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab5439bb279e3164bbfc15b45654f3a1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac779fe0738b7184ba3dde9a5f7dbdb6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bece43904a3a3644fa3a9fe3175792b7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5d6c60a26dceee4c90f3da87576e054 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8b3ad1efb99a5045b3d48da4c7ef24b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/BananaParty.YandexGames.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef7e0e3eb213f324c87b70a782844fb6 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PlaytestingScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cda990e2423bbf4892e6590ba056729 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/BananaParty.YandexGames.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 404c06c5c2bb17b45875165e50665303 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/BananaParty.YandexGames.Samples.Playtesting.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5a64b239ef00ed419a19e22c7c6a2f0 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/ApplicationAliveIndicator.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7b4fc29ca628d94c9ed0dc2570cc0cd 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 7400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityEngine.TestRunner.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/Billing.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b8688d836f1614498212514ef3a2687 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/GetProductCatalogResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class GetProductCatalogResponse 8 | { 9 | [field: Preserve] 10 | public CatalogProduct[] products; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Tools/Shortcut.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 128b7a20cf29dbb4aad52b39a6e1a3ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/YandexGamesSdk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb3377ff9a5308546b40f6001a6f2600 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/SdkTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f876d2348e8e3d429f178ae1c7b45ab 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising/StickyAd.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3e080172da9fc849afbf656b9ab6e95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising/VideoAd.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3efa21c0de2b5b1458c994849d8b3597 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Tools/ReviewPopup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d19ac102506d957409649892908911d2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Utility/PlayerPrefs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fdee491d7f471341967d8b8dd0d8b06 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Utility/RemoteImage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e2a1e218626bf84a822e57aaeeebe7c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/StickyAdTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f31a5d942fb3c824ab074d56548f6ac6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/VideoAdTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad45669f6b6c64e4db103c3104388b68 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising/InterstitialAd.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57e4e763b74da4345b03064ef836375a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/CatalogProduct.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ab75112c0ae21146ba274d3525ed63b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/PurchasedProduct.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 130efe4a1630b2546bdfa3bcba72a167 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/Leaderboard.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 746aefcb74dc45043bd7eac3459b9107 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/YandexGamesEnvironment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 738acba5b0265014eaa5d4698a08a13e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/ProductPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4aaeb3d725a35a43b26f809f95d256a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/WebEventSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46e49774b23051349b21bfcf4dce9e4b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/InterstitialAdTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1e05cd29a477804892bebc498261179 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/LeaderboardTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f638e13735a5fd34d8dcea2feabdfbf4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/PlayerAccountTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 12f68b6ef06b6f345a75513708fe9bb0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/PlayerPrefsTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78edf1445b59deb44b0164e23903617b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/ReviewPopupTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9ddfeaf83940de4ba46e1223783e700 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/PurchaseProductResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5acaa756a8160f488a89fa679a4d569 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount/PlayerAccount.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3cf2cefa38504c45b74fbc204d6a29c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PlaytestingCanvas.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96c5de85996737f488737e20891023ce 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/ProductCatalogPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a07487dcabbc3b148af225b95eeac4d0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/GetProductCatalogResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: afc6dbf8506e633478867473b8039904 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/GetPurchasedProductsResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1309d03784528448a36acddef4046a5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/LeaderboardEntryResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 569b13df4f68f97409ccaa5fdc513377 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount/ProfilePictureSize.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2863ebc756d64849a96af0f2fd9acd4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PurchasedProductPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1ef96628cbb0a7469a2a4ba4129c91a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/LeaderboardGetEntriesResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cdb17238ef8aaa4cbb5107324323e6b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PurchasedProductListPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32057f54ac7ebc64d8e73080d7583c49 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/LeaderboardDescriptionResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e131b313601c8d439d632bd9110a661 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount/PlayerAccountProfileDataResponse.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5168264f7c1ea14aa29803103ec0b20 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Packages/com.bananaparty.yandexgames/Samples/Playtesting/PlaytestingScene.unity 10 | guid: 2cda990e2423bbf4892e6590ba056729 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/PurchaseProductResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class PurchaseProductResponse 8 | { 9 | [field: Preserve] 10 | public PurchasedProduct purchaseData; 11 | [field: Preserve] 12 | public string signature; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/GetPurchasedProductsResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class GetPurchasedProductsResponse 8 | { 9 | [field: Preserve] 10 | public PurchasedProduct[] purchasedProducts; 11 | [field: Preserve] 12 | public string signature; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/BananaParty.YandexGames.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BananaParty.YandexGames", 3 | "rootNamespace": "", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 0 20 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/PurchasedProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class PurchasedProduct 8 | { 9 | [field: Preserve] 10 | public string developerPayload; 11 | [field: Preserve] 12 | public string productID; 13 | [field: Preserve] 14 | public string purchaseTime; 15 | [field: Preserve] 16 | public string purchaseToken; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.bananaparty.yandexgames", 3 | "version": "18.0.0", 4 | "displayName": "Yandex Games", 5 | "type": "library", 6 | "unity": "2022.3", 7 | "description": "Yandex Games Unity SDK for the WebGL platform.", 8 | "license": "MIT", 9 | "samples": [ 10 | { 11 | "displayName": "Playtesting Sample", 12 | "description": "Contains sample for uploading to Yandex Games and manually testing the SDK.", 13 | "path": "Samples~/Playtesting" 14 | } 15 | ], 16 | "author": "github.com/forcepusher" 17 | } -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/BananaParty.YandexGames.Samples.Playtesting.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BananaParty.YandexGames.Samples.Playtesting", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:ef7e0e3eb213f324c87b70a782844fb6" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [], 15 | "noEngineReferences": false 16 | } -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/WebEventSystem.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.EventSystems; 2 | 3 | namespace BananaParty.YandexGames.Samples 4 | { 5 | /// 6 | /// Fixes unresponsive UI controls after alt-tabbing on mobile Google Chrome. 7 | /// 8 | /// 9 | /// Workaround for 10 | /// 11 | public class WebEventSystem : EventSystem 12 | { 13 | protected override void OnApplicationFocus(bool hasFocus) => base.OnApplicationFocus(true); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/LeaderboardEntryResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class LeaderboardEntryResponse 8 | { 9 | [field: Preserve] 10 | public int score; 11 | [field: Preserve] 12 | public string extraData; 13 | [field: Preserve] 14 | public int rank; 15 | [field: Preserve] 16 | public PlayerAccountProfileDataResponse player; 17 | [field: Preserve] 18 | public string formattedScore; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising/StickyAd.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace BananaParty.YandexGames 4 | { 5 | /// 6 | /// Proxy for ysdk.adv.showBannerAdv() and ysdk.adv.hideBannerAdv() methods in YandexGames SDK. 7 | /// 8 | public static class StickyAd 9 | { 10 | public static void Show() => StickyAdShow(); 11 | 12 | [DllImport("__Internal")] 13 | private static extern void StickyAdShow(); 14 | 15 | public static void Hide() => StickyAdHide(); 16 | 17 | [DllImport("__Internal")] 18 | private static extern void StickyAdHide(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/BananaParty.YandexGames.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BananaParty.YandexGames.Tests", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:27619889b8ba8c24980f49ee34dbb44a", 6 | "GUID:0acc523941302664db1f4e527237feb3", 7 | "GUID:ef7e0e3eb213f324c87b70a782844fb6" 8 | ], 9 | "includePlatforms": [], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": true, 13 | "precompiledReferences": [ 14 | "nunit.framework.dll" 15 | ], 16 | "autoReferenced": false, 17 | "defineConstraints": [ 18 | "UNITY_INCLUDE_TESTS" 19 | ], 20 | "versionDefines": [], 21 | "noEngineReferences": false 22 | } -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/LeaderboardGetEntriesResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class LeaderboardGetEntriesResponse 8 | { 9 | [field: Preserve] 10 | public LeaderboardDescriptionResponse leaderboard; 11 | [field: Preserve] 12 | public Range[] ranges; 13 | [field: Preserve] 14 | public int userRank; 15 | [field: Preserve] 16 | public LeaderboardEntryResponse[] entries; 17 | 18 | 19 | [Serializable] 20 | public class Range 21 | { 22 | [field: Preserve] 23 | public int start; 24 | [field: Preserve] 25 | public int size; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/StickyAdTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine.TestTools; 4 | 5 | namespace BananaParty.YandexGames.Tests 6 | { 7 | public class StickyAdTests 8 | { 9 | [UnitySetUp] 10 | public IEnumerator InitializeSdk() 11 | { 12 | if (!YandexGamesSdk.IsInitialized) 13 | yield return YandexGamesSdk.Initialize(SdkTests.TrackSuccessCallback); 14 | } 15 | 16 | [Test] 17 | public void ShowShouldNotThrow() 18 | { 19 | Assert.DoesNotThrow(() => StickyAd.Show()); 20 | } 21 | 22 | [Test] 23 | public void HideShouldNotThrow() 24 | { 25 | Assert.DoesNotThrow(() => StickyAd.Hide()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/CatalogProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class CatalogProduct 8 | { 9 | [field: Preserve] 10 | public string description; 11 | 12 | [field: Preserve] 13 | public string id; 14 | 15 | [field: Preserve] 16 | public string imageURI; 17 | 18 | [field: Preserve] 19 | public string price; 20 | 21 | [field: Preserve] 22 | public string priceCurrencyCode; 23 | 24 | [field: Preserve] 25 | public string priceCurrencyImage; 26 | 27 | [field: Preserve] 28 | public string priceValue; 29 | 30 | [field: Preserve] 31 | public string title; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/ShortcutTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine.TestTools; 4 | 5 | namespace BananaParty.YandexGames.Tests 6 | { 7 | public class ShortcutTests 8 | { 9 | [UnitySetUp] 10 | public IEnumerator InitializeSdk() 11 | { 12 | if (!YandexGamesSdk.IsInitialized) 13 | yield return YandexGamesSdk.Initialize(SdkTests.TrackSuccessCallback); 14 | } 15 | 16 | [Test] 17 | public void CanSuggestShouldNotThrow() 18 | { 19 | Assert.DoesNotThrow(() => Shortcut.CanSuggest(result => {})); 20 | } 21 | 22 | [Test] 23 | public void SuggestShouldNotThrow() 24 | { 25 | Assert.DoesNotThrow(() => Shortcut.Suggest()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount/PlayerAccountProfileDataResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class PlayerAccountProfileDataResponse 8 | { 9 | [field: Preserve] 10 | public string uniqueID; 11 | [field: Preserve] 12 | public string lang; 13 | [field: Preserve] 14 | public string publicName; 15 | [field: Preserve] 16 | public string profilePicture; 17 | [field: Preserve] 18 | public ScopePermissions scopePermissions; 19 | 20 | [Serializable] 21 | public class ScopePermissions 22 | { 23 | [field: Preserve] 24 | public string avatar; 25 | [field: Preserve] 26 | public string public_name; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/ReviewPopupTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine.TestTools; 4 | 5 | namespace BananaParty.YandexGames.Tests 6 | { 7 | public class ReviewPopupTests 8 | { 9 | [UnitySetUp] 10 | public IEnumerator InitializeSdk() 11 | { 12 | if (!YandexGamesSdk.IsInitialized) 13 | yield return YandexGamesSdk.Initialize(SdkTests.TrackSuccessCallback); 14 | } 15 | 16 | [Test] 17 | public void CanReviewShouldNotThrow() 18 | { 19 | Assert.DoesNotThrow(() => ReviewPopup.CanOpen((result, reason) => { })); 20 | } 21 | 22 | [Test] 23 | public void ReviewShouldNotThrow() 24 | { 25 | Assert.DoesNotThrow(() => ReviewPopup.Open()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/PlayerPrefsTests.cs: -------------------------------------------------------------------------------- 1 | using BananaParty.YandexGames.Utility; 2 | using NUnit.Framework; 3 | 4 | namespace BananaParty.YandexGames.Tests 5 | { 6 | public class PlayerPrefsTests 7 | { 8 | [Test] 9 | public void ShouldNotThrowOnEmptyData() 10 | { 11 | Assert.DoesNotThrow(() => PlayerPrefs.ParseAndApplyData("")); 12 | } 13 | 14 | [Test] 15 | public void ShouldNotCorruptData() 16 | { 17 | // {"abc":"1232","s":"5","somestring":"herpthederp"} 18 | PlayerPrefs.ParseAndApplyData("{\"abc\":\"1232\",\"s\":\"5\",\"somestring\":\"herpthederp\"}"); 19 | Assert.AreEqual(PlayerPrefs.GetInt("abc"), 1232); 20 | Assert.AreEqual(PlayerPrefs.GetFloat("s"), 5f); 21 | Assert.AreEqual(PlayerPrefs.GetString("somestring"), "herpthederp"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YandexGamesUnity 2 | 3 | This is a development repository. To install the package, use this repo instead: 4 | https://github.com/forcepusher/com.bananaparty.yandexgames 5 | 6 | To run unit tests: in Unity, go to "Window" -> "General" -> "Test Runner". 7 | Make sure your target platform is set to WebGL in build settings. 8 | Switch to "PlayMode" and click "Run All Tests (WebGL)". It'll take a while. 9 | 10 | Yandex Games doesn't support SDK unit testing outside of their platform yet, so we have to run some manual tests. 11 | Make a regular build and upload it to Yandex Games according to documentation: 12 | https://yandex.ru/dev/games/doc/dg/concepts/about.html 13 | 14 | Before publishing a new version, rename "Samples" folder to "Samples~" and remove the meta file for the folder. 15 | https://forum.unity.com/threads/samples-in-packages-manual-setup.623080/#post-4991561 16 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/VideoAdTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine; 4 | using UnityEngine.TestTools; 5 | 6 | namespace BananaParty.YandexGames.Tests 7 | { 8 | public class VideoAdTests 9 | { 10 | [UnitySetUp] 11 | public IEnumerator InitializeSdk() 12 | { 13 | if (!YandexGamesSdk.IsInitialized) 14 | yield return YandexGamesSdk.Initialize(SdkTests.TrackSuccessCallback); 15 | } 16 | 17 | [UnityTest] 18 | public IEnumerator ShowShouldInvokeErrorCallback() 19 | { 20 | bool callbackInvoked = false; 21 | VideoAd.Show(onErrorCallback: (message) => 22 | { 23 | callbackInvoked = true; 24 | }); 25 | 26 | yield return new WaitForSecondsRealtime(1); 27 | 28 | Assert.IsTrue(callbackInvoked); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/InterstitialAdTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine; 4 | using UnityEngine.TestTools; 5 | 6 | namespace BananaParty.YandexGames.Tests 7 | { 8 | public class InterstitialAdTests 9 | { 10 | [UnitySetUp] 11 | public IEnumerator InitializeSdk() 12 | { 13 | if (!YandexGamesSdk.IsInitialized) 14 | yield return YandexGamesSdk.Initialize(SdkTests.TrackSuccessCallback); 15 | } 16 | 17 | [UnityTest] 18 | public IEnumerator ShowShouldInvokeErrorCallback() 19 | { 20 | bool callbackInvoked = false; 21 | InterstitialAd.Show(onErrorCallback: (message) => 22 | { 23 | callbackInvoked = true; 24 | }); 25 | 26 | yield return new WaitForSecondsRealtime(1); 27 | 28 | Assert.IsTrue(callbackInvoked); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | UnityAdsSettings: 27 | m_Enabled: 0 28 | m_InitializeOnStartup: 1 29 | m_TestMode: 0 30 | m_IosGameId: 31 | m_AndroidGameId: 32 | m_GameIds: {} 33 | m_GameId: 34 | PerformanceReportingSettings: 35 | m_Enabled: 0 36 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/YandexGamesEnvironment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class YandexGamesEnvironment 8 | { 9 | [field: Preserve] 10 | public App app; 11 | [field: Preserve] 12 | public Browser browser; 13 | [field: Preserve] 14 | public Internationalization i18n; 15 | [field: Preserve] 16 | public string payload; 17 | 18 | [Serializable] 19 | public class App 20 | { 21 | [field: Preserve] 22 | public string id; 23 | } 24 | 25 | [Serializable] 26 | public class Browser 27 | { 28 | [field: Preserve] 29 | public string lang; 30 | } 31 | 32 | [Serializable] 33 | public class Internationalization 34 | { 35 | [field: Preserve] 36 | public string lang; 37 | [field: Preserve] 38 | public string tld; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PurchasedProductPanel.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace BananaParty.YandexGames.Samples 5 | { 6 | public class PurchasedProductPanel : MonoBehaviour 7 | { 8 | [SerializeField] 9 | private Text _purchasedProductIdText; 10 | [SerializeField] 11 | private PurchasedProductListPanel _purchasedProductListPanel; 12 | 13 | private PurchasedProduct _purchasedProduct; 14 | 15 | public PurchasedProduct PurchasedProduct 16 | { 17 | set 18 | { 19 | _purchasedProduct = value; 20 | 21 | _purchasedProductIdText.text = value.productID; 22 | } 23 | } 24 | 25 | public void OnConsumeButtonClick() 26 | { 27 | Billing.ConsumeProduct(_purchasedProduct.purchaseToken, () => 28 | { 29 | Debug.Log($"Consumed {_purchasedProduct.productID}"); 30 | 31 | _purchasedProductListPanel.RemovePurchasedProductPanel(this); 32 | }); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 github.com/forcepusher 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/PlayerAccountTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine; 4 | using UnityEngine.TestTools; 5 | 6 | namespace BananaParty.YandexGames.Tests 7 | { 8 | public class PlayerAccountTests 9 | { 10 | [UnitySetUp] 11 | public IEnumerator InitializeSdk() 12 | { 13 | if (!YandexGamesSdk.IsInitialized) 14 | yield return YandexGamesSdk.Initialize(SdkTests.TrackSuccessCallback); 15 | } 16 | 17 | [Test] 18 | public void ShouldNotBeAuthorizedOnStart() 19 | { 20 | Assert.IsFalse(PlayerAccount.IsAuthorized); 21 | } 22 | 23 | [UnityTest] 24 | public IEnumerator AuthorizeShouldInvokeErrorCallback() 25 | { 26 | bool callbackInvoked = false; 27 | PlayerAccount.Authorize(onErrorCallback: (message) => 28 | { 29 | callbackInvoked = true; 30 | }); 31 | 32 | yield return new WaitForSecondsRealtime(1); 33 | 34 | Assert.IsTrue(callbackInvoked); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 github.com/forcepusher 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Tests/Runtime/SdkTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using NUnit.Framework; 3 | using UnityEngine.TestTools; 4 | 5 | namespace BananaParty.YandexGames.Tests 6 | { 7 | public class SdkTests 8 | { 9 | private static bool s_isInitializationSuccessCallbackReceived = false; 10 | 11 | [UnitySetUp] 12 | public IEnumerator InitializeSdk() 13 | { 14 | if (!YandexGamesSdk.IsInitialized) 15 | yield return YandexGamesSdk.Initialize(TrackSuccessCallback); 16 | } 17 | 18 | [Test] 19 | public void ShouldReturnEnvironment() 20 | { 21 | Assert.IsNotEmpty(YandexGamesSdk.Environment.browser.lang); 22 | } 23 | 24 | [Test] 25 | public void ShouldReceiveInitializationSuccessCallback() 26 | { 27 | Assert.IsTrue(s_isInitializationSuccessCallbackReceived); 28 | } 29 | 30 | [Test] 31 | public void IsRunningOnYandexShouldReturnFalse() 32 | { 33 | Assert.IsFalse(YandexGamesSdk.IsRunningOnYandex); 34 | } 35 | 36 | public static void TrackSuccessCallback() 37 | { 38 | s_isInitializationSuccessCallbackReceived = true; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 10 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 1 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 4 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_SerializeInlineMappingsOnOneLine: 1 31 | m_AssetPipelineMode: 1 32 | m_CacheServerMode: 0 33 | m_CacheServerEndpoint: 34 | m_CacheServerNamespacePrefix: default 35 | m_CacheServerEnableDownload: 1 36 | m_CacheServerEnableUpload: 1 37 | -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0.1 18 | m_ClothInterCollisionStiffness: 0.2 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ClothGravity: {x: 0, y: -9.81, z: 0} 26 | m_ContactPairsMode: 0 27 | m_BroadphaseType: 0 28 | m_WorldBounds: 29 | m_Center: {x: 0, y: 0, z: 0} 30 | m_Extent: {x: 250, y: 250, z: 250} 31 | m_WorldSubdivisions: 8 32 | m_FrictionType: 0 33 | m_EnableEnhancedDeterminism: 0 34 | m_EnableUnifiedHeightmaps: 1 35 | m_SolverType: 0 36 | m_DefaultMaxAngularSpeed: 50 37 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/README.md: -------------------------------------------------------------------------------- 1 | # com.bananaparty.yandexgames 2 | 3 | [Try the SDK demo here.](https://yandex.ru/games/app/223976?draft=true) 4 | 5 | **Key differences: Unlike other popular plugins, this SDK does not vandalize your project settings, and does not force you to use a specific WebGL Template. It is designed for publishing your project to multiple web game platforms, allowing you to use their respective SDKs (not just Yandex Games).** 6 | 7 | Project is mostly maintained on spare time, so it will be behind on new feature support. Forking is highly recommended to modify it for your specific needs. 8 | 9 | Make sure you have the standalone [Git](https://git-scm.com/downloads) installed. Reboot after installation. 10 | In Unity, open "Window" -> "Package Manager". 11 | Click the "+" sign at the top left corner -> "Add package from git URL..." 12 | Paste this: `https://github.com/forcepusher/com.bananaparty.yandexgames.git#18.0.0` 13 | See the minimum required Unity version in the `package.json` file. 14 | Find "Samples" in the package window and click the "Import" button. 15 | To update the package, simply add it again using a different version tag. 16 | 17 | This package automatically inserts YandexGames SDK script into HTML page when calling `YandexGamesSdk.Initialize()`. No need to modify WebGLTemplates, just use the SDK methods. 18 | 19 | Also see the [Development Repo](https://github.com/forcepusher/YandexGamesUnity) if you want to modify this package. 20 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/LeaderboardDescriptionResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine.Scripting; 3 | 4 | namespace BananaParty.YandexGames 5 | { 6 | [Serializable] 7 | public class LeaderboardDescriptionResponse 8 | { 9 | [field: Preserve] 10 | public string appID; 11 | [field: Preserve] 12 | public bool @default; 13 | [field: Preserve] 14 | public Description description; 15 | [field: Preserve] 16 | public string name; 17 | [field: Preserve] 18 | public Title title; 19 | 20 | 21 | [Serializable] 22 | public class Description 23 | { 24 | [field: Preserve] 25 | public bool invert_sort_order; 26 | [field: Preserve] 27 | public ScoreFormat score_format; 28 | [field: Preserve] 29 | public string type; 30 | 31 | 32 | [Serializable] 33 | public class ScoreFormat 34 | { 35 | [field: Preserve] 36 | public Options options; 37 | 38 | 39 | [Serializable] 40 | public class Options 41 | { 42 | [field: Preserve] 43 | public int decimal_offset; 44 | } 45 | } 46 | } 47 | 48 | [Serializable] 49 | public class Title 50 | { 51 | [field: Preserve] 52 | public string en; 53 | [field: Preserve] 54 | public string ru; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ai.navigation": "1.1.5", 4 | "com.unity.ide.visualstudio": "2.0.22", 5 | "com.unity.ide.vscode": "1.2.5", 6 | "com.unity.test-framework": "1.1.33", 7 | "com.unity.ugui": "1.0.0", 8 | "com.unity.modules.ai": "1.0.0", 9 | "com.unity.modules.androidjni": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.assetbundle": "1.0.0", 12 | "com.unity.modules.audio": "1.0.0", 13 | "com.unity.modules.cloth": "1.0.0", 14 | "com.unity.modules.director": "1.0.0", 15 | "com.unity.modules.imageconversion": "1.0.0", 16 | "com.unity.modules.imgui": "1.0.0", 17 | "com.unity.modules.jsonserialize": "1.0.0", 18 | "com.unity.modules.particlesystem": "1.0.0", 19 | "com.unity.modules.physics": "1.0.0", 20 | "com.unity.modules.physics2d": "1.0.0", 21 | "com.unity.modules.screencapture": "1.0.0", 22 | "com.unity.modules.terrain": "1.0.0", 23 | "com.unity.modules.terrainphysics": "1.0.0", 24 | "com.unity.modules.tilemap": "1.0.0", 25 | "com.unity.modules.ui": "1.0.0", 26 | "com.unity.modules.uielements": "1.0.0", 27 | "com.unity.modules.umbra": "1.0.0", 28 | "com.unity.modules.unityanalytics": "1.0.0", 29 | "com.unity.modules.unitywebrequest": "1.0.0", 30 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 31 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 32 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 33 | "com.unity.modules.unitywebrequestwww": "1.0.0", 34 | "com.unity.modules.vehicles": "1.0.0", 35 | "com.unity.modules.video": "1.0.0", 36 | "com.unity.modules.vr": "1.0.0", 37 | "com.unity.modules.wind": "1.0.0", 38 | "com.unity.modules.xr": "1.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Tools/ReviewPopup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | public class ReviewPopup 9 | { 10 | private static Action s_onCanOpenCallback; 11 | private static Action s_onOpenCallback; 12 | 13 | public static void CanOpen(Action onResultCallback) 14 | { 15 | s_onCanOpenCallback = onResultCallback; 16 | 17 | ReviewPopupCanOpen(OnCanOpenCallback); 18 | } 19 | 20 | [DllImport("__Internal")] 21 | private static extern void ReviewPopupCanOpen(Action onResultCallback); 22 | 23 | [MonoPInvokeCallback(typeof(Action))] 24 | private static void OnCanOpenCallback(bool result, string reason) 25 | { 26 | if (YandexGamesSdk.CallbackLogging) 27 | Debug.Log($"{nameof(Shortcut)}.{nameof(OnCanOpenCallback)} called. {nameof(result)}={result} {nameof(reason)}={reason}"); 28 | 29 | s_onCanOpenCallback?.Invoke(result, reason); 30 | } 31 | 32 | public static void Open(Action onResultCallback = null) 33 | { 34 | s_onOpenCallback = onResultCallback; 35 | 36 | ReviewPopupOpen(OnOpenCallback); 37 | } 38 | 39 | [DllImport("__Internal")] 40 | private static extern void ReviewPopupOpen(Action onResultCallback); 41 | 42 | [MonoPInvokeCallback(typeof(Action))] 43 | private static void OnOpenCallback(bool result) 44 | { 45 | if (YandexGamesSdk.CallbackLogging) 46 | Debug.Log($"{nameof(Shortcut)}.{nameof(OnOpenCallback)} called. {nameof(result)}={result}"); 47 | 48 | s_onOpenCallback?.Invoke(result); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Tools/Shortcut.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | public static class Shortcut 9 | { 10 | private static Action s_onCanSuggestCallback; 11 | private static Action s_onSuggestCallback; 12 | 13 | public static void CanSuggest(Action onResultCallback) 14 | { 15 | s_onCanSuggestCallback = onResultCallback; 16 | 17 | ShortcutCanSuggest(OnCanSuggestShortcutCallback); 18 | } 19 | 20 | [DllImport("__Internal")] 21 | private static extern void ShortcutCanSuggest(Action onResultCallback); 22 | 23 | [MonoPInvokeCallback(typeof(Action))] 24 | private static void OnCanSuggestShortcutCallback(bool result) 25 | { 26 | if (YandexGamesSdk.CallbackLogging) 27 | Debug.Log($"{nameof(Shortcut)}.{nameof(OnCanSuggestShortcutCallback)} called. {nameof(result)}={result}"); 28 | 29 | s_onCanSuggestCallback?.Invoke(result); 30 | } 31 | 32 | public static void Suggest(Action onResultCallback = null) 33 | { 34 | s_onSuggestCallback = onResultCallback; 35 | 36 | ShortcutSuggest(OnSuggestShortcutCallback); 37 | } 38 | 39 | [DllImport("__Internal")] 40 | private static extern void ShortcutSuggest(Action onAcceptCallback); 41 | 42 | [MonoPInvokeCallback(typeof(Action))] 43 | private static void OnSuggestShortcutCallback(bool result) 44 | { 45 | if (YandexGamesSdk.CallbackLogging) 46 | Debug.Log($"{nameof(Shortcut)}.{nameof(OnSuggestShortcutCallback)} called. {nameof(result)}={result}"); 47 | 48 | s_onSuggestCallback?.Invoke(result); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/YandexGamesPlugin.jslib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a00f68719b15ab2489b7d832ec52b8dd 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 1 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | : Any 16 | second: 17 | enabled: 0 18 | settings: 19 | Exclude Android: 1 20 | Exclude Editor: 1 21 | Exclude Linux64: 1 22 | Exclude OSXUniversal: 1 23 | Exclude WebGL: 0 24 | Exclude Win: 1 25 | Exclude Win64: 1 26 | Exclude iOS: 1 27 | - first: 28 | Android: Android 29 | second: 30 | enabled: 0 31 | settings: 32 | CPU: ARMv7 33 | - first: 34 | Any: 35 | second: 36 | enabled: 0 37 | settings: {} 38 | - first: 39 | Editor: Editor 40 | second: 41 | enabled: 0 42 | settings: 43 | CPU: AnyCPU 44 | DefaultValueInitialized: true 45 | OS: AnyOS 46 | - first: 47 | Standalone: Linux64 48 | second: 49 | enabled: 0 50 | settings: 51 | CPU: None 52 | - first: 53 | Standalone: OSXUniversal 54 | second: 55 | enabled: 0 56 | settings: 57 | CPU: None 58 | - first: 59 | Standalone: Win 60 | second: 61 | enabled: 0 62 | settings: 63 | CPU: x86 64 | - first: 65 | Standalone: Win64 66 | second: 67 | enabled: 0 68 | settings: 69 | CPU: x86_64 70 | - first: 71 | WebGL: WebGL 72 | second: 73 | enabled: 1 74 | settings: {} 75 | - first: 76 | iPhone: iOS 77 | second: 78 | enabled: 0 79 | settings: 80 | AddToEmbeddedBinaries: false 81 | CPU: AnyCPU 82 | CompileFlags: 83 | FrameworkDependencies: 84 | userData: 85 | assetBundleName: 86 | assetBundleVariant: 87 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/ProductPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace BananaParty.YandexGames.Samples 7 | { 8 | public class ProductPanel : MonoBehaviour 9 | { 10 | [SerializeField] 11 | private RawImage _productImage; 12 | [SerializeField] 13 | private Text _productIdText; 14 | 15 | private CatalogProduct _product; 16 | 17 | public CatalogProduct Product 18 | { 19 | set 20 | { 21 | _product = value; 22 | 23 | _productIdText.text = value.id; 24 | 25 | if (Uri.IsWellFormedUriString(value.imageURI, UriKind.Absolute)) 26 | StartCoroutine(DownloadAndSetProductImage(value.imageURI)); 27 | } 28 | } 29 | 30 | private IEnumerator DownloadAndSetProductImage(string imageUrl) 31 | { 32 | var remoteImage = new RemoteImage(imageUrl); 33 | remoteImage.Download(); 34 | 35 | while (!remoteImage.IsDownloadFinished) 36 | yield return null; 37 | 38 | if (remoteImage.IsDownloadSuccessful) 39 | _productImage.texture = remoteImage.Texture; 40 | } 41 | 42 | public void OnPurchaseButtonClick() 43 | { 44 | Billing.PurchaseProduct(_product.id, (purchaseProductResponse) => 45 | { 46 | Debug.Log($"Purchased {purchaseProductResponse.purchaseData.productID}"); 47 | }); 48 | } 49 | 50 | public void OnPurchaseAndConsumeButtonClick() 51 | { 52 | Billing.PurchaseProduct(_product.id, (purchaseProductResponse) => 53 | { 54 | Debug.Log($"Purchased {purchaseProductResponse.purchaseData.productID}"); 55 | 56 | Billing.ConsumeProduct(purchaseProductResponse.purchaseData.purchaseToken, () => 57 | { 58 | Debug.Log($"Consumed {purchaseProductResponse.purchaseData.productID}"); 59 | }); 60 | }); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_SimulationMode: 0 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_VideoShadersIncludeMode: 2 32 | m_AlwaysIncludedShaders: 33 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 42 | m_CustomRenderPipeline: {fileID: 0} 43 | m_TransparencySortMode: 0 44 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 45 | m_DefaultRenderingPath: 1 46 | m_DefaultMobileRenderingPath: 1 47 | m_TierSettings: [] 48 | m_LightmapStripping: 0 49 | m_FogStripping: 0 50 | m_InstancingStripping: 0 51 | m_LightmapKeepPlain: 1 52 | m_LightmapKeepDirCombined: 1 53 | m_LightmapKeepDynamicPlain: 1 54 | m_LightmapKeepDynamicDirCombined: 1 55 | m_LightmapKeepShadowMask: 1 56 | m_LightmapKeepSubtractive: 1 57 | m_FogKeepLinear: 1 58 | m_FogKeepExp: 1 59 | m_FogKeepExp2: 1 60 | m_AlbedoSwatchInfos: [] 61 | m_LightsUseLinearIntensity: 0 62 | m_LightsUseColorTemperature: 0 63 | m_LogWhenShaderIsCompiled: 0 64 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising/InterstitialAd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | /// 9 | /// Proxy for ysdk.adv.showFullscreenAdv() method in YandexGames SDK. 10 | /// 11 | public static class InterstitialAd 12 | { 13 | // Mutable static fields - absolutely disgusting. 14 | private static Action s_onOpenCallback; 15 | private static Action s_onCloseCallback; 16 | private static Action s_onErrorCallback; 17 | private static Action s_onOfflineCallback; 18 | 19 | /// 20 | /// Shows the fullscreen ad banner. 21 | /// 22 | /// 23 | /// Could be used only once every 2 minutes (at the time of writing). 24 | /// Otherwise calls onCloseCallback instantaneously. 25 | /// 26 | public static void Show(Action onOpenCallback = null, Action onCloseCallback = null, 27 | Action onErrorCallback = null, Action onOfflineCallback = null) 28 | { 29 | // Let's pretend you didn't see this. 30 | s_onOpenCallback = onOpenCallback; 31 | s_onCloseCallback = onCloseCallback; 32 | s_onErrorCallback = onErrorCallback; 33 | s_onOfflineCallback = onOfflineCallback; 34 | 35 | InterstitialAdShow(OnOpenCallback, OnCloseCallback, OnErrorCallback, OnOfflineCallback); 36 | } 37 | 38 | [DllImport("__Internal")] 39 | private static extern bool InterstitialAdShow(Action openCallback, Action closeCallback, Action errorCallback, Action offlineCallback); 40 | 41 | [MonoPInvokeCallback(typeof(Action))] 42 | private static void OnOpenCallback() 43 | { 44 | if (YandexGamesSdk.CallbackLogging) 45 | Debug.Log($"{nameof(InterstitialAd)}.{nameof(OnOpenCallback)} invoked"); 46 | 47 | s_onOpenCallback?.Invoke(); 48 | } 49 | 50 | [MonoPInvokeCallback(typeof(Action))] 51 | private static void OnCloseCallback(bool wasShown) 52 | { 53 | if (YandexGamesSdk.CallbackLogging) 54 | Debug.Log($"{nameof(InterstitialAd)}.{nameof(OnCloseCallback)} invoked, {nameof(wasShown)} = {wasShown}"); 55 | 56 | s_onCloseCallback?.Invoke(wasShown); 57 | } 58 | 59 | [MonoPInvokeCallback(typeof(Action))] 60 | private static void OnErrorCallback(string errorMessage) 61 | { 62 | if (YandexGamesSdk.CallbackLogging) 63 | Debug.Log($"{nameof(InterstitialAd)}.{nameof(OnErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 64 | 65 | s_onErrorCallback?.Invoke(errorMessage); 66 | } 67 | 68 | [MonoPInvokeCallback(typeof(Action))] 69 | private static void OnOfflineCallback() 70 | { 71 | if (YandexGamesSdk.CallbackLogging) 72 | Debug.Log($"{nameof(InterstitialAd)}.{nameof(OnOfflineCallback)} invoked"); 73 | 74 | s_onOfflineCallback?.Invoke(); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/YandexGamesSdk.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Runtime.InteropServices; 4 | using AOT; 5 | using UnityEngine; 6 | 7 | namespace BananaParty.YandexGames 8 | { 9 | public static class YandexGamesSdk 10 | { 11 | private static Action s_onInitializeSuccessCallback; 12 | 13 | /// 14 | /// Enable it to log SDK callbacks in the console. 15 | /// 16 | public static bool CallbackLogging = false; 17 | 18 | /// 19 | /// SDK is initialized automatically on load. 20 | /// If either something fails or called way too early, this will return false. 21 | /// 22 | public static bool IsInitialized => GetYandexGamesSdkIsInitialized(); 23 | 24 | /// 25 | /// Use it to check whether you're using Build and Run or running in the Editor.
26 | /// Can be called without initializing the SDK, can be called in Editor. 27 | ///
28 | public static bool IsRunningOnYandex 29 | { 30 | get 31 | { 32 | #if UNITY_WEBGL && !UNITY_EDITOR 33 | return YandexGamesSdkIsRunningOnYandex(); 34 | #else 35 | return false; 36 | #endif 37 | } 38 | } 39 | 40 | [DllImport("__Internal")] 41 | private static extern bool GetYandexGamesSdkIsInitialized(); 42 | 43 | public static YandexGamesEnvironment Environment 44 | { 45 | get 46 | { 47 | string environmentJson = GetYandexGamesSdkEnvironment(); 48 | return JsonUtility.FromJson(environmentJson); 49 | } 50 | } 51 | 52 | [DllImport("__Internal")] 53 | private static extern string GetYandexGamesSdkEnvironment(); 54 | 55 | /// 56 | /// Invoke this and wait for coroutine to finish before using any SDK methods.
57 | /// Downloads Yandex SDK script and inserts it into the HTML page. 58 | ///
59 | /// Coroutine waiting for to return true. 60 | public static IEnumerator Initialize(Action onSuccessCallback = null) 61 | { 62 | s_onInitializeSuccessCallback = onSuccessCallback; 63 | 64 | YandexGamesSdkInitialize(OnInitializeSuccessCallback); 65 | 66 | while (!IsInitialized) 67 | yield return null; 68 | } 69 | 70 | [DllImport("__Internal")] 71 | private static extern void YandexGamesSdkInitialize(Action successCallback); 72 | 73 | [MonoPInvokeCallback(typeof(Action))] 74 | private static void OnInitializeSuccessCallback() 75 | { 76 | if (CallbackLogging) 77 | Debug.Log($"{nameof(YandexGamesSdk)}.{nameof(OnInitializeSuccessCallback)} invoked"); 78 | 79 | s_onInitializeSuccessCallback?.Invoke(); 80 | } 81 | 82 | public static void GameReady() 83 | { 84 | if (CallbackLogging) 85 | Debug.Log($"{nameof(YandexGamesSdk)}.{nameof(GameReady)} invoked"); 86 | 87 | YandexGamesSdkGameReady(); 88 | } 89 | 90 | [DllImport("__Internal")] 91 | private static extern void YandexGamesSdkGameReady(); 92 | 93 | [DllImport("__Internal")] 94 | private static extern bool YandexGamesSdkIsRunningOnYandex(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Utility/RemoteImage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using UnityEngine; 5 | using UnityEngine.Networking; 6 | 7 | namespace BananaParty.YandexGames 8 | { 9 | public class RemoteImage 10 | { 11 | private readonly string _url; 12 | 13 | private Texture2D _texture; 14 | public Texture2D Texture 15 | { 16 | get 17 | { 18 | if (!IsDownloadFinished) 19 | throw new InvalidOperationException($"Attempt to get {nameof(Texture)} while {nameof(IsDownloadFinished)} = {IsDownloadFinished}"); 20 | 21 | if (!IsDownloadSuccessful) 22 | throw new InvalidOperationException($"Attempt to get {nameof(Texture)} while {nameof(IsDownloadSuccessful)} = {IsDownloadSuccessful}"); 23 | 24 | return _texture; 25 | } 26 | private set 27 | { 28 | _texture = value; 29 | } 30 | } 31 | 32 | public bool IsDownloadFinished { get; private set; } = false; 33 | 34 | public bool IsDownloadSuccessful { get; private set; } = false; 35 | 36 | public string DownloadErrorMessage { get; private set; } 37 | 38 | /// 39 | /// Creates an instance of an image that can be downloaded from a remote server. 40 | /// 41 | /// It's actually a URL, not URI because silently fails without a protocol (like https://). 42 | public RemoteImage(string url) 43 | { 44 | _url= url; 45 | } 46 | 47 | // Async is used here to avoid creation of coroutines that must be tied to a MonoBehaviour. 48 | public async void Download(Action successCallback = null, Action errorCallback = null, CancellationToken cancellationToken = default) 49 | { 50 | using (UnityWebRequest downloadTextureWebRequest = UnityWebRequestTexture.GetTexture(_url)) 51 | { 52 | UnityWebRequestAsyncOperation downloadOperation = downloadTextureWebRequest.SendWebRequest(); 53 | 54 | while (!downloadOperation.isDone) 55 | { 56 | if (cancellationToken.IsCancellationRequested) 57 | break; 58 | 59 | await Task.Yield(); 60 | } 61 | 62 | IsDownloadFinished = true; 63 | 64 | if (cancellationToken.IsCancellationRequested) 65 | { 66 | DownloadErrorMessage = $"Download interrupted via {nameof(CancellationToken)}"; 67 | } 68 | else if (downloadOperation.webRequest.result != UnityWebRequest.Result.Success) 69 | { 70 | DownloadErrorMessage = downloadOperation.webRequest.error; 71 | } 72 | else 73 | { 74 | _texture = DownloadHandlerTexture.GetContent(downloadTextureWebRequest); 75 | 76 | if (_texture != null) 77 | IsDownloadSuccessful = true; 78 | else 79 | DownloadErrorMessage = "Getting content of a downloaded texture has failed."; 80 | } 81 | } 82 | 83 | if (IsDownloadSuccessful) 84 | successCallback?.Invoke(_texture); 85 | else 86 | errorCallback?.Invoke(DownloadErrorMessage); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Advertising/VideoAd.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | /// 9 | /// Proxy for ysdk.adv.showRewardedVideo() method in YandexGames SDK. 10 | /// 11 | public static class VideoAd 12 | { 13 | // More statics to the god of statics. 14 | private static Action s_onOpenCallback; 15 | private static Action s_onRewardedCallback; 16 | private static Action s_onCloseCallback; 17 | private static Action s_onErrorCallback; 18 | 19 | private static bool s_isVideoAdOpen = false; 20 | 21 | /// 22 | /// Shows the rewarded video ad. 23 | /// 24 | /// 25 | /// Doesn't seem to have any call-per-minute limit (at the time of writing). 26 | /// 27 | public static void Show(Action onOpenCallback = null, Action onRewardedCallback = null, 28 | Action onCloseCallback = null, Action onErrorCallback = null) 29 | { 30 | // And this is where static fields backfire. Instant Karma. 31 | s_onOpenCallback = onOpenCallback; 32 | s_onRewardedCallback = onRewardedCallback; 33 | s_onCloseCallback = onCloseCallback; 34 | s_onErrorCallback = onErrorCallback; 35 | 36 | VideoAdShow(OnOpenCallback, OnRewardedCallback, OnCloseCallback, OnErrorCallback); 37 | } 38 | 39 | [DllImport("__Internal")] 40 | private static extern bool VideoAdShow(Action openCallback, Action rewardedCallback, Action closeCallback, Action errorCallback); 41 | 42 | [MonoPInvokeCallback(typeof(Action))] 43 | private static void OnOpenCallback() 44 | { 45 | if (YandexGamesSdk.CallbackLogging) 46 | Debug.Log($"{nameof(VideoAd)}.{nameof(OnOpenCallback)} invoked"); 47 | 48 | s_isVideoAdOpen = true; 49 | 50 | s_onOpenCallback?.Invoke(); 51 | } 52 | 53 | [MonoPInvokeCallback(typeof(Action))] 54 | private static void OnRewardedCallback() 55 | { 56 | if (!s_isVideoAdOpen) 57 | { 58 | if (YandexGamesSdk.CallbackLogging) 59 | Debug.Log($"Ignoring {nameof(VideoAd)}.{nameof(OnRewardedCallback)} because {nameof(s_isVideoAdOpen)} is {s_isVideoAdOpen}"); 60 | 61 | return; 62 | } 63 | 64 | if (YandexGamesSdk.CallbackLogging) 65 | Debug.Log($"{nameof(VideoAd)}.{nameof(OnRewardedCallback)} invoked"); 66 | 67 | s_onRewardedCallback?.Invoke(); 68 | } 69 | 70 | [MonoPInvokeCallback(typeof(Action))] 71 | private static void OnCloseCallback() 72 | { 73 | if (!s_isVideoAdOpen) 74 | { 75 | if (YandexGamesSdk.CallbackLogging) 76 | Debug.Log($"Ignoring {nameof(VideoAd)}.{nameof(OnCloseCallback)} because {nameof(s_isVideoAdOpen)} is {s_isVideoAdOpen}"); 77 | 78 | return; 79 | } 80 | 81 | if (YandexGamesSdk.CallbackLogging) 82 | Debug.Log($"{nameof(VideoAd)}.{nameof(OnCloseCallback)} invoked"); 83 | 84 | s_isVideoAdOpen = false; 85 | 86 | s_onCloseCallback?.Invoke(); 87 | } 88 | 89 | [MonoPInvokeCallback(typeof(Action))] 90 | private static void OnErrorCallback(string errorMessage) 91 | { 92 | if (YandexGamesSdk.CallbackLogging) 93 | Debug.Log($"{nameof(VideoAd)}.{nameof(OnErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 94 | 95 | s_onErrorCallback?.Invoke(errorMessage); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Assets/EmptySceneForTestRunner.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | -------------------------------------------------------------------------------- /ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "defaultInstantiationMode": 0 8 | }, 9 | { 10 | "userAdded": false, 11 | "type": "UnityEditor.Animations.AnimatorController", 12 | "defaultInstantiationMode": 0 13 | }, 14 | { 15 | "userAdded": false, 16 | "type": "UnityEngine.AnimatorOverrideController", 17 | "defaultInstantiationMode": 0 18 | }, 19 | { 20 | "userAdded": false, 21 | "type": "UnityEditor.Audio.AudioMixerController", 22 | "defaultInstantiationMode": 0 23 | }, 24 | { 25 | "userAdded": false, 26 | "type": "UnityEngine.ComputeShader", 27 | "defaultInstantiationMode": 1 28 | }, 29 | { 30 | "userAdded": false, 31 | "type": "UnityEngine.Cubemap", 32 | "defaultInstantiationMode": 0 33 | }, 34 | { 35 | "userAdded": false, 36 | "type": "UnityEngine.GameObject", 37 | "defaultInstantiationMode": 0 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEditor.LightingDataAsset", 42 | "defaultInstantiationMode": 0 43 | }, 44 | { 45 | "userAdded": false, 46 | "type": "UnityEngine.LightingSettings", 47 | "defaultInstantiationMode": 0 48 | }, 49 | { 50 | "userAdded": false, 51 | "type": "UnityEngine.Material", 52 | "defaultInstantiationMode": 0 53 | }, 54 | { 55 | "userAdded": false, 56 | "type": "UnityEditor.MonoScript", 57 | "defaultInstantiationMode": 1 58 | }, 59 | { 60 | "userAdded": false, 61 | "type": "UnityEngine.PhysicMaterial", 62 | "defaultInstantiationMode": 0 63 | }, 64 | { 65 | "userAdded": false, 66 | "type": "UnityEngine.PhysicsMaterial2D", 67 | "defaultInstantiationMode": 0 68 | }, 69 | { 70 | "userAdded": false, 71 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 72 | "defaultInstantiationMode": 0 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 77 | "defaultInstantiationMode": 0 78 | }, 79 | { 80 | "userAdded": false, 81 | "type": "UnityEngine.Rendering.VolumeProfile", 82 | "defaultInstantiationMode": 0 83 | }, 84 | { 85 | "userAdded": false, 86 | "type": "UnityEditor.SceneAsset", 87 | "defaultInstantiationMode": 1 88 | }, 89 | { 90 | "userAdded": false, 91 | "type": "UnityEngine.Shader", 92 | "defaultInstantiationMode": 1 93 | }, 94 | { 95 | "userAdded": false, 96 | "type": "UnityEngine.ShaderVariantCollection", 97 | "defaultInstantiationMode": 1 98 | }, 99 | { 100 | "userAdded": false, 101 | "type": "UnityEngine.Texture", 102 | "defaultInstantiationMode": 0 103 | }, 104 | { 105 | "userAdded": false, 106 | "type": "UnityEngine.Texture2D", 107 | "defaultInstantiationMode": 0 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Timeline.TimelineAsset", 112 | "defaultInstantiationMode": 0 113 | } 114 | ], 115 | "defaultDependencyTypeInfo": { 116 | "userAdded": false, 117 | "type": "", 118 | "defaultInstantiationMode": 1 119 | }, 120 | "newSceneOverride": 0 121 | } -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PurchasedProductListPanel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace BananaParty.YandexGames.Samples 6 | { 7 | public class PurchasedProductListPanel : MonoBehaviour 8 | { 9 | [SerializeField] 10 | private PurchasedProductPanel _purchasedProductPanelTemplate; 11 | [SerializeField] 12 | private LayoutGroup _purchasedProductsLayoutGroup; 13 | 14 | private readonly List _purchasedProductPanels = new List(); 15 | 16 | private void Awake() 17 | { 18 | _purchasedProductPanelTemplate.gameObject.SetActive(false); 19 | } 20 | 21 | private void OnEnable() 22 | { 23 | #if UNITY_EDITOR 24 | string sampleResponseJson = "{\"purchasedProducts\":[{\"productID\":\"AnotherTestProduct\",\"purchaseTime\":0,\"purchaseToken\":\"c7a6a276-bf77-483f-b657-ae7bfce3fd8f\"},{\"productID\":\"AnotherTestProduct\",\"purchaseTime\":0,\"purchaseToken\":\"89d0621d-7789-4330-9b45-c9294084490f\"},{\"productID\":\"AnotherTestProduct\",\"purchaseTime\":0,\"purchaseToken\":\"a39f433d-cbda-4fc7-8748-e1266d335251\"},{\"productID\":\"AnotherTestProduct\",\"purchaseTime\":0,\"purchaseToken\":\"aee6053e-3923-47f4-b703-3d21438274a4\"},{\"productID\":\"TestProduct\",\"purchaseTime\":0,\"purchaseToken\":\"a7afeaac-a694-4d39-a2eb-583f1bc19b1b\"},{\"productID\":\"TestProduct\",\"purchaseTime\":0,\"purchaseToken\":\"4b512664-a2f9-4906-ad26-66db76a69b82\"}],\"signature\":\"oQEbcvtMHUCBBipMUb8/vF0anwEqjoR6TZh+//jqIv0=.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZEF0IjoxNjc1OTE2MjQyLCJyZXF1ZXN0UGF5bG9hZCI6IiIsImRhdGEiOlt7InByb2R1Y3QiOnsiaWQiOiJBbm90aGVyVGVzdFByb2R1Y3QiLCJ0aXRsZSI6ItCW0LXQu9C10YjQtdGH0LrQsCIsImRlc2NyaXB0aW9uIjoiIiwicHJpY2UiOnsiY29kZSI6IllBTiIsInZhbHVlIjoiNCJ9LCJpbWFnZVByZWZpeCI6Imh0dHBzOi8vYXZhdGFycy5tZHMueWFuZGV4Lm5ldC9nZXQtZ2FtZXMvMjk3NzAzOS8yYTAwMDAwMTg2MjdjMDUzNDBjMTIzNGY1Y2ViMTg1MTc4MTIvIn0sInRva2VuIjoiYzdhNmEyNzYtYmY3Ny00ODNmLWI2NTctYWU3YmZjZTNmZDhmIiwiY3JlYXRlZCI6MTY3NTkwNDQ0Nn0seyJwcm9kdWN0Ijp7ImlkIjoiQW5vdGhlclRlc3RQcm9kdWN0IiwidGl0bGUiOiLQltC10LvQtdGI0LXRh9C60LAiLCJkZXNjcmlwdGlvbiI6IiIsInByaWNlIjp7ImNvZGUiOiJZQU4iLCJ2YWx1ZSI6IjQifSwiaW1hZ2VQcmVmaXgiOiJodHRwczovL2F2YXRhcnMubWRzLnlhbmRleC5uZXQvZ2V0LWdhbWVzLzI5NzcwMzkvMmEwMDAwMDE4NjI3YzA1MzQwYzEyMzRmNWNlYjE4NTE3ODEyLyJ9LCJ0b2tlbiI6Ijg5ZDA2MjFkLTc3ODktNDMzMC05YjQ1LWM5Mjk0MDg0NDkwZiIsImNyZWF0ZWQiOjE2NzU5MDI0MzF9LHsicHJvZHVjdCI6eyJpZCI6IkFub3RoZXJUZXN0UHJvZHVjdCIsInRpdGxlIjoi0JbQtdC70LXRiNC10YfQutCwIiwiZGVzY3JpcHRpb24iOiIiLCJwcmljZSI6eyJjb2RlIjoiWUFOIiwidmFsdWUiOiI0In0sImltYWdlUHJlZml4IjoiaHR0cHM6Ly9hdmF0YXJzLm1kcy55YW5kZXgubmV0L2dldC1nYW1lcy8yOTc3MDM5LzJhMDAwMDAxODYyN2MwNTM0MGMxMjM0ZjVjZWIxODUxNzgxMi8ifSwidG9rZW4iOiJhMzlmNDMzZC1jYmRhLTRmYzctODc0OC1lMTI2NmQzMzUyNTEiLCJjcmVhdGVkIjoxNjc1ODkxMDU3fSx7InByb2R1Y3QiOnsiaWQiOiJBbm90aGVyVGVzdFByb2R1Y3QiLCJ0aXRsZSI6ItCW0LXQu9C10YjQtdGH0LrQsCIsImRlc2NyaXB0aW9uIjoiIiwicHJpY2UiOnsiY29kZSI6IllBTiIsInZhbHVlIjoiNCJ9LCJpbWFnZVByZWZpeCI6Imh0dHBzOi8vYXZhdGFycy5tZHMueWFuZGV4Lm5ldC9nZXQtZ2FtZXMvMjk3NzAzOS8yYTAwMDAwMTg2MjdjMDUzNDBjMTIzNGY1Y2ViMTg1MTc4MTIvIn0sInRva2VuIjoiYWVlNjA1M2UtMzkyMy00N2Y0LWI3MDMtM2QyMTQzODI3NGE0IiwiY3JlYXRlZCI6MTY3NTg5MTAyN30seyJwcm9kdWN0Ijp7ImlkIjoiVGVzdFByb2R1Y3QiLCJ0aXRsZSI6ItCi0LXRgdGC0LvQvtC7IiwiZGVzY3JpcHRpb24iOiIiLCJwcmljZSI6eyJjb2RlIjoiWUFOIiwidmFsdWUiOiIxIn0sImltYWdlUHJlZml4IjoiIn0sInRva2VuIjoiYTdhZmVhYWMtYTY5NC00ZDM5LWEyZWItNTgzZjFiYzE5YjFiIiwiY3JlYXRlZCI6MTY3NDc2MzkyMH0seyJwcm9kdWN0Ijp7ImlkIjoiVGVzdFByb2R1Y3QiLCJ0aXRsZSI6ItCi0LXRgdGC0LvQvtC7IiwiZGVzY3JpcHRpb24iOiIiLCJwcmljZSI6eyJjb2RlIjoiWUFOIiwidmFsdWUiOiIxIn0sImltYWdlUHJlZml4IjoiIn0sInRva2VuIjoiNGI1MTI2NjQtYTJmOS00OTA2LWFkMjYtNjZkYjc2YTY5YjgyIiwiY3JlYXRlZCI6MTY3NDc2Mzc5M31dfQ==\"}"; 25 | UpdatePurchasedProducts(JsonUtility.FromJson(sampleResponseJson).purchasedProducts); 26 | #else 27 | Billing.GetPurchasedProducts(purchasedProductsResponse => UpdatePurchasedProducts(purchasedProductsResponse.purchasedProducts)); 28 | #endif 29 | } 30 | 31 | private void UpdatePurchasedProducts(PurchasedProduct[] purchasedProducts) 32 | { 33 | foreach (PurchasedProductPanel purchasedProductPanel in _purchasedProductPanels) 34 | Destroy(purchasedProductPanel.gameObject); 35 | 36 | _purchasedProductPanels.Clear(); 37 | 38 | foreach (PurchasedProduct purchasedProduct in purchasedProducts) 39 | { 40 | PurchasedProductPanel purchasedProductPanel = Instantiate(_purchasedProductPanelTemplate, _purchasedProductsLayoutGroup.transform); 41 | _purchasedProductPanels.Add(purchasedProductPanel); 42 | 43 | purchasedProductPanel.gameObject.SetActive(true); 44 | purchasedProductPanel.PurchasedProduct = purchasedProduct; 45 | } 46 | } 47 | 48 | public void RemovePurchasedProductPanel(PurchasedProductPanel purchasedProductPanel) 49 | { 50 | _purchasedProductPanels.Remove(purchasedProductPanel); 51 | 52 | Destroy(purchasedProductPanel.gameObject); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/FullscreenWindow/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{{ PRODUCT_NAME }}} 10 | 58 | 59 | 60 | 61 | 62 | 70 | 71 | 73 | 74 | 75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | 83 | 84 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Samples/Playtesting/PlaytestingCanvas.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 2 | 3 | using System.Collections; 4 | using BananaParty.YandexGames; 5 | using BananaParty.YandexGames.Samples; 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | using UnityEngine.UI; 9 | 10 | namespace BananaParty.YandexGames.Samples 11 | { 12 | public class PlaytestingCanvas : MonoBehaviour 13 | { 14 | [SerializeField] 15 | private Text _authorizationStatusText; 16 | 17 | [SerializeField] 18 | private Text _personalProfileDataPermissionStatusText; 19 | 20 | [SerializeField] 21 | private Text _isRunningOnYandexStatusText; 22 | 23 | [SerializeField] 24 | private InputField _cloudSaveDataInputField; 25 | 26 | private void Awake() 27 | { 28 | YandexGamesSdk.CallbackLogging = true; 29 | PlayerAccount.AuthorizedInBackground += OnAuthorizedInBackground; 30 | } 31 | 32 | private IEnumerator Start() 33 | { 34 | if (!YandexGamesSdk.IsRunningOnYandex) 35 | yield break; 36 | 37 | CanvasGroup canvasGroup = GetComponent(); 38 | canvasGroup.interactable = false; 39 | // Always wait for it if invoking something immediately in the first scene. 40 | yield return YandexGamesSdk.Initialize(); 41 | 42 | YandexGamesSdk.GameReady(); 43 | 44 | canvasGroup.interactable = true; 45 | 46 | if (PlayerAccount.IsAuthorized == false) 47 | PlayerAccount.StartAuthorizationPolling(1500); 48 | 49 | _isRunningOnYandexStatusText.color = YandexGamesSdk.IsRunningOnYandex ? Color.green : Color.red; 50 | 51 | while (true) 52 | { 53 | _authorizationStatusText.color = PlayerAccount.IsAuthorized ? Color.green : Color.red; 54 | 55 | if (PlayerAccount.IsAuthorized) 56 | _personalProfileDataPermissionStatusText.color = PlayerAccount.HasPersonalProfileDataPermission ? Color.green : Color.red; 57 | else 58 | _personalProfileDataPermissionStatusText.color = Color.red; 59 | 60 | yield return new WaitForSecondsRealtime(0.25f); 61 | } 62 | } 63 | 64 | private void OnDestroy() 65 | { 66 | PlayerAccount.AuthorizedInBackground -= OnAuthorizedInBackground; 67 | } 68 | 69 | public void OnShowInterstitialButtonClick() 70 | { 71 | InterstitialAd.Show(); 72 | } 73 | 74 | public void OnShowVideoButtonClick() 75 | { 76 | VideoAd.Show(); 77 | } 78 | 79 | public void OnShowStickyAdButtonClick() 80 | { 81 | StickyAd.Show(); 82 | } 83 | 84 | public void OnHideStickyAdButtonClick() 85 | { 86 | StickyAd.Hide(); 87 | } 88 | 89 | public void OnAuthorizeButtonClick() 90 | { 91 | PlayerAccount.Authorize(); 92 | } 93 | 94 | public void OnRequestPersonalProfileDataPermissionButtonClick() 95 | { 96 | PlayerAccount.RequestPersonalProfileDataPermission(); 97 | } 98 | 99 | public void OnGetProfileDataButtonClick() 100 | { 101 | PlayerAccount.GetProfileData((result) => 102 | { 103 | string name = result.publicName; 104 | if (string.IsNullOrEmpty(name)) 105 | name = "Anonymous"; 106 | Debug.Log($"My id = {result.uniqueID}, name = {name}"); 107 | }); 108 | } 109 | 110 | public void OnSetLeaderboardScoreButtonClick() 111 | { 112 | Leaderboard.SetScore("PlaytestBoard", Random.Range(1, 100)); 113 | } 114 | 115 | public void OnGetLeaderboardEntriesButtonClick() 116 | { 117 | Leaderboard.GetEntries("PlaytestBoard", (result) => 118 | { 119 | Debug.Log($"My rank = {result.userRank}"); 120 | foreach (var entry in result.entries) 121 | { 122 | string name = entry.player.publicName; 123 | if (string.IsNullOrEmpty(name)) 124 | name = "Anonymous"; 125 | Debug.Log(name + " " + entry.score); 126 | } 127 | }); 128 | } 129 | 130 | public void OnGetLeaderboardPlayerEntryButtonClick() 131 | { 132 | Leaderboard.GetPlayerEntry("PlaytestBoard", (result) => 133 | { 134 | if (result == null) 135 | Debug.Log("Player is not present in the leaderboard."); 136 | else 137 | Debug.Log($"My rank = {result.rank}, score = {result.score}"); 138 | }); 139 | } 140 | 141 | public void OnSetCloudSaveDataButtonClick() 142 | { 143 | PlayerAccount.SetCloudSaveData(_cloudSaveDataInputField.text); 144 | } 145 | 146 | public void OnGetCloudSaveDataButtonClick() 147 | { 148 | PlayerAccount.GetCloudSaveData((data) => _cloudSaveDataInputField.text = data); 149 | } 150 | 151 | public void OnGetEnvironmentButtonClick() 152 | { 153 | Debug.Log($"Environment = {JsonUtility.ToJson(YandexGamesSdk.Environment)}"); 154 | } 155 | 156 | public void OnCallGameReadyButtonClick() 157 | { 158 | YandexGamesSdk.GameReady(); 159 | } 160 | 161 | public void OnSuggestShortcutButtonClick() 162 | { 163 | Shortcut.Suggest(); 164 | } 165 | 166 | public void OnRequestReviewButtonClick() 167 | { 168 | ReviewPopup.Open(); 169 | } 170 | 171 | public void OnCanSuggestShortcutButtonClick() 172 | { 173 | Shortcut.CanSuggest(result => { }); 174 | } 175 | 176 | public void OnCanRequestReviewButtonClick() 177 | { 178 | ReviewPopup.CanOpen((result, reason) => { }); 179 | } 180 | 181 | private void OnAuthorizedInBackground() 182 | { 183 | Debug.Log($"{nameof(OnAuthorizedInBackground)} {PlayerAccount.IsAuthorized}"); 184 | } 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Billing/Billing.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | public static class Billing 9 | { 10 | private static Action s_onPurchaseProductSuccessCallback; 11 | private static Action s_onPurchaseProductErrorCallback; 12 | 13 | private static Action s_onConsumeProductSuccessCallback; 14 | private static Action s_onConsumeProductErrorCallback; 15 | 16 | private static Action s_onGetProductCatalogSuccessCallback; 17 | private static Action s_onGetProductCatalogErrorCallback; 18 | 19 | private static Action s_onGetPurchasedProductsSuccessCallback; 20 | private static Action s_onGetPurchasedProductsErrorCallback; 21 | 22 | #region PurchaseProduct 23 | public static void PurchaseProduct(string productId, Action onSuccessCallback = null, Action onErrorCallback = null, string developerPayload = "") 24 | { 25 | s_onPurchaseProductSuccessCallback = onSuccessCallback; 26 | s_onPurchaseProductErrorCallback = onErrorCallback; 27 | 28 | BillingPurchaseProduct(productId, OnPurchaseProductSuccessCallback, OnPurchaseProductErrorCallback, developerPayload); 29 | } 30 | 31 | [DllImport("__Internal")] 32 | private static extern void BillingPurchaseProduct(string productId, Action successCallback, Action errorCallback, string developerPayload); 33 | 34 | [MonoPInvokeCallback(typeof(Action))] 35 | private static void OnPurchaseProductSuccessCallback(string purchaseProductResponseJson) 36 | { 37 | if (YandexGamesSdk.CallbackLogging) 38 | Debug.Log($"{nameof(Billing)}.{nameof(OnPurchaseProductSuccessCallback)} invoked, {nameof(purchaseProductResponseJson)} = {purchaseProductResponseJson}"); 39 | 40 | PurchaseProductResponse response = JsonUtility.FromJson(purchaseProductResponseJson); 41 | 42 | s_onPurchaseProductSuccessCallback?.Invoke(response); 43 | } 44 | 45 | [MonoPInvokeCallback(typeof(Action))] 46 | private static void OnPurchaseProductErrorCallback(string errorMessage) 47 | { 48 | if (YandexGamesSdk.CallbackLogging) 49 | Debug.Log($"{nameof(Billing)}.{nameof(OnPurchaseProductErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 50 | 51 | s_onPurchaseProductErrorCallback?.Invoke(errorMessage); 52 | } 53 | #endregion 54 | 55 | #region ConsumeProduct 56 | public static void ConsumeProduct(string purchasedProductToken, Action onSuccessCallback = null, Action onErrorCallback = null) 57 | { 58 | s_onConsumeProductSuccessCallback = onSuccessCallback; 59 | s_onConsumeProductErrorCallback = onErrorCallback; 60 | 61 | BillingConsumeProduct(purchasedProductToken, OnConsumeProductSuccessCallback, OnConsumeProductErrorCallback); 62 | } 63 | 64 | [DllImport("__Internal")] 65 | private static extern void BillingConsumeProduct(string purchasedProductToken, Action successCallback, Action errorCallback); 66 | 67 | [MonoPInvokeCallback(typeof(Action))] 68 | private static void OnConsumeProductSuccessCallback() 69 | { 70 | if (YandexGamesSdk.CallbackLogging) 71 | Debug.Log($"{nameof(Billing)}.{nameof(OnConsumeProductSuccessCallback)} invoked"); 72 | 73 | s_onConsumeProductSuccessCallback?.Invoke(); 74 | } 75 | 76 | [MonoPInvokeCallback(typeof(Action))] 77 | private static void OnConsumeProductErrorCallback(string errorMessage) 78 | { 79 | if (YandexGamesSdk.CallbackLogging) 80 | Debug.Log($"{nameof(Billing)}.{nameof(OnConsumeProductErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 81 | 82 | s_onConsumeProductErrorCallback?.Invoke(errorMessage); 83 | } 84 | #endregion 85 | 86 | #region GetProductCatalog 87 | public static void GetProductCatalog(Action onSuccessCallback = null, Action onErrorCallback = null) 88 | { 89 | s_onGetProductCatalogSuccessCallback = onSuccessCallback; 90 | s_onGetProductCatalogErrorCallback = onErrorCallback; 91 | 92 | BillingGetProductCatalog(OnGetProductCatalogSuccessCallback, OnGetProductCatalogErrorCallback); 93 | } 94 | 95 | [DllImport("__Internal")] 96 | private static extern void BillingGetProductCatalog(Action successCallback, Action errorCallback); 97 | 98 | [MonoPInvokeCallback(typeof(Action))] 99 | private static void OnGetProductCatalogSuccessCallback(string productCatalogResponseJson) 100 | { 101 | if (YandexGamesSdk.CallbackLogging) 102 | Debug.Log($"{nameof(Billing)}.{nameof(OnGetProductCatalogSuccessCallback)} invoked, {nameof(productCatalogResponseJson)} = {productCatalogResponseJson}"); 103 | 104 | GetProductCatalogResponse response = JsonUtility.FromJson(productCatalogResponseJson); 105 | 106 | s_onGetProductCatalogSuccessCallback?.Invoke(response); 107 | } 108 | 109 | [MonoPInvokeCallback(typeof(Action))] 110 | private static void OnGetProductCatalogErrorCallback(string errorMessage) 111 | { 112 | if (YandexGamesSdk.CallbackLogging) 113 | Debug.Log($"{nameof(Billing)}.{nameof(OnGetProductCatalogErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 114 | 115 | s_onGetProductCatalogErrorCallback?.Invoke(errorMessage); 116 | } 117 | #endregion 118 | 119 | #region GetPurchasedProducts 120 | public static void GetPurchasedProducts(Action onSuccessCallback = null, Action onErrorCallback = null) 121 | { 122 | s_onGetPurchasedProductsSuccessCallback = onSuccessCallback; 123 | s_onGetPurchasedProductsErrorCallback = onErrorCallback; 124 | 125 | BillingGetPurchasedProducts(OnGetPurchasedProductsSuccessCallback, OnGetPurchasedProductsErrorCallback); 126 | } 127 | 128 | [DllImport("__Internal")] 129 | private static extern void BillingGetPurchasedProducts(Action successCallback, Action errorCallback); 130 | 131 | [MonoPInvokeCallback(typeof(Action))] 132 | private static void OnGetPurchasedProductsSuccessCallback(string purchasedProductsResponseJson) 133 | { 134 | if (YandexGamesSdk.CallbackLogging) 135 | Debug.Log($"{nameof(Billing)}.{nameof(OnGetPurchasedProductsSuccessCallback)} invoked, {nameof(purchasedProductsResponseJson)} = {purchasedProductsResponseJson}"); 136 | 137 | GetPurchasedProductsResponse response = JsonUtility.FromJson(purchasedProductsResponseJson); 138 | 139 | s_onGetPurchasedProductsSuccessCallback?.Invoke(response); 140 | } 141 | 142 | [MonoPInvokeCallback(typeof(Action))] 143 | private static void OnGetPurchasedProductsErrorCallback(string errorMessage) 144 | { 145 | if (YandexGamesSdk.CallbackLogging) 146 | Debug.Log($"{nameof(Billing)}.{nameof(OnGetPurchasedProductsErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 147 | 148 | s_onGetPurchasedProductsErrorCallback?.Invoke(errorMessage); 149 | } 150 | #endregion 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Leaderboard/Leaderboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | public static class Leaderboard 9 | { 10 | // This is what we deserve for using Unity. 11 | private static Action s_onSetScoreSuccessCallback; 12 | private static Action s_onSetScoreErrorCallback; 13 | 14 | private static Action s_onGetEntriesSuccessCallback; 15 | private static Action s_onGetEntriesErrorCallback; 16 | 17 | private static Action s_onGetPlayerEntrySuccessCallback; 18 | private static Action s_onGetPlayerEntryErrorCallback; 19 | 20 | // We shouldn't normally use regions, but my eyes hurt from statics. 21 | 22 | #region SetScore 23 | /// 24 | /// To prevent overwriting a better result, use . 25 | /// If user did not give or rejected it, the result will be posted anonymously. 26 | /// Requires authorization. Use and . 27 | /// 28 | public static void SetScore(string leaderboardName, int score, Action onSuccessCallback = null, Action onErrorCallback = null, string extraData = "") 29 | { 30 | if (leaderboardName == null) 31 | throw new ArgumentNullException(nameof(leaderboardName)); 32 | 33 | if (extraData == null) 34 | extraData = string.Empty; 35 | 36 | s_onSetScoreSuccessCallback = onSuccessCallback; 37 | s_onSetScoreErrorCallback = onErrorCallback; 38 | 39 | LeaderboardSetScore(leaderboardName, score, OnSetScoreSuccessCallback, OnSetScoreErrorCallback, extraData); 40 | } 41 | 42 | [DllImport("__Internal")] 43 | private static extern void LeaderboardSetScore(string leaderboardName, int score, Action successCallback, Action errorCallback, string extraData); 44 | 45 | [MonoPInvokeCallback(typeof(Action))] 46 | private static void OnSetScoreSuccessCallback() 47 | { 48 | if (YandexGamesSdk.CallbackLogging) 49 | Debug.Log($"{nameof(Leaderboard)}.{nameof(OnSetScoreSuccessCallback)} invoked"); 50 | 51 | s_onSetScoreSuccessCallback?.Invoke(); 52 | } 53 | 54 | [MonoPInvokeCallback(typeof(Action))] 55 | private static void OnSetScoreErrorCallback(string errorMessage) 56 | { 57 | if (YandexGamesSdk.CallbackLogging) 58 | Debug.Log($"{nameof(Leaderboard)}.{nameof(OnSetScoreErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 59 | 60 | s_onSetScoreErrorCallback?.Invoke(errorMessage); 61 | } 62 | #endregion 63 | 64 | #region GetEntries 65 | /// 66 | /// Returns a fully parsed result object in onSuccessCallback. 67 | /// 68 | /// 69 | /// Requires authorization. Use and . 70 | /// 71 | public static void GetEntries(string leaderboardName, Action onSuccessCallback, Action onErrorCallback = null, int topPlayersCount = 5, int competingPlayersCount = 5, bool includeSelf = true, ProfilePictureSize pictureSize = ProfilePictureSize.medium) 72 | { 73 | if (leaderboardName == null) 74 | throw new ArgumentNullException(nameof(leaderboardName)); 75 | 76 | s_onGetEntriesSuccessCallback = onSuccessCallback; 77 | s_onGetEntriesErrorCallback = onErrorCallback; 78 | 79 | LeaderboardGetEntries(leaderboardName, OnGetEntriesSuccessCallback, OnGetEntriesErrorCallback, topPlayersCount, competingPlayersCount, includeSelf, pictureSize.ToString()); 80 | } 81 | 82 | [DllImport("__Internal")] 83 | private static extern void LeaderboardGetEntries(string leaderboardName, Action successCallback, Action errorCallback, int topPlayersCount, int competingPlayersCount, bool includeSelf, string pictureSize); 84 | 85 | [MonoPInvokeCallback(typeof(Action))] 86 | private static void OnGetEntriesSuccessCallback(string entriesResponseJson) 87 | { 88 | if (YandexGamesSdk.CallbackLogging) 89 | Debug.Log($"{nameof(Leaderboard)}.{nameof(OnGetEntriesSuccessCallback)} invoked, {nameof(entriesResponseJson)} = {entriesResponseJson}"); 90 | 91 | LeaderboardGetEntriesResponse entriesResponse = JsonUtility.FromJson(entriesResponseJson); 92 | 93 | s_onGetEntriesSuccessCallback?.Invoke(entriesResponse); 94 | } 95 | 96 | [MonoPInvokeCallback(typeof(Action))] 97 | private static void OnGetEntriesErrorCallback(string errorMessage) 98 | { 99 | if (YandexGamesSdk.CallbackLogging) 100 | Debug.Log($"{nameof(Leaderboard)}.{nameof(OnGetEntriesErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 101 | 102 | s_onGetEntriesErrorCallback?.Invoke(errorMessage); 103 | } 104 | #endregion 105 | 106 | #region GetPlayerEntry 107 | /// 108 | /// Returns a fully parsed result object in onSuccessCallback, or returns null if player is not present. 109 | /// 110 | /// 111 | /// Requires authorization. Use and . 112 | /// 113 | public static void GetPlayerEntry(string leaderboardName, Action onSuccessCallback, Action onErrorCallback = null, ProfilePictureSize pictureSize = ProfilePictureSize.medium) 114 | { 115 | if (leaderboardName == null) 116 | throw new ArgumentNullException(nameof(leaderboardName)); 117 | 118 | s_onGetPlayerEntrySuccessCallback = onSuccessCallback; 119 | s_onGetPlayerEntryErrorCallback = onErrorCallback; 120 | 121 | LeaderboardGetPlayerEntry(leaderboardName, OnGetPlayerEntrySuccessCallback, OnGetPlayerEntryErrorCallback, pictureSize.ToString()); 122 | } 123 | 124 | [DllImport("__Internal")] 125 | private static extern void LeaderboardGetPlayerEntry(string leaderboardName, Action successCallback, Action errorCallback, string pictureSize); 126 | 127 | [MonoPInvokeCallback(typeof(Action))] 128 | private static void OnGetPlayerEntrySuccessCallback(string entryResponseJson) 129 | { 130 | if (YandexGamesSdk.CallbackLogging) 131 | Debug.Log($"{nameof(Leaderboard)}.{nameof(OnGetPlayerEntrySuccessCallback)} invoked, {nameof(entryResponseJson)} = {entryResponseJson}"); 132 | 133 | LeaderboardEntryResponse entryResponse = entryResponseJson == "null" ? null : JsonUtility.FromJson(entryResponseJson); 134 | 135 | s_onGetPlayerEntrySuccessCallback?.Invoke(entryResponse); 136 | } 137 | 138 | [MonoPInvokeCallback(typeof(Action))] 139 | private static void OnGetPlayerEntryErrorCallback(string errorMessage) 140 | { 141 | if (YandexGamesSdk.CallbackLogging) 142 | Debug.Log($"{nameof(Leaderboard)}.{nameof(OnGetPlayerEntryErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 143 | 144 | s_onGetPlayerEntryErrorCallback?.Invoke(errorMessage); 145 | } 146 | #endregion 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | skinWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | customRenderPipeline: {fileID: 0} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Low 47 | pixelLightCount: 0 48 | shadows: 0 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 0 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 0 66 | lodBias: 0.4 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 16 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 0} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: Medium 83 | pixelLightCount: 1 84 | shadows: 1 85 | shadowResolution: 0 86 | shadowProjection: 1 87 | shadowCascades: 1 88 | shadowDistance: 20 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 0 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 0 97 | softParticles: 0 98 | softVegetation: 0 99 | realtimeReflectionProbes: 0 100 | billboardsFaceCameraPosition: 0 101 | vSyncCount: 1 102 | lodBias: 0.7 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 64 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 0} 116 | excludedTargetPlatforms: [] 117 | - serializedVersion: 2 118 | name: High 119 | pixelLightCount: 2 120 | shadows: 2 121 | shadowResolution: 1 122 | shadowProjection: 1 123 | shadowCascades: 2 124 | shadowDistance: 40 125 | shadowNearPlaneOffset: 3 126 | shadowCascade2Split: 0.33333334 127 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 128 | shadowmaskMode: 1 129 | skinWeights: 2 130 | textureQuality: 0 131 | anisotropicTextures: 1 132 | antiAliasing: 0 133 | softParticles: 0 134 | softVegetation: 1 135 | realtimeReflectionProbes: 1 136 | billboardsFaceCameraPosition: 1 137 | vSyncCount: 1 138 | lodBias: 1 139 | maximumLODLevel: 0 140 | streamingMipmapsActive: 0 141 | streamingMipmapsAddAllCameras: 1 142 | streamingMipmapsMemoryBudget: 512 143 | streamingMipmapsRenderersPerFrame: 512 144 | streamingMipmapsMaxLevelReduction: 2 145 | streamingMipmapsMaxFileIORequests: 1024 146 | particleRaycastBudget: 256 147 | asyncUploadTimeSlice: 2 148 | asyncUploadBufferSize: 16 149 | asyncUploadPersistentBuffer: 1 150 | resolutionScalingFixedDPIFactor: 1 151 | customRenderPipeline: {fileID: 0} 152 | excludedTargetPlatforms: [] 153 | - serializedVersion: 2 154 | name: Very High 155 | pixelLightCount: 3 156 | shadows: 2 157 | shadowResolution: 2 158 | shadowProjection: 1 159 | shadowCascades: 2 160 | shadowDistance: 70 161 | shadowNearPlaneOffset: 3 162 | shadowCascade2Split: 0.33333334 163 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 164 | shadowmaskMode: 1 165 | skinWeights: 4 166 | textureQuality: 0 167 | anisotropicTextures: 2 168 | antiAliasing: 2 169 | softParticles: 1 170 | softVegetation: 1 171 | realtimeReflectionProbes: 1 172 | billboardsFaceCameraPosition: 1 173 | vSyncCount: 1 174 | lodBias: 1.5 175 | maximumLODLevel: 0 176 | streamingMipmapsActive: 0 177 | streamingMipmapsAddAllCameras: 1 178 | streamingMipmapsMemoryBudget: 512 179 | streamingMipmapsRenderersPerFrame: 512 180 | streamingMipmapsMaxLevelReduction: 2 181 | streamingMipmapsMaxFileIORequests: 1024 182 | particleRaycastBudget: 1024 183 | asyncUploadTimeSlice: 2 184 | asyncUploadBufferSize: 16 185 | asyncUploadPersistentBuffer: 1 186 | resolutionScalingFixedDPIFactor: 1 187 | customRenderPipeline: {fileID: 0} 188 | excludedTargetPlatforms: [] 189 | - serializedVersion: 2 190 | name: Ultra 191 | pixelLightCount: 4 192 | shadows: 2 193 | shadowResolution: 2 194 | shadowProjection: 1 195 | shadowCascades: 4 196 | shadowDistance: 150 197 | shadowNearPlaneOffset: 3 198 | shadowCascade2Split: 0.33333334 199 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 200 | shadowmaskMode: 1 201 | skinWeights: 255 202 | textureQuality: 0 203 | anisotropicTextures: 2 204 | antiAliasing: 2 205 | softParticles: 1 206 | softVegetation: 1 207 | realtimeReflectionProbes: 1 208 | billboardsFaceCameraPosition: 1 209 | vSyncCount: 1 210 | lodBias: 2 211 | maximumLODLevel: 0 212 | streamingMipmapsActive: 0 213 | streamingMipmapsAddAllCameras: 1 214 | streamingMipmapsMemoryBudget: 512 215 | streamingMipmapsRenderersPerFrame: 512 216 | streamingMipmapsMaxLevelReduction: 2 217 | streamingMipmapsMaxFileIORequests: 1024 218 | particleRaycastBudget: 4096 219 | asyncUploadTimeSlice: 2 220 | asyncUploadBufferSize: 16 221 | asyncUploadPersistentBuffer: 1 222 | resolutionScalingFixedDPIFactor: 1 223 | customRenderPipeline: {fileID: 0} 224 | excludedTargetPlatforms: [] 225 | m_PerPlatformDefaultQuality: 226 | Android: 2 227 | Lumin: 5 228 | Nintendo Switch: 5 229 | PS4: 5 230 | Stadia: 5 231 | Standalone: 5 232 | WebGL: 3 233 | Windows Store Apps: 5 234 | XboxOne: 5 235 | iPhone: 2 236 | tvOS: 2 237 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # --- Modified settings 2 | 3 | # Annoying line endings 4 | [*] 5 | end_of_line = lf 6 | 7 | # --- Original Microsoft settings 8 | # Source: https://github.com/dotnet/runtime/blob/main/.editorconfig 9 | # editorconfig.org 10 | 11 | # top-most EditorConfig file 12 | root = true 13 | 14 | # Default settings: 15 | # A newline ending every file 16 | # Use 4 spaces as indentation 17 | [*] 18 | insert_final_newline = true 19 | indent_style = space 20 | indent_size = 4 21 | trim_trailing_whitespace = true 22 | 23 | [project.json] 24 | indent_size = 2 25 | 26 | # Generated code 27 | [*{_AssemblyInfo.cs,.notsupported.cs}] 28 | generated_code = true 29 | 30 | # C# files 31 | [*.cs] 32 | # New line preferences 33 | csharp_new_line_before_open_brace = all 34 | csharp_new_line_before_else = true 35 | csharp_new_line_before_catch = true 36 | csharp_new_line_before_finally = true 37 | csharp_new_line_before_members_in_object_initializers = true 38 | csharp_new_line_before_members_in_anonymous_types = true 39 | csharp_new_line_between_query_expression_clauses = true 40 | 41 | # Indentation preferences 42 | csharp_indent_block_contents = true 43 | csharp_indent_braces = false 44 | csharp_indent_case_contents = true 45 | csharp_indent_case_contents_when_block = true 46 | csharp_indent_switch_labels = true 47 | csharp_indent_labels = one_less_than_current 48 | 49 | # Modifier preferences 50 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion 51 | 52 | # avoid this. unless absolutely necessary 53 | dotnet_style_qualification_for_field = false:suggestion 54 | dotnet_style_qualification_for_property = false:suggestion 55 | dotnet_style_qualification_for_method = false:suggestion 56 | dotnet_style_qualification_for_event = false:suggestion 57 | 58 | # Types: use keywords instead of BCL types, and permit var only when the type is clear 59 | csharp_style_var_for_built_in_types = false:suggestion 60 | csharp_style_var_when_type_is_apparent = false:none 61 | csharp_style_var_elsewhere = false:suggestion 62 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 63 | dotnet_style_predefined_type_for_member_access = true:suggestion 64 | 65 | # name all constant fields using PascalCase 66 | dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion 67 | dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields 68 | dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style 69 | dotnet_naming_symbols.constant_fields.applicable_kinds = field 70 | dotnet_naming_symbols.constant_fields.required_modifiers = const 71 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case 72 | 73 | # static fields should have s_ prefix 74 | dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion 75 | dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields 76 | dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style 77 | dotnet_naming_symbols.static_fields.applicable_kinds = field 78 | dotnet_naming_symbols.static_fields.required_modifiers = static 79 | dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected 80 | dotnet_naming_style.static_prefix_style.required_prefix = s_ 81 | dotnet_naming_style.static_prefix_style.capitalization = camel_case 82 | 83 | # internal and private fields should be _camelCase 84 | dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion 85 | dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields 86 | dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style 87 | dotnet_naming_symbols.private_internal_fields.applicable_kinds = field 88 | dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal 89 | dotnet_naming_style.camel_case_underscore_style.required_prefix = _ 90 | dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case 91 | 92 | # Code style defaults 93 | csharp_using_directive_placement = outside_namespace:suggestion 94 | dotnet_sort_system_directives_first = true 95 | csharp_prefer_braces = true:silent 96 | csharp_preserve_single_line_blocks = true:none 97 | csharp_preserve_single_line_statements = false:none 98 | csharp_prefer_static_local_function = true:suggestion 99 | csharp_prefer_simple_using_statement = false:none 100 | csharp_style_prefer_switch_expression = true:suggestion 101 | dotnet_style_readonly_field = true:suggestion 102 | 103 | # Expression-level preferences 104 | dotnet_style_object_initializer = true:suggestion 105 | dotnet_style_collection_initializer = true:suggestion 106 | dotnet_style_explicit_tuple_names = true:suggestion 107 | dotnet_style_coalesce_expression = true:suggestion 108 | dotnet_style_null_propagation = true:suggestion 109 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion 110 | dotnet_style_prefer_inferred_tuple_names = true:suggestion 111 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion 112 | dotnet_style_prefer_auto_properties = true:suggestion 113 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent 114 | dotnet_style_prefer_conditional_expression_over_return = true:silent 115 | csharp_prefer_simple_default_expression = true:suggestion 116 | 117 | # Expression-bodied members 118 | csharp_style_expression_bodied_methods = true:silent 119 | csharp_style_expression_bodied_constructors = true:silent 120 | csharp_style_expression_bodied_operators = true:silent 121 | csharp_style_expression_bodied_properties = true:silent 122 | csharp_style_expression_bodied_indexers = true:silent 123 | csharp_style_expression_bodied_accessors = true:silent 124 | csharp_style_expression_bodied_lambdas = true:silent 125 | csharp_style_expression_bodied_local_functions = true:silent 126 | 127 | # Pattern matching 128 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion 129 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 130 | csharp_style_inlined_variable_declaration = true:suggestion 131 | 132 | # Null checking preferences 133 | csharp_style_throw_expression = true:suggestion 134 | csharp_style_conditional_delegate_call = true:suggestion 135 | 136 | # Other features 137 | csharp_style_prefer_index_operator = false:none 138 | csharp_style_prefer_range_operator = false:none 139 | csharp_style_pattern_local_over_anonymous_function = false:none 140 | 141 | # Space preferences 142 | csharp_space_after_cast = false 143 | csharp_space_after_colon_in_inheritance_clause = true 144 | csharp_space_after_comma = true 145 | csharp_space_after_dot = false 146 | csharp_space_after_keywords_in_control_flow_statements = true 147 | csharp_space_after_semicolon_in_for_statement = true 148 | csharp_space_around_binary_operators = before_and_after 149 | csharp_space_around_declaration_statements = do_not_ignore 150 | csharp_space_before_colon_in_inheritance_clause = true 151 | csharp_space_before_comma = false 152 | csharp_space_before_dot = false 153 | csharp_space_before_open_square_brackets = false 154 | csharp_space_before_semicolon_in_for_statement = false 155 | csharp_space_between_empty_square_brackets = false 156 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 157 | csharp_space_between_method_call_name_and_opening_parenthesis = false 158 | csharp_space_between_method_call_parameter_list_parentheses = false 159 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 160 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 161 | csharp_space_between_method_declaration_parameter_list_parentheses = false 162 | csharp_space_between_parentheses = false 163 | csharp_space_between_square_brackets = false 164 | 165 | # C++ Files 166 | [*.{cpp,h,in}] 167 | curly_bracket_next_line = true 168 | indent_brace_style = Allman 169 | 170 | # Xml project files 171 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] 172 | indent_size = 2 173 | 174 | [*.{csproj,vbproj,proj,nativeproj,locproj}] 175 | charset = utf-8 176 | 177 | # Xml build files 178 | [*.builds] 179 | indent_size = 2 180 | 181 | # Xml files 182 | [*.{xml,stylecop,resx,ruleset}] 183 | indent_size = 2 184 | 185 | # Xml config files 186 | [*.{props,targets,config,nuspec}] 187 | indent_size = 2 188 | 189 | # YAML config files 190 | [*.{yml,yaml}] 191 | indent_size = 2 192 | 193 | # Shell scripts 194 | [*.sh] 195 | end_of_line = lf 196 | [*.{cmd,bat}] 197 | end_of_line = crlf 198 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.bananaparty.yandexgames": { 4 | "version": "file:com.bananaparty.yandexgames", 5 | "depth": 0, 6 | "source": "embedded", 7 | "dependencies": {} 8 | }, 9 | "com.unity.ai.navigation": { 10 | "version": "1.1.5", 11 | "depth": 0, 12 | "source": "registry", 13 | "dependencies": { 14 | "com.unity.modules.ai": "1.0.0" 15 | }, 16 | "url": "https://packages.unity.com" 17 | }, 18 | "com.unity.ext.nunit": { 19 | "version": "1.0.6", 20 | "depth": 1, 21 | "source": "registry", 22 | "dependencies": {}, 23 | "url": "https://packages.unity.com" 24 | }, 25 | "com.unity.ide.visualstudio": { 26 | "version": "2.0.22", 27 | "depth": 0, 28 | "source": "registry", 29 | "dependencies": { 30 | "com.unity.test-framework": "1.1.9" 31 | }, 32 | "url": "https://packages.unity.com" 33 | }, 34 | "com.unity.ide.vscode": { 35 | "version": "1.2.5", 36 | "depth": 0, 37 | "source": "registry", 38 | "dependencies": {}, 39 | "url": "https://packages.unity.com" 40 | }, 41 | "com.unity.test-framework": { 42 | "version": "1.1.33", 43 | "depth": 0, 44 | "source": "registry", 45 | "dependencies": { 46 | "com.unity.ext.nunit": "1.0.6", 47 | "com.unity.modules.imgui": "1.0.0", 48 | "com.unity.modules.jsonserialize": "1.0.0" 49 | }, 50 | "url": "https://packages.unity.com" 51 | }, 52 | "com.unity.ugui": { 53 | "version": "1.0.0", 54 | "depth": 0, 55 | "source": "builtin", 56 | "dependencies": { 57 | "com.unity.modules.ui": "1.0.0", 58 | "com.unity.modules.imgui": "1.0.0" 59 | } 60 | }, 61 | "com.unity.modules.ai": { 62 | "version": "1.0.0", 63 | "depth": 0, 64 | "source": "builtin", 65 | "dependencies": {} 66 | }, 67 | "com.unity.modules.androidjni": { 68 | "version": "1.0.0", 69 | "depth": 0, 70 | "source": "builtin", 71 | "dependencies": {} 72 | }, 73 | "com.unity.modules.animation": { 74 | "version": "1.0.0", 75 | "depth": 0, 76 | "source": "builtin", 77 | "dependencies": {} 78 | }, 79 | "com.unity.modules.assetbundle": { 80 | "version": "1.0.0", 81 | "depth": 0, 82 | "source": "builtin", 83 | "dependencies": {} 84 | }, 85 | "com.unity.modules.audio": { 86 | "version": "1.0.0", 87 | "depth": 0, 88 | "source": "builtin", 89 | "dependencies": {} 90 | }, 91 | "com.unity.modules.cloth": { 92 | "version": "1.0.0", 93 | "depth": 0, 94 | "source": "builtin", 95 | "dependencies": { 96 | "com.unity.modules.physics": "1.0.0" 97 | } 98 | }, 99 | "com.unity.modules.director": { 100 | "version": "1.0.0", 101 | "depth": 0, 102 | "source": "builtin", 103 | "dependencies": { 104 | "com.unity.modules.audio": "1.0.0", 105 | "com.unity.modules.animation": "1.0.0" 106 | } 107 | }, 108 | "com.unity.modules.imageconversion": { 109 | "version": "1.0.0", 110 | "depth": 0, 111 | "source": "builtin", 112 | "dependencies": {} 113 | }, 114 | "com.unity.modules.imgui": { 115 | "version": "1.0.0", 116 | "depth": 0, 117 | "source": "builtin", 118 | "dependencies": {} 119 | }, 120 | "com.unity.modules.jsonserialize": { 121 | "version": "1.0.0", 122 | "depth": 0, 123 | "source": "builtin", 124 | "dependencies": {} 125 | }, 126 | "com.unity.modules.particlesystem": { 127 | "version": "1.0.0", 128 | "depth": 0, 129 | "source": "builtin", 130 | "dependencies": {} 131 | }, 132 | "com.unity.modules.physics": { 133 | "version": "1.0.0", 134 | "depth": 0, 135 | "source": "builtin", 136 | "dependencies": {} 137 | }, 138 | "com.unity.modules.physics2d": { 139 | "version": "1.0.0", 140 | "depth": 0, 141 | "source": "builtin", 142 | "dependencies": {} 143 | }, 144 | "com.unity.modules.screencapture": { 145 | "version": "1.0.0", 146 | "depth": 0, 147 | "source": "builtin", 148 | "dependencies": { 149 | "com.unity.modules.imageconversion": "1.0.0" 150 | } 151 | }, 152 | "com.unity.modules.subsystems": { 153 | "version": "1.0.0", 154 | "depth": 1, 155 | "source": "builtin", 156 | "dependencies": { 157 | "com.unity.modules.jsonserialize": "1.0.0" 158 | } 159 | }, 160 | "com.unity.modules.terrain": { 161 | "version": "1.0.0", 162 | "depth": 0, 163 | "source": "builtin", 164 | "dependencies": {} 165 | }, 166 | "com.unity.modules.terrainphysics": { 167 | "version": "1.0.0", 168 | "depth": 0, 169 | "source": "builtin", 170 | "dependencies": { 171 | "com.unity.modules.physics": "1.0.0", 172 | "com.unity.modules.terrain": "1.0.0" 173 | } 174 | }, 175 | "com.unity.modules.tilemap": { 176 | "version": "1.0.0", 177 | "depth": 0, 178 | "source": "builtin", 179 | "dependencies": { 180 | "com.unity.modules.physics2d": "1.0.0" 181 | } 182 | }, 183 | "com.unity.modules.ui": { 184 | "version": "1.0.0", 185 | "depth": 0, 186 | "source": "builtin", 187 | "dependencies": {} 188 | }, 189 | "com.unity.modules.uielements": { 190 | "version": "1.0.0", 191 | "depth": 0, 192 | "source": "builtin", 193 | "dependencies": { 194 | "com.unity.modules.ui": "1.0.0", 195 | "com.unity.modules.imgui": "1.0.0", 196 | "com.unity.modules.jsonserialize": "1.0.0" 197 | } 198 | }, 199 | "com.unity.modules.umbra": { 200 | "version": "1.0.0", 201 | "depth": 0, 202 | "source": "builtin", 203 | "dependencies": {} 204 | }, 205 | "com.unity.modules.unityanalytics": { 206 | "version": "1.0.0", 207 | "depth": 0, 208 | "source": "builtin", 209 | "dependencies": { 210 | "com.unity.modules.unitywebrequest": "1.0.0", 211 | "com.unity.modules.jsonserialize": "1.0.0" 212 | } 213 | }, 214 | "com.unity.modules.unitywebrequest": { 215 | "version": "1.0.0", 216 | "depth": 0, 217 | "source": "builtin", 218 | "dependencies": {} 219 | }, 220 | "com.unity.modules.unitywebrequestassetbundle": { 221 | "version": "1.0.0", 222 | "depth": 0, 223 | "source": "builtin", 224 | "dependencies": { 225 | "com.unity.modules.assetbundle": "1.0.0", 226 | "com.unity.modules.unitywebrequest": "1.0.0" 227 | } 228 | }, 229 | "com.unity.modules.unitywebrequestaudio": { 230 | "version": "1.0.0", 231 | "depth": 0, 232 | "source": "builtin", 233 | "dependencies": { 234 | "com.unity.modules.unitywebrequest": "1.0.0", 235 | "com.unity.modules.audio": "1.0.0" 236 | } 237 | }, 238 | "com.unity.modules.unitywebrequesttexture": { 239 | "version": "1.0.0", 240 | "depth": 0, 241 | "source": "builtin", 242 | "dependencies": { 243 | "com.unity.modules.unitywebrequest": "1.0.0", 244 | "com.unity.modules.imageconversion": "1.0.0" 245 | } 246 | }, 247 | "com.unity.modules.unitywebrequestwww": { 248 | "version": "1.0.0", 249 | "depth": 0, 250 | "source": "builtin", 251 | "dependencies": { 252 | "com.unity.modules.unitywebrequest": "1.0.0", 253 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 254 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 255 | "com.unity.modules.audio": "1.0.0", 256 | "com.unity.modules.assetbundle": "1.0.0", 257 | "com.unity.modules.imageconversion": "1.0.0" 258 | } 259 | }, 260 | "com.unity.modules.vehicles": { 261 | "version": "1.0.0", 262 | "depth": 0, 263 | "source": "builtin", 264 | "dependencies": { 265 | "com.unity.modules.physics": "1.0.0" 266 | } 267 | }, 268 | "com.unity.modules.video": { 269 | "version": "1.0.0", 270 | "depth": 0, 271 | "source": "builtin", 272 | "dependencies": { 273 | "com.unity.modules.audio": "1.0.0", 274 | "com.unity.modules.ui": "1.0.0", 275 | "com.unity.modules.unitywebrequest": "1.0.0" 276 | } 277 | }, 278 | "com.unity.modules.vr": { 279 | "version": "1.0.0", 280 | "depth": 0, 281 | "source": "builtin", 282 | "dependencies": { 283 | "com.unity.modules.jsonserialize": "1.0.0", 284 | "com.unity.modules.physics": "1.0.0", 285 | "com.unity.modules.xr": "1.0.0" 286 | } 287 | }, 288 | "com.unity.modules.wind": { 289 | "version": "1.0.0", 290 | "depth": 0, 291 | "source": "builtin", 292 | "dependencies": {} 293 | }, 294 | "com.unity.modules.xr": { 295 | "version": "1.0.0", 296 | "depth": 0, 297 | "source": "builtin", 298 | "dependencies": { 299 | "com.unity.modules.physics": "1.0.0", 300 | "com.unity.modules.jsonserialize": "1.0.0", 301 | "com.unity.modules.subsystems": "1.0.0" 302 | } 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [18.0.0] - 2025-07-05 8 | ### Changed 9 | - Changed the package name to a personal brand, since the origin company was dissolved. 10 | - Changed the license to a personal brand as well. The license is still MIT. 11 | 12 | ## [17.0.0] - 2025-07-04 13 | ### Added 14 | - WebAssembly 2023 support. 15 | 16 | ### Changed 17 | - Minimal Unity version is now 2022.3. 18 | 19 | ## [16.1.1] - 2024-07-31 20 | ### Changed 21 | - Using new sdk loader link `/sdk.js` instead of `https://yandex.ru/games/sdk/v2` for new moderation guidelines. 22 | 23 | ## [16.1.0] - 2024-07-13 24 | ### Fixed 25 | - Fixed saving JSON fields via `PlayerPrefs` cloud save utility. 26 | - `YandexGamesSdk.IsRunningOnYandex` now works when used within european Yandex Games reskin [Playhop](https://playhop.com/). 27 | - Added error callback when trying to save invalid JSON via `PlayerAccount.SetCloudSaveData()`. 28 | 29 | ### Added 30 | - Added `CatalogProduct.priceCurrencyImage` for passing an IAP moderation. 31 | 32 | ## [16.0.0] - 2023-08-11 33 | ### Changed 34 | - Moved PlayerPrefs utility to its own `BananaParty.YandexGames.Utility` namespace to prevent unintentional naming clashes. 35 | 36 | ## [15.1.1] - 2023-11-01 37 | ### Fixed 38 | - Silent failure when invoking `YandexGamesSdk.Environment` property while SDK is not initialized. 39 | 40 | ## [15.1.0] - 2023-10-17 41 | ### Added 42 | - `YandexGamesSdk.IsRunningOnYandex` property to check whether you're using Build and Run or running the game on Yandex. 43 | 44 | ## [15.0.0] - 2023-10-07 45 | ### Added 46 | - `ReviewPopup.Open` and `CanOpen` methods for requesting user to rate your game. 47 | 48 | ### Changed 49 | - `Shortcut.Suggest` now has a single callback with boolean indicating success. 50 | 51 | ## [14.0.0] - 2023-10-06 52 | ### Changed 53 | - `Shortcuts` class renamed to singular `Shortcut`. 54 | - `yandexGames.sdk.features.LoadingAPI.ready` method is no longer called automatically to prevent game moderation rejection. 55 | - `GameReady` class contents are moved to `YandexGamesSdk` class. 56 | 57 | ### Added 58 | - Added `Shortcut` and `GameReady` testing buttons to playtesting canvas. 59 | 60 | ## [13.3.0] - 2023-09-27 61 | ### Added 62 | - Added GameReady API that allows to manually call `ysdk.features.LoadingAPI.ready()` when the game has finished loading. 63 | - Added desktop shortcut placement API. 64 | 65 | ## [13.2.0] - 2023-07-31 66 | ### Added 67 | - `BananaParty.YandexGames.PlayerPrefs` utility script for migrating from PlayerPrefs-based saves to `PlayerAccount.SetCloudSaveData`. 68 | 69 | ## [13.1.0] - 2023-07-24 70 | ### Added 71 | - `PlayerAccount.StartAuthorizationPolling()` method and `AuthorizedInBackground` event to detect background user login after initialization. 72 | 73 | ## [13.0.0] - 2023-04-25 74 | ### Changed 75 | - Billing methods no longer require authorization. 76 | 77 | ### Removed 78 | - Removed Device.Type since it does not detect an iPad as a tablet. 79 | Proper device type detection is implemented in [WebUtility](https://github.com/forcepusher/com.bananaparty.webutility) package. 80 | 81 | ## [12.0.1] - 2023-04-06 82 | ### Fixed 83 | - Fixed an exploit where disabling internet connection causes rewarded video ads to immediately grant a reward without showing an ad. 84 | 85 | ## [12.0.0] - 2023-04-06 86 | ### Added 87 | - Profile pictures now will be fetched with `PlayerAccount.GetProfileData()`, `Leaderboard.GetPlayerEntry` and `GetEntries` methods. 88 | Find profile picture URLs in `PlayerAccountProfileDataResponse.profilePicture` and download it via `RemoteImage` class. 89 | 90 | ### Changed 91 | - `PlayerAccount.SetPlayerData` and `GetPlayerData` are renamed to `PlayerAccount.SetCloudSaveData` and `GetCloudSaveData`. 92 | - Removed redundant authorization requirement for these methods: `PlayerAccount.HasPersonalProfileDataPermission()`, `RequestPersonalProfileDataPermission()`, `GetProfileData()`, `GetPlayerData()`, `SetPlayerData()`. 93 | 94 | ## [11.2.1] - 2023-03-17 95 | ### Fixed 96 | - The SDK now calls `ysdk.features.LoadingAPI.ready` method when initialization is complete. 97 | 98 | ## [11.2.0] - 2023-02-09 99 | ### Added 100 | - `Billing` class for In-App purchases. 101 | 102 | ## [11.1.0] - 2023-01-20 103 | ### Added 104 | - `StickyAd.Show()` and `StickyAd.Hide` methods for controlling StickyAd visibility at run time. 105 | 106 | ## [11.0.0] - 2022-08-29 107 | ### Removed 108 | - WebApplication and WebEventSystem are now split into a separate [WebUtility](https://github.com/forcepusher/com.bananaparty.webutility) package. 109 | 110 | ## [10.0.0] - 2022-08-10 111 | ### Added 112 | - YandexGamesSdk.Initialize() now has onSuccessCallback and returns a coroutine waiting for initialization to finish. 113 | 114 | ### Removed 115 | - YandexGamesSdk.WaitForInitialization() is gone. Yield on YandexGamesSdk.Initialize() coroutine instead. 116 | 117 | ### Changed 118 | - The SDK is no longer initializing itself because developers often forget to use WaitForInitialization() coroutine. 119 | This was leading to errors that were difficult to reproduce and detect. Now you have to call YandexGamesSdk.Initialize() on your own. 120 | 121 | ## [9.0.0] - 2022-07-22 122 | ### Fixed 123 | - Interstitial misspelling. 124 | 125 | ## [8.3.1] - 2022-06-08 126 | ### Fixed 127 | - PlayerAccount.IsAuthorized was broken due to recent YandexGames API changes. This update solves it. 128 | 129 | ## [8.3.0] - 2022-06-03 130 | ### Added 131 | - YandexGamesSdk.Environment data structure that proxies `ysdk.environment`. 132 | 133 | ## [8.2.0] - 2022-02-27 134 | ### Added 135 | - Device.Type property that proxies `ysdk.deviceInfo.type`. 136 | 137 | ## [8.1.0] - 2022-02-25 138 | ### Added 139 | - PlayerAccount.GetPlayerData and SetPlayerData that implements Cloud Save functionality. 140 | 141 | ## [8.0.1] - 2022-02-08 142 | ### Fixed 143 | - Prevent crashes when Yandex SDK API throws an empty error (or error of an unexpected type). 144 | 145 | ## [8.0.0] - 2022-01-24 146 | ### Changed 147 | - Added BananaParty prefix in front of all namespaces to comply with MSDN C# standard. 148 | 149 | ## [7.0.0] - 2021-12-24 150 | ### Changed 151 | - WebBackgroundMute.Enable was replaced with WebApplication.InBackground property. Now you will have to manually set `AudioListener.pause = WebApplication.InBackground;` in an Update to achieve the same effect. Although now you can use it for anything rather than just muting the audio in the background. 152 | 153 | ## [6.0.0] - 2021-12-15 154 | ### Changed 155 | - PlayerAccount.Authorized is now PlayerAccount.IsAuthorized. Needed that to achieve full naming consistency across internal and external API. 156 | - Same goes for YandexGamesSdk.IsInitialized. 157 | 158 | ## [5.0.1] - 2021-12-15 159 | ### Fixed 160 | - Leaderboard.GetPlayerEntry successCallback silently stopping execution when it's supposed to return null. 161 | 162 | ## [5.0.0] - 2021-12-14 163 | ### Changed 164 | - Leaderboard.GetPlayerEntry now returns null in successCallback instead of invoking errorCallback. 165 | 166 | ### Added 167 | - WebBackgroundMute to mute audio when RunInBackground is enabled. 168 | 169 | ## [4.0.0] - 2021-12-13 170 | ### Changed 171 | - Making it clear that GetProfileData still returns some data if permissions were not granted. 172 | - Renamed RequestProfileDataPermission to RequestPersonalProfileDataPermission. 173 | - Renamed HasProfileDataPermission to HasPersonalProfileDataPermission. 174 | 175 | [18.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/17.0.0...18.0.0 176 | [17.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/16.1.1...17.0.0 177 | [16.1.1] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/16.1.0...16.1.1 178 | [16.1.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/16.0.0...16.1.0 179 | [16.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/15.1.1...16.0.0 180 | [15.1.1] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/15.1.0...15.1.1 181 | [15.1.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/15.0.0...15.1.0 182 | [15.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/14.0.0...15.0.0 183 | [14.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/13.3.0...14.0.0 184 | [13.3.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/13.2.0...13.3.0 185 | [13.2.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/13.1.0...13.2.0 186 | [13.1.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/13.0.0...13.1.0 187 | [13.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/12.0.1...13.0.0 188 | [12.0.1] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/12.0.0...12.0.1 189 | [12.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/11.2.1...12.0.0 190 | [11.2.1] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/11.2.0...11.2.1 191 | [11.2.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/11.1.0...11.2.0 192 | [11.1.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/11.0.0...11.1.0 193 | [11.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/10.0.0...11.0.0 194 | [10.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/8.3.1...10.0.0 195 | [8.3.1] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/8.3.0...8.3.1 196 | [8.3.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/8.2.0...8.3.0 197 | [8.2.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/8.1.0...8.2.0 198 | [8.1.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/8.0.1...8.1.0 199 | [8.0.1] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/8.0.0...8.0.1 200 | [8.0.0] https://github.com/forcepusher/com.bananaparty.yandexgames/compare/7.0.0...8.0.0 201 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/Utility/PlayerPrefs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BananaParty.YandexGames.Utility 6 | { 7 | public static class PlayerPrefs 8 | { 9 | private static Action s_onSaveSuccessCallback; 10 | private static Action s_onSaveErrorCallback; 11 | 12 | private static Action s_onLoadSuccessCallback; 13 | private static Action s_onLoadErrorCallback; 14 | 15 | private static readonly Dictionary s_prefs = new Dictionary(); 16 | 17 | public static void Save(Action onSuccessCallback = null, Action onErrorCallback = null) 18 | { 19 | var jsonStringBuilder = new StringBuilder(); 20 | jsonStringBuilder.Append('{'); 21 | 22 | foreach (KeyValuePair pref in s_prefs) 23 | { 24 | string maskedValue = MaskJsonString(pref.Value); 25 | jsonStringBuilder.Append($"\"{pref.Key}\":\"{maskedValue}\","); 26 | } 27 | 28 | if (s_prefs.Count > 0) 29 | jsonStringBuilder.Length -= 1; 30 | 31 | jsonStringBuilder.Append('}'); 32 | 33 | string jsonData = jsonStringBuilder.ToString(); 34 | 35 | s_onSaveSuccessCallback = onSuccessCallback; 36 | s_onSaveErrorCallback = onErrorCallback; 37 | 38 | PlayerAccount.SetCloudSaveData(jsonData, OnSaveSuccessCallback, OnSaveErrorCallback); 39 | } 40 | 41 | private static void OnSaveSuccessCallback() 42 | { 43 | s_onSaveSuccessCallback?.Invoke(); 44 | } 45 | 46 | private static void OnSaveErrorCallback(string errorMessage) 47 | { 48 | s_onSaveErrorCallback?.Invoke(errorMessage); 49 | } 50 | 51 | public static void Load(Action onSuccessCallback = null, Action onErrorCallback = null) 52 | { 53 | s_onLoadSuccessCallback = onSuccessCallback; 54 | s_onLoadErrorCallback = onErrorCallback; 55 | 56 | PlayerAccount.GetCloudSaveData(OnLoadSuccessCallback, OnLoadErrorCallback); 57 | } 58 | 59 | enum IterationState 60 | { 61 | StartingKeyQuote, 62 | Key, 63 | StartingValueQuote, 64 | Value 65 | } 66 | 67 | private static void OnLoadSuccessCallback(string jsonData) 68 | { 69 | ParseAndApplyData(jsonData); 70 | 71 | s_onLoadSuccessCallback?.Invoke(); 72 | } 73 | 74 | public static void ParseAndApplyData(string jsonData) 75 | { 76 | if (string.IsNullOrEmpty(jsonData)) 77 | jsonData = "{}"; 78 | 79 | s_prefs.Clear(); 80 | 81 | string unparsedData = jsonData.Trim('{', '}'); 82 | 83 | var key = new StringBuilder(); 84 | var value = new StringBuilder(); 85 | 86 | IterationState iterationState = IterationState.StartingKeyQuote; 87 | 88 | int characterIterator = 0; 89 | while (characterIterator < unparsedData.Length) 90 | { 91 | char character = unparsedData[characterIterator]; 92 | 93 | switch (iterationState) 94 | { 95 | case IterationState.StartingKeyQuote: 96 | if (character == '"') 97 | { 98 | iterationState = IterationState.Key; 99 | } 100 | 101 | break; 102 | 103 | case IterationState.Key: 104 | if (character == '"') 105 | { 106 | iterationState = IterationState.StartingValueQuote; 107 | } 108 | else 109 | { 110 | key.Append(character); 111 | } 112 | 113 | break; 114 | 115 | case IterationState.StartingValueQuote: 116 | if (character == '"') 117 | { 118 | iterationState = IterationState.Value; 119 | } 120 | 121 | break; 122 | 123 | case IterationState.Value: 124 | if (character == '"') 125 | { 126 | iterationState = IterationState.StartingKeyQuote; 127 | 128 | string unmaskedValue = UnmaskJsonString(value.ToString()); 129 | s_prefs[key.ToString()] = unmaskedValue; 130 | key.Clear(); 131 | value.Clear(); 132 | } 133 | else 134 | { 135 | value.Append(character); 136 | } 137 | 138 | break; 139 | } 140 | 141 | characterIterator += 1; 142 | } 143 | } 144 | 145 | private static void OnLoadErrorCallback(string errorMessage) 146 | { 147 | s_onLoadErrorCallback?.Invoke(errorMessage); 148 | } 149 | 150 | public static bool HasKey(string key) 151 | { 152 | return s_prefs.ContainsKey(key); 153 | } 154 | 155 | public static void DeleteKey(string key) 156 | { 157 | s_prefs.Remove(key); 158 | } 159 | 160 | public static void DeleteAll() 161 | { 162 | s_prefs.Clear(); 163 | } 164 | 165 | public static void SetString(string key, string value) 166 | { 167 | if (s_prefs.ContainsKey(key)) 168 | s_prefs[key] = value; 169 | else 170 | s_prefs.Add(key, value); 171 | } 172 | 173 | public static string GetString(string key, string defaultValue) 174 | { 175 | if (s_prefs.ContainsKey(key)) 176 | return s_prefs[key]; 177 | else 178 | return defaultValue; 179 | } 180 | 181 | public static string GetString(string key) 182 | { 183 | string defaultValue = ""; 184 | return GetString(key, defaultValue); 185 | } 186 | 187 | public static void SetInt(string key, int value) 188 | { 189 | if (s_prefs.ContainsKey(key)) 190 | s_prefs[key] = value.ToString(); 191 | else 192 | s_prefs.Add(key, value.ToString()); 193 | } 194 | 195 | public static int GetInt(string key, int defaultValue) 196 | { 197 | if (s_prefs.ContainsKey(key) && int.TryParse(s_prefs[key], out int value)) 198 | return value; 199 | else 200 | return defaultValue; 201 | } 202 | 203 | public static int GetInt(string key) 204 | { 205 | int defaultValue = 0; 206 | return GetInt(key, defaultValue); 207 | } 208 | 209 | public static void SetFloat(string key, float value) 210 | { 211 | if (s_prefs.ContainsKey(key)) 212 | s_prefs[key] = value.ToString(); 213 | else 214 | s_prefs.Add(key, value.ToString()); 215 | } 216 | 217 | public static float GetFloat(string key, float defaultValue) 218 | { 219 | if (s_prefs.ContainsKey(key) && float.TryParse(s_prefs[key], out float value)) 220 | return value; 221 | else 222 | return defaultValue; 223 | } 224 | 225 | public static float GetFloat(string key) 226 | { 227 | float defaultValue = 0; 228 | return GetFloat(key, defaultValue); 229 | } 230 | 231 | private static string MaskJsonString(string value) 232 | { 233 | const string openBracketMask = "#OBM#"; 234 | const string closeBracketMask = "#CBM#"; 235 | const string quoteMask = "#QuM#"; 236 | 237 | var stringBuilder = new StringBuilder(); 238 | 239 | int characterIterator = 0; 240 | while (characterIterator < value.Length) 241 | { 242 | char character = value[characterIterator]; 243 | 244 | switch (character) 245 | { 246 | case '{': 247 | stringBuilder.Append(openBracketMask); 248 | break; 249 | case '}': 250 | stringBuilder.Append(closeBracketMask); 251 | break; 252 | case '"': 253 | stringBuilder.Append(quoteMask); 254 | break; 255 | default: 256 | stringBuilder.Append(character); 257 | break; 258 | } 259 | 260 | characterIterator += 1; 261 | } 262 | 263 | return stringBuilder.ToString(); 264 | } 265 | 266 | private static string UnmaskJsonString(string value) 267 | { 268 | const string openBracketMask = "#OBM#"; 269 | const string closeBracketMask = "#CBM#"; 270 | const string quoteMask = "#QuM#"; 271 | const char checker = '#'; 272 | const int maskSize = 5; 273 | 274 | var stringBuilder = new StringBuilder(); 275 | 276 | int characterIterator = 0; 277 | while (characterIterator < value.Length) 278 | { 279 | char character = value[characterIterator]; 280 | 281 | if (characterIterator <= value.Length - maskSize && character == checker) 282 | { 283 | string subString = value.Substring(characterIterator, maskSize); 284 | 285 | switch (subString) 286 | { 287 | case openBracketMask: 288 | stringBuilder.Append('{'); 289 | characterIterator += maskSize; 290 | break; 291 | case closeBracketMask: 292 | stringBuilder.Append('}'); 293 | characterIterator += maskSize; 294 | break; 295 | case quoteMask: 296 | stringBuilder.Append('"'); 297 | characterIterator += maskSize; 298 | break; 299 | default: 300 | stringBuilder.Append(character); 301 | characterIterator += 1; 302 | break; 303 | } 304 | } 305 | else 306 | { 307 | stringBuilder.Append(character); 308 | characterIterator += 1; 309 | } 310 | } 311 | 312 | return stringBuilder.ToString(); 313 | } 314 | } 315 | } 316 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | - serializedVersion: 3 297 | m_Name: Enable Debug Button 1 298 | descriptiveName: 299 | descriptiveNegativeName: 300 | negativeButton: 301 | positiveButton: left ctrl 302 | altNegativeButton: 303 | altPositiveButton: joystick button 8 304 | gravity: 0 305 | dead: 0 306 | sensitivity: 0 307 | snap: 0 308 | invert: 0 309 | type: 0 310 | axis: 0 311 | joyNum: 0 312 | - serializedVersion: 3 313 | m_Name: Enable Debug Button 2 314 | descriptiveName: 315 | descriptiveNegativeName: 316 | negativeButton: 317 | positiveButton: backspace 318 | altNegativeButton: 319 | altPositiveButton: joystick button 9 320 | gravity: 0 321 | dead: 0 322 | sensitivity: 0 323 | snap: 0 324 | invert: 0 325 | type: 0 326 | axis: 0 327 | joyNum: 0 328 | - serializedVersion: 3 329 | m_Name: Debug Reset 330 | descriptiveName: 331 | descriptiveNegativeName: 332 | negativeButton: 333 | positiveButton: left alt 334 | altNegativeButton: 335 | altPositiveButton: joystick button 1 336 | gravity: 0 337 | dead: 0 338 | sensitivity: 0 339 | snap: 0 340 | invert: 0 341 | type: 0 342 | axis: 0 343 | joyNum: 0 344 | - serializedVersion: 3 345 | m_Name: Debug Next 346 | descriptiveName: 347 | descriptiveNegativeName: 348 | negativeButton: 349 | positiveButton: page down 350 | altNegativeButton: 351 | altPositiveButton: joystick button 5 352 | gravity: 0 353 | dead: 0 354 | sensitivity: 0 355 | snap: 0 356 | invert: 0 357 | type: 0 358 | axis: 0 359 | joyNum: 0 360 | - serializedVersion: 3 361 | m_Name: Debug Previous 362 | descriptiveName: 363 | descriptiveNegativeName: 364 | negativeButton: 365 | positiveButton: page up 366 | altNegativeButton: 367 | altPositiveButton: joystick button 4 368 | gravity: 0 369 | dead: 0 370 | sensitivity: 0 371 | snap: 0 372 | invert: 0 373 | type: 0 374 | axis: 0 375 | joyNum: 0 376 | - serializedVersion: 3 377 | m_Name: Debug Validate 378 | descriptiveName: 379 | descriptiveNegativeName: 380 | negativeButton: 381 | positiveButton: return 382 | altNegativeButton: 383 | altPositiveButton: joystick button 0 384 | gravity: 0 385 | dead: 0 386 | sensitivity: 0 387 | snap: 0 388 | invert: 0 389 | type: 0 390 | axis: 0 391 | joyNum: 0 392 | - serializedVersion: 3 393 | m_Name: Debug Persistent 394 | descriptiveName: 395 | descriptiveNegativeName: 396 | negativeButton: 397 | positiveButton: right shift 398 | altNegativeButton: 399 | altPositiveButton: joystick button 2 400 | gravity: 0 401 | dead: 0 402 | sensitivity: 0 403 | snap: 0 404 | invert: 0 405 | type: 0 406 | axis: 0 407 | joyNum: 0 408 | - serializedVersion: 3 409 | m_Name: Debug Multiplier 410 | descriptiveName: 411 | descriptiveNegativeName: 412 | negativeButton: 413 | positiveButton: left shift 414 | altNegativeButton: 415 | altPositiveButton: joystick button 3 416 | gravity: 0 417 | dead: 0 418 | sensitivity: 0 419 | snap: 0 420 | invert: 0 421 | type: 0 422 | axis: 0 423 | joyNum: 0 424 | - serializedVersion: 3 425 | m_Name: Debug Horizontal 426 | descriptiveName: 427 | descriptiveNegativeName: 428 | negativeButton: left 429 | positiveButton: right 430 | altNegativeButton: 431 | altPositiveButton: 432 | gravity: 1000 433 | dead: 0.001 434 | sensitivity: 1000 435 | snap: 0 436 | invert: 0 437 | type: 0 438 | axis: 0 439 | joyNum: 0 440 | - serializedVersion: 3 441 | m_Name: Debug Vertical 442 | descriptiveName: 443 | descriptiveNegativeName: 444 | negativeButton: down 445 | positiveButton: up 446 | altNegativeButton: 447 | altPositiveButton: 448 | gravity: 1000 449 | dead: 0.001 450 | sensitivity: 1000 451 | snap: 0 452 | invert: 0 453 | type: 0 454 | axis: 0 455 | joyNum: 0 456 | - serializedVersion: 3 457 | m_Name: Debug Vertical 458 | descriptiveName: 459 | descriptiveNegativeName: 460 | negativeButton: down 461 | positiveButton: up 462 | altNegativeButton: 463 | altPositiveButton: 464 | gravity: 1000 465 | dead: 0.001 466 | sensitivity: 1000 467 | snap: 0 468 | invert: 0 469 | type: 2 470 | axis: 6 471 | joyNum: 0 472 | - serializedVersion: 3 473 | m_Name: Debug Horizontal 474 | descriptiveName: 475 | descriptiveNegativeName: 476 | negativeButton: left 477 | positiveButton: right 478 | altNegativeButton: 479 | altPositiveButton: 480 | gravity: 1000 481 | dead: 0.001 482 | sensitivity: 1000 483 | snap: 0 484 | invert: 0 485 | type: 2 486 | axis: 5 487 | joyNum: 0 488 | -------------------------------------------------------------------------------- /Packages/com.bananaparty.yandexgames/Runtime/PlayerAccount/PlayerAccount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using AOT; 4 | using UnityEngine; 5 | 6 | namespace BananaParty.YandexGames 7 | { 8 | /// 9 | /// Proxy for player-related methods in YandexGames SDK. 10 | /// 11 | public static class PlayerAccount 12 | { 13 | public static event Action AuthorizedInBackground; 14 | 15 | private static Action s_onStartAuthorizationPollingSuccessCallback; 16 | private static Action s_onStartAuthorizationPollingErrorCallback; 17 | 18 | private static Action s_onAuthorizeSuccessCallback; 19 | private static Action s_onAuthorizeErrorCallback; 20 | 21 | private static Action s_onRequestPersonalProfileDataPermissionSuccessCallback; 22 | private static Action s_onRequestPersonalProfileDataPermissionErrorCallback; 23 | 24 | private static Action s_onGetProfileDataSuccessCallback; 25 | private static Action s_onGetProfileDataErrorCallback; 26 | 27 | private static Action s_onSetCloudSaveDataSuccessCallback; 28 | private static Action s_onSetCloudSaveDataErrorCallback; 29 | 30 | private static Action s_onGetCloudSaveDataSuccessCallback; 31 | private static Action s_onGetCloudSaveDataErrorCallback; 32 | 33 | /// 34 | /// Use this before calling SDK methods that require authorization. 35 | /// 36 | public static bool IsAuthorized => GetPlayerAccountIsAuthorized(); 37 | 38 | [DllImport("__Internal")] 39 | private static extern bool GetPlayerAccountIsAuthorized(); 40 | 41 | /// 42 | /// Permission to use name and profile picture from the Yandex account. 43 | /// 44 | /// 45 | /// Requires authorization. Use and . 46 | /// 47 | public static bool HasPersonalProfileDataPermission => GetPlayerAccountHasPersonalProfileDataPermission(); 48 | 49 | [DllImport("__Internal")] 50 | private static extern bool GetPlayerAccountHasPersonalProfileDataPermission(); 51 | 52 | #region Authorize 53 | /// 54 | /// Calls a scary authorization window upon the user. Be very afraid. 55 | /// 56 | public static void Authorize(Action onSuccessCallback = null, Action onErrorCallback = null) 57 | { 58 | s_onAuthorizeSuccessCallback = onSuccessCallback; 59 | s_onAuthorizeErrorCallback = onErrorCallback; 60 | 61 | PlayerAccountAuthorize(OnAuthorizeSuccessCallback, OnAuthorizeErrorCallback); 62 | } 63 | 64 | [DllImport("__Internal")] 65 | private static extern void PlayerAccountAuthorize(Action successCallback, Action errorCallback); 66 | 67 | [MonoPInvokeCallback(typeof(Action))] 68 | private static void OnAuthorizeSuccessCallback() 69 | { 70 | if (YandexGamesSdk.CallbackLogging) 71 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnAuthorizeSuccessCallback)} invoked"); 72 | 73 | s_onAuthorizeSuccessCallback?.Invoke(); 74 | } 75 | 76 | [MonoPInvokeCallback(typeof(Action))] 77 | private static void OnAuthorizeErrorCallback(string errorMessage) 78 | { 79 | if (YandexGamesSdk.CallbackLogging) 80 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnAuthorizeErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 81 | 82 | s_onAuthorizeErrorCallback?.Invoke(errorMessage); 83 | } 84 | 85 | public static void StartAuthorizationPolling(int repeatDelay, Action successCallback = null, Action errorCallback = null) 86 | { 87 | s_onStartAuthorizationPollingSuccessCallback = successCallback; 88 | s_onStartAuthorizationPollingErrorCallback = errorCallback; 89 | 90 | PlayerAccountStartAuthorizationPolling(repeatDelay, OnStartAuthorizationPollingSuccessCallback, OnStartAuthorizationPollingErrorCallback); 91 | } 92 | 93 | [DllImport("__Internal")] 94 | private static extern void PlayerAccountStartAuthorizationPolling(int repeatDelay, Action successCallback, Action errorCallback); 95 | 96 | [MonoPInvokeCallback(typeof(Action))] 97 | private static void OnStartAuthorizationPollingSuccessCallback() 98 | { 99 | if (YandexGamesSdk.CallbackLogging) 100 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnStartAuthorizationPollingSuccessCallback)} invoked"); 101 | 102 | AuthorizedInBackground?.Invoke(); 103 | s_onStartAuthorizationPollingSuccessCallback?.Invoke(); 104 | } 105 | 106 | [MonoPInvokeCallback(typeof(Action))] 107 | private static void OnStartAuthorizationPollingErrorCallback() 108 | { 109 | if (YandexGamesSdk.CallbackLogging) 110 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnStartAuthorizationPollingErrorCallback)} invoked"); 111 | 112 | s_onStartAuthorizationPollingErrorCallback?.Invoke(); 113 | } 114 | #endregion 115 | 116 | #region RequestPersonalProfileDataPermission 117 | /// 118 | /// Request the permission to get Yandex account name and profile picture when calling . 119 | /// 120 | /// 121 | /// Be aware, if user rejects the request - it's permanent. The request window will never open again.
122 | /// Requires authorization. Use and . 123 | ///
124 | public static void RequestPersonalProfileDataPermission(Action onSuccessCallback = null, Action onErrorCallback = null) 125 | { 126 | s_onRequestPersonalProfileDataPermissionSuccessCallback = onSuccessCallback; 127 | s_onRequestPersonalProfileDataPermissionErrorCallback = onErrorCallback; 128 | 129 | PlayerAccountRequestPersonalProfileDataPermission(OnRequestPersonalProfileDataPermissionSuccessCallback, OnRequestPersonalProfileDataPermissionErrorCallback); 130 | } 131 | 132 | [DllImport("__Internal")] 133 | private static extern void PlayerAccountRequestPersonalProfileDataPermission(Action successCallback, Action errorCallback); 134 | 135 | [MonoPInvokeCallback(typeof(Action))] 136 | private static void OnRequestPersonalProfileDataPermissionSuccessCallback() 137 | { 138 | if (YandexGamesSdk.CallbackLogging) 139 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnRequestPersonalProfileDataPermissionSuccessCallback)} invoked"); 140 | 141 | s_onRequestPersonalProfileDataPermissionSuccessCallback?.Invoke(); 142 | } 143 | 144 | [MonoPInvokeCallback(typeof(Action))] 145 | private static void OnRequestPersonalProfileDataPermissionErrorCallback(string errorMessage) 146 | { 147 | if (YandexGamesSdk.CallbackLogging) 148 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnRequestPersonalProfileDataPermissionErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 149 | 150 | s_onRequestPersonalProfileDataPermissionErrorCallback?.Invoke(errorMessage); 151 | } 152 | #endregion 153 | 154 | #region GetProfileData 155 | /// 156 | /// Will only return unless . 157 | /// 158 | /// 159 | /// Requires authorization. Use and . 160 | /// 161 | public static void GetProfileData(Action onSuccessCallback, Action onErrorCallback = null, ProfilePictureSize pictureSize = ProfilePictureSize.medium) 162 | { 163 | s_onGetProfileDataSuccessCallback = onSuccessCallback; 164 | s_onGetProfileDataErrorCallback = onErrorCallback; 165 | 166 | PlayerAccountGetProfileData(OnGetProfileDataSuccessCallback, OnGetProfileDataErrorCallback, pictureSize.ToString()); 167 | } 168 | 169 | [DllImport("__Internal")] 170 | private static extern void PlayerAccountGetProfileData(Action successCallback, Action errorCallback, string pictureSize); 171 | 172 | [MonoPInvokeCallback(typeof(Action))] 173 | private static void OnGetProfileDataSuccessCallback(string profileDataResponseJson) 174 | { 175 | if (YandexGamesSdk.CallbackLogging) 176 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnGetProfileDataSuccessCallback)} invoked, {nameof(profileDataResponseJson)} = {profileDataResponseJson}"); 177 | 178 | PlayerAccountProfileDataResponse profileDataResponse = JsonUtility.FromJson(profileDataResponseJson); 179 | 180 | s_onGetProfileDataSuccessCallback?.Invoke(profileDataResponse); 181 | } 182 | 183 | [MonoPInvokeCallback(typeof(Action))] 184 | private static void OnGetProfileDataErrorCallback(string errorMessage) 185 | { 186 | if (YandexGamesSdk.CallbackLogging) 187 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnGetProfileDataErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 188 | 189 | s_onGetProfileDataErrorCallback?.Invoke(errorMessage); 190 | } 191 | #endregion 192 | 193 | #region Cloud Save 194 | /// 195 | /// Stores Cloud Save data in the player account. Proxy for player.setData() with "flush" setting set to true. 196 | /// 197 | public static void SetCloudSaveData(string cloudSaveDataJson, Action onSuccessCallback = null, Action onErrorCallback = null) 198 | { 199 | if (cloudSaveDataJson == null) 200 | throw new ArgumentNullException(nameof(cloudSaveDataJson)); 201 | 202 | if (string.IsNullOrEmpty(cloudSaveDataJson)) 203 | cloudSaveDataJson = "{}"; 204 | 205 | s_onSetCloudSaveDataSuccessCallback = onSuccessCallback; 206 | s_onSetCloudSaveDataErrorCallback = onErrorCallback; 207 | 208 | PlayerAccountSetCloudSaveData(cloudSaveDataJson, OnSetCloudSaveDataSuccessCallback, OnSetCloudSaveDataErrorCallback); 209 | } 210 | 211 | [DllImport("__Internal")] 212 | private static extern void PlayerAccountSetCloudSaveData(string cloudSaveDataJson, Action successCallback, Action errorCallback); 213 | 214 | [MonoPInvokeCallback(typeof(Action))] 215 | private static void OnSetCloudSaveDataSuccessCallback() 216 | { 217 | if (YandexGamesSdk.CallbackLogging) 218 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnSetCloudSaveDataSuccessCallback)} invoked"); 219 | 220 | s_onSetCloudSaveDataSuccessCallback?.Invoke(); 221 | } 222 | 223 | [MonoPInvokeCallback(typeof(Action))] 224 | private static void OnSetCloudSaveDataErrorCallback(string errorMessage) 225 | { 226 | if (YandexGamesSdk.CallbackLogging) 227 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnSetCloudSaveDataErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 228 | 229 | s_onSetCloudSaveDataErrorCallback?.Invoke(errorMessage); 230 | } 231 | 232 | /// 233 | /// Loads cloud save data, proxy for player.getData(). 234 | /// 235 | /// 236 | /// Callback that returns unparsed JSON string.
237 | /// If player does not have any data saved, an empty JSON "{}" is returned. 238 | /// 239 | public static void GetCloudSaveData(Action onSuccessCallback = null, Action onErrorCallback = null) 240 | { 241 | s_onGetCloudSaveDataSuccessCallback = onSuccessCallback; 242 | s_onGetCloudSaveDataErrorCallback = onErrorCallback; 243 | 244 | PlayerAccountGetCloudSaveData(OnGetCloudSaveDataSuccessCallback, OnGetCloudSaveDataErrorCallback); 245 | } 246 | 247 | [DllImport("__Internal")] 248 | private static extern void PlayerAccountGetCloudSaveData(Action successCallback, Action errorCallback); 249 | 250 | [MonoPInvokeCallback(typeof(Action))] 251 | private static void OnGetCloudSaveDataSuccessCallback(string playerDataJson) 252 | { 253 | if (YandexGamesSdk.CallbackLogging) 254 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnGetCloudSaveDataSuccessCallback)} invoked, {nameof(playerDataJson)} = {playerDataJson}"); 255 | 256 | s_onGetCloudSaveDataSuccessCallback?.Invoke(playerDataJson); 257 | } 258 | 259 | [MonoPInvokeCallback(typeof(Action))] 260 | private static void OnGetCloudSaveDataErrorCallback(string errorMessage) 261 | { 262 | if (YandexGamesSdk.CallbackLogging) 263 | Debug.Log($"{nameof(PlayerAccount)}.{nameof(OnGetCloudSaveDataErrorCallback)} invoked, {nameof(errorMessage)} = {errorMessage}"); 264 | 265 | s_onGetCloudSaveDataErrorCallback?.Invoke(errorMessage); 266 | } 267 | #endregion 268 | } 269 | } 270 | --------------------------------------------------------------------------------