├── Utils ├── Logger │ ├── Dev.cs.meta │ ├── LogQueue.cs.meta │ ├── Logger.cs.meta │ ├── IDebugLoggable.cs.meta │ ├── FixedSizedQueue.cs.meta │ ├── FixedSizedQueue.cs │ ├── IDebugLoggable.cs │ ├── Dev.cs │ └── Logger.cs ├── ThreadUtils.cs.meta ├── DiagnosticUtils.cs.meta ├── IComponent.cs.meta ├── Reachability.cs.meta ├── Tools │ ├── CSVParser.cs.meta │ ├── ReplayTimer.cs.meta │ ├── ReplayTimer.cs │ └── CSVParser.cs ├── Loadable │ ├── ILoadableExtensions.cs │ ├── ILoadable.cs │ ├── Prefabs.meta │ ├── Singleton.meta │ ├── ILoadable.cs.meta │ ├── ILoadableExtensions.cs.meta │ ├── Singleton │ │ ├── Singleton.cs.meta │ │ ├── SingletonMonitor.cs.meta │ │ ├── SingletonUtils.cs.meta │ │ ├── ComponentSingleton.cs.meta │ │ ├── ScriptableObjectSingleton.cs.meta │ │ ├── SingletonUtils.cs │ │ ├── Singleton.cs │ │ ├── SingletonMonitor.cs │ │ └── ScriptableObjectSingleton.cs │ └── Prefabs │ │ ├── ComponentPrefab.cs.meta │ │ └── ComponentPrefab.cs ├── Screen │ ├── ScreenUtils.cs.meta │ └── ScreenUtils.cs ├── UI │ ├── Buttons │ │ ├── IButtonEvents.cs.meta │ │ ├── PaginatorButtons.cs.meta │ │ ├── IButtonEvents.cs │ │ ├── ButtonEvents.cs.meta │ │ ├── ButtonEvents.cs │ │ └── PaginatorButtons.cs │ ├── ScrollRect │ │ ├── ScrollRectClicker.cs.meta │ │ ├── NestedScrollRect.cs.meta │ │ ├── ScrollRectClickerComponent.cs.meta │ │ ├── ScrollRectTouchPassthrough.cs.meta │ │ ├── ScrollRectPaginator.cs.meta │ │ ├── ScrollRectClickerComponent.cs │ │ ├── ScrollRectClicker.cs │ │ └── NestedScrollRect.cs │ ├── Buttons.meta │ ├── ScrollRect.meta │ ├── Sorting.meta │ └── Sorting │ │ ├── SortingLayer.cs.meta │ │ ├── SortingOrder.cs.meta │ │ ├── CanvasOrderSorter.cs.meta │ │ ├── DropdownTemplateSortingOrderHelper.cs.meta │ │ ├── DropdownTemplateSortingOrderHelper.cs │ │ ├── SortingLayer.cs │ │ ├── SortingOrder.cs │ │ └── CanvasOrderSorter.cs ├── iCloudPlugin │ ├── iCloudManager.cs.meta │ ├── KeychainPlugin.cs.meta │ ├── Plugins │ │ ├── IOS │ │ │ ├── KeychainPlugin.mm.meta │ │ │ ├── iCloudPlugin.mm.meta │ │ │ └── KeychainPlugin.mm │ │ └── IOS.meta │ ├── UnityiCloud.entitlements.meta │ ├── Plugins.meta │ ├── UnityiCloud.entitlements │ └── KeychainPlugin.cs ├── Extensions │ ├── POD │ │ ├── FloatExtensions.cs.meta │ │ ├── DoubleExtensions.cs.meta │ │ ├── IntExtensions.cs.meta │ │ ├── DoubleExtensions.cs │ │ └── FloatExtensions.cs │ ├── POD.meta │ ├── BoolExtensions.cs.meta │ ├── EnumExtensions.cs.meta │ ├── ListExtensions.cs.meta │ ├── MathExtensions.cs.meta │ ├── ClassExtensions.cs.meta │ ├── ComponentExtensions.cs.meta │ ├── DateTimeExtensions.cs.meta │ ├── StringExtensions.cs.meta │ ├── TransformExtensions.cs.meta │ ├── VectorExtensions.cs.meta │ ├── GameObjectExtensions.cs.meta │ ├── MonoBehaviourExtensions.cs.meta │ ├── RectTransformExtensions.cs.meta │ ├── ScrollRectExtensions.cs.meta │ ├── VectorExtensions.cs │ ├── BoolExtensions.cs │ ├── ScrollRectExtensions.cs │ ├── EnumExtensions.cs │ ├── MonoBehaviourExtensions.cs │ ├── DateTimeExtensions.cs │ ├── ClassExtensions.cs │ ├── MathExtensions.cs │ ├── ListExtensions.cs │ ├── GameObjectExtensions.cs │ ├── StringExtensions.cs │ └── ComponentExtensions.cs ├── Performance │ ├── ParticleCleanup.cs.meta │ ├── SceneWarmupCamera.cs.meta │ ├── PerformanceOptimizer.cs.meta │ ├── SceneWarmupCamera.prefab.meta │ ├── ParticleCleanup.cs │ ├── SceneWarmupCamera.cs │ ├── SceneWarmupCamera.prefab │ └── PerformanceOptimizer.cs ├── DeepLinkHandler │ ├── DeepLinkReceiver.cs.meta │ ├── DeepLinkReceiverEditor.cs.meta │ ├── DeepLinkReceiverEditor.cs │ └── DeepLinkReceiver.cs ├── Serializer │ ├── Types │ │ ├── SerializableDateTime.cs.meta │ │ ├── SerializableDateJsonConverter.cs.meta │ │ ├── SerializableDateTime.cs │ │ └── SerializableDateJsonConverter.cs │ ├── ConditionalIgnorePropertiesResolver.cs.meta │ ├── Types.meta │ ├── ISerializer.cs.meta │ ├── ObjectGroup.cs.meta │ ├── IReplaySerialazable.cs.meta │ ├── LocalSerializer.cs.meta │ ├── NetworkSerializer.cs.meta │ ├── IgnorePropertiesResolver.cs.meta │ ├── LocalSerializerExtensions.cs.meta │ ├── CollectionClearingContractResolver.cs.meta │ ├── JSONSerializedScriptableObject.cs.meta │ ├── IReplaySerialazable.cs │ ├── CollectionClearingContractResolver.cs │ ├── IgnorePropertiesResolver.cs │ ├── ISerializer.cs │ ├── ObjectGroup.cs │ ├── LocalSerializerExtensions.cs │ ├── ConditionalIgnorePropertiesResolver.cs │ ├── JSONSerializedScriptableObject.cs │ ├── LocalSerializer.cs │ └── NetworkSerializer.cs ├── NativeSplashScreen │ ├── Plugins │ │ ├── iOS │ │ │ └── UnityAppController+NativeSplashScreen.mm.meta │ │ └── iOS.meta │ ├── Plugins.meta │ ├── NativeSplashScreen.cs.meta │ └── NativeSplashScreen.cs ├── Constants.cs ├── UI.meta ├── Input.meta ├── Loadable.meta ├── Logger.meta ├── Screen.meta ├── Tools.meta ├── Extensions.meta ├── Performance.meta ├── Serializer.meta ├── ServerTime.meta ├── SharePlugin.meta ├── iCloudPlugin.meta ├── DeepLinkHandler.meta ├── NativeSplashScreen.meta ├── SharePlugin │ ├── Plugins.meta │ ├── Plugins │ │ ├── iOS.meta │ │ └── iOS │ │ │ ├── ShareSheet.h │ │ │ ├── ShareSheet.h.meta │ │ │ ├── ShareSheet.m.meta │ │ │ └── ShareSheet.m │ ├── ShareSheet.cs.meta │ └── ShareSheet.cs ├── Types.cs.meta ├── Constants.cs.meta ├── InputUtils.cs.meta ├── CharacterUtils.cs.meta ├── CollectionUtils.cs.meta ├── CoroutineUtils.cs.meta ├── PlatformUtils.cs.meta ├── StringUtils.cs.meta ├── Input │ ├── DesktopInput.cs.meta │ ├── InputHandler.cs.meta │ ├── InputPlatform.cs.meta │ ├── MobileInput.cs.meta │ ├── InputPlatform.cs │ ├── DesktopInput.cs │ ├── MobileInput.cs │ └── InputHandler.cs ├── NotificationsHelper.cs.meta ├── ServerTime │ ├── ServerTime.cs.meta │ ├── ServerTimeRetriever.cs.meta │ ├── ServerTimeRetriever.cs │ └── ServerTime.cs ├── IComponent.cs ├── CharacterUtils.cs ├── PlatformUtils.cs ├── Types.cs ├── ThreadUtils.cs ├── CoroutineUtils.cs └── InputUtils.cs ├── README.md.meta ├── Editor.meta ├── ReplayLib.asmdef.meta ├── Utils.meta ├── Editor ├── DebugLoggableEditor.cs.meta └── DebugLoggableEditor.cs └── ReplayLib.asmdef /Utils/Logger/Dev.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93cb44f184095469a88bbfeac4d9690a -------------------------------------------------------------------------------- /Utils/ThreadUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73f15ad92a9a44c67b3aeee627839869 -------------------------------------------------------------------------------- /Utils/DiagnosticUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 375ec76234fca487fb9abd99e78a8026 -------------------------------------------------------------------------------- /Utils/IComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85078b56e28c0476d853d4e345104c18 3 | -------------------------------------------------------------------------------- /Utils/Logger/LogQueue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2143d9e9878ab401abdd9ded1895ff13 -------------------------------------------------------------------------------- /Utils/Logger/Logger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5da7b1cbf4954d968fb190da29d08a9 -------------------------------------------------------------------------------- /Utils/Reachability.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 169e2ea1aa4e541a3b823ec9f6ddbf09 -------------------------------------------------------------------------------- /Utils/Tools/CSVParser.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6396730eb80f9444e9efc2a6d2a31ba7 -------------------------------------------------------------------------------- /Utils/Loadable/ILoadableExtensions.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Replay.Utils 3 | { 4 | 5 | } 6 | 7 | -------------------------------------------------------------------------------- /Utils/Logger/IDebugLoggable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ccfc0470c3af41d88bf103bdc95572e -------------------------------------------------------------------------------- /Utils/Screen/ScreenUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8afa236d726e343258bc1e227910e4f5 -------------------------------------------------------------------------------- /Utils/UI/Buttons/IButtonEvents.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b97a9fc3c4784211867b4d0e4c0fa41 -------------------------------------------------------------------------------- /Utils/iCloudPlugin/iCloudManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98693b4b5ea384c2dbc8a9cbe91c6bb6 -------------------------------------------------------------------------------- /Utils/Extensions/POD/FloatExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ff50caa7a79744faa201654e16bc0da -------------------------------------------------------------------------------- /Utils/Performance/ParticleCleanup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd5fa7551d13e4152bbb1396e4aa76d8 -------------------------------------------------------------------------------- /Utils/Performance/SceneWarmupCamera.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d572ac08229dc4834a172550407a7c2e -------------------------------------------------------------------------------- /Utils/UI/Buttons/PaginatorButtons.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56508c06fa27f4fc59e609e67f5a98da -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/ScrollRectClicker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77eb568ff99f546ec8c92a54396f039d -------------------------------------------------------------------------------- /Utils/iCloudPlugin/KeychainPlugin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52c3604cc62ed41bb9eb6c60c3493191 -------------------------------------------------------------------------------- /Utils/DeepLinkHandler/DeepLinkReceiver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91aab40cd01a7434c85c2631e866bf87 -------------------------------------------------------------------------------- /Utils/Extensions/POD/DoubleExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74f55296d6dd448d1a6fd38f0e728064 3 | -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/NestedScrollRect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9f91520119dc413abd632e037d1d5d8 3 | -------------------------------------------------------------------------------- /Utils/Performance/PerformanceOptimizer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0bc7a60f681bf4b719652d7b3859fce1 3 | -------------------------------------------------------------------------------- /Utils/Serializer/Types/SerializableDateTime.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72574b9ac40564b65bc45be90c75a67b -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/ScrollRectClickerComponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8950f4f7656614167974bce59da5272e -------------------------------------------------------------------------------- /Utils/iCloudPlugin/Plugins/IOS/KeychainPlugin.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7729ebcc3c9d84bd197f27b4eb85dc4d -------------------------------------------------------------------------------- /Utils/iCloudPlugin/Plugins/IOS/iCloudPlugin.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b25be7bbbfc94a8a8d969f407b0c009 -------------------------------------------------------------------------------- /Utils/DeepLinkHandler/DeepLinkReceiverEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75338b1ed47554fcca64d6c783d7e5e3 3 | -------------------------------------------------------------------------------- /Utils/Serializer/ConditionalIgnorePropertiesResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88411d2d9ba7c4d88a69687935ca1285 -------------------------------------------------------------------------------- /Utils/Serializer/Types/SerializableDateJsonConverter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c32fe6a98ea14e64bd22fd8d622eaf1 -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/ScrollRectTouchPassthrough.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93ccc518e0a72459b9cccdedb2b25a1c 3 | -------------------------------------------------------------------------------- /Utils/Loadable/ILoadable.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils 2 | { 3 | public interface ILoadable 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Utils/NativeSplashScreen/Plugins/iOS/UnityAppController+NativeSplashScreen.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7696e56c8933446359ce963b466c5c5b -------------------------------------------------------------------------------- /Utils/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils 2 | { 3 | public static class Constants 4 | { 5 | public static readonly int SentinnelValue = -999999; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89fde413374814030aed5df3f48eefc7 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a13752e687b745ab8d8f2c27a04aa73 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ReplayLib.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3f4478971a0941f78f0c24bdd4ce260 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3dfd43221ec5648c38d37c53def56674 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f115159e95b7d4820ac3a2edbc8d0976 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Input.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d116a9d5294c14ffc99b8b88d70aae16 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Loadable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 810ecb15c45444c4c957c70edbc4c58c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Logger.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9efc5c624f1724dca9f31cf41047a544 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Screen.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54f7637e3e99e48198bc1c88f2097d32 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Tools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22531e9c68c99465e88d2f5c68ceaf5f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da3684091a3214749b437339b769081c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Performance.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b052986cc9174eba973148fcb541b95 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Serializer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a34c75f56114f4db58e8f47f494de2e8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/ServerTime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be779dc6c7593470c8142f6b663e742b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/SharePlugin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60e10b42434e74616a9e0d813eb877e2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/UI/Buttons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 72fda06343aac4dc3bc39a2b5dc005df 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/UI/ScrollRect.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fcf053e2b7ad414d9bfbcc7e097c9a7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/UI/Sorting.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15470cf927cb4447c902579b08b19aae 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/iCloudPlugin.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8867212ca2337432b9742e28d57cd29e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/DeepLinkHandler.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be3c6cd8d2dbb47c4b30fd58bce9caa3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Extensions/POD.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32f5c8b1785b5402bbd2a7b86e4cc4e0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Loadable/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff9c1bae1e4f84376a4a5a6c631fee09 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5383ea5a0b7e847a5b65b72ff6cbe0bd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/NativeSplashScreen.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7b9c1d3f8075e472f81c8b3b28317897 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/Performance/SceneWarmupCamera.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19bca72c92f4043538456a03eb33bafc 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Utils/Serializer/Types.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e7004cfe3e2242a498ef18d2c835555 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/iCloudPlugin/UnityiCloud.entitlements.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b444134e380249d39fd57cfdcb8e963 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Utils/SharePlugin/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db449e6f50291468982ac5d2c870d668 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/SharePlugin/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f58b1517ef984b218c0daf5aea8e3c4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/SharePlugin/Plugins/iOS/ShareSheet.h: -------------------------------------------------------------------------------- 1 | //share sheet iOS Plugin 2 | 3 | typedef void (*on_complete_native_type)(bool); 4 | void ShowShareSheet(const char *message, const char* imagePath, on_complete_native_type onCompleteFunc); 5 | -------------------------------------------------------------------------------- /Utils/iCloudPlugin/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcf1a195de6f84e299b8be1476d5edc5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/NativeSplashScreen/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc994c66f41534ffbb25d8cf01b9b824 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/iCloudPlugin/Plugins/IOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62a4d04fae7ff4502a4e1944a910730f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/NativeSplashScreen/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1e809d55228848e89bb493473636fa1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Utils/UI/Buttons/IButtonEvents.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public interface IButtonEvents 4 | { 5 | public void OnTouchDown() 6 | { 7 | } 8 | 9 | public void OnTouchUp() 10 | { 11 | } 12 | public void OnClick() 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Utils/Types.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 90c6a8791ec7a4f6a8961322741ac63e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Constants.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 430dbdea77eb74a8a81e36567365fa18 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/InputUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 431c75884535f42aeacbaf85479ebeec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/CharacterUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61bd8b59935734095a4f1af931f0d64c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/CollectionUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9bb94c0a39ea8451a805e7abca4424ad 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/CoroutineUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 699ff1528a26941c8927a5b1bbfdd814 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/PlatformUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 370e1a5081dd34433b6e31568ba9cf49 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/StringUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f8902bc53ef2463fbacd1587dda8b5b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/DebugLoggableEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de930e233491a42618571ced062e9c4c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Input/DesktopInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9853e32d72eef4a42bfcad6931dc4869 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Input/InputHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 521b937e76d2140ca999c75f9c52e251 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Input/InputPlatform.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8db02a259da704cf2a886c44288af522 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Input/MobileInput.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3eb4b342629940e5a6fde568fc2d419 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/ILoadable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9188b21bca4814f3b87a75f552820632 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/NotificationsHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 364ad131cdb1f402fb15af283d3ab6e0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Tools/ReplayTimer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f116ee1bc73134e5ab1d2e1bbd49daec 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/BoolExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f521a5596b09141fc8305dbdf5d4941f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/EnumExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 805333feeaa804ec5b7ee50b62a6541b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/ListExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b32695a3638e44bbb9d7f7c0a1070d4e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/MathExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6261699d4fc2403382ee3e17dbae366 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Logger/FixedSizedQueue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49ec41582b32d470e8e21417cbdc6ad5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/ISerializer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5e2c95cd1b8b4637b1f93a0b0b290a9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/ObjectGroup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 524df93ca4c704c7ea085d135fd853ed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/ServerTime/ServerTime.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 194905d557a0d4dd6a7fb9c48d51eb26 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/SharePlugin/ShareSheet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08916a91a18dd401dad13d7c0365c300 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/UI/Buttons/ButtonEvents.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b72438fc1523b48cb948517a6b789a2d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/UI/Sorting/SortingLayer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5511c7e30b47485e935ed9b09a2ae24 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/UI/Sorting/SortingOrder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80156fdc6963a46a39f4b01931f1c394 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/ClassExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca23612df0ea04120974e50614572547 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/ComponentExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 433c4fa330faf428fa3af85e02edcacb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/DateTimeExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f102e61d6b7ed4e98bd18c74a4f207ca 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/POD/IntExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58f2e4391b34c4902b2e3c01e221cb7c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/StringExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 689cece37ca974421aa8cdb41ff313eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/TransformExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cbdde1ec88104a8f8412c2446c05fa8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/VectorExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cbb695bcaa5c49559aa387e66fdfa35 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/ILoadableExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 304df3467954442b2ac6aca628073a88 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/Singleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1b51dbced6d54f8aa80f6f88c3bf4a9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/IReplaySerialazable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f55c46605b8c54d4193b50a89410e0aa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/LocalSerializer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5fb8b007df634ccb8758b9bfa37453e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/NetworkSerializer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f8701c9606e04fdf9af8f144f33ff43 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/ServerTime/ServerTimeRetriever.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 199e75170eb4f4ef1a28e2746f6c62b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/UI/Sorting/CanvasOrderSorter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74a5bb0f319e249908a990257dd02edd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/GameObjectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 635f70b1568504dff9d3a2d7558a6aff 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/MonoBehaviourExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 738ff893bcbf44926ae1956280241e5d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/RectTransformExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 991868976371f4869a6ae0ed6dc16d70 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Extensions/ScrollRectExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b474abef813d4b529ff28156fb549de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Prefabs/ComponentPrefab.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a06cae022ca3746d0a719088065409da 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/SingletonMonitor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2afb39ade3ff14365bff4f5f8b667fbd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/SingletonUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4a542dbd6b8742c3aeb6f04b984ed9b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/IgnorePropertiesResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ae0a2ff3072742349f456da3ad6ee7c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/ScrollRectPaginator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 354333f2ef78e4fa5a473628f078a909 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/ComponentSingleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b252a629aa8cc47308c451b70b04f7b3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/NativeSplashScreen/NativeSplashScreen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d733fa023fbb846ad9fdd6f44c269896 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/LocalSerializerExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e23058b7a82764574b4fbc0e3e259dac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/ScriptableObjectSingleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 46e1970970b994c7f9d2798adf4aabe3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/CollectionClearingContractResolver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb101339ee51c491384cbfa9d12bd2d2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Serializer/JSONSerializedScriptableObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 310b4821fb1da448491949985ba4b339 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/UI/Sorting/DropdownTemplateSortingOrderHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2627a05f329d745f8ab56de2bfc90840 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/SingletonUtils.cs: -------------------------------------------------------------------------------- 1 | using Replay.Utils; 2 | 3 | public static class SingletonUtils 4 | { 5 | public static void HandleStartupInterfaceSupport(T singleton) 6 | { 7 | //IReplaySerialazable 8 | var serializable = singleton as IReplaySerialazable; 9 | serializable?.Deserialize(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Utils/iCloudPlugin/UnityiCloud.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.ubiquity-kvstore-identifier 6 | $(TeamIdentifierPrefix)$(CFBundleIdentifier) 7 | 8 | -------------------------------------------------------------------------------- /Utils/IComponent.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Replay.Utils 4 | { 5 | public interface IComponent 6 | { 7 | public GameObject gameObject { get; } 8 | public Transform transform { get; } 9 | public bool enabled { get; set; } 10 | 11 | } 12 | public static class IComponentExtensions 13 | { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /Utils/Input/InputPlatform.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Replay.Utils 4 | { 5 | 6 | public abstract class InputPlatform 7 | { 8 | public abstract bool GetPointerDown(); 9 | public abstract bool GetPointer(); 10 | public abstract bool GetPointerUp(); 11 | public abstract Vector2 GetPointerPosition(); 12 | } 13 | } -------------------------------------------------------------------------------- /Utils/Serializer/IReplaySerialazable.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils 2 | { 3 | //this interface will call deserialize on awake automatically if the object inherits from: 4 | //Singleton 5 | //ComponentSingleton 6 | //otherwise both methods should be called manually 7 | public interface IReplaySerialazable 8 | { 9 | void Serialize(); 10 | void Deserialize(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /Utils/Extensions/POD/DoubleExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils 2 | { 3 | public static class DoubleExtensions 4 | { 5 | public static bool Approximately(this double a, double b, double epsilon = 1E-06d) => 6 | MathExtensions.Approximately(a, b, epsilon); 7 | public static double Clamp(this double value, double min, double max) => 8 | MathExtensions.Clamp(value, min, max); 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /Utils/Extensions/POD/FloatExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils 2 | { 3 | public static class FloatExtensions 4 | { 5 | public static bool Approximately(this float a, float b, float epsilon = 1E-06f) => 6 | MathExtensions.Approximately(a, b, epsilon); 7 | public static double Clamp(this float value, float min, float max) => 8 | MathExtensions.Clamp(value, min, max); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /Utils/Input/DesktopInput.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Replay.Utils 4 | { 5 | public class DesktopInput : InputPlatform 6 | { 7 | public override bool GetPointer() => Input.GetMouseButton(0); 8 | public override bool GetPointerDown() => Input.GetMouseButtonDown(0); 9 | public override bool GetPointerUp() => Input.GetMouseButtonUp(0); 10 | public override Vector2 GetPointerPosition() => Input.mousePosition; 11 | } 12 | } -------------------------------------------------------------------------------- /ReplayLib.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReplayLib", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:9e24947de15b9834991c9d8411ea37cf", 6 | "GUID:84651a3751eca9349aac36a66bba901b", 7 | "GUID:1e8e55397bd004beaba78a667566665f" 8 | ], 9 | "includePlatforms": [], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Utils/UI/Sorting/DropdownTemplateSortingOrderHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils.UI 6 | { 7 | public class DropdownTemplateSortingOrderHelper : MonoBehaviour 8 | { 9 | public int sortingOrderToOverride = 32530; 10 | private void OnEnable() 11 | { 12 | Canvas canvas = GetComponent(); 13 | if(canvas != null) 14 | { 15 | canvas.sortingOrder = sortingOrderToOverride; 16 | 17 | } 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Utils/Extensions/VectorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils 6 | { 7 | public static class VectorExtensions 8 | { 9 | public static Vector2 Rotated(this Vector2 v, float delta) 10 | { 11 | return v.RotatedRad(Mathf.Deg2Rad * delta); 12 | } 13 | public static Vector2 RotatedRad(this Vector2 v, float delta) 14 | { 15 | return new Vector2( 16 | v.x * Mathf.Cos(delta) - v.y * Mathf.Sin(delta), 17 | v.x * Mathf.Sin(delta) + v.y * Mathf.Cos(delta) 18 | ); 19 | } 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /Utils/Serializer/CollectionClearingContractResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Replay.Utils 6 | { 7 | public class CollectionClearingContractResolver : DefaultContractResolver 8 | { 9 | protected override JsonArrayContract CreateArrayContract(Type objectType) 10 | { 11 | var c = base.CreateArrayContract(objectType); 12 | c.OnDeserializingCallbacks.Add((obj, streamingContext) => 13 | { 14 | var list = obj as IList; 15 | if (list != null && !list.IsReadOnly) 16 | list.Clear(); 17 | }); 18 | return c; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Utils/CharacterUtils.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Replay.Utils 3 | { 4 | public static class CharacterUtils 5 | { 6 | public static bool IsSpecialUnicodeCharacter(char c) 7 | { 8 | // ASCII characters are in the range 0-127 9 | // Characters above 127 are extended Unicode characters 10 | return (int)c > 127; 11 | } 12 | 13 | public static bool IsEmoji(string s) 14 | { 15 | // Check if string contains any surrogate pairs (which most emoji use) 16 | for (int i = 0; i < s.Length - 1; i++) 17 | { 18 | if (char.IsSurrogatePair(s[i], s[i + 1])) 19 | return true; 20 | } 21 | return false; 22 | } 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /Utils/Logger/FixedSizedQueue.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | 3 | namespace Replay.Utils 4 | { 5 | public class FixedSizedQueue : ConcurrentQueue 6 | { 7 | private readonly object syncObject = new object(); 8 | 9 | public int Size { get; private set; } 10 | 11 | public FixedSizedQueue(int size) 12 | { 13 | Size = size; 14 | } 15 | 16 | public new void Enqueue(T obj) 17 | { 18 | base.Enqueue(obj); 19 | lock (syncObject) 20 | { 21 | while (base.Count > Size) 22 | { 23 | T outObj; 24 | base.TryDequeue(out outObj); 25 | } 26 | } 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Utils/SharePlugin/Plugins/iOS/ShareSheet.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fa0671ffd68c4516920ef8a8021985b 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | iPhone: iOS 27 | second: 28 | enabled: 1 29 | settings: 30 | AddToEmbeddedBinaries: false 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Utils/SharePlugin/Plugins/iOS/ShareSheet.m.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cacacd9f3b3f4287bc6712c49019e4a 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | iPhone: iOS 27 | second: 28 | enabled: 1 29 | settings: 30 | AddToEmbeddedBinaries: false 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /Utils/PlatformUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Replay.Utils 5 | { 6 | public static class PlatformUtils 7 | { 8 | //platform specific strings 9 | public static T GetPlatformSpecificObject(T iOSObject, T androidObject) 10 | { 11 | #if UNITY_EDITOR 12 | return iOSObject; 13 | #endif 14 | switch (Application.platform) 15 | { 16 | case RuntimePlatform.IPhonePlayer: 17 | return iOSObject; 18 | case RuntimePlatform.Android: 19 | return androidObject; 20 | } 21 | 22 | throw new NotImplementedException("GetPlatformSpecificString not implemented for this platform"); 23 | return iOSObject; 24 | } 25 | 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /Utils/NativeSplashScreen/NativeSplashScreen.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils 2 | { 3 | public static class NativeSplashScreen 4 | { 5 | public static void RemoveNativeSplashScreen() 6 | { 7 | #if !UNITY_EDITOR 8 | #if UNITY_IOS 9 | NativeSplashScreen_RemoveNativeSplashScreeniOS(); 10 | #elif UNITY_ANDROID 11 | NativeSplashScreen_RemoveNativeSplashScreenAndroid(); 12 | #endif 13 | #endif 14 | } 15 | 16 | #if UNITY_IOS && !UNITY_EDITOR 17 | [System.Runtime.InteropServices.DllImport("__Internal")] 18 | private static extern void NativeSplashScreen_RemoveNativeSplashScreeniOS(); 19 | #endif 20 | 21 | #if UNITY_ANDROID && !UNITY_EDITOR 22 | //[System.Runtime.InteropServices.DllImport("__Internal")] 23 | //private static extern void NativeSplashScreen_RemoveNativeSplashScreenAndroid(); 24 | #endif 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /Utils/UI/Sorting/SortingLayer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils.UI 6 | { 7 | public enum SortingLayer 8 | { 9 | undef = -1, 10 | Foundation = -20, 11 | Behind = -10, 12 | Default = 0, 13 | UI = 10, 14 | HUD = 20, 15 | Store = 30, 16 | Dialog = 40, 17 | Debug = 50, 18 | AboveAll = 60 19 | } 20 | public static class SortingLayerExtensions 21 | { 22 | public static string ToName(this SortingLayer sortingLayer) => sortingLayer.ConvertToString(); 23 | public static int ToID(this SortingLayer sortingLayer) => UnityEngine.SortingLayer.NameToID(sortingLayer.ToName()); 24 | 25 | public static void SetOn(this SortingLayer sortingLayer, Canvas canvas) => canvas.sortingLayerID = sortingLayer.ToID(); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/ScrollRectClickerComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | using UnityEngine.EventSystems; 5 | 6 | public class ScrollRectClickerComponent : MonoBehaviour 7 | { 8 | [Serializable] 9 | public class ButtonEventType : UnityEvent { } 10 | public ButtonEventType onClick = new (); 11 | 12 | public Action onScrollRectBeginDrag, onScrollRectEndDrag, onScrollRectClick; 13 | 14 | public virtual void OnScrollRectBeginDrag(PointerEventData data) 15 | { 16 | onScrollRectBeginDrag?.Invoke(data); 17 | } 18 | 19 | public virtual void OnScrollRectEndDrag(PointerEventData data) 20 | { 21 | onScrollRectEndDrag?.Invoke(data); 22 | } 23 | 24 | public virtual void OnScrollRectClick(PointerEventData data) 25 | { 26 | onScrollRectClick?.Invoke(data); 27 | onClick?.Invoke(); 28 | } 29 | } -------------------------------------------------------------------------------- /Utils/Serializer/IgnorePropertiesResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Serialization; 5 | 6 | namespace Replay.Utils 7 | { 8 | //short helper class to ignore some properties from serialization 9 | public class IgnorePropertiesResolver : DefaultContractResolver 10 | { 11 | private readonly HashSet ignoreProps; 12 | public IgnorePropertiesResolver(IEnumerable propNamesToIgnore) 13 | { 14 | ignoreProps = new HashSet(propNamesToIgnore); 15 | } 16 | 17 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 18 | { 19 | JsonProperty property = base.CreateProperty(member, memberSerialization); 20 | if (ignoreProps.Contains(property.PropertyName)) 21 | { 22 | property.ShouldSerialize = _ => false; 23 | } 24 | return property; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Utils/Extensions/BoolExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Replay.Utils { 2 | public static class BoolExtensions 3 | { 4 | public static void Flip(this ref bool b) => b = !b; 5 | public static bool Fliped(this bool b) => !b; 6 | 7 | public static string ToBoolString(this bool b) => b ? "true" : "false"; 8 | 9 | public static bool ToBool(this string boolString) 10 | { 11 | if (string.IsNullOrEmpty(boolString)) 12 | return false; 13 | if (string.IsNullOrWhiteSpace(boolString)) 14 | return false; 15 | string lowerCased = boolString.ToLower(); 16 | if (lowerCased == "true") 17 | return true; 18 | if (lowerCased == "1") 19 | return true; 20 | //other rnumbers? 21 | return false; 22 | } 23 | 24 | public static bool GetRandom(float chance = 0.5F) => MathExtensions.GetRandomBool(chance); 25 | public static void SetRandom(this ref bool b, float chance = 0.5F) => b = GetRandom(chance); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Utils/DeepLinkHandler/DeepLinkReceiverEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEngine; 3 | using UnityEditor; 4 | using Replay.Utils; 5 | 6 | namespace Replay.Utils 7 | { 8 | 9 | [CustomEditor(typeof(DeepLinkReceiver), true)] 10 | public class DeepLinkReceiverEditor : Editor 11 | { 12 | private string _deepLinkURL = ""; 13 | 14 | public override void OnInspectorGUI() 15 | { 16 | base.OnInspectorGUI(); 17 | 18 | if (Application.isPlaying) 19 | { 20 | var receiver = (DeepLinkReceiver)target; 21 | if (receiver != null) 22 | { 23 | GUILayout.Space(20); 24 | GUILayout.Label("Test Deep Link:", EditorStyles.boldLabel); 25 | _deepLinkURL = EditorGUILayout.TextField("URL: ", _deepLinkURL); 26 | if (GUILayout.Button("Trigger Deep Link")) 27 | receiver.onDeepLinkActivated?.Invoke(_deepLinkURL); 28 | } 29 | } 30 | } 31 | } 32 | } 33 | #endif -------------------------------------------------------------------------------- /Utils/Input/MobileInput.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Replay.Utils 4 | { 5 | public class MobileInput : InputPlatform 6 | { 7 | //public override bool GetPointer() => Input.touchCount > 0; 8 | public override bool GetPointer() => Input.touchCount == 1; 9 | public override bool GetPointerDown() 10 | { 11 | if (GetPointer()) 12 | return Input.GetTouch(0).phase == TouchPhase.Began; 13 | else 14 | return false; 15 | } 16 | public override bool GetPointerUp() 17 | { 18 | if (GetPointer()) 19 | return Input.GetTouch(0).phase == TouchPhase.Ended; 20 | else 21 | return false; 22 | } 23 | //public override Vector2 GetPointerPosition() => Input.mousePosition; 24 | public override Vector2 GetPointerPosition() 25 | { 26 | 27 | if (Input.touchCount > 0) 28 | return Input.GetTouch(0).position; 29 | return Vector2.zero; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Utils/UI/Sorting/SortingOrder.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils.UI 6 | { 7 | public enum SortingOrder 8 | { 9 | undef = -1, 10 | 11 | UI = 1000, 12 | HUD = 5000, 13 | 14 | UILevel2 = 10000, 15 | HUDLevel2 = 15000, 16 | 17 | UILevel3 = 20000, 18 | HUDLevel3 = 25000, 19 | 20 | StoreOrSettings = 29000, 21 | 22 | HUDStats = 29500, 23 | 24 | ModalDialog = 30000, 25 | 26 | DropDownContent = 31500, 27 | 28 | Transition = 32000, 29 | 30 | DebugInfo = 32100, 31 | 32 | AboveAll = 32500 33 | } 34 | 35 | public static class SortingOrderExtensions 36 | { 37 | public static void SetOn(this SortingOrder sortingOrder, Canvas canvas, int orderInGroup = 0) 38 | { 39 | if(sortingOrder != SortingOrder.undef) 40 | canvas.sortingOrder = sortingOrder.intValue() + orderInGroup; 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Utils/Performance/ParticleCleanup.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Replay.Utils 5 | { 6 | public class ParticleCleanup : MonoBehaviour 7 | { 8 | private readonly HashSet _particleSystems = new(); 9 | // Start is called once before the first execution of Update after the MonoBehaviour is created 10 | private void OnEnable() 11 | { 12 | FindParticleSystems(); 13 | } 14 | 15 | private void OnDisable() 16 | { 17 | ClearParticleSystems(); 18 | } 19 | 20 | void FindParticleSystems() 21 | { 22 | var particleSystems = GetComponentsInChildren(); 23 | if (particleSystems != null && !particleSystems.IsEmpty()) 24 | _particleSystems.AddRange(particleSystems); 25 | 26 | } 27 | 28 | public void ClearParticleSystems() 29 | { 30 | foreach (var ps in _particleSystems) 31 | { 32 | if (ps != null && ps.IsAlive()) 33 | ps.Clear(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Utils/Serializer/ISerializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils 6 | { 7 | interface ISerializer 8 | { 9 | void SetBool(string key, bool value); 10 | void SetInt(string key, int value); 11 | void SetFloat(string key, float value); 12 | void SetDouble(string key, double value); 13 | void SetString(string key, string value, bool saveToDeviceAccount = false); 14 | 15 | bool GetBool(string key); 16 | bool GetBool(string key, bool defaultValue); 17 | 18 | int GetInt(string key); 19 | int GetInt(string key, int defaultValue); 20 | 21 | float GetFloat(string key); 22 | float GetFloat(string key, float defaultValue); 23 | 24 | double GetDouble(string key); 25 | double GetDouble(string key, double defaultValue); 26 | 27 | string GetString(string key); 28 | string GetString(string key, string defaultValue, bool loadFromDeviceAccount = false); 29 | 30 | void DeleteAll(bool deleteFromDeviceAccount = true); 31 | void DeleteKey(string key, bool deleteFromDeviceAccount = true); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Utils/Input/InputHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils 6 | { 7 | public class InputHandler : MonoBehaviour 8 | { 9 | public enum Platform 10 | { 11 | MOBILE, 12 | DESKTOP 13 | } 14 | public Platform inputPlatform = Platform.DESKTOP; 15 | private Dictionary _platformInput = new Dictionary(); 16 | public Action PointerUp; 17 | private void Awake() 18 | { 19 | _platformInput.Add(Platform.MOBILE, new MobileInput()); 20 | _platformInput.Add(Platform.DESKTOP, new DesktopInput()); 21 | } 22 | private void Update() 23 | { 24 | if (GetPointerUp()) 25 | PointerUp?.Invoke(); 26 | } 27 | public bool GetPointerDown() => _platformInput[inputPlatform].GetPointerDown(); 28 | public bool GetPointer() => _platformInput[inputPlatform].GetPointer(); 29 | public bool GetPointerUp() => _platformInput[inputPlatform].GetPointerUp(); 30 | public Vector2 GetPointerPosition() => _platformInput[inputPlatform].GetPointerPosition(); 31 | } 32 | } -------------------------------------------------------------------------------- /Utils/Extensions/ScrollRectExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace Replay.Utils 7 | { 8 | public static class ScrollRectExtensions 9 | { 10 | public static Vector2 GetSnapToPositionToBringChildIntoView(this ScrollRect scrollRect, RectTransform child) 11 | { 12 | Canvas.ForceUpdateCanvases(); 13 | Vector2 viewportLocalPosition = scrollRect.viewport.localPosition; 14 | Vector2 childLocalPosition = child.localPosition; 15 | Vector2 result = new Vector2( 16 | 0 - (viewportLocalPosition.x + childLocalPosition.x), 17 | 0 - (viewportLocalPosition.y + childLocalPosition.y) 18 | ); 19 | return result; 20 | } 21 | 22 | public static void SnapTo(this ScrollRect scrollRect, RectTransform target) 23 | { 24 | Canvas.ForceUpdateCanvases(); 25 | 26 | var content = scrollRect.content; 27 | content.anchoredPosition = 28 | (Vector2)scrollRect.transform.InverseTransformPoint(content.position) 29 | - (Vector2)scrollRect.transform.InverseTransformPoint(target.position); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Utils/iCloudPlugin/KeychainPlugin.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Replay.Utils 4 | { 5 | public static class KeychainPlugin 6 | { 7 | #if UNITY_IOS && !UNITY_EDITOR 8 | [DllImport("__Internal")] 9 | private static extern bool _SaveToKeychain(string key, string value); 10 | 11 | [DllImport("__Internal")] 12 | private static extern string _LoadFromKeychain(string key); 13 | 14 | [DllImport("__Internal")] 15 | private static extern bool _DeleteFromKeychain(string key); 16 | #endif 17 | 18 | public static bool SetString(string key, string value) 19 | { 20 | #if UNITY_IOS && !UNITY_EDITOR 21 | return _SaveToKeychain(key, value); 22 | #else 23 | return true; 24 | #endif 25 | } 26 | 27 | public static string GetString(string key) 28 | { 29 | #if UNITY_IOS && !UNITY_EDITOR 30 | return _LoadFromKeychain(key); 31 | #else 32 | return null; 33 | #endif 34 | } 35 | 36 | public static bool DeleteKey(string key) 37 | { 38 | #if UNITY_IOS && !UNITY_EDITOR 39 | return _DeleteFromKeychain(key); 40 | #else 41 | return true; 42 | #endif 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Utils/Serializer/ObjectGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEditor; 5 | using UnityEngine; 6 | using Object = UnityEngine.Object; 7 | 8 | namespace Replay.Utils 9 | { 10 | 11 | 12 | 13 | [Serializable] 14 | public class ObjectGroup where T : Object 15 | { 16 | public List objects; 17 | 18 | public T activeObject => objects[_activeIndex]; 19 | 20 | 21 | private int _activeIndex = 0; 22 | public int activeIndex 23 | { 24 | get => _activeIndex; 25 | set 26 | { 27 | _activeIndex = value; 28 | for (int i = 0; i < objects.Count; i++) 29 | { 30 | T obj = objects[i]; 31 | if (obj == null) continue; 32 | 33 | GameObject o = null; 34 | 35 | if (obj is GameObject) 36 | o = obj as GameObject; 37 | else if(obj is Component) 38 | { 39 | var c = obj as Component; 40 | o = c?.gameObject; 41 | } 42 | 43 | o?.SetActive(i == _activeIndex); 44 | } 45 | 46 | } 47 | } 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /Utils/UI/Sorting/CanvasOrderSorter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Replay.Utils.UI; 3 | using SortingLayer = Replay.Utils.UI.SortingLayer; 4 | 5 | [RequireComponent(typeof(Canvas))] 6 | public class CanvasOrderSorter : MonoBehaviour 7 | { 8 | [Header("Canvas Sorting Order Groupped:")] 9 | public SortingOrder canvasSortingOrderGroup = SortingOrder.undef; 10 | public int canvasSortingOrderInGroup = 0; 11 | 12 | [Header("World Space Only:")] 13 | public SortingLayer canvasSortingLayer = SortingLayer.Default; 14 | 15 | void Awake() 16 | { 17 | ApplyCanvasSorting(); 18 | } 19 | 20 | Canvas _canvas = null; 21 | public Canvas canvas 22 | { 23 | get { 24 | if(_canvas == null) 25 | _canvas = GetComponent(); 26 | return _canvas; 27 | } 28 | } 29 | 30 | public void ApplyCanvasSorting() 31 | { 32 | canvas.overrideSorting = true; 33 | canvasSortingLayer.SetOn(canvas); 34 | canvasSortingOrderGroup.SetOn(canvas, canvasSortingOrderInGroup); 35 | } 36 | public int sortingOrder 37 | { 38 | get => canvas.sortingOrder; 39 | set => canvas.sortingOrder = value; 40 | } 41 | public int sortingLayerID 42 | { 43 | get => canvas.sortingLayerID; 44 | set => canvas.sortingLayerID = value; 45 | } 46 | 47 | public string sortingLayerName 48 | { 49 | get => canvas.sortingLayerName; 50 | set => canvas.sortingLayerName = value; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Utils/Types.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Replay.Utils 4 | { 5 | public class Lazy 6 | { 7 | private volatile bool _isInitialized; 8 | private T _value; 9 | private readonly Func _initializer; 10 | private readonly object _lock = new object(); 11 | 12 | public T Value 13 | { 14 | get 15 | { 16 | if (!_isInitialized) 17 | { 18 | lock (_lock) 19 | { 20 | if (!_isInitialized) 21 | { 22 | try 23 | { 24 | _value = _initializer(); 25 | } 26 | finally 27 | { 28 | _isInitialized = true; 29 | } 30 | } 31 | } 32 | } 33 | return _value; 34 | } 35 | } 36 | 37 | public bool IsValueCreated => _isInitialized; 38 | 39 | public void Reset() 40 | { 41 | lock (_lock) 42 | { 43 | _isInitialized = false; 44 | _value = default; 45 | } 46 | } 47 | 48 | public static implicit operator T(Lazy l) => l.Value; 49 | 50 | public Lazy(Func initializer) 51 | { 52 | _initializer = initializer ?? throw new ArgumentNullException(nameof(initializer)); 53 | _isInitialized = false; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Utils/Tools/ReplayTimer.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | public class ReplayTimer 4 | { 5 | Stopwatch _stopWatch = new Stopwatch(); 6 | bool _isTicking = false; 7 | bool _paused = false; 8 | public void StartTimer() 9 | { 10 | _stopWatch.Restart(); 11 | _isTicking = true; 12 | _paused = false; 13 | } 14 | public void ResetTimer() 15 | { 16 | _stopWatch.Restart(); 17 | _isTicking = true; 18 | _paused = false; 19 | } 20 | 21 | public void StopTimer() 22 | { 23 | _stopWatch.Stop(); 24 | _isTicking = false; 25 | _paused = false; 26 | } 27 | 28 | public bool isTicking => _isTicking; 29 | 30 | public bool paused 31 | { 32 | get => _paused; 33 | set 34 | { 35 | if (_paused != value) 36 | { 37 | _paused = value; 38 | if (_paused) 39 | _stopWatch.Stop(); 40 | else if (_isTicking) 41 | _stopWatch.Start(); 42 | } 43 | } 44 | } 45 | public long elapsedMilliseconds => _stopWatch.ElapsedMilliseconds; 46 | public double elapsedSeconds => elapsedMilliseconds / 1000F; 47 | 48 | public double GetCountdownSeconds(double duration) 49 | { 50 | double retVal = duration - elapsedSeconds; 51 | 52 | if (retVal < 0F) 53 | retVal = 0F; 54 | 55 | return retVal; 56 | } 57 | 58 | public double GetElapsedTimeSeconds() 59 | => elapsedSeconds; 60 | 61 | public bool GetIsExpired(double duration) => GetCountdownSeconds(duration) <= 1F; 62 | } 63 | -------------------------------------------------------------------------------- /Utils/Serializer/Types/SerializableDateTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils 6 | { 7 | [Serializable] 8 | public class SerializableDateTime 9 | { 10 | [SerializeField] public long ticks; 11 | [SerializeField] public DateTimeKind kind; 12 | 13 | public SerializableDateTime(DateTime dateTime) 14 | { 15 | ticks = dateTime.Ticks; 16 | kind = dateTime.Kind; 17 | } 18 | 19 | public DateTime ToDateTime() => 20 | new (ticks, kind); 21 | } 22 | 23 | [Serializable] 24 | [JsonConverter(typeof(SerializableDateJsonConverter))] 25 | public class SerializableDate 26 | { 27 | public enum Month 28 | { 29 | January = 1, 30 | February = 2, 31 | March = 3, 32 | April = 4, 33 | May = 5, 34 | June = 6, 35 | July = 7, 36 | August = 8, 37 | September = 9, 38 | October = 10, 39 | November = 11, 40 | December = 12 41 | } 42 | [SerializeField] public Month month = (Month)DateTime.Now.Month; 43 | [SerializeField] [Range(1, 31)] public int day = DateTime.Now.Day; 44 | [SerializeField] public int year = DateTime.Now.Year; 45 | 46 | public void SetDate(DateTime date) 47 | { 48 | month = (Month)date.Month; 49 | day = date.Day; 50 | year = date.Year; 51 | } 52 | 53 | public DateTime ToDateTime() => 54 | new (year, month.intValue(), day); 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /Utils/Logger/IDebugLoggable.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Replay.Utils 4 | { 5 | public interface IDebugLoggable 6 | { 7 | string ToDebugString() 8 | => ToString(); 9 | string logTag => GetType().Name; 10 | string ToDebugStringWithLogs() 11 | => ToDebugString() + "\n\nLogs:\n" + this.GetLogs(); 12 | } 13 | 14 | //TODO: make Dev a member and call this.Dev.Log() 15 | public static class IDebugLoggableExtensions 16 | { 17 | public static string ToDebugStringWithLogs(this IDebugLoggable loggable) 18 | => loggable.ToDebugString() + "\n\nLogs:\n" + loggable.GetLogs(); 19 | //get logs 20 | public static string GetLogs(this IDebugLoggable loggable) 21 | => Logger.Instance.GetLogs(loggable.logTag); 22 | 23 | //debug logs 24 | public static void Log(this IDebugLoggable loggable, string message) 25 | => Debug.Log(Dev.ResolveMessageWithTag(message, loggable.logTag)); 26 | 27 | public static void LogWarning(this IDebugLoggable loggable, string message) 28 | => Debug.LogWarning(Dev.ResolveMessageWithTag(message, loggable.logTag)); 29 | 30 | public static void LogError(this IDebugLoggable loggable, string message) 31 | => Debug.LogError(Dev.ResolveMessageWithTag(message, loggable.logTag)); 32 | 33 | //dev logs 34 | public static void DevLog(this IDebugLoggable loggable, string message) 35 | => Dev.Log(message, loggable.logTag); 36 | 37 | public static void DevLogWarning(this IDebugLoggable loggable, string message) 38 | => Dev.LogWarning(message, loggable.logTag); 39 | 40 | public static void DevLogError(this IDebugLoggable loggable, string message) 41 | => Dev.LogError(message, loggable.logTag); 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /Utils/Extensions/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace Replay.Utils 7 | { 8 | public static class EnumExtensions 9 | { 10 | public static string ConvertToString(this Enum enumValue) => Enum.GetName(enumValue.GetType(), enumValue); 11 | public static EnumType ConvertToEnum(this string enumValue) => (EnumType) Enum.Parse(typeof(EnumType), enumValue); 12 | 13 | public static int intValue(this Enum enumValue) => (int)(object)enumValue; 14 | 15 | public static int ValueIndex(this T enumValue) where T : Enum 16 | { 17 | T[] array = (T[])Enum.GetValues(typeof(T)); 18 | return Array.IndexOf(array, enumValue); 19 | } 20 | 21 | public static bool IsLast(this T enumValue) where T : Enum 22 | { 23 | T[] array = (T[])Enum.GetValues(typeof(T)); 24 | int i = Array.IndexOf(array, enumValue); 25 | return i >= array.Length - 1; 26 | } 27 | 28 | public static bool IsFirst(this T enumValue) where T : Enum 29 | { 30 | int i = ValueIndex(enumValue); 31 | return i <= 0; 32 | } 33 | public static T Next(this T enumValue) where T : Enum 34 | { 35 | //return (T)(((int)enumValue + 1) % Enum.GetValues(typeof(T)).Length); 36 | 37 | T[] array = (T[])Enum.GetValues(typeof(T)); 38 | int i = Array.IndexOf(array, enumValue) + 1; 39 | return (i >= array.Length) ? array[0] : array[i]; 40 | } 41 | 42 | public static T Previous(this T enumValue) where T : Enum 43 | { 44 | T[] array = (T[])Enum.GetValues(typeof(T)); 45 | int i = Array.IndexOf(array, enumValue) - 1; 46 | return (i < 0) ? array[array.Length - 1] : array[i]; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Utils/Serializer/Types/SerializableDateJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Linq; 4 | using Replay.Utils; 5 | 6 | public class SerializableDateJsonConverter : JsonConverter 7 | { 8 | public override bool CanConvert(Type objectType) 9 | { 10 | return objectType == typeof(SerializableDate); 11 | } 12 | 13 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 14 | { 15 | if (reader.TokenType == JsonToken.Null) 16 | return null; 17 | 18 | JObject jsonObject = JObject.Load(reader); 19 | var retVal = existingValue as SerializableDate ?? new SerializableDate(); 20 | 21 | if (jsonObject["month"] != null) 22 | { 23 | string monthString = jsonObject["month"].ToString(); 24 | if (Enum.TryParse(monthString, true, out var month)) 25 | retVal.month = month; 26 | } 27 | 28 | if (jsonObject["day"] != null) 29 | retVal.day = jsonObject["day"].Value(); 30 | 31 | if (jsonObject["year"] != null) 32 | retVal.year = jsonObject["year"].Value(); 33 | 34 | return retVal; 35 | } 36 | 37 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 38 | { 39 | if (value == null) 40 | { 41 | writer.WriteNull(); 42 | return; 43 | } 44 | 45 | SerializableDate date = (SerializableDate)value; 46 | 47 | writer.WriteStartObject(); 48 | writer.WritePropertyName("month"); 49 | writer.WriteValue(date.month.ToString()); 50 | writer.WritePropertyName("day"); 51 | writer.WriteValue(date.day); 52 | writer.WritePropertyName("year"); 53 | writer.WriteValue(date.year); 54 | writer.WriteEndObject(); 55 | } 56 | } -------------------------------------------------------------------------------- /Utils/SharePlugin/ShareSheet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Replay.Utils; 4 | 5 | 6 | //public class SharePlugin : MonoBehaviour 7 | public class ShareSheet : Singleton, IDebugLoggable 8 | { 9 | public string logTag => "ShareSheet"; 10 | delegate void on_complete_native_type(bool completed); 11 | private Action _onComplete; 12 | 13 | #if UNITY_IOS 14 | [DllImport("__Internal")] 15 | private static extern void ShowShareSheet(string message, string imagePath, on_complete_native_type onCompleteFunc); 16 | #endif 17 | 18 | public void ShowShareSheet(string message, string imagePath, Action onComplete = null) 19 | { 20 | _onComplete = onComplete; 21 | #if UNITY_EDITOR 22 | this.Log("Running on Unity Editor!"); 23 | 24 | //Mock 25 | CoroutineUtils.Delay(2.0f, () => 26 | { 27 | OnCompleteNative(true); 28 | }); 29 | #else 30 | #if UNITY_IOS 31 | this.Log("Running on iOS!"); 32 | ShowShareSheet(message, imagePath, (on_complete_native_type)OnCompleteNative); 33 | #elif UNITY_ANDROID 34 | // This code only runs on Android 35 | this.Log("Running on Android!"); 36 | // Android-specific API calls 37 | #else 38 | // This code runs on all other platforms 39 | this.Log("Running on Unknown Platform!"); 40 | 41 | //Mock 42 | CoroutineUtils.Delay(2.0f, () => 43 | { 44 | OnCompleteNative(); 45 | }); 46 | #endif 47 | #endif 48 | } 49 | 50 | [AOT.MonoPInvokeCallback(typeof(on_complete_native_type))] 51 | public static void OnCompleteNative(bool completed) 52 | { 53 | ThreadUtils.Instance.ExecuteOnMainThreadUpdate(() => 54 | { 55 | if (IsLoaded) 56 | Instance.OnComplete(completed); 57 | }); 58 | } 59 | public void OnComplete(bool completed) 60 | { 61 | _onComplete?.Invoke(completed); 62 | Unload(); 63 | } 64 | } -------------------------------------------------------------------------------- /Utils/UI/ScrollRect/ScrollRectClicker.cs: -------------------------------------------------------------------------------- 1 | using Replay.Utils; 2 | using UnityEngine; 3 | using UnityEngine.EventSystems; 4 | 5 | public class ScrollRectClicker : MonoBehaviour, IBeginDragHandler, IEndDragHandler 6 | { 7 | public enum ScrollMode { All = 0, Vertical = 10, Horizontal = 20 } 8 | [SerializeField] private ScrollMode scrollMode = ScrollMode.All; 9 | [SerializeField] private float maxClickableDistance = 20F; 10 | 11 | ScrollRectClickerComponent[] GetClickers() => GetComponentsInChildren(); 12 | 13 | private Vector2 _startPos; 14 | public void OnBeginDrag (PointerEventData data) 15 | { 16 | _startPos = data.position; 17 | var clickers = GetClickers(); 18 | foreach (var clicker in clickers) 19 | clicker.OnScrollRectBeginDrag(data); 20 | } 21 | 22 | public void OnEndDrag (PointerEventData data) 23 | { 24 | 25 | var clickers = GetClickers(); 26 | foreach (var clicker in clickers) 27 | clicker.OnScrollRectEndDrag(data); 28 | 29 | float distance; 30 | 31 | switch (scrollMode) 32 | { 33 | 34 | case ScrollMode.Vertical: 35 | distance = Mathf.Abs(_startPos.y - data.position.y); 36 | break; 37 | case ScrollMode.Horizontal: 38 | distance = Mathf.Abs(_startPos.x - data.position.x); 39 | break; 40 | case ScrollMode.All: 41 | default: 42 | distance = Vector2.Distance (_startPos, data.position); 43 | break; 44 | } 45 | 46 | if (distance < maxClickableDistance) { 47 | foreach (var clicker in clickers) 48 | { 49 | var raycastObject = data.pointerCurrentRaycast.gameObject; 50 | if(clicker.gameObject.HasChildObject(raycastObject)) 51 | clicker.OnScrollRectClick(data); 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Utils/ThreadUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using Replay.Utils; 5 | using UnityEngine; 6 | using UnityEngine.Scripting; 7 | 8 | public class ThreadUtils : ComponentSingleton, IDebugLoggable 9 | { 10 | [Preserve] 11 | public static bool ShouldCreateOwnGameObject() => true; 12 | [Preserve] 13 | public static bool ShouldEnableDontDestroyOnLoad() => true; 14 | //[Preserve] 15 | //public static bool ShouldNotRenameGameObject() => true; 16 | 17 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] 18 | private static void Initialize() => 19 | Load(); 20 | 21 | volatile bool _queued = false; 22 | List _backlog = new (8); 23 | List _actions = new (8); 24 | 25 | public void ExecuteOnMainThread(Action action) 26 | { 27 | var mainThreadContext = System.Threading.SynchronizationContext.Current; 28 | mainThreadContext.Post(_ => action?.Invoke(), null); 29 | } 30 | public void RunAsync(Action action) { 31 | ThreadPool.QueueUserWorkItem(o => action()); 32 | } 33 | 34 | public void RunAsync(Action action, object state) { 35 | ThreadPool.QueueUserWorkItem(o => action(o), state); 36 | } 37 | 38 | public void ExecuteOnMainThreadUpdate(Action action) 39 | { 40 | lock(_backlog) { 41 | _backlog.Add(action); 42 | _queued = true; 43 | } 44 | } 45 | 46 | private void Update() 47 | { 48 | if(_queued) 49 | { 50 | lock(_backlog) { 51 | (_actions, _backlog) = (_backlog, _actions); 52 | _queued = false; 53 | } 54 | 55 | foreach(var action in _actions) 56 | action(); 57 | 58 | _actions.Clear(); 59 | } 60 | } 61 | 62 | public string ToDebugString() 63 | { 64 | var count = _actions.Count; 65 | return $"Jobs Count: {count}"; 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /Utils/Serializer/LocalSerializerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | using UnityEngine; 5 | 6 | namespace Replay.Utils 7 | { 8 | public static class LocalSerializerExtensions 9 | { 10 | public static bool SetList(this LocalSerializer serializer, string key, List values) 11 | { 12 | bool retVal = false; 13 | try 14 | { 15 | string jsonString = JsonConvert.SerializeObject(values, Formatting.None); 16 | serializer.SetString(key, jsonString); 17 | retVal = true; 18 | } 19 | catch (Exception e) 20 | { 21 | Debug.LogError(e); 22 | retVal = false; 23 | } 24 | 25 | return retVal; 26 | } 27 | 28 | public static bool SetHashSet(this LocalSerializer serializer, string key, HashSet values) 29 | { 30 | bool retVal = false; 31 | try 32 | { 33 | string jsonString = JsonConvert.SerializeObject(values, Formatting.None); 34 | serializer.SetString(key, jsonString); 35 | retVal = true; 36 | } 37 | catch (Exception e) 38 | { 39 | Debug.LogError(e); 40 | retVal = false; 41 | } 42 | 43 | return retVal; 44 | } 45 | 46 | public static HashSet GetHashSet(this LocalSerializer serializer, string key, HashSet defaultValue = null) 47 | { 48 | string jsonString = serializer.GetString(key, null); 49 | if (!string.IsNullOrEmpty(jsonString)) 50 | { 51 | HashSet retVal = new(); 52 | try 53 | { 54 | JsonConvert.PopulateObject(jsonString, retVal); 55 | } 56 | catch (Exception e) 57 | { 58 | Debug.LogError(e); 59 | } 60 | 61 | return retVal; 62 | } 63 | return defaultValue; 64 | } 65 | 66 | } 67 | } -------------------------------------------------------------------------------- /Utils/Extensions/MonoBehaviourExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace Replay.Utils 7 | { 8 | public static class MonoBehaviourExtensions 9 | { 10 | 11 | //call "this.Delay(...)" in order to use this extension 12 | public static Coroutine Delay(this MonoBehaviour monoBehavior, float delayTime, Action action) => monoBehavior.StartCoroutine(CoroutineUtils.DelayCoroutine(delayTime, action)); 13 | public static Coroutine NextFrame(this MonoBehaviour monoBehavior, Action action) => monoBehavior.StartCoroutine(CoroutineUtils.NextFrameCoroutine(action)); 14 | public static Coroutine SkipFrames(this MonoBehaviour monoBehavior, int frameCount, Action action) => monoBehavior.StartCoroutine(CoroutineUtils.SkipFramesCoroutine(frameCount, action)); 15 | public static Coroutine NextFixedUpdate(this MonoBehaviour monoBehavior, Action action) => monoBehavior.StartCoroutine(CoroutineUtils.NextFixedUpdateCoroutine(action)); 16 | public static Coroutine WaitWhile(this MonoBehaviour monoBehavior, Func condition, Action action) => monoBehavior.StartCoroutine(CoroutineUtils.WaitWhileCoroutine(condition, action)); 17 | public static Coroutine WaitUntil(this MonoBehaviour monoBehavior, Func condition, Action action) => monoBehavior.StartCoroutine(CoroutineUtils.WaitUntilCoroutine(condition, action)); 18 | 19 | //Stop And null Coroutine 20 | public static void StopAndNullCoroutine(this MonoBehaviour monoBehavior, ref Coroutine coroutine) 21 | { 22 | if (monoBehavior.IsLoaded() && coroutine != null) 23 | { 24 | try 25 | { 26 | monoBehavior.StopCoroutine(coroutine); 27 | } 28 | catch (Exception e) 29 | { 30 | Debug.LogError("StopAndNullCoroutine threw an exception: " + e.Message); 31 | } 32 | } 33 | 34 | coroutine = null; 35 | } 36 | 37 | //Canvas 38 | public static RectTransform GetRectTransform(this MonoBehaviour monoBehavior) => monoBehavior.GetComponent(); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/Singleton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace Replay.Utils 7 | { 8 | public abstract class Singleton where T : Singleton, new() 9 | { 10 | private static T _Instance = null; 11 | public static T Instance 12 | { 13 | get 14 | { 15 | if(_Instance == null) 16 | { 17 | _Instance = new T(); 18 | _Instance._LoadingSequenceImpl(); 19 | _Instance.Init(); 20 | } 21 | 22 | 23 | return _Instance; 24 | } 25 | } 26 | 27 | public static T WeakInstance { get => IsLoaded ? Instance : null; } 28 | 29 | public static bool IsLoaded 30 | { 31 | get => _Instance != null; 32 | set 33 | { 34 | if (value) 35 | { 36 | if (!IsLoaded) 37 | Load(); 38 | } 39 | else 40 | { 41 | if (IsLoaded) 42 | Unload(); 43 | } 44 | } 45 | } 46 | public static T Load() 47 | { 48 | return Instance; 49 | } 50 | 51 | public static void Unload() 52 | { 53 | if (IsLoaded) 54 | { 55 | _Instance.Deinit(); 56 | _Instance = null; 57 | } 58 | 59 | 60 | } 61 | //protected: 62 | protected virtual void Init() { } 63 | protected virtual void Deinit() { } 64 | 65 | 66 | //startup 67 | private void _LoadingSequenceImpl() 68 | { 69 | SingletonUtils.HandleStartupInterfaceSupport(this); 70 | } 71 | 72 | protected static string GetClassName() => ClassExtensions.GetClassName(); 73 | 74 | #if FINALIZER_LOGS_ENABLED 75 | ~Singleton() 76 | { 77 | Debug.LogWarning("Finalizer: Singleton: "+ GetClassName()); 78 | } 79 | #endif 80 | } 81 | } 82 | 83 | 84 | -------------------------------------------------------------------------------- /Utils/CoroutineUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | using UnityEngine.Scripting; 5 | 6 | namespace Replay.Utils 7 | { 8 | public class CoroutineUtils : ComponentSingleton, IDebugLoggable 9 | { 10 | [Preserve] 11 | public static bool ShouldCreateOwnGameObject() => true; 12 | [Preserve] 13 | public static bool ShouldEnableDontDestroyOnLoad() => true; 14 | //[Preserve] 15 | //public static bool ShouldNotRenameGameObject() => true; 16 | 17 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] 18 | private static void Initialize() => 19 | Load(); 20 | 21 | //Coroutines 22 | public static IEnumerator DelayCoroutine(float delayTime, Action action) { yield return new WaitForSeconds(delayTime); action?.Invoke(); } 23 | public static IEnumerator NextFrameCoroutine(Action action) { yield return null; action?.Invoke(); } 24 | public static IEnumerator SkipFramesCoroutine(int frameCount, Action action) 25 | { 26 | for (int i = 0; i < frameCount; i++) 27 | yield return null; 28 | action?.Invoke(); 29 | } 30 | public static IEnumerator NextFixedUpdateCoroutine(Action action) { yield return new WaitForFixedUpdate(); action?.Invoke(); } 31 | public static IEnumerator WaitWhileCoroutine(Func condition, Action action) { yield return new WaitWhile(condition); action?.Invoke(); } 32 | public static IEnumerator WaitUntilCoroutine(Func condition, Action action) { yield return new WaitUntil(condition); action?.Invoke(); } 33 | 34 | //Factories (additional factories see in MonoBehaviorExtensions) 35 | public static Coroutine Delay(float delayTime, Action action) => Instance.StartCoroutine(DelayCoroutine(delayTime, action)); 36 | public static Coroutine NextFrame(Action action) => Instance.StartCoroutine(NextFrameCoroutine(action)); 37 | public static Coroutine SkipFrames(int frameCount, Action action) => Instance.StartCoroutine(SkipFramesCoroutine(frameCount, action)); 38 | public static Coroutine NextFixedUpdate(Action action) =>Instance.StartCoroutine(NextFixedUpdateCoroutine(action)); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Utils/Extensions/DateTimeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Replay.Utils { 4 | public static class DateTimeExtensions 5 | { 6 | public static int GetDaysBetween(this DateTime startDateTimeLocal, DateTime endDateTimeLocal, bool absolute = false) 7 | { 8 | // Normalize to midnight (remove time component) 9 | DateTime startDateLocal = startDateTimeLocal.Date; 10 | DateTime endDateLocal = endDateTimeLocal.Date; 11 | 12 | // Calculate days between the two dates 13 | TimeSpan span = endDateLocal - startDateLocal; 14 | int retVal = absolute ? Math.Abs(span.Days) : span.Days; 15 | return retVal; 16 | } 17 | 18 | public static string ToDisplayString(this DateTime dateTime) 19 | { 20 | //convert to format: SEPTEMBER 9, 2025 21 | return dateTime.ToString("MMMM d, yyyy"); 22 | } 23 | public static string ToLoggerString(this DateTime dateTime, bool hasBrackets = true) 24 | { 25 | string retVal = dateTime.ToString("MMM-dd HH:mm:ss"); 26 | if (hasBrackets) 27 | retVal = retVal.ToBracketedString(); 28 | return retVal; 29 | } 30 | public static string ToDateString(this DateTime dateTime, bool hasBrackets = true) 31 | { 32 | string retVal = dateTime.ToString("MMM-dd"); 33 | if (hasBrackets) 34 | retVal = retVal.ToBracketedString(); 35 | return retVal; 36 | } 37 | public static string ToLoggerStringFull(this DateTime dateTime, bool hasYear = false, bool hasBrackets = true) 38 | { 39 | string timeZoneAbbr = "UTC"; 40 | if (dateTime.Kind == DateTimeKind.Local) 41 | { 42 | TimeZoneInfo timeZone = TimeZoneInfo.Local; 43 | timeZoneAbbr = timeZone.IsDaylightSavingTime(dateTime) ? 44 | timeZone.DaylightName.Split(' ')[0] : 45 | timeZone.StandardName.Split(' ')[0]; 46 | } 47 | 48 | string retVal = dateTime.ToString(hasYear ? "MMM-dd-yyyy HH:mm:ss" : "MMM-dd HH:mm:ss") + " " + timeZoneAbbr; 49 | if (hasBrackets) 50 | retVal = retVal.ToBracketedString(); 51 | return retVal; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Utils/SharePlugin/Plugins/iOS/ShareSheet.m: -------------------------------------------------------------------------------- 1 | //share sheet iOS Plugin 2 | 3 | #import "ShareSheet.h" 4 | #import 5 | #import 6 | 7 | void ShowShareSheet(const char *message, const char* imagePath, on_complete_native_type onCompleteFunc) 8 | { 9 | NSString *nsMessage = [NSString stringWithUTF8String:message]; 10 | 11 | UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController; 12 | 13 | NSMutableArray *activityItems = [NSMutableArray arrayWithObject:nsMessage]; 14 | 15 | if (imagePath != nil) 16 | { 17 | NSString *nsImagePath = [NSString stringWithUTF8String:imagePath]; 18 | UIImage *screenshot = [UIImage imageWithContentsOfFile:nsImagePath]; 19 | if (screenshot != nil) 20 | [activityItems addObject:screenshot]; 21 | } 22 | 23 | UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil]; 24 | 25 | // Set the excluded activity types 26 | activityViewController.excludedActivityTypes = @[UIActivityTypePostToWeibo, 27 | UIActivityTypePrint, 28 | UIActivityTypeCopyToPasteboard, 29 | UIActivityTypeAssignToContact, 30 | UIActivityTypeSaveToCameraRoll, 31 | UIActivityTypeAddToReadingList, 32 | UIActivityTypePostToTencentWeibo, 33 | UIActivityTypeAirDrop, 34 | UIActivityTypeOpenInIBooks, 35 | UIActivityTypeMarkupAsPDF, 36 | @"com.apple.reminders.sharingextension", 37 | @"com.apple.mobilenotes.SharingExtension"]; 38 | 39 | 40 | [activityViewController setCompletionWithItemsHandler:^(UIActivityType activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) { 41 | //Callback to Unity 42 | if(onCompleteFunc != nil) 43 | onCompleteFunc(completed); 44 | }]; 45 | [rootViewController presentViewController:activityViewController animated:YES completion:nil]; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Utils/Serializer/ConditionalIgnorePropertiesResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Serialization; 6 | 7 | namespace Replay.Utils 8 | { 9 | /// 10 | /// Contract resolver that conditionally ignores properties based on a predicate function. 11 | /// Used for version-based serialization where deprecated fields are omitted in newer versions. 12 | /// 13 | public class ConditionalIgnorePropertiesResolver : DefaultContractResolver 14 | { 15 | private readonly HashSet alwaysIgnoreProps; 16 | private readonly HashSet conditionalIgnoreProps; 17 | private readonly Func shouldIgnoreConditionalProps; 18 | 19 | /// 20 | /// Creates a resolver that can conditionally ignore properties based on the object being serialized. 21 | /// 22 | /// Properties to always ignore 23 | /// Properties to ignore based on predicate 24 | /// Function that determines if conditional properties should be ignored 25 | public ConditionalIgnorePropertiesResolver( 26 | IEnumerable alwaysIgnore, 27 | IEnumerable conditionalIgnore, 28 | Func shouldIgnorePredicate) 29 | { 30 | alwaysIgnoreProps = new HashSet(alwaysIgnore ?? new string[0]); 31 | conditionalIgnoreProps = new HashSet(conditionalIgnore ?? new string[0]); 32 | shouldIgnoreConditionalProps = shouldIgnorePredicate ?? (_ => false); 33 | } 34 | 35 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 36 | { 37 | JsonProperty property = base.CreateProperty(member, memberSerialization); 38 | 39 | // Always ignore these properties 40 | if (alwaysIgnoreProps.Contains(property.PropertyName)) 41 | { 42 | property.ShouldSerialize = _ => false; 43 | } 44 | // Conditionally ignore based on predicate 45 | else if (conditionalIgnoreProps.Contains(property.PropertyName)) 46 | { 47 | property.ShouldSerialize = instance => !shouldIgnoreConditionalProps(instance); 48 | } 49 | 50 | return property; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Utils/Serializer/JSONSerializedScriptableObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils 6 | { 7 | public abstract class JSONSerializedScriptableObject : ScriptableObject { 8 | 9 | public Action onDataChanged; 10 | 11 | public enum JSONLibrary { Undefined, Unity, Newtonsoft } 12 | 13 | public virtual string dataKey => null; 14 | 15 | public virtual JSONLibrary preferredJSONLibrary => JSONLibrary.Undefined; 16 | 17 | public virtual string ToJSON(bool prettyJSON = true) => ToJSON(preferredJSONLibrary, prettyJSON); 18 | public virtual string ToJSON(JSONLibrary jsonLibrary, bool prettyJSON = true) 19 | { 20 | if(jsonLibrary == JSONLibrary.Unity) 21 | return JsonUtility.ToJson(this, prettyJSON); 22 | else if(jsonLibrary == JSONLibrary.Newtonsoft) 23 | return JsonConvert.SerializeObject(this, prettyJSON ? Formatting.Indented : Formatting.None, 24 | new JsonSerializerSettings() { ContractResolver = new IgnorePropertiesResolver(new[] { "name", "hideFlags", "onDataChanged", "dataKey", "preferredJSONLibrary"}) }); 25 | 26 | //undefined library 27 | return null; 28 | } 29 | 30 | public virtual bool PopulateFromJSON(string jsonString) => PopulateFromJSON(jsonString, preferredJSONLibrary); 31 | public virtual bool PopulateFromJSON(string jsonString, JSONLibrary jsonLibrary) 32 | { 33 | bool retVal = true; 34 | try 35 | { 36 | if (jsonLibrary == JSONLibrary.Unity) 37 | JsonUtility.FromJsonOverwrite(jsonString, this); 38 | else if (jsonLibrary == JSONLibrary.Newtonsoft) 39 | JsonConvert.PopulateObject(jsonString, this, 40 | new JsonSerializerSettings { 41 | ContractResolver = new CollectionClearingContractResolver(), 42 | }); 43 | else if (jsonLibrary == JSONLibrary.Undefined) 44 | retVal = false; 45 | } 46 | catch (Exception) 47 | { 48 | retVal = false; 49 | } 50 | 51 | if (retVal) 52 | onDataChanged?.Invoke(this); 53 | 54 | return retVal; 55 | } 56 | 57 | // Returns nested ScriptableObjects that should be marked as dirty when this object is updated 58 | public virtual ScriptableObject[] GetNestedScriptableObjects() => null; 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Utils/Loadable/Singleton/SingletonMonitor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace Replay.Utils 6 | { 7 | public interface IReplaySingleton { 8 | public void _OnSingletonAwake(); 9 | public void _OnSingletonStart(); 10 | public void _OnSingletonDestroy(); 11 | } 12 | 13 | /// 14 | /// Monitors and manages the lifecycle of a singleton component that implements IReplaySingleton. 15 | /// This class ensures proper initialization and cleanup of singleton objects. 16 | /// 17 | public class SingletonMonitor : MonoBehaviour 18 | { 19 | /// 20 | /// Reference to the singleton component being monitored. 21 | /// This component must implement IReplaySingleton interface. 22 | /// 23 | public IReplaySingleton _singleton = null; 24 | 25 | /// 26 | /// Finds and returns the first non-null component that implements IReplaySingleton on this GameObject. 27 | /// 28 | /// The first valid IReplaySingleton component found, or null if none exists. 29 | IReplaySingleton GetReplaySingleton() 30 | { 31 | var allComponents = GetComponents(); 32 | foreach(var component in allComponents) 33 | { 34 | if (component != null) 35 | return component; 36 | } 37 | return null; 38 | } 39 | 40 | /// 41 | /// Unity's Awake callback. Initializes the singleton reference and triggers its awake event. 42 | /// 43 | void Awake() 44 | { 45 | _singleton = GetReplaySingleton(); 46 | _singleton?._OnSingletonAwake(); 47 | } 48 | 49 | /// 50 | /// Unity's Start callback. Ensures singleton is initialized and triggers its start event. 51 | /// Acts as a fallback if singleton wasn't found during Awake. 52 | /// 53 | private void Start() 54 | { 55 | if(_singleton == null) 56 | _singleton = GetReplaySingleton(); 57 | _singleton?._OnSingletonStart(); 58 | } 59 | 60 | /// 61 | /// Unity's OnDestroy callback. Triggers singleton's destroy event if the GameObject 62 | /// is being destroyed normally (not through DontDestroyOnLoad). 63 | /// 64 | void OnDestroy() 65 | { 66 | if(this != null && gameObject != null && !gameObject.isDontDestroyOnLoadActivated()) 67 | _singleton?._OnSingletonDestroy(); 68 | _singleton = null; 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /Editor/DebugLoggableEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEngine; 3 | using UnityEditor; 4 | using Replay.Utils; 5 | 6 | [CustomEditor(typeof(MonoBehaviour), true)] 7 | public class DebugLoggableEditor : Editor 8 | { 9 | static bool _printsLogs = false; 10 | void OnEnable() 11 | { 12 | if (target is IDebugLoggable) 13 | EditorApplication.update += OnEditorUpdate; 14 | } 15 | 16 | void OnDisable() 17 | { 18 | if (target is IDebugLoggable) 19 | EditorApplication.update -= OnEditorUpdate; 20 | } 21 | private float _lastUpdateTime; 22 | private bool _shouldUpdate = false; 23 | void OnEditorUpdate() 24 | { 25 | if (_shouldUpdate && target is IDebugLoggable) 26 | if (Application.isPlaying) 27 | { 28 | if (Time.time - _lastUpdateTime >= _updateInterval) 29 | { 30 | _lastUpdateTime = Time.time; 31 | Repaint(); 32 | } 33 | } 34 | } 35 | static float _updateInterval = 0.1F; 36 | public override void OnInspectorGUI() 37 | { 38 | DrawDefaultInspector(); 39 | DrawDebugLoggableInspector(); 40 | 41 | } 42 | 43 | public void DrawDebugLoggableInspector() 44 | { 45 | if (target is IDebugLoggable) 46 | { 47 | GUILayout.Space(20); 48 | _shouldUpdate = EditorGUILayout.Toggle("Force Redraw on Update", _shouldUpdate); 49 | if(_shouldUpdate) 50 | _updateInterval = EditorGUILayout.Slider("Update Interval", _updateInterval, 0f, 1f); 51 | 52 | string className = target.GetType().Name; 53 | 54 | GUILayout.Space(20); 55 | GUILayout.Label(className + " (IDebugLoggable):"); 56 | _printsLogs = EditorGUILayout.Toggle("Print Logs", _printsLogs); 57 | 58 | if (Application.isPlaying) 59 | { 60 | var r = (IDebugLoggable)target; 61 | if (r == null) 62 | { 63 | GUILayout.Label(className + " is Not Initialized!"); 64 | } 65 | else 66 | { 67 | GUILayout.Label(r.ToDebugString()); 68 | GUILayout.Space(20); 69 | if(_printsLogs) 70 | { 71 | GUILayout.Label("Logs:", EditorStyles.boldLabel); 72 | GUILayout.Space(20); 73 | GUILayout.Label(r.GetLogs()); 74 | } 75 | 76 | } 77 | } 78 | else 79 | { 80 | GUILayout.Label("Enter Playmode!"); 81 | } 82 | } 83 | } 84 | } 85 | #endif -------------------------------------------------------------------------------- /Utils/Performance/SceneWarmupCamera.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Replay.Utils; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(Camera))] 6 | public class SceneWarmupCamera : MonoBehaviour 7 | { 8 | [Header("Events and Behavior")] 9 | [SerializeField] private bool snapsOnAwake = false; 10 | [SerializeField] private bool snapsOnStart = true; 11 | [SerializeField] private bool createsRenderTextureOnAwake = true; 12 | [SerializeField] private bool destroysRenderTextureImmediately = true; 13 | 14 | [Header("Camera")] 15 | [SerializeField] private Camera warmupCamera; 16 | 17 | [Header("Render Texture")] 18 | [SerializeField] private int renderTextureWidth = 100; 19 | [SerializeField] private int renderTextureHeight = 100; 20 | [SerializeField] private int renderTextureDepth = 24; 21 | [SerializeField] private RenderTextureFormat renderTextureFormat = RenderTextureFormat.ARGB32; 22 | 23 | //private 24 | private RenderTexture _tempRT = null; 25 | private void Awake() 26 | { 27 | if(warmupCamera == null) 28 | warmupCamera = GetComponent(); 29 | 30 | if(createsRenderTextureOnAwake) 31 | CreateRenderTextureIfNeeded(); 32 | 33 | warmupCamera.enabled = false; 34 | 35 | if(snapsOnAwake) 36 | Blit(); 37 | } 38 | 39 | void Start() 40 | { 41 | if(snapsOnStart) 42 | Blit(); 43 | } 44 | 45 | private void OnDestroy() 46 | { 47 | DestroyRenderTextureIfNeeded(); 48 | } 49 | 50 | #region Camera 51 | public void Blit(Action onComplete = null) 52 | { 53 | warmupCamera.enabled = true; 54 | 55 | CreateRenderTextureIfNeeded(); 56 | 57 | //allow one frame to render 58 | this.NextFrame(() => 59 | { 60 | // Release the temporary render texture 61 | if (destroysRenderTextureImmediately) 62 | DestroyRenderTextureIfNeeded(); 63 | 64 | warmupCamera.enabled = false; 65 | onComplete?.Invoke(); 66 | }); 67 | } 68 | 69 | public void CreateRenderTextureIfNeeded(){ 70 | if (_tempRT == null) 71 | { 72 | _tempRT = RenderTexture.GetTemporary( 73 | renderTextureWidth, 74 | renderTextureHeight, 75 | renderTextureDepth, renderTextureFormat); 76 | warmupCamera.targetTexture = _tempRT; 77 | } 78 | } 79 | 80 | public void DestroyRenderTextureIfNeeded(){ 81 | if (_tempRT != null) 82 | { 83 | warmupCamera.targetTexture = null; 84 | RenderTexture.ReleaseTemporary(_tempRT); 85 | _tempRT = null; 86 | } 87 | } 88 | #endregion 89 | } 90 | -------------------------------------------------------------------------------- /Utils/InputUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using UnityEngine.EventSystems; 6 | using UnityEngine.Scripting; 7 | 8 | namespace Replay.Utils 9 | { 10 | public class InputHelper : ComponentSingleton 11 | { 12 | [Preserve] 13 | public static bool ShouldCreateOwnGameObject() => true; 14 | [Preserve] 15 | public static bool ShouldEnableDontDestroyOnLoad() => true; 16 | 17 | public Action OnAnyTouchOverUIChanged; 18 | 19 | public bool IsAnyTouchOverUI { get; private set; } = false; 20 | private void Update() 21 | { 22 | bool value = InputUtils.IsAnyTouchOverUI(); 23 | if(value != IsAnyTouchOverUI) 24 | { 25 | IsAnyTouchOverUI = value; 26 | 27 | OnAnyTouchOverUIChanged?.Invoke(value); 28 | } 29 | } 30 | } 31 | public static class InputUtils 32 | { 33 | public static bool IsAnyTouchOverUI() 34 | { 35 | bool retVal = false; 36 | foreach (var touch in Input.touches) 37 | { 38 | if (touch.IsOverUI()) 39 | { 40 | retVal = true; 41 | break; 42 | } 43 | } 44 | return retVal; 45 | } 46 | public static bool IsOverUI(this Touch touch) => IsScreenPositionOverUI(touch.position); 47 | 48 | public static bool IsScreenPositionOverUI(Vector2 position) 49 | { 50 | // Check if position is in safe area for iOS 51 | //if (!IsPositionInSafeArea(position)) 52 | // return true; // Treat touches outside safe area as over UI 53 | 54 | if (ScreenUtils.IsTouchNearScreenEdge(position, 6)) 55 | return true; 56 | 57 | PointerEventData PointerEventData = new PointerEventData(EventSystem.current); 58 | PointerEventData.position = position; 59 | List retVal = new List(); 60 | EventSystem.current.RaycastAll(PointerEventData, retVal); 61 | return retVal.Count > 0; 62 | } 63 | 64 | public static List GetUIObjectsForScreenPosition(Vector2 position) 65 | { 66 | PointerEventData PointerEventData = new PointerEventData(EventSystem.current); 67 | PointerEventData.position = position; 68 | List retVal = new List(); 69 | EventSystem.current.RaycastAll(PointerEventData, retVal); 70 | return retVal; 71 | } 72 | public static Collider RaycastToColliderForScreenPosition(Vector2 screenPosition) 73 | { 74 | RaycastHit hit; 75 | Physics.Raycast(Camera.main.ScreenPointToRay(screenPosition), out hit); 76 | return hit.collider; 77 | } 78 | } 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /Utils/Loadable/Prefabs/ComponentPrefab.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | 4 | namespace Replay.Utils 5 | { 6 | public abstract class ComponentPrefab : MonoBehaviour, ILoadable where T : ComponentPrefab 7 | { 8 | public static T Create(Transform parent = null, string pathOrIdentifierOverride = null) 9 | { 10 | T retVal = null; 11 | //1. Check if resource path is provided 12 | string resourcePath = string.IsNullOrEmpty(pathOrIdentifierOverride) ? _GetStringValueIfAny("ResourcePath") : pathOrIdentifierOverride; 13 | if (!string.IsNullOrEmpty(resourcePath)) 14 | retVal = LoadFromResources(resourcePath, parent); 15 | 16 | //2. Check if Addressable identifier is provided 17 | if (retVal == null) 18 | { 19 | string addressablesIdentifier = string.IsNullOrEmpty(pathOrIdentifierOverride) ? _GetStringValueIfAny("AddressablesIdentifier") : pathOrIdentifierOverride; 20 | if (!string.IsNullOrEmpty(addressablesIdentifier)) 21 | retVal = LoadFromAddressables(addressablesIdentifier, parent); 22 | } 23 | return retVal; 24 | } 25 | 26 | public static T LoadFromResources(string resourcePath, Transform parent = null) 27 | { 28 | var prefab = Resources.Load(resourcePath); 29 | T retVal = Instantiate(prefab); 30 | if (retVal != null) 31 | { 32 | if (parent != null) 33 | retVal.transform.SetParent(parent, false); 34 | } 35 | return retVal; 36 | } 37 | 38 | public static T LoadFromAddressables(string addressablesIdentifier, Transform parent = null) 39 | { 40 | throw new NotImplementedException(); 41 | //return null; 42 | } 43 | protected static string _GetStringValueIfAny(string methodName) 44 | { 45 | Func f = (bool isBaseType) => { 46 | string retVal = null; 47 | Type type = isBaseType ? typeof(T).BaseType : typeof(T); 48 | var staticPrefabOverrideMethod = type?.GetMethod(methodName); 49 | if (staticPrefabOverrideMethod != null) 50 | retVal = (string)staticPrefabOverrideMethod.Invoke(null, Array.Empty()); 51 | return retVal; 52 | }; 53 | 54 | 55 | //checking the base type 56 | string retVal = f(true); 57 | 58 | //checking the target type 59 | if (string.IsNullOrEmpty(retVal)) 60 | retVal = f(false); 61 | 62 | return retVal; 63 | } 64 | 65 | protected static string GetClassName() => ClassExtensions.GetClassName(); 66 | 67 | #if FINALIZER_LOGS_ENABLED 68 | ~ComponentPrefab() 69 | { 70 | Debug.LogWarning("Finalizer: ComponentPrefab: "+ GetClassName()); 71 | } 72 | #endif 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /Utils/Extensions/ClassExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Replay.Utils 4 | { 5 | public static class ClassExtensions 6 | { 7 | public static T GetRetValOrDefaultForStaticMethodName(Type type, string methodName, object[] parameters = null, bool isPolymorphic = true) 8 | { 9 | //get method 10 | var staticMethod = type.GetMethod(methodName); 11 | if (isPolymorphic) 12 | { 13 | while (staticMethod == null) 14 | { 15 | type = type.BaseType; 16 | if(type == null) 17 | break; 18 | staticMethod = type.GetMethod(methodName); 19 | } 20 | } 21 | 22 | //get retVal 23 | T retVal = default; 24 | if (staticMethod != null) 25 | { 26 | if (parameters == null) 27 | parameters = new object[] { }; 28 | retVal = (T)staticMethod.Invoke(null, parameters); 29 | } 30 | 31 | return retVal; 32 | } 33 | 34 | public static R GetRetValOrDefaultForStaticMethodName(string methodName, object[] parameters = null, 35 | bool isPolymorphic = true) 36 | => GetRetValOrDefaultForStaticMethodName(typeof(T), methodName, parameters, isPolymorphic); 37 | 38 | 39 | public static string GetStringOrNullForStaticMethodName(this T _, string methodName, object[] parameters = null, 40 | bool isPolymorphic = true) 41 | => GetRetValOrDefaultForStaticMethodName(methodName, parameters, isPolymorphic); 42 | 43 | public static bool GetBoolOrFalseForStaticMethodName(this T _, string methodName, object[] parameters = null, 44 | bool isPolymorphic = true) where T : class 45 | => GetRetValOrDefaultForStaticMethodName(methodName, parameters, isPolymorphic); 46 | 47 | public static int GetIntOrZeroForStaticMethodName(this T _, string methodName, object[] parameters = null, 48 | bool isPolymorphic = true) where T : class 49 | => GetRetValOrDefaultForStaticMethodName(methodName, parameters, isPolymorphic); 50 | 51 | public static float GetFloatOrZeroForStaticMethodName(this T _, string methodName, object[] parameters = null, 52 | bool isPolymorphic = true) where T : class 53 | => GetRetValOrDefaultForStaticMethodName(methodName, parameters, isPolymorphic); 54 | 55 | public static double GetDoubleOrZeroForStaticMethodName(this T _, string methodName, object[] parameters = null, 56 | bool isPolymorphic = true) where T : class 57 | => GetRetValOrDefaultForStaticMethodName(methodName, parameters, isPolymorphic); 58 | 59 | public static string GetClassName() => typeof(T).Name; 60 | public static string GetClassName(this T _) => GetClassName(); 61 | 62 | } 63 | 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Utils/Extensions/MathExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | using Random = UnityEngine.Random; 6 | 7 | namespace Replay.Utils 8 | { 9 | public static class MathExtensions 10 | { 11 | public static int Inverse(this int value) => value * -1; 12 | public static double Inverse(this double value) => value *= -1d; 13 | public static float Inverse(this float value) => value * -1f; 14 | public static float Complement(this float value) 15 | { 16 | if (value < 0.0f || value > 1.0f) 17 | throw new ArgumentOutOfRangeException(nameof(value), "Expects value between in range 0 to 1."); 18 | 19 | return 1.0f - value; 20 | } 21 | public static double Complement(this double value) 22 | { 23 | if (value < 0.0d || value > 1.0d) 24 | throw new ArgumentOutOfRangeException(nameof(value), "Expects value between in range 0 to 1."); 25 | 26 | return 1.0d - value; 27 | } 28 | public static bool InRange(this int value, int min, int max) => value >= min && value <= max; 29 | public static float Normalize(this float value, float min, float max) => (value - min) / (max - min); 30 | public static float Map(this float value, float min, float max, float targetMin, float targetMax) 31 | => (value - min) * ((targetMax - targetMin) / (max - min)) + targetMin; 32 | 33 | public static bool ToBool(this int value) => value == 0 ? false : true; 34 | public static int ToInt(this bool value) => value ? 1 : 0; 35 | 36 | 37 | // public static bool Approximately(float a, float b) 38 | // { 39 | // return (double) Mathf.Abs(b - a) < (double) Mathf.Max(1E-06f * Mathf.Max(Mathf.Abs(a), Mathf.Abs(b)), Mathf.Epsilon * 8f); 40 | // } 41 | public static bool Approximately(float a, float b, float epsilon = 1E-06f) 42 | { 43 | return (double)Mathf.Abs(b - a) < (double)Mathf.Max(epsilon * Mathf.Max(Mathf.Abs(a), Mathf.Abs(b)), Mathf.Epsilon * 8f); 44 | } 45 | // public static bool Approximately(double a, double b) 46 | // { 47 | // return Math.Abs(b - a) < Math.Max(1E-06d * Math.Max(Math.Abs(a), Math.Abs(b)), double.Epsilon * 8d); 48 | // } 49 | public static double Clamp(float value, float min, float max) 50 | { 51 | if(value < min) 52 | return min; 53 | if(value > max) 54 | return max; 55 | return value; 56 | } 57 | public static bool Approximately(double a, double b, double epsilon = 1E-06d) 58 | { 59 | return Math.Abs(b - a) < Math.Max(epsilon * Math.Max(Math.Abs(a), Math.Abs(b)), double.Epsilon * 8d); 60 | } 61 | public static double Clamp(double value, double min, double max) 62 | { 63 | if(value < min) 64 | return min; 65 | if(value > max) 66 | return max; 67 | return value; 68 | } 69 | //random bool 70 | public static bool GetRandomBool(float chance = 0.5F) => Random.Range(0F, 1F) <= chance; 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /Utils/Screen/ScreenUtils.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public static class ScreenUtils 4 | { 5 | /// 6 | /// Controls whether the device's screen can timeout/sleep based on system settings. 7 | /// 8 | /// 9 | /// true to enable screen timeout using system settings; 10 | /// false to prevent the screen from timing out (keep screen always on). 11 | /// 12 | /// 13 | /// When set to true, the screen will follow the device's system timeout settings. 14 | /// When set to false, the screen will stay on indefinitely (useful during gameplay). 15 | /// 16 | /// 17 | /// 18 | /// // Keep screen always on 19 | /// ScreenUtils.screenTimerOn = false; 20 | /// 21 | /// // Allow screen to timeout based on system settings 22 | /// ScreenUtils.screenTimerOn = true; 23 | /// 24 | /// 25 | public static bool screenTimerOn 26 | { 27 | get => Screen.sleepTimeout != SleepTimeout.NeverSleep; 28 | set => Screen.sleepTimeout = value ? SleepTimeout.SystemSetting : SleepTimeout.NeverSleep; 29 | } 30 | 31 | /// 32 | /// Converts millimeters to pixels based on device DPI 33 | /// 34 | /// Distance in millimeters 35 | /// Distance in pixels 36 | public static float MillimetersToPixels(float millimeters) 37 | { 38 | // Get device DPI, fallback to 160 DPI if not available 39 | float dpi = Screen.dpi > 0 ? Screen.dpi : 160f; 40 | 41 | // Convert mm to inches (1 inch = 25.4 mm), then inches to pixels 42 | return (millimeters / 25.4f) * dpi; 43 | } 44 | 45 | public static float PixelsToMillimeters(float pixels) 46 | { 47 | // Get device DPI, fallback to 160 DPI if not available 48 | float dpi = Screen.dpi > 0 ? Screen.dpi : 160f; 49 | 50 | // Convert pixels to inches, then inches to millimeters (1 inch = 25.4 mm) 51 | return (pixels / dpi) * 25.4f; 52 | } 53 | public static float PixelsToInches(float pixels) 54 | { 55 | // Get device DPI, fallback to 160 DPI if not available 56 | float dpi = Screen.dpi > 0 ? Screen.dpi : 160f; 57 | 58 | // Convert pixels to inches 59 | return pixels / dpi; 60 | } 61 | 62 | /// 63 | /// Checks if a touch is near screen edges where iOS gestures might interfere 64 | /// 65 | public static bool IsTouchNearScreenEdge(Vector2 screenPosition, float edgeThresholdMM) 66 | { 67 | float edgeThreshold = MillimetersToPixels(edgeThresholdMM); 68 | 69 | return screenPosition.x < edgeThreshold || 70 | screenPosition.x > Screen.width - edgeThreshold || 71 | screenPosition.y < edgeThreshold || 72 | screenPosition.y > Screen.height - edgeThreshold; 73 | } 74 | /// 75 | /// Checks if a screen position is within the safe area (iOS notch/home indicator safe) 76 | /// 77 | public static bool IsPositionInSafeArea(Vector2 screenPosition) 78 | { 79 | Rect safeArea = Screen.safeArea; 80 | return safeArea.Contains(screenPosition); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Utils/UI/Buttons/ButtonEvents.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using UnityEngine.EventSystems; 4 | using UnityEngine.UI; 5 | using UnityEngine.Events; 6 | using Replay.Utils; 7 | 8 | [RequireComponent(typeof(Button))] 9 | public class ButtonEvents : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler 10 | { 11 | [Serializable] 12 | public class ButtonEventType : UnityEvent { } 13 | 14 | public ButtonEventType onTouchDown = new (); 15 | public ButtonEventType onTouchUp = new (); 16 | public ButtonEventType onClick = new (); 17 | 18 | public enum Mode 19 | { 20 | EventHandler, 21 | EventTrigger 22 | }; 23 | [SerializeField] public Mode mode = Mode.EventHandler; 24 | 25 | EventTrigger eventTrigger; 26 | Button button; 27 | 28 | private void Awake() 29 | { 30 | if (mode == Mode.EventTrigger) 31 | SetupEventTriggers(); 32 | } 33 | 34 | private void OnDestroy() 35 | { 36 | ClearEventTriggers(); 37 | } 38 | 39 | #region Event Triggers 40 | 41 | void AddEventTrigger(EventTriggerType type, Action eventHandler) 42 | { 43 | var entry = new EventTrigger.Entry(); 44 | entry.eventID = type; 45 | entry.callback.AddListener((data) => { if (button.interactable) eventHandler?.Invoke(data); }); 46 | eventTrigger.triggers.Add(entry); 47 | } 48 | void ClearEventTriggers() 49 | { 50 | if(eventTrigger != null) 51 | eventTrigger.triggers.Clear(); 52 | } 53 | void SetupEventTriggers() 54 | { 55 | eventTrigger = gameObject.GetOrAddComponent(); 56 | button = gameObject.GetOrAddComponent