├── .gitignore ├── .idea └── .idea.UnityUseful │ ├── .idea │ ├── .idea.UnityUseful.iml │ ├── contentModel.xml │ ├── encodings.xml │ ├── indexLayout.xml │ ├── modules.xml │ ├── projectSettingsUpdater.xml │ ├── vcs.xml │ └── workspace.xml │ └── riderModule.iml ├── Assets ├── VavilichevGD.meta └── VavilichevGD │ ├── Architecture.meta │ ├── Architecture │ ├── Storage.meta │ └── Storage │ │ ├── Example.meta │ │ ├── Example │ │ ├── Scenes.meta │ │ ├── Scenes │ │ │ ├── StorageExample.unity │ │ │ └── StorageExample.unity.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── StorageExample.cs │ │ │ └── StorageExample.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── CloudStorage.cs │ │ ├── CloudStorage.cs.meta │ │ ├── FileStorage.cs │ │ ├── FileStorage.cs.meta │ │ ├── GameData.cs │ │ ├── GameData.cs.meta │ │ ├── Storage.cs │ │ ├── Storage.cs.meta │ │ ├── Surrogates.meta │ │ └── Surrogates │ │ │ ├── QuaternionSerializationSurrogate.cs │ │ │ ├── QuaternionSerializationSurrogate.cs.meta │ │ │ ├── Vector2SerializationSurrogate.cs │ │ │ ├── Vector2SerializationSurrogate.cs.meta │ │ │ ├── Vector3SerializationSurrogate.cs │ │ │ └── Vector3SerializationSurrogate.cs.meta │ │ ├── Storage System 3.0.unitypackage │ │ └── Storage System 3.0.unitypackage.meta │ ├── Attributes.meta │ ├── Attributes │ ├── ExponentialView.meta │ └── ExponentialView │ │ ├── Example.meta │ │ ├── Example │ │ ├── Scenes.meta │ │ ├── Scenes │ │ │ ├── ExponentialViewExample.unity │ │ │ └── ExponentialViewExample.unity.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── ExponentialViewExample.cs │ │ │ └── ExponentialViewExample.cs.meta │ │ ├── ExponentialView v.1.03.unitypackage │ │ ├── ExponentialView v.1.03.unitypackage.meta │ │ ├── ReadMe.md │ │ ├── ReadMe.md.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── ExponentialViewDrawer.cs │ │ └── ExponentialViewDrawer.cs.meta │ │ ├── ExponentialViewAttribute.cs │ │ ├── ExponentialViewAttribute.cs.meta │ │ ├── ExponentialViewDictionaryBase.cs │ │ ├── ExponentialViewDictionaryBase.cs.meta │ │ ├── ExponentialViewDictionaryEn.cs │ │ ├── ExponentialViewDictionaryEn.cs.meta │ │ ├── ExponentialViewDictionaryRu.cs │ │ ├── ExponentialViewDictionaryRu.cs.meta │ │ ├── ExponentialViewExtensions.cs │ │ ├── ExponentialViewExtensions.cs.meta │ │ ├── ExponentialViewTranslator.cs │ │ ├── ExponentialViewTranslator.cs.meta │ │ ├── ExponentialViewUtility.cs │ │ └── ExponentialViewUtility.cs.meta │ ├── Gameplay.meta │ ├── Gameplay │ ├── Dialogues.meta │ ├── Dialogues │ │ ├── DialogueGraph.meta │ │ ├── DialogueGraph │ │ │ ├── Resources.meta │ │ │ ├── Resources │ │ │ │ ├── DialogueGraph.uss │ │ │ │ ├── DialogueGraph.uss.meta │ │ │ │ ├── Node.uss │ │ │ │ └── Node.uss.meta │ │ │ ├── Scripts.meta │ │ │ └── Scripts │ │ │ │ ├── DialogueInfo.cs │ │ │ │ ├── DialogueInfo.cs.meta │ │ │ │ ├── DialogueNodeData.cs │ │ │ │ ├── DialogueNodeData.cs.meta │ │ │ │ ├── Editor.meta │ │ │ │ ├── Editor │ │ │ │ ├── DialogueGraph.cs │ │ │ │ ├── DialogueGraph.cs.meta │ │ │ │ ├── DialogueGraphView.cs │ │ │ │ ├── DialogueGraphView.cs.meta │ │ │ │ ├── DialogueInfoEditor.cs │ │ │ │ ├── DialogueInfoEditor.cs.meta │ │ │ │ ├── EditorDialogueNode.cs │ │ │ │ ├── EditorDialogueNode.cs.meta │ │ │ │ ├── GraphSaveUtility.cs │ │ │ │ ├── GraphSaveUtility.cs.meta │ │ │ │ ├── NodeSearchWindow.cs │ │ │ │ └── NodeSearchWindow.cs.meta │ │ │ │ ├── NodeLinkData.cs │ │ │ │ └── NodeLinkData.cs.meta │ │ ├── DialogueGraph_1.png │ │ ├── DialogueGraph_1.png.meta │ │ ├── DialogueGraph_2.png │ │ ├── DialogueGraph_2.png.meta │ │ ├── DialogueGraph_3.png │ │ ├── DialogueGraph_3.png.meta │ │ ├── DialogueGraph_4.png │ │ ├── DialogueGraph_4.png.meta │ │ ├── DialogueSystem.unitypackage │ │ ├── DialogueSystem.unitypackage.meta │ │ ├── Example.meta │ │ ├── Example │ │ │ ├── Prefabs.meta │ │ │ ├── Prefabs │ │ │ │ ├── ExampleRoot.prefab │ │ │ │ └── ExampleRoot.prefab.meta │ │ │ ├── Resources.meta │ │ │ ├── Resources │ │ │ │ ├── ExampleDialogueGraph.asset │ │ │ │ └── ExampleDialogueGraph.asset.meta │ │ │ ├── Scenes.meta │ │ │ ├── Scenes │ │ │ │ ├── DialoguesExample.unity │ │ │ │ └── DialoguesExample.unity.meta │ │ │ ├── Scripts.meta │ │ │ └── Scripts │ │ │ │ ├── DialogueExample.cs │ │ │ │ ├── DialogueExample.cs.meta │ │ │ │ ├── UIWidgetDialogueOptionExample.cs │ │ │ │ ├── UIWidgetDialogueOptionExample.cs.meta │ │ │ │ ├── UIWidgetDialogueOptionsExample.cs │ │ │ │ └── UIWidgetDialogueOptionsExample.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── Dialogue.cs │ │ │ ├── Dialogue.cs.meta │ │ │ ├── DialogueNode.cs │ │ │ ├── DialogueNode.cs.meta │ │ │ ├── DialogueOption.cs │ │ │ ├── DialogueOption.cs.meta │ │ │ ├── DialogueState.cs │ │ │ ├── DialogueState.cs.meta │ │ │ ├── DialogueTree.cs │ │ │ └── DialogueTree.cs.meta │ ├── FX.meta │ ├── FX │ │ ├── Scripts.meta │ │ ├── Scripts │ │ │ ├── FXGenerator.cs │ │ │ ├── FXGenerator.cs.meta │ │ │ ├── FXObject.cs │ │ │ └── FXObject.cs.meta │ │ ├── UI.meta │ │ └── UI │ │ │ ├── Examples.meta │ │ │ ├── Examples │ │ │ ├── Prefabs.meta │ │ │ ├── Prefabs │ │ │ │ ├── ExampleFXUIDistance.prefab │ │ │ │ ├── ExampleFXUIDistance.prefab.meta │ │ │ │ ├── ExampleFXUIDistanceAndOffset.prefab │ │ │ │ ├── ExampleFXUIDistanceAndOffset.prefab.meta │ │ │ │ ├── ExampleFXUIOffset.prefab │ │ │ │ └── ExampleFXUIOffset.prefab.meta │ │ │ ├── Scenes.meta │ │ │ ├── Scenes │ │ │ │ ├── ExampleFXUI.unity │ │ │ │ └── ExampleFXUI.unity.meta │ │ │ ├── Scripts.meta │ │ │ └── Scripts │ │ │ │ ├── ExampleFXUIGenerator.cs │ │ │ │ └── ExampleFXUIGenerator.cs.meta │ │ │ ├── FXUIAnimations.gif │ │ │ ├── FXUIAnimations.gif.meta │ │ │ ├── README.md │ │ │ ├── README.md.meta │ │ │ ├── Scripts.meta │ │ │ ├── Scripts │ │ │ ├── FXUIAnimation.cs │ │ │ ├── FXUIAnimation.cs.meta │ │ │ ├── FXUIAnimationDistance.cs │ │ │ ├── FXUIAnimationDistance.cs.meta │ │ │ ├── FXUIAnimationDistanceAndOffset.cs │ │ │ ├── FXUIAnimationDistanceAndOffset.cs.meta │ │ │ ├── FXUIAnimationOffset.cs │ │ │ ├── FXUIAnimationOffset.cs.meta │ │ │ ├── FXUIGenerator.cs │ │ │ ├── FXUIGenerator.cs.meta │ │ │ ├── FXUIObject.cs │ │ │ └── FXUIObject.cs.meta │ │ │ ├── UnityUIFXAnimation.unitypackage │ │ │ └── UnityUIFXAnimation.unitypackage.meta │ ├── ItemsContainer.meta │ └── ItemsContainer │ │ ├── Example.meta │ │ ├── Example │ │ ├── Scenes.meta │ │ ├── Scenes │ │ │ ├── ItemsContainerExample.unity │ │ │ └── ItemsContainerExample.unity.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── ItemExample.cs │ │ │ ├── ItemExample.cs.meta │ │ │ ├── ItemsContainerExample.cs │ │ │ ├── ItemsContainerExample.cs.meta │ │ │ ├── ItemsService.cs │ │ │ ├── ItemsService.cs.meta │ │ │ ├── UIItemCell.cs │ │ │ ├── UIItemCell.cs.meta │ │ │ ├── UIItemsContainerExample.cs │ │ │ ├── UIItemsContainerExample.cs.meta │ │ │ ├── UIItemsContainerLogger.cs │ │ │ └── UIItemsContainerLogger.cs.meta │ │ ├── ItemsContainer v.1.02.unitypackage │ │ ├── ItemsContainer v.1.02.unitypackage.meta │ │ ├── ReadMe.md │ │ ├── Scripts.meta │ │ └── Scripts │ │ ├── Abstract.meta │ │ ├── Abstract │ │ ├── IItem.cs │ │ ├── IItem.cs.meta │ │ ├── IItemCell.cs │ │ ├── IItemCell.cs.meta │ │ ├── IItemsContainer.cs │ │ └── IItemsContainer.cs.meta │ │ ├── Data.meta │ │ ├── Data │ │ ├── ItemCellData.cs │ │ ├── ItemCellData.cs.meta │ │ ├── ItemCellStateChangeArgs.cs │ │ ├── ItemCellStateChangeArgs.cs.meta │ │ ├── ItemsContainerData.cs │ │ ├── ItemsContainerData.cs.meta │ │ ├── ItemsContainerErrorCode.cs │ │ └── ItemsContainerErrorCode.cs.meta │ │ ├── Extensions.meta │ │ ├── Extensions │ │ ├── ItemsCellExtensions.cs │ │ ├── ItemsCellExtensions.cs.meta │ │ ├── ItemsContainerExtensions.cs │ │ └── ItemsContainerExtensions.cs.meta │ │ ├── Item.cs │ │ ├── Item.cs.meta │ │ ├── ItemCell.cs │ │ ├── ItemCell.cs.meta │ │ ├── ItemsContainer.cs │ │ └── ItemsContainer.cs.meta │ ├── Tools.meta │ ├── Tools │ ├── Coroutines.meta │ └── Coroutines │ │ ├── Coroutines 1.05.unitypackage │ │ ├── Coroutines 1.05.unitypackage.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ ├── Coroutines.cs │ │ └── Coroutines.cs.meta │ ├── Utils.meta │ └── Utils │ ├── Attributes.meta │ ├── Attributes │ ├── ObjectsOfType.meta │ ├── ObjectsOfType │ │ ├── GameObjectOfTypeAttribute.cs │ │ ├── GameObjectOfTypeAttribute.cs.meta │ │ ├── GameObjectOfTypeDrawer.cs │ │ ├── GameObjectOfTypeDrawer.cs.meta │ │ ├── ObjectOfTypeAttributeBase.cs │ │ ├── ObjectOfTypeAttributeBase.cs.meta │ │ ├── ObjectOfTypeDrawerBase.cs │ │ ├── ObjectOfTypeDrawerBase.cs.meta │ │ ├── ReadMe.md │ │ ├── ScriptableObjectOfTypeAttribute.cs │ │ ├── ScriptableObjectOfTypeAttribute.cs.meta │ │ ├── ScriptableObjectOfTypeDrawer.cs │ │ └── ScriptableObjectOfTypeDrawer.cs.meta │ ├── VavilichevGD. Attributes v. 0.11.unitypackage │ └── VavilichevGD. Attributes v. 0.11.unitypackage.meta │ ├── Editor.meta │ ├── Editor │ ├── Builder.meta │ ├── Builder │ │ ├── Android.meta │ │ ├── Android │ │ │ ├── AndroidBuildConfig.cs │ │ │ ├── AndroidBuildConfig.cs.meta │ │ │ ├── AndroidBuildHelper.cs │ │ │ ├── AndroidBuildHelper.cs.meta │ │ │ ├── Config.meta │ │ │ └── Config │ │ │ │ ├── AndroidBuildConfig.asset │ │ │ │ └── AndroidBuildConfig.asset.meta │ │ ├── EditorBuilder.unitypackage │ │ ├── EditorBuilder.unitypackage.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── ScreenChooseSettings.png │ │ ├── ScreenChooseSettings.png.meta │ │ ├── ScreenPlayerSettings.png │ │ ├── ScreenPlayerSettings.png.meta │ │ ├── ScreenSetupSettings.png │ │ ├── ScreenSetupSettings.png.meta │ │ ├── ScreenSwitchPlatform.png │ │ └── ScreenSwitchPlatform.png.meta │ ├── EditorHelper.cs │ └── EditorHelper.cs.meta │ ├── Math.meta │ ├── Math │ ├── Math.cs │ └── Math.cs.meta │ ├── Observable.meta │ ├── Observable │ ├── ObservableVariable.cs │ └── ObservableVariable.cs.meta │ ├── PoolMono.cs │ ├── PoolMono.cs.meta │ ├── SyncedTimer.meta │ └── SyncedTimer │ ├── Example.meta │ ├── Example │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── TimerWidget.prefab │ │ └── TimerWidget.prefab.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── TimerExample.unity │ │ └── TimerExample.unity.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── WidgetTimerExample.cs │ │ └── WidgetTimerExample.cs.meta │ ├── ReadMe.md │ ├── Scripts.meta │ ├── Scripts │ ├── SyncedTimer.cs │ ├── SyncedTimer.cs.meta │ ├── TimeChangingSource.cs │ ├── TimeChangingSource.cs.meta │ ├── TimeInvoker.cs │ ├── TimeInvoker.cs.meta │ ├── TimerType.cs │ └── TimerType.cs.meta │ ├── SyncedTimer v.1.03.unitypackage │ └── SyncedTimer v.1.03.unitypackage.meta ├── Packages └── manifest.json └── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | 57 | # Crashlytics generated file 58 | crashlytics-build.properties 59 | 60 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/.idea/.idea.UnityUseful.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Library/PackageCache/com.unity.collab-proxy@1.2.16 7 | Library/PackageCache/com.unity.ext.nunit@1.0.0 8 | Library/PackageCache/com.unity.ide.rider@1.1.4 9 | Library/PackageCache/com.unity.ide.vscode@1.1.4 10 | Library/PackageCache/com.unity.test-framework@1.1.13 11 | Library/PackageCache/com.unity.textmeshpro@2.0.1 12 | Library/PackageCache/com.unity.timeline@1.2.14 13 | Packages 14 | ProjectSettings 15 | 16 | 17 | .git 18 | .idea 19 | Builds 20 | Library 21 | Logs 22 | Temp 23 | obj 24 | 25 | 26 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/.idea/projectSettingsUpdater.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/.idea.UnityUseful/riderModule.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Assets/VavilichevGD.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a4357f3a7cacb14e8c66c0442ed0757 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6bca34dcfea3a748acf1fe489266091 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4a55244d0853124b962612499860952 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ea10e28d6ab4768982e670895ae6671 3 | timeCreated: 1617970268 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Example/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c4e8d9f02194260bfed0c1f5d4188aa 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Example/Scenes/StorageExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64342abbc1a0d1a4a9e727190db95e11 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a30dc172e97848828c6cf90d5f088971 3 | timeCreated: 1617969760 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Example/Scripts/StorageExample.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using Random = UnityEngine.Random; 4 | 5 | namespace VavilichevGD.Architecture.StorageSystem.Example { 6 | public class StorageExample : MonoBehaviour { 7 | 8 | #region CONSTANTS 9 | 10 | private const string KEY_INT = "INTEGER"; 11 | private const string KEY_SPEED = "SPEED"; 12 | private const string KEY_FLOAT = "FLOAT"; 13 | private const string KEY_VECTOR3 = "VECTOR3"; 14 | private const string KEY_VECTOR2 = "VECTOR2"; 15 | private const string KEY_VERSION = "VERSION"; 16 | 17 | #endregion 18 | 19 | [SerializeField] private Button _buttonSaveAsync; 20 | [SerializeField] private Button _buttonLoadInstantly; 21 | [SerializeField] private Button _buttonLoadWithRoutine; 22 | [SerializeField] private Text _textLog; 23 | 24 | [SerializeField] private string _storageFileName = "GameState.save"; 25 | 26 | private bool _savingComplete; 27 | private Storage _storage; 28 | 29 | 30 | #region LIFECYCLE 31 | 32 | private void Start() { 33 | _storage = new FileStorage(_storageFileName); 34 | _storage.Load(); 35 | PrintData("loaded instantly at start", false); 36 | 37 | var loadedVersion = _storage.Get(KEY_VERSION); 38 | if (loadedVersion < 2) { 39 | _storage.Set(KEY_VERSION, 2); 40 | _storage.Set(KEY_SPEED, 100); 41 | Debug.Log("New version. Speed changed to 100"); 42 | } 43 | } 44 | 45 | private void OnEnable() { 46 | _buttonSaveAsync.onClick.AddListener(OnSaveAsyncButtonClick); 47 | _buttonLoadInstantly.onClick.AddListener(OnLoadInstantlyButtonClick); 48 | _buttonLoadWithRoutine.onClick.AddListener(OnLoadWithRoutineButtonClick); 49 | } 50 | 51 | private void OnDisable() { 52 | _buttonSaveAsync.onClick.RemoveListener(OnSaveAsyncButtonClick); 53 | _buttonLoadInstantly.onClick.RemoveListener(OnLoadInstantlyButtonClick); 54 | _buttonLoadWithRoutine.onClick.RemoveListener(OnLoadWithRoutineButtonClick); 55 | } 56 | 57 | #endregion 58 | 59 | 60 | 61 | private void Update() { 62 | if (_savingComplete) { 63 | PrintData("saved async", true); 64 | Log($"Saving complete at: {Time.time}", true); 65 | _savingComplete = false; 66 | } 67 | } 68 | 69 | #region CALLBACKS 70 | 71 | private void OnSaveAsyncButtonClick() { 72 | Log($"Saving started: {Time.time}", false); 73 | 74 | _storage.Set(KEY_INT, Random.Range(0, 10)); 75 | _storage.Set(KEY_FLOAT, Random.Range(0f, 10f)); 76 | _storage.Set(KEY_VECTOR3, Vector3.left); 77 | _storage.Set(KEY_VECTOR2, Vector2.up); 78 | _storage.Set(KEY_VERSION, 2); 79 | 80 | _storage.SaveAsync(() => { 81 | // We cannot get Time.time (for logging the end of saving process) 82 | // because Unity doesn't support to do this in the side thread. That is why we use a simple flag. 83 | _savingComplete = true; 84 | }); 85 | } 86 | 87 | private void OnLoadInstantlyButtonClick() { 88 | _storage.Load(); 89 | PrintData("loaded instantly", false); 90 | } 91 | 92 | private void OnLoadWithRoutineButtonClick() { 93 | _storage.LoadWithRoutine(loadedData => PrintData("loaded with routine", false)); 94 | } 95 | 96 | #endregion 97 | 98 | 99 | 100 | #region LOGGING 101 | 102 | private void PrintData(string process, bool append) { 103 | var loadedInt = _storage.Get(KEY_INT); 104 | var loadedSpeed = _storage.Get(KEY_SPEED); 105 | var loadedFloat = _storage.Get(KEY_FLOAT); 106 | var loadedVector3 = _storage.Get(KEY_VECTOR3); 107 | var loadedVector2 = _storage.Get(KEY_VECTOR2); 108 | var loadedVersion = _storage.Get(KEY_VERSION); 109 | 110 | 111 | Log($"GameData {process}:\n" + 112 | $"int = {loadedInt},\n" + 113 | $"speed = {loadedSpeed},\n" + 114 | $"float = {loadedFloat},\n" + 115 | $"vector3 = {loadedVector3},\n" + 116 | $"vector2 = {loadedVector2},\n" + 117 | $"version = {loadedVersion}", append); 118 | } 119 | 120 | private void Log(string text, bool append) { 121 | var logText = append ? _textLog.text + "\n" + text : text; 122 | _textLog.text = logText; 123 | } 124 | 125 | #endregion 126 | 127 | } 128 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Example/Scripts/StorageExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca1d40c061554b448a20c68c9bf021c6 3 | timeCreated: 1617962520 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/README.md: -------------------------------------------------------------------------------- 1 | # Storage system for Unity 2 | 3 | • Async operation supported (with callbacks)
4 | • Coroutine operation supported (with callbacks also)
5 | • Only local (file) storage realized now
6 | • The system is flexible and support expanding with a cloud storage really easy
7 | • Mobile friendly
8 | • Multiple storage containers supported
9 |
10 | 11 | ### v.3.0 12 | Even more flexible aproach to save the game data.
13 | **WARNING: If you want to update your storage system from v.2.12 to v.3.0, you will have to make some architecture changes. You cannot just update the asset.** 14 |
15 | 16 | Whats new: 17 | - You can save different blocks of data. It works like a container. Just create Storage instance (FileStorage or Cloud Storage (not implemented yet)) and save data into it. It will be convenient to separate game settings data that usually loads at the start of the game from game progress data that usually loads after main menu scene. 18 | 19 | 20 | 21 | ### v2.12 22 | More flexible approach to save the game data with key-value pair. Looks like Player Prefs, but it isn't the same. New version supports all serializable objects and stored in one place (file or cloud, cloud doesn't supported yet). 23 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd11e1ae79232da438f344729b2bdbd4 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aff2881274473944e8df874277462fd4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/CloudStorage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Architecture.StorageSystem { 5 | public class CloudStorage : Storage{ 6 | protected override void SaveInternal() { 7 | throw new NotImplementedException(); 8 | } 9 | 10 | protected override void SaveAsyncInternal(Action callback = null) { 11 | throw new NotImplementedException(); 12 | } 13 | 14 | protected override Coroutine SaveWithRoutineInternal(Action callback = null) { 15 | throw new NotImplementedException(); 16 | } 17 | 18 | protected override void LoadInternal() { 19 | throw new NotImplementedException(); 20 | } 21 | 22 | protected override void LoadAsyncInternal(Action callback = null) { 23 | throw new NotImplementedException(); 24 | } 25 | 26 | protected override Coroutine LoadWithRoutineInternal(Action callback = null) { 27 | throw new NotImplementedException(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/CloudStorage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3ebb4b9fbc14a46aafec75e86b86f11 3 | timeCreated: 1625925097 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/FileStorage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.IO; 4 | using System.Threading; 5 | using UnityEngine; 6 | using VavilichevGD.Tools; 7 | 8 | namespace VavilichevGD.Architecture.StorageSystem { 9 | public sealed class FileStorage : Storage{ 10 | 11 | public string filePath { get; } 12 | 13 | public FileStorage(string fileName) { 14 | var folder = "Saves"; 15 | var folderPath = $"{Application.persistentDataPath}/{folder}"; 16 | if (!Directory.Exists(folderPath)) 17 | Directory.CreateDirectory(folderPath); 18 | 19 | filePath = $"{folderPath}/{fileName}"; 20 | } 21 | 22 | 23 | #region SAVE 24 | 25 | protected override void SaveInternal() { 26 | var file = File.Create(filePath); 27 | formatter.Serialize(file, data); 28 | file.Close(); 29 | } 30 | 31 | protected override void SaveAsyncInternal(Action callback = null) { 32 | var thread = new Thread(() => SaveDataTaskThreaded(callback)); 33 | thread.Start(); 34 | } 35 | 36 | private void SaveDataTaskThreaded(Action callback) { 37 | Save(); 38 | callback?.Invoke(); 39 | } 40 | 41 | protected override Coroutine SaveWithRoutineInternal(Action callback = null) { 42 | return Coroutines.StartRoutine(SaveRoutine(callback)); 43 | 44 | } 45 | 46 | private IEnumerator SaveRoutine(Action callback) { 47 | var threadEnded = false; 48 | 49 | SaveAsync(() => { 50 | threadEnded = true; 51 | }); 52 | 53 | while (!threadEnded) 54 | yield return null; 55 | 56 | callback?.Invoke(); 57 | } 58 | 59 | #endregion 60 | 61 | 62 | 63 | #region LOAD 64 | 65 | protected override void LoadInternal() { 66 | if (!File.Exists(filePath)) { 67 | var gameDataByDefault = new GameData(); 68 | data = gameDataByDefault; 69 | Save(); 70 | } 71 | 72 | var file = File.Open(filePath, FileMode.Open); 73 | data = (GameData) formatter.Deserialize(file); 74 | file.Close(); 75 | } 76 | 77 | 78 | protected override void LoadAsyncInternal(Action callback = null) { 79 | var thread = new Thread(() => LoadDataTaskThreaded(callback)); 80 | thread.Start(); 81 | } 82 | 83 | private void LoadDataTaskThreaded(Action callback) { 84 | Load(); 85 | callback?.Invoke(data); 86 | } 87 | 88 | 89 | 90 | protected override Coroutine LoadWithRoutineInternal(Action callback = null) { 91 | return Coroutines.StartRoutine(LoadRoutine(callback)); 92 | 93 | } 94 | 95 | private IEnumerator LoadRoutine(Action callback) { 96 | var threadEnded = false; 97 | var gameData = new GameData(); 98 | 99 | LoadAsync((loadedData) => { 100 | threadEnded = true; 101 | }); 102 | 103 | while (!threadEnded) 104 | yield return null; 105 | 106 | callback?.Invoke(gameData); 107 | } 108 | 109 | #endregion 110 | 111 | 112 | } 113 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/FileStorage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ee606e96d7f49b1a0e50bb26eddeb71 3 | timeCreated: 1625925087 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/GameData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace VavilichevGD.Architecture.StorageSystem { 6 | [Serializable] 7 | public sealed class GameData : ISerializationCallbackReceiver { 8 | 9 | 10 | public List keys; 11 | public List values; 12 | 13 | public Dictionary dataMap = new Dictionary(); 14 | 15 | 16 | public void OnBeforeSerialize() { 17 | keys.Clear(); 18 | values.Clear(); 19 | 20 | foreach (var item in dataMap) { 21 | keys.Add(item.Key); 22 | values.Add(item.Value); 23 | } 24 | } 25 | 26 | public void OnAfterDeserialize() 27 | { 28 | dataMap = new Dictionary(); 29 | 30 | for (int i = 0; i != Math.Min(keys.Count, values.Count); i++) 31 | dataMap.Add(keys[i], values[i]); 32 | } 33 | 34 | 35 | public T Get(string key) { 36 | this.dataMap.TryGetValue(key, out var foundValue); 37 | if (foundValue != null) 38 | return (T) foundValue; 39 | return default; 40 | } 41 | 42 | public T Get(string key, T valueByDefault) { 43 | this.dataMap.TryGetValue(key, out var value); 44 | if (value != null) 45 | return (T) value; 46 | 47 | this.Set(key, valueByDefault); 48 | return valueByDefault; 49 | } 50 | 51 | public void Set(string key, T newValue) { 52 | this.dataMap[key] = newValue; 53 | } 54 | 55 | public override string ToString() { 56 | var line = ""; 57 | foreach (var pair in this.dataMap) 58 | line += $"Pair: {pair.Key} - {pair.Value}\n"; 59 | return line; 60 | } 61 | 62 | } 63 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/GameData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27322153627744b59461277dee407b53 3 | timeCreated: 1617966215 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Storage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using System.Runtime.Serialization.Formatters.Binary; 4 | using UnityEngine; 5 | 6 | namespace VavilichevGD.Architecture.StorageSystem { 7 | public abstract class Storage { 8 | 9 | #region EVENTS 10 | 11 | public event Action OnStorageSaveStartedEvent; 12 | public event Action OnStorageSaveCompleteEvent; 13 | public event Action OnStorageLoadedEvent; 14 | 15 | #endregion 16 | 17 | 18 | public static BinaryFormatter formatter { 19 | get { 20 | if (_formatter == null) 21 | _formatter = CreateBinaryFormatter(); 22 | return _formatter; 23 | } 24 | } 25 | private static BinaryFormatter _formatter; 26 | 27 | public GameData data { get; protected set; } 28 | 29 | 30 | 31 | private static BinaryFormatter CreateBinaryFormatter() { 32 | var createdFormatter = new BinaryFormatter(); 33 | var selector = new SurrogateSelector(); 34 | 35 | var vector3Surrogate = new Vector3SerializationSurrogate(); 36 | var vector2Surrogate = new Vector2SerializationSurrogate(); 37 | var quaternionSurrogate = new QuaternionSerializationSurrogate(); 38 | 39 | selector.AddSurrogate(typeof(Vector3), new StreamingContext(StreamingContextStates.All), vector3Surrogate); 40 | selector.AddSurrogate(typeof(Vector2), new StreamingContext(StreamingContextStates.All), vector2Surrogate); 41 | selector.AddSurrogate(typeof(Quaternion), new StreamingContext(StreamingContextStates.All), quaternionSurrogate); 42 | 43 | createdFormatter.SurrogateSelector = selector; 44 | 45 | return createdFormatter; 46 | } 47 | 48 | 49 | #region SAVE 50 | 51 | public void Save() { 52 | OnStorageSaveStartedEvent?.Invoke(); 53 | SaveInternal(); 54 | OnStorageSaveCompleteEvent?.Invoke(); 55 | } 56 | 57 | protected abstract void SaveInternal(); 58 | 59 | public void SaveAsync(Action callback = null) { 60 | OnStorageSaveStartedEvent?.Invoke(); 61 | SaveAsyncInternal(callback); 62 | OnStorageSaveCompleteEvent?.Invoke(); 63 | } 64 | 65 | protected abstract void SaveAsyncInternal(Action callback = null); 66 | 67 | public Coroutine SaveWithRoutine(Action callback = null) { 68 | OnStorageSaveStartedEvent?.Invoke(); 69 | return SaveWithRoutineInternal(() => { 70 | callback?.Invoke(); 71 | OnStorageSaveCompleteEvent?.Invoke(); 72 | }); 73 | } 74 | 75 | protected abstract Coroutine SaveWithRoutineInternal(Action callback = null); 76 | 77 | #endregion 78 | 79 | 80 | 81 | #region LOAD 82 | 83 | public void Load() { 84 | LoadInternal(); 85 | OnStorageLoadedEvent?.Invoke(data); 86 | } 87 | 88 | protected abstract void LoadInternal(); 89 | 90 | public void LoadAsync(Action callback = null) { 91 | LoadAsyncInternal(loadedData => { 92 | callback?.Invoke(data); 93 | OnStorageLoadedEvent?.Invoke(data); 94 | }); 95 | } 96 | 97 | protected abstract void LoadAsyncInternal(Action callback = null); 98 | 99 | public Coroutine LoadWithRoutine(Action callback = null) { 100 | return LoadWithRoutineInternal(loadedData => { 101 | callback?.Invoke(data); 102 | OnStorageLoadedEvent?.Invoke(data); 103 | }); 104 | } 105 | 106 | protected abstract Coroutine LoadWithRoutineInternal(Action callback = null); 107 | 108 | #endregion 109 | 110 | 111 | 112 | 113 | public T Get(string key) { 114 | return data.Get(key); 115 | } 116 | 117 | public T Get(string key, T valueByDefault) { 118 | return data.Get(key, valueByDefault); 119 | } 120 | 121 | public void Set(string key, T value) { 122 | this.data.Set(key, value); 123 | } 124 | 125 | public override string ToString() { 126 | return this.data.ToString(); 127 | } 128 | 129 | } 130 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Storage.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6c2159127ec480eb98ea990fe5aa983 3 | timeCreated: 1625925080 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25a97196b6b74703901f8ffb1389de72 3 | timeCreated: 1617969563 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates/QuaternionSerializationSurrogate.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Architecture.StorageSystem { 5 | public class QuaternionSerializationSurrogate : ISerializationSurrogate { 6 | public void GetObjectData(object obj, SerializationInfo info, StreamingContext context) { 7 | var quaternion = (Quaternion) obj; 8 | info.AddValue("x", quaternion.x); 9 | info.AddValue("y", quaternion.y); 10 | info.AddValue("z", quaternion.z); 11 | info.AddValue("w", quaternion.w); 12 | } 13 | 14 | public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { 15 | var quaternion = (Quaternion) obj; 16 | quaternion.x = (float) info.GetValue("x", typeof(float)); 17 | quaternion.y = (float) info.GetValue("y", typeof(float)); 18 | quaternion.z = (float) info.GetValue("z", typeof(float)); 19 | quaternion.w = (float) info.GetValue("w", typeof(float)); 20 | obj = quaternion; 21 | return obj; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates/QuaternionSerializationSurrogate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74de5b772ab348f7aceff429de99cc31 3 | timeCreated: 1617952301 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates/Vector2SerializationSurrogate.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Architecture.StorageSystem { 5 | public class Vector2SerializationSurrogate : ISerializationSurrogate { 6 | public void GetObjectData(object obj, SerializationInfo info, StreamingContext context) { 7 | var v2 = (Vector2) obj; 8 | info.AddValue("x", v2.x); 9 | info.AddValue("y", v2.y); 10 | } 11 | 12 | public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { 13 | var v2 = (Vector2) obj; 14 | v2.x = (float) info.GetValue("x", typeof(float)); 15 | v2.y = (float) info.GetValue("y", typeof(float)); 16 | obj = v2; 17 | return obj; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates/Vector2SerializationSurrogate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08b15bfb642048fc84d26beb822abf6d 3 | timeCreated: 1617957758 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates/Vector3SerializationSurrogate.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Architecture.StorageSystem { 5 | public sealed class Vector3SerializationSurrogate : ISerializationSurrogate { 6 | public void GetObjectData(object obj, SerializationInfo info, StreamingContext context) { 7 | var v3 = (Vector3) obj; 8 | info.AddValue("x", v3.x); 9 | info.AddValue("y", v3.y); 10 | info.AddValue("z", v3.z); 11 | } 12 | 13 | public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { 14 | var v3 = (Vector3) obj; 15 | v3.x = (float) info.GetValue("x", typeof(float)); 16 | v3.y = (float) info.GetValue("y", typeof(float)); 17 | v3.z = (float) info.GetValue("z", typeof(float)); 18 | obj = v3; 19 | return obj; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Scripts/Surrogates/Vector3SerializationSurrogate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eec182d4895143198b86c2af38af16cd 3 | timeCreated: 1617952105 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Storage System 3.0.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Architecture/Storage/Storage System 3.0.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Architecture/Storage/Storage System 3.0.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaa9ff5e206aa864fb7c9bc2f0a0b6b8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4b1b41eb24b713489bf8d88c6131d46 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6c9a85db0bd44b5f983727587177793 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 743f695ed01041f1b84b6d4d07644cd6 3 | timeCreated: 1627327389 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Example/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55405c2c7d72fa747a90c5ff4eb1199b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Example/Scenes/ExponentialViewExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 859773d0d6304dc6a61440275ac72dea 3 | timeCreated: 1627327389 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Example/Scripts/ExponentialViewExample.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using VavilichevGD.Attributes; 4 | 5 | public class ExponentialViewExample : MonoBehaviour { 6 | 7 | #region CONSTANTS 8 | 9 | private const string PREF_KEY = "BIG_NUMBER_VALUE"; 10 | 11 | #endregion 12 | 13 | [SerializeField, ExponentialView] private double minValueForRandom; 14 | [SerializeField, ExponentialView] private double maxValueForRandom; 15 | [Space] 16 | [SerializeField] private Button btnSave; 17 | [SerializeField] private Button btnLoad; 18 | [SerializeField] private Button btnRandomize; 19 | [Space] 20 | [SerializeField] private Text textLog; 21 | 22 | 23 | private double _number; 24 | 25 | #region MONO 26 | 27 | private void OnEnable() { 28 | btnSave.onClick.AddListener(OnSaveButtonClick); 29 | btnLoad.onClick.AddListener(OnLoadButtonClick); 30 | btnRandomize.onClick.AddListener(OnRandomizeButtonClick); 31 | UpdateTextField(); 32 | } 33 | 34 | private void OnDisable() { 35 | btnSave.onClick.RemoveListener(OnSaveButtonClick); 36 | btnLoad.onClick.RemoveListener(OnLoadButtonClick); 37 | btnRandomize.onClick.RemoveListener(OnRandomizeButtonClick); 38 | } 39 | 40 | #endregion 41 | 42 | 43 | private void UpdateTextField() { 44 | textLog.text = _number.ToStringFormatted(); 45 | } 46 | 47 | private void Save() { 48 | PlayerPrefs.SetString(PREF_KEY, _number.ToString("r")); 49 | } 50 | 51 | private void Load() { 52 | var loadedString = PlayerPrefs.GetString(PREF_KEY, _number.ToString("r")); 53 | _number = double.Parse(loadedString); 54 | } 55 | 56 | private void RandomizeNumber() { 57 | _number = ExponentialViewUtility.GetRandomBigNumber(minValueForRandom, maxValueForRandom); 58 | } 59 | 60 | 61 | #region CALLBACKS 62 | 63 | private void OnSaveButtonClick() { 64 | Save(); 65 | } 66 | 67 | private void OnLoadButtonClick() { 68 | Load(); 69 | UpdateTextField(); 70 | } 71 | 72 | private void OnRandomizeButtonClick() { 73 | RandomizeNumber(); 74 | UpdateTextField(); 75 | } 76 | 77 | #endregion 78 | 79 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Example/Scripts/ExponentialViewExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 257626870a074a72ba55d9fe38944db1 3 | timeCreated: 1627287857 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/ExponentialView v.1.03.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Attributes/ExponentialView/ExponentialView v.1.03.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/ExponentialView v.1.03.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8cf88bd5b0a04f47b06db43d1ff8ced 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/ReadMe.md: -------------------------------------------------------------------------------- 1 | # ExponentialView Attribute 2 | 3 | This asset was developed for making incremental games, where you must use extra large numbers. Asset just shows number in editor in convenient way, using exponential format of number.
4 | Just use ExponentialView attribute for double type. 5 | 6 | 7 | ![image](https://user-images.githubusercontent.com/22970240/127616934-6f899e2b-3d67-48f5-8a7c-5852d6e8a150.png) 8 | 9 | 10 | You can fill mantissa and exponent in editor. The limits are:
11 | From 1 to 9.99 for mantissa, but you can also put 0;
12 | From -2 to 307 for exponent.
13 |
14 | You cannot write the numbers that are out of this limits, asset automatically clamps it. 15 | 16 | ![image](https://user-images.githubusercontent.com/22970240/127616990-2f79a03d-b109-4b13-8ee6-86338cda7959.png) 17 | 18 | 19 | Asset contains translation of numbers. It will be usefull for incremental games that shows you extra large numbers in short format. 20 | 21 | ![image](https://user-images.githubusercontent.com/22970240/127551175-af73d8ad-e1a4-4619-a3fd-d5314917ca98.png) 22 | 23 | You can use simple formatting: 24 | 25 | ![image](https://user-images.githubusercontent.com/22970240/127552121-e8ebff9b-6e93-4505-87f3-863e5e6ea308.png) 26 | 27 | 28 | Or specific translation: 29 | 30 | ![image](https://user-images.githubusercontent.com/22970240/127552188-a60cedae-67bb-4dcf-a54f-4362e48073c6.png) 31 | 32 | For specific translation check that specified dictionary of language exists. If not write your own. Watch ExponentialViewDictionaryEn.cs or ExponentialViewDictionaryRu.cs for details. Dont forget to add it to ExponentialViewTranslator.cs class. 33 | 34 | ![image](https://user-images.githubusercontent.com/22970240/127617090-9dbe8684-1c00-463d-ba00-32e9b6bd7ff8.png) 35 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/ReadMe.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f445b5c3ff73d5549aa9cc61e9cd6ae6 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cdd1e500accc9d41ac879f571123543 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c570a182e1e45e244972f65e23fd0b76 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/Editor/ExponentialViewDrawer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace VavilichevGD.Attributes { 6 | [CustomPropertyDrawer(typeof(ExponentialViewAttribute))] 7 | public class ExponentialViewDrawer : PropertyDrawer { 8 | 9 | #region CONSTANTS 10 | 11 | private const string DOUBLE_TYPE = "double"; 12 | 13 | #endregion 14 | 15 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { 16 | 17 | ValidateProperty(property); 18 | 19 | var doubleValue = property.doubleValue; 20 | var mantissa = doubleValue.GetMantissa(2); 21 | var exponent = doubleValue.GetExponent(); 22 | 23 | EditorGUI.BeginProperty(position, label, property); 24 | 25 | // Draw label 26 | position = EditorGUI.PrefixLabel(position, label); 27 | 28 | // Calculate rects 29 | var mantissaRect = new Rect(position.x, position.y, position.width - 95, position.height); 30 | position.x = mantissaRect.position.x + mantissaRect.width + 5f; 31 | 32 | var tenRect = new Rect(position.x, position.y, 15, position.height); 33 | position.x = tenRect.position.x + tenRect.width + 5f; 34 | 35 | var exponentRect = new Rect(position.x, position.y, position.width - mantissaRect.width - tenRect.width - 10, position.height); 36 | 37 | // Draw fields - pass GUIContent.none to each so they are drawn without labels 38 | mantissa = EditorGUI.DoubleField(mantissaRect, mantissa); 39 | mantissa = ClampMantissa(mantissa, ExponentialViewUtility.MANTISSA_MIN, ExponentialViewUtility.MANTISSA_MAX); 40 | 41 | EditorGUI.LabelField(tenRect, "+E"); 42 | exponent = EditorGUI.IntField(exponentRect, exponent); 43 | exponent = Mathf.Clamp(exponent, ExponentialViewUtility.EXPONENT_MIN, ExponentialViewUtility.EXPONENT_MAX); 44 | 45 | 46 | EditorGUI.EndProperty(); 47 | 48 | property.doubleValue = mantissa * Math.Pow(10, exponent); 49 | property.serializedObject.ApplyModifiedProperties(); 50 | } 51 | 52 | private void ValidateProperty(SerializedProperty property) { 53 | var type = property.type; 54 | if (type != DOUBLE_TYPE) 55 | throw new Exception($"ExponentialView attribute works only with double value ({property.displayName})"); 56 | } 57 | 58 | private double ClampMantissa(double value, double min, double max) { 59 | if (value == 0d) 60 | return value; 61 | 62 | var clampedValue = value; 63 | if (clampedValue < min) 64 | clampedValue = min; 65 | else if (clampedValue > max) 66 | clampedValue = max; 67 | return clampedValue; 68 | } 69 | 70 | } 71 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/Editor/ExponentialViewDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3766f27214ed4d33a95736720ba2d237 3 | timeCreated: 1627299538 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Attributes { 5 | [Serializable] 6 | public class ExponentialViewAttribute : PropertyAttribute { } 7 | } 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88d6947d8f57462089909d5afb69e0ce 3 | timeCreated: 1627299389 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewDictionaryBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using UnityEngine; 4 | 5 | namespace VavilichevGD.Attributes { 6 | public abstract class ExponentialViewDictionaryBase { 7 | 8 | protected abstract string[] dictionary { get; } 9 | 10 | 11 | public string Translate(double d) { 12 | var exponent = d.GetExponent(); 13 | if (dictionary.Length < exponent / 3) { 14 | Debug.LogError($"Dictionary doesn't have name for exponent: {exponent}"); 15 | return ReturnSimplifiedDouble(d, exponent); 16 | } 17 | 18 | var rank = Mathf.FloorToInt(exponent / 3f) - 1; 19 | if (rank < 0) { 20 | var roundedValue = Math.Round(d, 2); 21 | return roundedValue.ToString(CultureInfo.InvariantCulture); 22 | } 23 | 24 | 25 | var mantissa = d.GetMantissa(2); 26 | if (exponent % 3 != 0) 27 | mantissa *= Math.Pow(10, exponent % 3); 28 | 29 | return $"{mantissa}{dictionary[rank]}"; 30 | } 31 | 32 | private string ReturnSimplifiedDouble(double d, int exponent) { 33 | var mantissa = d.GetMantissa(2); 34 | return $"{mantissa}+E{exponent}"; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewDictionaryBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f3b598a772c25145a5d7bf473060b64 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewDictionaryEn.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Attributes { 2 | public class ExponentialViewDictionaryEn : ExponentialViewDictionaryBase { 3 | protected override string[] dictionary { get; } = { 4 | "K", 5 | "M", 6 | "B", 7 | "T", 8 | 9 | "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", 10 | "t", "u", "v", "w", "x", "y", "z", 11 | 12 | "aa", "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj", "ak", "al", "am", "an", "ao", "ap", 13 | "aq", "ar", "as", "at", "au", "av", "aw", "ax", "ay", "az", 14 | 15 | "ba", "bb", "bc", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bk", "bl", "bm", "bn", "bo", "bp", 16 | "bq", "br", "bs", "bt", "bu", "bv", "bw", "bx", "by", "bz", 17 | 18 | "ca", "cb", "cc", "cd", "ce", "cf", "cg", "ch", "ci", "cj", "ck", "cl", "cm", "cn", "co", "cp", 19 | "cq", "cr", "cs", "ct", "cu", "cv", "cw", "cx", "cy", "cz", 20 | 21 | "da", "db", "dc", "dd", "de", "df", "dg", "dh", "di", "dj", "dk", "dl", "dm", "dn", "do", "dp", 22 | "dq", "dr", "ds", "dt", "du", "dv", "dw", "dx", "dy", "dz", 23 | 24 | "ea", "eb", "ec", "ed", "ee", "ef", "eg", "eh", "ei", "ej", "ek", "el", "em", "en", "eo", "ep", 25 | "eq", "er", "es", "et", "eu", "ev", "ew", "ex", "ey", "ez", 26 | }; 27 | } 28 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewDictionaryEn.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acebefb79e698cc4a9f465c2dc5d3b3f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewDictionaryRu.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Attributes { 2 | public class ExponentialViewDictionaryRu : ExponentialViewDictionaryBase { 3 | protected override string[] dictionary { get; } = { 4 | "тыс", 5 | "млн", 6 | "млрд", 7 | "трлн", 8 | 9 | "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", 10 | "t", "u", "v", "w", "x", "y", "z", 11 | 12 | "aa", "ab", "ac", "ad", "ae", "af", "ag", "ah", "ai", "aj", "ak", "al", "am", "an", "ao", "ap", 13 | "aq", "ar", "as", "at", "au", "av", "aw", "ax", "ay", "az", 14 | 15 | "ba", "bb", "bc", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bk", "bl", "bm", "bn", "bo", "bp", 16 | "bq", "br", "bs", "bt", "bu", "bv", "bw", "bx", "by", "bz", 17 | 18 | "ca", "cb", "cc", "cd", "ce", "cf", "cg", "ch", "ci", "cj", "ck", "cl", "cm", "cn", "co", "cp", 19 | "cq", "cr", "cs", "ct", "cu", "cv", "cw", "cx", "cy", "cz", 20 | 21 | "da", "db", "dc", "dd", "de", "df", "dg", "dh", "di", "dj", "dk", "dl", "dm", "dn", "do", "dp", 22 | "dq", "dr", "ds", "dt", "du", "dv", "dw", "dx", "dy", "dz", 23 | 24 | "ea", "eb", "ec", "ed", "ee", "ef", "eg", "eh", "ei", "ej", "ek", "el", "em", "en", "eo", "ep", 25 | "eq", "er", "es", "et", "eu", "ev", "ew", "ex", "ey", "ez", 26 | 27 | }; 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewDictionaryRu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8e74126d23da934187dd9a29deac147 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewExtensions.cs: -------------------------------------------------------------------------------- 1 |  using System; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Attributes { 5 | public static class ExponentialViewExtensions { 6 | 7 | public static int GetExponent(this double d) { 8 | var doubleParts = ExtractScientificNotationParts(d); 9 | return Convert.ToInt32(doubleParts[1]); 10 | } 11 | 12 | public static double GetMantissa(this double d, int digits) { 13 | var doubleParts = ExtractScientificNotationParts(d); 14 | var mantissa = Convert.ToDouble(doubleParts[0]); 15 | var roundedMantissa = Math.Min(Math.Round(mantissa, digits), 9.99d); 16 | return roundedMantissa; 17 | } 18 | 19 | private static string[] ExtractScientificNotationParts(this double d) { 20 | var doubleParts = d.ToString(@"E17").Split('E'); 21 | if (doubleParts.Length != 2) 22 | throw new ArgumentException(); 23 | 24 | return doubleParts; 25 | } 26 | 27 | public static string ToStringFormatted(this double d) { 28 | return ExponentialViewTranslator.Translate(d, SystemLanguage.English); 29 | } 30 | 31 | public static string ToStringTranslated(this double d) { 32 | return ExponentialViewTranslator.Translate(d); 33 | } 34 | 35 | public static string ToStringTranslated(this double d, SystemLanguage language) { 36 | return ExponentialViewTranslator.Translate(d, language); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 598b96be9fa24f73ac9d889186f5a85a 3 | timeCreated: 1627298927 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewTranslator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VavilichevGD.Attributes { 4 | public static class ExponentialViewTranslator { 5 | 6 | public static bool isInitialized => _dictionaryBase != null; 7 | 8 | private static ExponentialViewDictionaryBase _dictionaryBase; 9 | private static SystemLanguage _language; 10 | 11 | public static void UpdateDictionary(SystemLanguage newLanguage = SystemLanguage.English) { 12 | if (newLanguage == _language) 13 | return; 14 | 15 | _language = newLanguage; 16 | switch (_language) { 17 | 18 | case SystemLanguage.English: 19 | _dictionaryBase = new ExponentialViewDictionaryEn(); 20 | break; 21 | 22 | case SystemLanguage.Russian: 23 | _dictionaryBase = new ExponentialViewDictionaryRu(); 24 | break; 25 | 26 | default: 27 | _dictionaryBase = new ExponentialViewDictionaryEn(); 28 | break; 29 | 30 | } 31 | } 32 | 33 | public static string Translate(double d) { 34 | if (!isInitialized) 35 | UpdateDictionary(); 36 | return _dictionaryBase.Translate(d); 37 | } 38 | 39 | public static string Translate(double d, SystemLanguage language) { 40 | UpdateDictionary(language); 41 | return _dictionaryBase.Translate(d); 42 | } 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewTranslator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4c31577e326e7d469ca358d44566b03 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VavilichevGD.Attributes { 4 | public static class ExponentialViewUtility { 5 | 6 | #region CONSTANTS 7 | 8 | public const double MANTISSA_MIN = 1.00d; 9 | public const double MANTISSA_MAX = 9.99d; 10 | public const int EXPONENT_MIN = -2; 11 | public const int EXPONENT_MAX = 307; 12 | 13 | #endregion 14 | 15 | public static readonly double minValue = MANTISSA_MIN * Math.Pow(10, EXPONENT_MIN); 16 | public static readonly double maxValue = MANTISSA_MAX * Math.Pow(10, EXPONENT_MAX); 17 | 18 | 19 | public static double GetRandomBigNumber(double min, double max) { 20 | var random = new Random(); 21 | var rDouble = random.NextDouble(); // between 0 and 1 22 | var difference = max - min; 23 | var differenceExponent = difference.GetExponent(); 24 | var rExponent = random.Next(1, differenceExponent); 25 | var rDoubleFinal = rDouble / Math.Pow(10, rExponent - 1); // -1 because of rDouble placed between 0 and 1 26 | var result = rDoubleFinal * difference + min; 27 | result = Math.Round(result, 2); 28 | 29 | return result; 30 | } 31 | 32 | public static double GetRandomBigNumber() { 33 | return GetRandomBigNumber(minValue, maxValue); 34 | } 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Attributes/ExponentialView/Scripts/ExponentialViewUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37cbedee225b4c79b0725a9f60ea756d 3 | timeCreated: 1627327796 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0757751f01bb33409485688cf07c2bb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0fcc2f55b0957b4ea1793c1fcdb3a52 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 437a43b2b5364d99adfd87ed2d0566c6 3 | timeCreated: 1615494441 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24d69611dde846d4c95bc02666e64e50 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Resources/DialogueGraph.uss: -------------------------------------------------------------------------------- 1 | GridBackground { 2 | --grid-background-color: #282828; 3 | --line-color: rgba(193, 196, 192, 0.1); 4 | --thick-line-color: rgba(193, 196, 192, 0.1); 5 | spacing: 1; 6 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Resources/DialogueGraph.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1a1db5f47ceb6f4f855654fa3ee830a 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | disableValidation: 0 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Resources/Node.uss: -------------------------------------------------------------------------------- 1 | EditorDialogueNode #title{ 2 | background-color: #186b95; 3 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Resources/Node.uss.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb8ac232cc168f242b8e4d81fa99ddfb 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} 11 | disableValidation: 0 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca48d3b08d2009c418ad95fe50115107 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/DialogueInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace VavilichevGD.Gameplay.Dialogues { 7 | [Serializable] 8 | public class DialogueInfo : ScriptableObject { 9 | 10 | public List nodeLinks = new List(); 11 | public List dialogueNodeData = new List(); 12 | 13 | public void Clear() { 14 | this.nodeLinks.Clear(); 15 | this.dialogueNodeData.Clear(); 16 | } 17 | 18 | public override bool Equals(object other) { 19 | if (other.GetType() != this.GetType()) 20 | return false; 21 | 22 | var info = (DialogueInfo) other; 23 | 24 | var currentLinksCount = this.nodeLinks.Count; 25 | if (info.nodeLinks.Count != currentLinksCount) 26 | return false; 27 | 28 | for (int i = 0; i < currentLinksCount; i++) { 29 | var curNodeLink = this.nodeLinks[i]; 30 | 31 | if (info.nodeLinks.All(e => e.portName != curNodeLink.portName)) 32 | return false; 33 | 34 | if (info.nodeLinks.All(e => e.baseNodeGUID != curNodeLink.baseNodeGUID)) 35 | return false; 36 | 37 | if (info.nodeLinks.All(e => e.targetNodeGUID != curNodeLink.targetNodeGUID)) 38 | return false; 39 | } 40 | 41 | var curNodesCount = this.dialogueNodeData.Count; 42 | if (info.dialogueNodeData.Count != curNodesCount) 43 | return false; 44 | 45 | for (int i = 0; i < curNodesCount; i++) { 46 | var curNodeData = this.dialogueNodeData[i]; 47 | 48 | if (info.dialogueNodeData.All(e => e.guid != curNodeData.guid)) 49 | return false; 50 | 51 | if (info.dialogueNodeData.All(e => e.author != curNodeData.author)) 52 | return false; 53 | 54 | if (info.dialogueNodeData.All(e => e.dialogueText != curNodeData.dialogueText)) 55 | return false; 56 | 57 | if (info.dialogueNodeData.All(e => e.position != curNodeData.position)) 58 | return false; 59 | } 60 | 61 | return true; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/DialogueInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0541891c97c7574a8c6d4649bb4c0cb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/DialogueNodeData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | [Serializable] 5 | public class DialogueNodeData { 6 | public string guid; 7 | public string author; 8 | public string dialogueText; 9 | public Vector2 position; 10 | } 11 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/DialogueNodeData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09b4beaa303d4ed4ab03ee745a46286a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 530c42bc5d954f49a2d9fe88a78b24d4 3 | timeCreated: 1615494447 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/DialogueGraph.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEditor.Experimental.GraphView; 3 | using UnityEditor.UIElements; 4 | using UnityEngine; 5 | using UnityEngine.UIElements; 6 | using VavilichevGD.Gameplay.Dialogues; 7 | 8 | namespace VavilichevGD.Editor.Dialogues { 9 | public class DialogueGraph : EditorWindow { 10 | 11 | #region CONSTANTS 12 | 13 | private const string TITLE_DIALOGUE_GRAPH = "Dialogue Graph"; 14 | 15 | #endregion 16 | 17 | private DialogueGraphView graphView; 18 | private GraphSaveUtility saveUtility; 19 | 20 | #region EDITOR 21 | 22 | [MenuItem("Window/Dialogues/Dialogue Graph")] 23 | public static void OpenDialogueGraphWindow() { 24 | var window = GetWindow(); 25 | window.Initialize(); 26 | } 27 | 28 | public static void OpenDialogueGraphWindow(DialogueInfo dialogueInfo) { 29 | var window = GetWindow(); 30 | window.Initialize(); 31 | window.saveUtility.LoadGraph(dialogueInfo); 32 | } 33 | 34 | #endregion 35 | 36 | 37 | #region LIFECYCLE 38 | 39 | public void Initialize() { 40 | this.titleContent = new GUIContent(TITLE_DIALOGUE_GRAPH); 41 | 42 | var gv = this.CreateGraphView(); 43 | this.saveUtility = new GraphSaveUtility(gv); 44 | this.saveUtility.OnFileNameChangedEvent += this.OnFileNameChanged; 45 | 46 | this.CreateToolbar(); 47 | this.CreateMiniMap(); 48 | } 49 | 50 | private void OnDisable() { 51 | if (this.saveUtility == null) 52 | return; 53 | 54 | this.saveUtility.SaveBeforeClose(); 55 | this.saveUtility.OnFileNameChangedEvent -= this.OnFileNameChanged; 56 | this.rootVisualElement.Remove(this.graphView); 57 | } 58 | 59 | #endregion 60 | 61 | private DialogueGraphView CreateGraphView() { 62 | this.graphView = new DialogueGraphView(this) { 63 | name = TITLE_DIALOGUE_GRAPH 64 | }; 65 | 66 | this.graphView.StretchToParentSize(); 67 | this.rootVisualElement.Add(this.graphView); 68 | return this.graphView; 69 | } 70 | 71 | private void CreateToolbar() { 72 | var toolbar = new Toolbar(); 73 | toolbar.Add(new Button(this.OnSaveButtonClicked) {text = "Save"}); 74 | toolbar.Add(new Button(this.OnSaveAsButtonClicked) {text = "Save As.."}); 75 | toolbar.Add(new Button(this.OnLoadButtonClicked) {text = "Load"}); 76 | 77 | rootVisualElement.Add(toolbar); 78 | } 79 | 80 | private void CreateMiniMap() { 81 | var miniMap = new MiniMap {anchored = true}; 82 | this.UpdateMiniMapPosition(miniMap); 83 | this.graphView.Add(miniMap); 84 | 85 | rootVisualElement.RegisterCallback(visualElement => { 86 | this.UpdateMiniMapPosition(miniMap); 87 | }); 88 | } 89 | 90 | private void UpdateMiniMapPosition(MiniMap miniMap) { 91 | var coords = this.graphView.contentViewContainer.WorldToLocal(new Vector2(this.maxSize.x - 10, 30)); 92 | miniMap.SetPosition(new Rect(coords.x, coords.y, 200, 140)); 93 | } 94 | 95 | #region CALLBACKS 96 | 97 | private void OnSaveButtonClicked() { 98 | this.saveUtility.SaveGraph(); 99 | } 100 | 101 | private void OnSaveAsButtonClicked() { 102 | this.saveUtility.SaveGraphAs(); 103 | } 104 | 105 | private void OnLoadButtonClicked() { 106 | this.saveUtility.LoadGraph(); 107 | } 108 | 109 | private void OnFileNameChanged(string newFileName) { 110 | this.titleContent.text = $"{TITLE_DIALOGUE_GRAPH} - {newFileName}"; 111 | } 112 | 113 | #endregion 114 | 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/DialogueGraph.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b4ff8530fe5d794680636d313b68b7d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/DialogueGraphView.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14acaf7c50e9c634bbd65599fbdba819 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/DialogueInfoEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | using VavilichevGD.Gameplay.Dialogues; 4 | 5 | namespace VavilichevGD.Editor.Dialogues { 6 | [CustomEditor(typeof(DialogueInfo))] 7 | public class DialogueInfoEditor : UnityEditor.Editor { 8 | public override void OnInspectorGUI() { 9 | base.OnInspectorGUI(); 10 | 11 | EditorGUILayout.Space(); 12 | if (GUILayout.Button("Open Graph")) 13 | this.OpenGraph(); 14 | } 15 | 16 | private void OpenGraph() { 17 | var dialogueInfo = target as DialogueInfo; 18 | DialogueGraph.OpenDialogueGraphWindow(dialogueInfo); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/DialogueInfoEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 194a1924cc897f341a351f34a794ce53 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/EditorDialogueNode.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor.Experimental.GraphView; 2 | 3 | namespace VavilichevGD.Editor.Dialogues { 4 | public class EditorDialogueNode : Node { 5 | public string GUID; 6 | public string author; 7 | public string text; 8 | public bool entryPoint = false; 9 | } 10 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/EditorDialogueNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25c3a4346b2ef2241ac618e8694ecf4a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/GraphSaveUtility.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 853d9f73f35342578e739ac3b604098c 3 | timeCreated: 1614701006 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/NodeSearchWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEditor; 3 | using UnityEditor.Experimental.GraphView; 4 | using UnityEngine; 5 | using UnityEngine.UIElements; 6 | 7 | namespace VavilichevGD.Editor.Dialogues { 8 | public class NodeSearchWindow : ScriptableObject, ISearchWindowProvider { 9 | 10 | private DialogueGraphView graphView; 11 | private EditorWindow window; 12 | private Texture2D indentationIcon; 13 | 14 | public void Initialize(EditorWindow window, DialogueGraphView graphView) { 15 | this.window = window; 16 | this.graphView = graphView; 17 | 18 | indentationIcon = new Texture2D(1, 1); 19 | indentationIcon.SetPixel(0, 0, new Color(0, 0, 0, 0)); 20 | indentationIcon.Apply(); 21 | } 22 | 23 | public List CreateSearchTree(SearchWindowContext context) { 24 | var tree = new List { 25 | new SearchTreeGroupEntry(new GUIContent("Create Elements"), 0), 26 | new SearchTreeEntry(new GUIContent("Dialogue Node", indentationIcon)) { 27 | userData = new EditorDialogueNode(), 28 | level = 1 29 | } 30 | }; 31 | 32 | return tree; 33 | } 34 | 35 | public bool OnSelectEntry(SearchTreeEntry SearchTreeEntry, SearchWindowContext context) { 36 | 37 | var worldMousePosition = window.rootVisualElement.ChangeCoordinatesTo(window.rootVisualElement.parent, 38 | context.screenMousePosition - window.position.position); 39 | var localMousePosition = graphView.contentViewContainer.WorldToLocal(worldMousePosition); 40 | 41 | switch (SearchTreeEntry.userData) { 42 | case EditorDialogueNode dialogueNode: 43 | graphView.CreateNode("Dialogue Text", "Author", localMousePosition); 44 | return true; 45 | default: 46 | return false; 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/Editor/NodeSearchWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85954630f98b47cba78aa821cefd8512 3 | timeCreated: 1614715757 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/NodeLinkData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VavilichevGD.Gameplay.Dialogues { 4 | [Serializable] 5 | public class NodeLinkData { 6 | public string baseNodeGUID; 7 | public string portName; 8 | public string targetNodeGUID; 9 | } 10 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph/Scripts/NodeLinkData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d11f8eada9aaf14dab555e54cc10a44 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_1.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac00afe2cefa7f948989cb5c991255ca 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_2.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf1ccc5f122ed4448b56ade9eee74821 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_3.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_3.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddab4de50e8fd674db179180459f078c 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_4.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_4.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc4c843922bca3243af4c898c3a20d95 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueSystem.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/Dialogues/DialogueSystem.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/DialogueSystem.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30064845065f5014fbcc003f6f5fa9f8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a32dd36b587b7804e914f0cc5da2f40a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 283eb9d768035e64dae75b36e25d32f6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Prefabs/ExampleRoot.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d401d535eb713134f87b9fa2f58f51aa 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7ce1bb7fb357054784406578716b5ac 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Resources/ExampleDialogueGraph.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: b0541891c97c7574a8c6d4649bb4c0cb, type: 3} 13 | m_Name: ExampleDialogueGraph 14 | m_EditorClassIdentifier: 15 | nodeLinks: 16 | - baseNodeGUID: a7cc683c-1f68-4bb4-b4ab-2177c2fa0dc1 17 | portName: Begin 18 | targetNodeGUID: 20ffadf7-155d-4875-b4e1-d4f20c5ae535 19 | - baseNodeGUID: 52f426be-62bb-4528-a0df-2480a8e80e80 20 | portName: Great! I'll subscribe! 21 | targetNodeGUID: 31fd6ae0-2298-4076-85a7-7231917b2f24 22 | - baseNodeGUID: ac8dd6cd-dfe0-4280-9212-e9d523a65509 23 | portName: Tell me about about your creator. 24 | targetNodeGUID: 52f426be-62bb-4528-a0df-2480a8e80e80 25 | - baseNodeGUID: 20ffadf7-155d-4875-b4e1-d4f20c5ae535 26 | portName: Cool! Show me what you can 27 | targetNodeGUID: ac8dd6cd-dfe0-4280-9212-e9d523a65509 28 | - baseNodeGUID: 20ffadf7-155d-4875-b4e1-d4f20c5ae535 29 | portName: Okay. Understood. 30 | targetNodeGUID: 82f929ea-3890-4844-8477-109ff132499d 31 | - baseNodeGUID: ac8dd6cd-dfe0-4280-9212-e9d523a65509 32 | portName: I dont want listen to you! 33 | targetNodeGUID: 1952ff5b-3c57-4f2d-bd94-c863047f9c66 34 | - baseNodeGUID: 1952ff5b-3c57-4f2d-bd94-c863047f9c66 35 | portName: Okay. I'll do it. 36 | targetNodeGUID: 31fd6ae0-2298-4076-85a7-7231917b2f24 37 | dialogueNodeData: 38 | - guid: ac8dd6cd-dfe0-4280-9212-e9d523a65509 39 | author: Richard 40 | dialogueText: I can give you different answers, depend on your choice! 41 | position: {x: 719, y: -14} 42 | - guid: 20ffadf7-155d-4875-b4e1-d4f20c5ae535 43 | author: Richard 44 | dialogueText: Hi there! I am a super duper coolest asset "Dialogues"! 45 | position: {x: 195, y: 172} 46 | - guid: 52f426be-62bb-4528-a0df-2480a8e80e80 47 | author: Richard 48 | dialogueText: 'You can find my creator on twitter: @vavilichevgd' 49 | position: {x: 1330, y: -58} 50 | - guid: 31fd6ae0-2298-4076-85a7-7231917b2f24 51 | author: Richard 52 | dialogueText: Thanks! Bye. 53 | position: {x: 1897, y: 61} 54 | - guid: 82f929ea-3890-4844-8477-109ff132499d 55 | author: Richard 56 | dialogueText: Okay, Bye. 57 | position: {x: 940, y: 221} 58 | - guid: 1952ff5b-3c57-4f2d-bd94-c863047f9c66 59 | author: Richard 60 | dialogueText: Okay. But you have to subscribe @vavilichevgd on twitter! 61 | position: {x: 1306, y: 107} 62 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Resources/ExampleDialogueGraph.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bd9631c950112d47850845b580b3a3c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86389bcbf049dd14ead3df466e3bf330 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scenes/DialoguesExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a00d21dead51a8a4eb8fde4189b6a8a2 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e2ee65bb3e38e944a9fa1266f9cfc9a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts/DialogueExample.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace VavilichevGD.Gameplay.Dialogues.Example { 5 | public class DialogueExample : MonoBehaviour { 6 | 7 | [SerializeField] private DialogueInfo dialogueInfo; 8 | 9 | [SerializeField] private Text textFieldAuthor; 10 | [SerializeField] private Text textFieldSpeech; 11 | [SerializeField] private UIWidgetDialogueOptionsExample widgetDialogueOptionsExample; 12 | 13 | private Dialogue dialogue; 14 | 15 | private void Start() { 16 | this.dialogue = new Dialogue(dialogueInfo); 17 | 18 | var firstDialogueNodeId = this.dialogue.state.guidCurrent; 19 | var firstDialogueNode = this.dialogue.dialogueTree.GetNode(firstDialogueNodeId); 20 | this.Setup(firstDialogueNode); 21 | 22 | this.widgetDialogueOptionsExample.OnOptionClickedEvent += OnOptionExampleClicked; 23 | } 24 | 25 | private void OnOptionExampleClicked(DialogueOption option) { 26 | var nextDialogueNodeId = option.targetNodeGuid; 27 | this.dialogue.state.guidCurrent = nextDialogueNodeId; 28 | var nextDialogueNode = this.dialogue.dialogueTree.GetNode(nextDialogueNodeId); 29 | this.Setup(nextDialogueNode); 30 | } 31 | 32 | private void Setup(DialogueNode dialogueNode) { 33 | this.textFieldAuthor.text = dialogueNode.author; 34 | this.textFieldSpeech.text = dialogueNode.text; 35 | this.widgetDialogueOptionsExample.Setup(dialogueNode.options); 36 | } 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts/DialogueExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e38c73858419d354db4e75ece7a915fb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts/UIWidgetDialogueOptionExample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace VavilichevGD.Gameplay.Dialogues.Example { 6 | public class UIWidgetDialogueOptionExample : MonoBehaviour { 7 | 8 | #region EVENTS 9 | 10 | public event Action OnClickedEvent; 11 | 12 | #endregion 13 | 14 | [SerializeField] private Button button; 15 | [SerializeField] private Text textOption; 16 | 17 | public DialogueOption option { get; private set; } 18 | 19 | public void Setup(DialogueOption option) { 20 | this.option = option; 21 | this.textOption.text = option.text; 22 | } 23 | 24 | private void OnEnable() { 25 | this.button.onClick.AddListener(this.OnClicked); 26 | } 27 | 28 | private void OnDisable() { 29 | this.button.onClick.RemoveListener(this.OnClicked); 30 | } 31 | 32 | #region CALLBACKS 33 | 34 | private void OnClicked() { 35 | this.OnClickedEvent?.Invoke(this.option); 36 | } 37 | 38 | #endregion 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts/UIWidgetDialogueOptionExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3cb945ae62364d77a591b19f650e0392 3 | timeCreated: 1615389568 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts/UIWidgetDialogueOptionsExample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | 7 | namespace VavilichevGD.Gameplay.Dialogues.Example { 8 | public class UIWidgetDialogueOptionsExample : MonoBehaviour { 9 | 10 | #region EVENTS 11 | 12 | public event Action OnOptionClickedEvent; 13 | 14 | #endregion 15 | 16 | [SerializeField] private List widgetsOptions; 17 | [SerializeField] private Button buttonCancel; 18 | [SerializeField] private Button buttonSubscribe; 19 | 20 | 21 | private void OnEnable() { 22 | foreach (var uiOption in this.widgetsOptions) 23 | uiOption.OnClickedEvent += this.OnOptionClicked; 24 | 25 | this.buttonCancel.onClick.AddListener(this.OnCancelButtonClicked); 26 | this.buttonSubscribe.onClick.AddListener(this.OnSubscribeOnTwitterButtonClicked); 27 | } 28 | 29 | private void OnDisable() { 30 | foreach (var uiOption in this.widgetsOptions) 31 | uiOption.OnClickedEvent -= this.OnOptionClicked; 32 | 33 | this.buttonCancel.onClick.RemoveListener(this.OnCancelButtonClicked); 34 | this.buttonSubscribe.onClick.RemoveListener(this.OnSubscribeOnTwitterButtonClicked); 35 | } 36 | 37 | 38 | public void Setup(List options) { 39 | this.DeactivateAll(); 40 | 41 | for (int i = 0; i < options.Count; i++) { 42 | widgetsOptions[i].gameObject.SetActive(true); 43 | widgetsOptions[i].Setup(options[i]); 44 | } 45 | 46 | this.buttonCancel.gameObject.SetActive(options.Count == 0); 47 | this.buttonSubscribe.gameObject.SetActive(options.Count == 0); 48 | } 49 | 50 | private void DeactivateAll() { 51 | foreach (var uiOption in widgetsOptions) 52 | uiOption.gameObject.SetActive(false); 53 | this.buttonCancel.gameObject.SetActive(false); 54 | this.buttonSubscribe.gameObject.SetActive(false); 55 | } 56 | 57 | 58 | #region CALLBACKS 59 | 60 | private void OnOptionClicked(DialogueOption option) { 61 | this.OnOptionClickedEvent?.Invoke(option); 62 | } 63 | 64 | private void OnCancelButtonClicked() { 65 | #if UNITY_EDITOR 66 | EditorApplication.isPlaying = false; 67 | #endif 68 | } 69 | 70 | private void OnSubscribeOnTwitterButtonClicked() { 71 | Application.OpenURL("https://twitter.com/vavilichevgd"); 72 | #if UNITY_EDITOR 73 | EditorApplication.isPlaying = false; 74 | #endif 75 | } 76 | 77 | #endregion 78 | 79 | } 80 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Example/Scripts/UIWidgetDialogueOptionsExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d0878b5a01449bd9d04a57cae656bc8 3 | timeCreated: 1615389526 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/README.md: -------------------------------------------------------------------------------- 1 | # Dialogue System with Graph View 2 |
3 | 4 | [Load DialogueSystem.unitypackage](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Gameplay/Dialogues/DialogueSystem.unitypackage) 5 | 6 | 7 | 8 |
9 | 10 | To create new Dialogue - just go to **Window/Dialogues/Dialogue Graph** 11 | 12 | 13 |

14 | Simple system that allows you to write your game dialogues with convenient graph tool! 15 |

16 | ![](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_1.png?raw=true) 17 | 18 | ## Features 19 | - Simple Save & Load (files stored like a scriptable objects); 20 | - Zoom in and out (you can write really big dialogue); 21 | - Flexible code allows you to add your own data to the sistem; 22 | - Easy to use. 23 | 24 |

25 | --- 26 | 27 | #### The scriptable object can be look a little bit weird. But it is okay, the Dialogue system uses GUID as identifier of each dialogue node. No need to read scriptable object in the inspector window. Just click "Open Graph" button. 28 | ![](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Gameplay/Dialogues/DialogueGraph_2.png?raw=true) 29 | 30 |

31 | --- 32 | #### Watch the example to learn more. Here is the code that used in that example - looks pretty easy, isn't it? 33 | 34 | ```csharp 35 | using UnityEngine; 36 | using UnityEngine.UI; 37 | 38 | namespace VavilichevGD.Gameplay.Dialogues.Example { 39 | public class DialogueExample : MonoBehaviour { 40 | 41 | [SerializeField] private DialogueInfo dialogueInfo; 42 | 43 | [SerializeField] private Text textFieldAuthor; 44 | [SerializeField] private Text textFieldSpeech; 45 | [SerializeField] private UIWidgetDialogueOptionsExample widgetDialogueOptionsExample; 46 | 47 | private Dialogue dialogue; 48 | 49 | private void Start() { 50 | this.dialogue = new Dialogue(dialogueInfo); 51 | 52 | var firstDialogueNodeId = this.dialogue.state.guidCurrent; 53 | var firstDialogueNode = this.dialogue.dialogueTree.GetNode(firstDialogueNodeId); 54 | this.Setup(firstDialogueNode); 55 | 56 | this.widgetDialogueOptionsExample.OnOptionClickedEvent += OnOptionExampleClicked; 57 | } 58 | 59 | private void OnOptionExampleClicked(DialogueOption option) { 60 | var nextDialogueNodeId = option.targetNodeGuid; 61 | this.dialogue.state.guidCurrent = nextDialogueNodeId; 62 | var nextDialogueNode = this.dialogue.dialogueTree.GetNode(nextDialogueNodeId); 63 | this.Setup(nextDialogueNode); 64 | } 65 | 66 | private void Setup(DialogueNode dialogueNode) { 67 | this.textFieldAuthor.text = dialogueNode.author; 68 | this.textFieldSpeech.text = dialogueNode.text; 69 | this.widgetDialogueOptionsExample.Setup(dialogueNode.options); 70 | } 71 | 72 | } 73 | } 74 | ``` 75 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfb7ac5e8a0c0814a93d8bf49a4555c7 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b484a79f90e7704dba17ebb69f43d7a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/Dialogue.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay.Dialogues { 2 | public class Dialogue { 3 | 4 | public DialogueInfo info { get; } 5 | public DialogueState state { get; } 6 | public DialogueTree dialogueTree { get; } 7 | 8 | public Dialogue(DialogueInfo info) { 9 | this.info = info; 10 | this.state = new DialogueState(info.nodeLinks[0].targetNodeGUID); 11 | this.dialogueTree = new DialogueTree(info); 12 | } 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/Dialogue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 078d9c5ecd3a4e6fa73e5f412c1e3311 3 | timeCreated: 1615323925 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VavilichevGD.Gameplay.Dialogues { 4 | public class DialogueNode { 5 | public string guid { get; set; } 6 | public string author { get; set; } 7 | public string text { get; set; } 8 | public List options { get; set; } = new List(); 9 | } 10 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c14c7920295f4efba3bc2c35e2b6f68a 3 | timeCreated: 1615382031 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueOption.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay.Dialogues { 2 | public class DialogueOption { 3 | public string text; 4 | public string targetNodeGuid; 5 | } 6 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueOption.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56016bef581347e38be2a5623580e2d7 3 | timeCreated: 1615387741 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueState.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay.Dialogues { 2 | public class DialogueState { 3 | public string guidCurrent; 4 | public bool isViewed; 5 | 6 | public DialogueState(string firstGuid) { 7 | this.guidCurrent = firstGuid; 8 | this.isViewed = false; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueState.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27b3f1a08a884104b36819789eb8a89f 3 | timeCreated: 1615381660 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueTree.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace VavilichevGD.Gameplay.Dialogues { 5 | public class DialogueTree { 6 | 7 | private Dictionary nodesMap; 8 | 9 | public DialogueTree(DialogueInfo info) { 10 | 11 | this.nodesMap = new Dictionary(); 12 | 13 | foreach (var nodeData in info.dialogueNodeData) { 14 | var allOptionLinks = info.nodeLinks.Where(link => link.baseNodeGUID == nodeData.guid); 15 | var createdOptions = new List(); 16 | foreach (var linkData in allOptionLinks) { 17 | var createdOption = new DialogueOption { 18 | text = linkData.portName, 19 | targetNodeGuid = linkData.targetNodeGUID 20 | }; 21 | createdOptions.Add(createdOption); 22 | } 23 | 24 | var createdNode = new DialogueNode { 25 | author = nodeData.author, 26 | guid = nodeData.guid, 27 | text = nodeData.dialogueText, 28 | options = createdOptions 29 | }; 30 | 31 | this.nodesMap[nodeData.guid] = createdNode; 32 | } 33 | } 34 | 35 | public DialogueNode GetNode(string guid) { 36 | this.nodesMap.TryGetValue(guid, out var node); 37 | return node; 38 | } 39 | 40 | public override string ToString() { 41 | var text = "Dialogue tree content: \n"; 42 | 43 | var nodes = this.nodesMap.Values; 44 | foreach (var node in nodes) { 45 | text += $"{node.author} || {node.text} || {node.guid}\n"; 46 | foreach (var option in node.options) 47 | text += $"Option: {option.text}\n"; 48 | } 49 | 50 | return text; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/Dialogues/Scripts/DialogueTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dcd954ad12a49aa8ff99006df8b1264 3 | timeCreated: 1615381927 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba0a8d0b46d3efb4fb168137a8b12070 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69218b0f209121248b71c7312d9ec48d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/Scripts/FXGenerator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using VavilichevGD.Utils; 3 | 4 | namespace VavilichevGD.FXs { 5 | public abstract class FXGenerator : MonoBehaviour where T : FXObject { 6 | 7 | [SerializeField] protected T prefab; 8 | [SerializeField] protected int poolCount = 3; 9 | [SerializeField] protected bool autoExpand = false; 10 | 11 | protected PoolMono fxPool; 12 | 13 | 14 | protected virtual void Awake() { 15 | this.InitFXPool(); 16 | } 17 | 18 | protected virtual void InitFXPool() { 19 | var myTransform = this.transform; 20 | this.fxPool = new PoolMono(this.prefab, this.poolCount, myTransform); 21 | this.fxPool.autoExpand = this.autoExpand; 22 | } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/Scripts/FXGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c504b60b8ea7487ca59c0be603a486d6 3 | timeCreated: 1613925537 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/Scripts/FXObject.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VavilichevGD.FXs { 4 | public class FXObject : MonoBehaviour { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/Scripts/FXObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ebd87ff51264d3b89542bee32be38b8 3 | timeCreated: 1613925679 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3f4b51f5148854439ebb8dcb8ad0256 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0757bb9116884f54f87aa4ef1ef3e286 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6baf230b2e084244bbc3b769c6f6665a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Prefabs/ExampleFXUIDistance.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6035306a84878474ca44b9068bc9ca4e 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Prefabs/ExampleFXUIDistanceAndOffset.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ca5d923c62369f4b8ee8cfbd429d35b 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Prefabs/ExampleFXUIOffset.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3460f41210abb1c4686e70bdf1b3b462 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2364922c240bfc49b8e6503d4350a9e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Scenes/ExampleFXUI.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56309035c5954ba428f47f11d2248414 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13dfcdf9d290d9a47829c78d60b226ab 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Scripts/ExampleFXUIGenerator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace VavilichevGD.FXs.Example { 5 | public class ExampleFXUIGenerator : FXUIGenerator { 6 | 7 | [Space] 8 | [SerializeField] private Button button; 9 | [SerializeField] private bool manyFXs; 10 | 11 | private void OnEnable() { 12 | this.button.onClick.AddListener(this.OnClick); 13 | } 14 | 15 | private void OnDisable() { 16 | this.button.onClick.RemoveListener(this.OnClick); 17 | } 18 | 19 | 20 | #region CALLBACKS 21 | 22 | private void OnClick() { 23 | var startPosition = this.transform.position; 24 | if (this.manyFXs) 25 | this.MakeFXMany(startPosition); 26 | else 27 | this.MakeFX(startPosition); 28 | } 29 | 30 | #endregion 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Examples/Scripts/ExampleFXUIGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4929409d4f9301a4db4c5f8e800737e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/FXUIAnimations.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/FX/UI/FXUIAnimations.gif -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/FXUIAnimations.gif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d45b09051e423345be453d04091c87f 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/README.md: -------------------------------------------------------------------------------- 1 | # Preview: 2 | 3 | ![FXUIAnimations](https://user-images.githubusercontent.com/22970240/143770376-032928df-ff99-44db-b4dc-54dd55ade6d6.gif) 4 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31392d2767d7dd040af63038450e55c0 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc992d0a9a4d94e4093c4cfb92c991e8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | 5 | namespace VavilichevGD.FXs { 6 | public abstract class FXUIAnimation : MonoBehaviour{ 7 | 8 | #region EVENTS 9 | 10 | public event Action OnAnimationFinishedEvent; 11 | 12 | #endregion 13 | 14 | [SerializeField] protected float duration = 1f; 15 | [SerializeField] protected float animationStartDelay = 0.25f; 16 | 17 | public bool isPlaying { get; private set; } 18 | 19 | protected Transform myTransform; 20 | 21 | protected virtual void Awake() { 22 | this.myTransform = this.transform; 23 | } 24 | 25 | public void Play(Vector3 startPosition, Transform targetPoint) { 26 | if (this.isPlaying) 27 | throw new Exception("Could not start animation while another one is running"); 28 | 29 | this.StartCoroutine(this.AnimationRoutineBase(startPosition, targetPoint)); 30 | } 31 | 32 | private IEnumerator AnimationRoutineBase(Vector3 startPosition, Transform targetPoint) { 33 | this.isPlaying = true; 34 | 35 | yield return new WaitForSeconds(this.animationStartDelay); 36 | yield return this.StartCoroutine(this.AnimationRoutine(startPosition, targetPoint)); 37 | 38 | this.isPlaying = false; 39 | this.OnAnimationFinishedEvent?.Invoke(this); 40 | } 41 | 42 | protected abstract IEnumerator AnimationRoutine(Vector3 startPosition, Transform targetPoint); 43 | } 44 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74e6d71b92f4494db41575ce1adf910b 3 | timeCreated: 1613927395 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimationDistance.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.FXs { 5 | public class FXUIAnimationDistance : FXUIAnimation { 6 | 7 | [SerializeField] private AnimationCurve distanceLerp = AnimationCurve.Constant(0f, 1f, 0f); 8 | 9 | protected override IEnumerator AnimationRoutine(Vector3 startPosition, Transform targetPoint) { 10 | var timer = 0f; 11 | var distanceCurve = 0f; 12 | 13 | while (timer < 1f) { 14 | timer = Mathf.Min(timer + Time.deltaTime / this.duration, 1f); 15 | distanceCurve = this.distanceLerp.Evaluate(timer); 16 | var nextPosition = Vector3.Lerp(startPosition, targetPoint.position, distanceCurve); 17 | 18 | this.myTransform.position = nextPosition; 19 | yield return null; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimationDistance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ba77946910b4a819b9bf6770dfb1276 3 | timeCreated: 1613929592 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimationDistanceAndOffset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.FXs { 5 | public class FXUIAnimationDistanceAndOffset : FXUIAnimation { 6 | 7 | [SerializeField] private AnimationCurve offsetOverLifeTimeY = AnimationCurve.Constant(0f, 1f, 0f); 8 | [SerializeField] private AnimationCurve offsetOverLifeTimeX = AnimationCurve.Constant(0f, 1f, 0f); 9 | [SerializeField] private AnimationCurve distanceLerp = AnimationCurve.Constant(0f, 1f, 0f); 10 | 11 | protected override IEnumerator AnimationRoutine(Vector3 startPosition, Transform targetPoint) { 12 | var timer = 0f; 13 | var distanceCurve = 0f; 14 | 15 | while (timer < 1f) { 16 | timer = Mathf.Min(timer + Time.deltaTime / this.duration, 1f); 17 | distanceCurve = this.distanceLerp.Evaluate(timer); 18 | var nextPosition = Vector3.Lerp(startPosition, targetPoint.position, distanceCurve); 19 | nextPosition.x += this.offsetOverLifeTimeX.Evaluate(timer); 20 | nextPosition.y += this.offsetOverLifeTimeY.Evaluate(timer); 21 | 22 | this.myTransform.position = nextPosition; 23 | yield return null; 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimationDistanceAndOffset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95613d5436a6445dbf73122099c80c3f 3 | timeCreated: 1613931551 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimationOffset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.FXs { 5 | public class FXUIAnimationOffset : FXUIAnimation { 6 | 7 | [SerializeField] private AnimationCurve offsetOverLifeTimeY = AnimationCurve.Constant(0f, 1f, 0f); 8 | [SerializeField] private AnimationCurve offsetOverLifeTimeX = AnimationCurve.Constant(0f, 1f, 0f); 9 | 10 | protected override IEnumerator AnimationRoutine(Vector3 startPosition, Transform targetPoint) { 11 | 12 | float timer = 0f; 13 | while (timer < 1f) { 14 | timer = Mathf.Min(timer + Time.deltaTime / this.duration, 1f); 15 | var nextPosition = Vector3.Lerp(startPosition, targetPoint.position, timer); 16 | nextPosition.x += this.offsetOverLifeTimeX.Evaluate(timer); 17 | nextPosition.y += this.offsetOverLifeTimeY.Evaluate(timer); 18 | 19 | this.myTransform.position = nextPosition; 20 | yield return null; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIAnimationOffset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c400cec16b434f97919c1f82ad04307e 3 | timeCreated: 1613929010 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using UnityEngine; 4 | 5 | namespace VavilichevGD.FXs { 6 | public abstract class FXUIGenerator : FXGenerator { 7 | #region EVENTS 8 | 9 | public event Action OnFXReachedTargetEvent; 10 | 11 | #endregion 12 | 13 | [SerializeField] protected Transform transformTarget; 14 | [Space] 15 | [SerializeField] protected int packCountMin = 3; 16 | [SerializeField] protected int packCountMax = 5; 17 | [SerializeField] protected float timeBetweenParts = 0.1f; 18 | 19 | 20 | protected void MakeFX(Vector3 validPosition) { 21 | this.MakeFXMany(validPosition, 1); 22 | } 23 | 24 | protected void MakeFXMany(Vector3 validPosition) { 25 | var rCount = UnityEngine.Random.Range(this.packCountMin, this.packCountMax + 1); 26 | this.MakeFXMany(validPosition, rCount); 27 | } 28 | 29 | protected void MakeFXMany(Vector3 validPosition, int count) { 30 | this.StartCoroutine(this.FXWorkRoutine(validPosition, count)); 31 | } 32 | 33 | protected virtual IEnumerator FXWorkRoutine(Vector3 validPosition, int count) { 34 | var finishedParts = 0; 35 | 36 | void OnParticleReachedTarget(FXUIAnimation fxuiAnimation) { 37 | fxuiAnimation.OnAnimationFinishedEvent -= OnParticleReachedTarget; 38 | fxuiAnimation.gameObject.SetActive(false); 39 | finishedParts++; 40 | } 41 | 42 | for (int i = 0; i < count; i++) { 43 | var fx = this.fxPool.GetFreeElement(); 44 | fx.Go(validPosition, this.transformTarget); 45 | fx.animation.OnAnimationFinishedEvent += OnParticleReachedTarget; 46 | yield return new WaitForSeconds(this.timeBetweenParts); 47 | } 48 | 49 | while (finishedParts < count) 50 | yield return null; 51 | 52 | this.OnFXReachedTargetEvent?.Invoke(this); 53 | } 54 | 55 | } 56 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0888ed6f3e534277b77ce577b4542e6e 3 | timeCreated: 1613927058 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIObject.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using VavilichevGD.Utils.Math; 3 | 4 | namespace VavilichevGD.FXs { 5 | public class FXUIObject : FXObject { 6 | 7 | [SerializeField] private FXUIAnimation m_animation; 8 | [Space] 9 | [SerializeField] private bool randomOffsetOnStart; 10 | [SerializeField] private float offsetMin = 0.05f; 11 | [SerializeField] private float offsetMax = 0.1f; 12 | 13 | public FXUIAnimation animation => this.m_animation; 14 | 15 | public void Go(Vector3 startPosition, Transform targetPoint) { 16 | var finalStartPosition = startPosition; 17 | 18 | if (this.randomOffsetOnStart) { 19 | var rX = Random.Range(this.offsetMin, this.offsetMax) * Math.RandomSign(); 20 | var rY = Random.Range(this.offsetMin, this.offsetMax) * Math.RandomSign(); 21 | finalStartPosition = startPosition + new Vector3(rX, rY, 0f); 22 | } 23 | 24 | this.transform.position = finalStartPosition; 25 | this.animation.Play(finalStartPosition, targetPoint); 26 | } 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/Scripts/FXUIObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1d94358d3784457b6c770911092e455 3 | timeCreated: 1613927269 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/UnityUIFXAnimation.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/FX/UI/UnityUIFXAnimation.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/FX/UI/UnityUIFXAnimation.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e005c514805454348b9dedd746d0acf4 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d927979f7a744cc081b346b8660f4ada 3 | timeCreated: 1635100070 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 883ad8bbe3cb4ec981ca0501a7850356 3 | timeCreated: 1635101658 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfd7c2acf339b7c4da80b8686d0c6702 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scenes/ItemsContainerExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce5091937dc5d074a9456ea34033412d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e18d1c836e354b1681815a84ba591ab2 3 | timeCreated: 1635101663 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/ItemExample.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VavilichevGD.Gameplay.Examples { 4 | public class ItemExample : Item { 5 | public Color color { get;} 6 | 7 | public ItemExample(string id, int maxItemsInCell, Color color) : base(id, maxItemsInCell) { 8 | this.color = color; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/ItemExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 388f14c85d81487b8f4f1bb85092b017 3 | timeCreated: 1636831999 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/ItemsContainerExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2afe5a1ab1d44881894503d7eab93551 3 | timeCreated: 1635101729 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/ItemsService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace VavilichevGD.Gameplay.Examples { 4 | public class ItemsService { 5 | private Dictionary _itemsMap; 6 | 7 | public ItemsService() { 8 | _itemsMap = new Dictionary(); 9 | } 10 | 11 | public void Add(Item item) { 12 | _itemsMap[item.id] = item; 13 | } 14 | 15 | public void Remove(Item item) { 16 | if (_itemsMap.ContainsKey(item.id)) 17 | _itemsMap.Remove(item.id); 18 | } 19 | 20 | public T GetItem(string itemId) where T : Item { 21 | _itemsMap.TryGetValue(itemId, out var result); 22 | 23 | return result as T; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/ItemsService.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4094034f049148489f52a584179d196f 3 | timeCreated: 1636832106 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/UIItemCell.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using VavilichevGD.Gameplay.Data; 4 | 5 | namespace VavilichevGD.Gameplay.Examples { 6 | public class UIItemCell : MonoBehaviour { 7 | [SerializeField] private Image imgIcon; 8 | [SerializeField] private Text textAmount; 9 | 10 | public IItemCell itemCell { get; private set; } 11 | 12 | private ItemsService _itemsService; 13 | 14 | private void OnDisable() { 15 | Unsubscribe(); 16 | } 17 | 18 | public void SetItemsService(ItemsService itemsService) { 19 | _itemsService = itemsService; 20 | } 21 | 22 | public void SetItemCel(IItemCell itemCell) { 23 | Unsubscribe(); 24 | 25 | this.itemCell = itemCell; 26 | this.itemCell.OnItemCellStateChangedEvent += OnItemCellStateChanged; 27 | 28 | Refresh(); 29 | } 30 | 31 | public void Refresh() { 32 | if (!itemCell.isEmpty) { 33 | var item = _itemsService.GetItem(itemCell.itemId); 34 | imgIcon.color = item.color; 35 | textAmount.text = itemCell.itemsAmount.ToString(); 36 | } 37 | else { 38 | Clear(); 39 | } 40 | } 41 | 42 | public void Clear() { 43 | imgIcon.color = Color.white; 44 | textAmount.text = ""; 45 | } 46 | 47 | private void Unsubscribe() { 48 | if (itemCell != null) 49 | itemCell.OnItemCellStateChangedEvent -= OnItemCellStateChanged; 50 | } 51 | 52 | private void OnItemCellStateChanged(ItemCellStateChangeArgs e) { 53 | Refresh(); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/UIItemCell.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd62ca2cf2ae47b8b76747e05e58122c 3 | timeCreated: 1636831746 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/UIItemsContainerExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2927170202c166143b27f6accec27ea4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/UIItemsContainerLogger.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using VavilichevGD.Gameplay.Data; 4 | 5 | namespace VavilichevGD.Gameplay.Examples { 6 | public class UIItemsContainerLogger : MonoBehaviour { 7 | [SerializeField] private UIItemsContainerExample _uiItemsContainer; 8 | [SerializeField] private Text _textLogLine; 9 | 10 | private void OnEnable() { 11 | _uiItemsContainer.itemsContainer.OnValueChangedEvent += OnItemsContainerChanged; 12 | } 13 | 14 | private void OnDisable() { 15 | _uiItemsContainer.itemsContainer.OnValueChangedEvent -= OnItemsContainerChanged; 16 | } 17 | 18 | private void OnItemsContainerChanged(ItemsContainer oldContainer, ItemsContainer newContainer) { 19 | if (oldContainer != null) { 20 | oldContainer.OnItemsContainerStateChangedEvent -= OnItemsContainerStateChanged; 21 | } 22 | 23 | newContainer.OnItemsContainerStateChangedEvent += OnItemsContainerStateChanged; 24 | } 25 | 26 | private void OnItemsContainerStateChanged(ItemCellStateChangeArgs e) { 27 | if (!e.success) { 28 | _textLogLine.text = $"{e.errorText}"; 29 | } 30 | else { 31 | _textLogLine.text = 32 | $"Changed: item {e.itemId} into cell {e.cellId}. Items in cell before: {e.itemsAmountOld}, and new {e.itemsAmountNew}"; 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Example/Scripts/UIItemsContainerLogger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3c9dff2f6c395c42aa9725d24ea35f3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/ItemsContainer v.1.02.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Gameplay/ItemsContainer/ItemsContainer v.1.02.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/ItemsContainer v.1.02.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6d74ebcfc55abf4c8d63fe60df4bc62 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/ReadMe.md: -------------------------------------------------------------------------------- 1 | # ItemsContainer asset 2 | 3 | Watch Example for details. 4 | 5 | ![image](https://user-images.githubusercontent.com/22970240/142776210-3ff7e4ca-c4d6-4530-8edc-2666c946e272.png) 6 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97873e3014c549d192a7e69ef378b3c6 3 | timeCreated: 1635100076 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e7252470115466e899c781d129a33f8 3 | timeCreated: 1635100084 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract/IItem.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay { 2 | public interface IItem { 3 | string id { get; } 4 | int maxItemsInCell { get; } 5 | } 6 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract/IItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14f77c362e3c4f49a4b0780eece284ca 3 | timeCreated: 1636747650 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract/IItemCell.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VavilichevGD.Gameplay.Data; 3 | 4 | namespace VavilichevGD.Gameplay { 5 | public interface IItemCell { 6 | event Action OnItemCellStateChangedEvent; 7 | 8 | string id { get; } 9 | string itemId { get; set; } 10 | int itemsAmount { get; set; } 11 | int capacity { get; set; } 12 | bool isFull { get; } 13 | bool isEmpty { get; } 14 | 15 | void Clear(); 16 | 17 | void AddItems(IItem item, int amount, out int remainder); 18 | 19 | void RemoveItems(IItem item, int amount, out int remainder); 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract/IItemCell.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d4552ee90f442189dd0aaac188d1244 3 | timeCreated: 1635100210 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract/IItemsContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VavilichevGD.Gameplay.Data; 3 | 4 | namespace VavilichevGD.Gameplay { 5 | public interface IItemsContainer { 6 | event Action OnItemsContainerStateChangedEvent; 7 | 8 | string id { get; } 9 | IItemCell[] itemCells { get; } 10 | 11 | IItemCell GetCellData(string cellId); 12 | 13 | bool HasEnoughItems(string itemId, int requiredItemsCount); 14 | 15 | int GetItemAmount(string itemId); 16 | 17 | void AddItems(Item item, int amount, Action callback); 18 | 19 | void AddItemsToCell(Item item, int amount, string cellId); 20 | 21 | void RemoveItems(Item item, int amount, out int remainder); 22 | 23 | void RemoveItemsFromCell(Item item, int amount, string cellId, out int remainder); 24 | } 25 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Abstract/IItemsContainer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9fdc16e25774a24851f6449edebbc21 3 | timeCreated: 1635100127 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87bdefd9a43b4fdcac8d9cf310ff7fda 3 | timeCreated: 1636404004 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemCellData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VavilichevGD.Gameplay.Data { 4 | [Serializable] 5 | public struct ItemCellData { 6 | public string cellId; 7 | public string itemId; 8 | public int itemsAmount; 9 | public int capacity; 10 | } 11 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemCellData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: baf97b42edfe4f67a3d5c9f32846e6dd 3 | timeCreated: 1636745923 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemCellStateChangeArgs.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay.Data { 2 | public struct ItemCellStateChangeArgs { 3 | public string cellId; 4 | public string itemId; 5 | public int itemsAmountOld; 6 | public int itemsAmountNew; 7 | public int itemsRemainder; 8 | public string errorText; 9 | public ItemsContainerErrorCode errorCode; 10 | 11 | public bool success => string.IsNullOrWhiteSpace(errorText); 12 | } 13 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemCellStateChangeArgs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbdd1deda9534738b1dd576b97f005be 3 | timeCreated: 1636745753 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemsContainerData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace VavilichevGD.Gameplay.Data { 5 | [Serializable] 6 | public struct ItemsContainerData { 7 | public string id; 8 | public List itemCellDatas; 9 | } 10 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemsContainerData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf6ea0b9ce2b4efd85f57e2a6c73c973 3 | timeCreated: 1636484680 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemsContainerErrorCode.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay.Data { 2 | public enum ItemsContainerErrorCode { 3 | None = 0, 4 | CellIsEmpty = 1, 5 | CellIsFull = 2, 6 | CompareDifferentItems = 3, 7 | NotEnoughItems = 4, 8 | Unknown 9 | } 10 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Data/ItemsContainerErrorCode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d745dabb431848b285215a49372e2672 3 | timeCreated: 1637522029 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e630241cc2341dbbcaddfd5d23bb9b4 3 | timeCreated: 1636747601 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Extensions/ItemsCellExtensions.cs: -------------------------------------------------------------------------------- 1 | using VavilichevGD.Gameplay.Data; 2 | 3 | namespace VavilichevGD.Gameplay.Extensions { 4 | public static class ItemsCellExtensions { 5 | public static ItemCellData ToData(this IItemCell itemCell) { 6 | var itemsCellData = new ItemCellData(); 7 | 8 | itemsCellData.cellId = itemCell.id; 9 | itemsCellData.itemId = itemCell.itemId; 10 | itemsCellData.itemsAmount = itemCell.itemsAmount; 11 | itemsCellData.capacity = itemCell.capacity; 12 | 13 | return itemsCellData; 14 | } 15 | 16 | public static ItemCell FromData(this ItemCellData data) { 17 | var itemCell = new ItemCell(data.cellId); 18 | 19 | itemCell.itemId = data.itemId; 20 | itemCell.itemsAmount = data.itemsAmount; 21 | itemCell.capacity = data.capacity; 22 | 23 | return itemCell; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Extensions/ItemsCellExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7b724171a95489a86303d6cad290f20 3 | timeCreated: 1636746335 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Extensions/ItemsContainerExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using VavilichevGD.Gameplay.Data; 3 | 4 | namespace VavilichevGD.Gameplay.Extensions { 5 | public static class ItemsContainerExtensions { 6 | public static ItemsContainerData ToData(this IItemsContainer itemsContainer) { 7 | var itemCellDatas = new List(); 8 | var itemsCount = itemsContainer.itemCells.Length; 9 | 10 | for (int i = 0; i < itemsCount; i++) { 11 | var cell = itemsContainer.itemCells[i]; 12 | 13 | itemCellDatas.Add(cell.ToData()); 14 | } 15 | 16 | var itemsContainerData = new ItemsContainerData { 17 | id = itemsContainer.id, 18 | itemCellDatas = itemCellDatas 19 | }; 20 | 21 | return itemsContainerData; 22 | } 23 | 24 | public static ItemsContainer FromData(this ItemsContainerData itemsContainerData) { 25 | var containerId = itemsContainerData.id; 26 | var itemsAmount = itemsContainerData.itemCellDatas.Count; 27 | var items = new ItemCell[itemsAmount]; 28 | 29 | for (int i = 0; i < itemsAmount; i++) { 30 | items[i] = itemsContainerData.itemCellDatas[i].FromData(); 31 | } 32 | 33 | return new ItemsContainer(containerId, items); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Extensions/ItemsContainerExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2de469c415df4e25945f044f2bd28928 3 | timeCreated: 1636746383 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Item.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Gameplay { 2 | public class Item : IItem { 3 | public string id { get; } 4 | public int maxItemsInCell { get; } 5 | 6 | public Item(string id, int maxItemsInCell) { 7 | this.id = id; 8 | this.maxItemsInCell = maxItemsInCell; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/Item.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae4ad9b52be4431d9268c29348a1d2d9 3 | timeCreated: 1636486415 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/ItemCell.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using VavilichevGD.Gameplay.Data; 3 | 4 | namespace VavilichevGD.Gameplay { 5 | public class ItemCell : IItemCell{ 6 | public event Action OnItemCellStateChangedEvent; 7 | 8 | public string id { get; } 9 | public string itemId { get; set; } 10 | public int itemsAmount { get; set; } 11 | public int capacity { get; set; } 12 | 13 | public bool isFull => !string.IsNullOrWhiteSpace(itemId) && itemsAmount >= capacity; 14 | public bool isEmpty => string.IsNullOrWhiteSpace(itemId) || itemsAmount == 0; 15 | 16 | public ItemCell(string id) { 17 | this.id = id; 18 | } 19 | 20 | public virtual void Clear() { 21 | itemId = null; 22 | itemsAmount = 0; 23 | capacity = 0; 24 | 25 | var result = new ItemCellStateChangeArgs(); 26 | result.cellId = id; 27 | 28 | OnItemCellStateChangedEvent?.Invoke(result); 29 | } 30 | 31 | public virtual void AddItems(IItem item, int amount, out int remainder) { 32 | var result = new ItemCellStateChangeArgs(); 33 | 34 | result.cellId = id; 35 | result.itemId = item.id; 36 | result.itemsAmountOld = itemsAmount; 37 | result.itemsAmountNew = itemsAmount; 38 | 39 | if (isFull) { 40 | result.errorText = $"Cell is full"; 41 | result.errorCode = ItemsContainerErrorCode.CellIsFull; 42 | result.itemsRemainder = amount; 43 | remainder = amount; 44 | 45 | OnItemCellStateChangedEvent?.Invoke(result); 46 | return; 47 | } 48 | 49 | if (isEmpty) { 50 | itemId = item.id; 51 | capacity = item.maxItemsInCell; 52 | } 53 | 54 | if (itemId != item.id) { 55 | result.errorText = 56 | $"You are trying to add item with different id. Item in cel is: {itemId} and you are adding: {item.id}"; 57 | result.errorCode = ItemsContainerErrorCode.CompareDifferentItems; 58 | result.itemsRemainder = amount; 59 | remainder = amount; 60 | 61 | OnItemCellStateChangedEvent?.Invoke(result); 62 | return; 63 | } 64 | 65 | var sum = itemsAmount + amount; 66 | 67 | if (sum > capacity) { 68 | result.itemsRemainder = sum - capacity; 69 | itemsAmount = capacity; 70 | } 71 | else { 72 | itemsAmount = sum; 73 | } 74 | 75 | result.itemsAmountNew = itemsAmount; 76 | remainder = result.itemsRemainder; 77 | 78 | OnItemCellStateChangedEvent?.Invoke(result); 79 | } 80 | 81 | public virtual void RemoveItems(IItem item, int amount, out int remainder) { 82 | var result = new ItemCellStateChangeArgs(); 83 | 84 | result.cellId = id; 85 | result.itemId = item.id; 86 | result.itemsAmountOld = itemsAmount; 87 | result.itemsAmountNew = itemsAmount; 88 | result.itemsRemainder = amount; 89 | remainder = amount; 90 | 91 | if (isEmpty) { 92 | result.errorText = $"Cell is empty"; 93 | result.errorCode = ItemsContainerErrorCode.CellIsEmpty; 94 | 95 | OnItemCellStateChangedEvent?.Invoke(result); 96 | return; 97 | } 98 | 99 | if (itemId != item.id) { 100 | result.errorText = 101 | $"You are trying to remove item with different id. Item in cel is: {itemId} and you are removing: {item.id}"; 102 | result.errorCode = ItemsContainerErrorCode.CompareDifferentItems; 103 | 104 | OnItemCellStateChangedEvent?.Invoke(result); 105 | return; 106 | } 107 | 108 | if (itemsAmount < amount) { 109 | result.errorText = 110 | $"Not enough items in the cell. Cell has {itemsAmount} items, and you are trying to remove {amount}"; 111 | result.errorCode = ItemsContainerErrorCode.NotEnoughItems; 112 | result.itemsAmountNew = 0; 113 | result.itemsRemainder = amount - itemsAmount; 114 | remainder = result.itemsRemainder; 115 | 116 | Clear(); 117 | 118 | OnItemCellStateChangedEvent?.Invoke(result); 119 | return; 120 | } 121 | 122 | itemsAmount -= amount; 123 | 124 | if (itemsAmount == 0) 125 | Clear(); 126 | 127 | result.itemsAmountNew = itemsAmount; 128 | result.itemsRemainder = 0; 129 | remainder = 0; 130 | 131 | OnItemCellStateChangedEvent?.Invoke(result); 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/ItemCell.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a388f349cb64b048a9e7c082b154e97 3 | timeCreated: 1636484694 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Gameplay/ItemsContainer/Scripts/ItemsContainer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f45da53e4b7f41808ec5d34430f9360e 3 | timeCreated: 1635100402 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71138c8befa303246abb351bc5376c33 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools/Coroutines.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae2de82b070e8714d9524e99729580f4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools/Coroutines/Coroutines 1.05.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Tools/Coroutines/Coroutines 1.05.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools/Coroutines/Coroutines 1.05.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3aeea1b83f7d0a24681779fa962fe90e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools/Coroutines/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 486ddc5a485d4e040a344ecb9fa481ec 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools/Coroutines/Scripts/Coroutines.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Tools 5 | { 6 | public class Coroutines : MonoBehaviour { 7 | 8 | #region CONSTANTS 9 | 10 | private const string NAME = "[COROUTINE MANAGER]"; 11 | 12 | #endregion 13 | 14 | private static Coroutines instance => GetInstance(); 15 | private static Coroutines m_instance; 16 | private static bool isInitialized => m_instance != null; 17 | 18 | 19 | private static Coroutines GetInstance() { 20 | if (!isInitialized) 21 | m_instance = CreateSingleton(); 22 | return m_instance; 23 | } 24 | 25 | private static Coroutines CreateSingleton() { 26 | var createdManager = new GameObject(NAME).AddComponent(); 27 | createdManager.hideFlags = HideFlags.HideAndDontSave; 28 | DontDestroyOnLoad(createdManager.gameObject); 29 | return createdManager; 30 | } 31 | 32 | public static Coroutine StartRoutine(IEnumerator enumerator) { 33 | return instance.StartCoroutine(enumerator); 34 | } 35 | 36 | public static void StopRoutine(Coroutine routine) { 37 | if (routine != null) 38 | instance.StopCoroutine(routine); 39 | } 40 | 41 | public static void StopRoutine(string routineName) { 42 | instance.StopCoroutine(routineName); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Tools/Coroutines/Scripts/Coroutines.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc1f85e2afa77f245ad777eea48c6d62 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64b89939e5b503e4fb463437e5305589 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf4430e76ace46140907c88fb5e4c327 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3abc03c7bd7f4516aff1c1bdab2fd984 3 | timeCreated: 1641843758 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/GameObjectOfTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VavilichevGD.Utils.Attributes.ObjectsOfType { 4 | public class GameObjectOfTypeAttribute : ObjectOfTypeAttributeBase { 5 | public GameObjectOfTypeAttribute(Type type, bool allowSceneObjects = true) : base(type, allowSceneObjects) { 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/GameObjectOfTypeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d68e42b44ba4bd4782a5d2c08aaab23 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/GameObjectOfTypeDrawer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | using Object = UnityEngine.Object; 5 | 6 | namespace VavilichevGD.Utils.Attributes.ObjectsOfType { 7 | [CustomPropertyDrawer(typeof(GameObjectOfTypeAttribute))] 8 | public class GameObjectOfTypeDrawer : ObjectOfTypeDrawerBase { 9 | protected override Type GetCurrentObjectType() { 10 | Type resultType = null; 11 | 12 | if (HasObjectType()) { 13 | resultType = typeof(GameObject); 14 | } 15 | 16 | return resultType; 17 | } 18 | 19 | protected override Type GetRequiredObjectType() { 20 | return typeof(GameObject); 21 | } 22 | 23 | protected override bool IsValidObject(Object o, Type requiredType) { 24 | bool result = false; 25 | 26 | var go = o as GameObject; 27 | 28 | if (go != null) { 29 | result = go.GetComponent(requiredType) != null; 30 | } 31 | 32 | return result; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/GameObjectOfTypeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de475cc1d137b5b4797effd92464cfb9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ObjectOfTypeAttributeBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Utils.Attributes.ObjectsOfType { 5 | public class ObjectOfTypeAttributeBase : PropertyAttribute { 6 | public Type type { get; } 7 | public bool allowSceneObjects { get; } 8 | 9 | public ObjectOfTypeAttributeBase(Type type, bool allowSceneObjects = true) 10 | { 11 | this.type = type; 12 | this.allowSceneObjects = allowSceneObjects; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ObjectOfTypeAttributeBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9a068500a7d4567bbf54e93f5573266 3 | timeCreated: 1641845780 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ObjectOfTypeDrawerBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEditor; 4 | using UnityEngine; 5 | using Object = UnityEngine.Object; 6 | 7 | namespace VavilichevGD.Utils.Attributes.ObjectsOfType { 8 | public abstract class ObjectOfTypeDrawerBase : PropertyDrawer{ 9 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { 10 | var objectType = GetCurrentObjectType(); 11 | 12 | if (objectType == null) { 13 | DrawErrorOfType(position); 14 | return; 15 | } 16 | 17 | var ootAttribute = attribute as ObjectOfTypeAttributeBase; 18 | var requiredType = ootAttribute.type; 19 | 20 | CheckDragAndDrops(position, requiredType); 21 | CheckValues(property, requiredType); 22 | DrawObjectField(position, label, property, requiredType, objectType, ootAttribute.allowSceneObjects); 23 | } 24 | 25 | protected abstract Type GetCurrentObjectType(); 26 | protected abstract Type GetRequiredObjectType(); 27 | protected abstract bool IsValidObject(Object o, Type requiredType); 28 | 29 | protected bool HasObjectType() { 30 | return fieldInfo.FieldType == typeof(T) || typeof(IEnumerable).IsAssignableFrom(fieldInfo.FieldType); 31 | } 32 | 33 | private void CheckDragAndDrops(Rect position, Type requiredType) { 34 | if (position.Contains(Event.current.mousePosition)) { 35 | var draggedObjectsCount = DragAndDrop.objectReferences.Length; 36 | 37 | for (int i = 0; i < draggedObjectsCount; i++) { 38 | if (!IsValidObject(DragAndDrop.objectReferences[i], requiredType)) { 39 | DragAndDrop.visualMode = DragAndDropVisualMode.Rejected; 40 | break; 41 | } 42 | } 43 | } 44 | } 45 | 46 | private void CheckValues(SerializedProperty property, Type requiredType) { 47 | if (property.objectReferenceValue != null) { 48 | if (!IsValidObject(property.objectReferenceValue, requiredType)) { 49 | property.objectReferenceValue = null; 50 | } 51 | } 52 | } 53 | 54 | private void DrawObjectField( 55 | Rect position, 56 | GUIContent label, 57 | SerializedProperty property, 58 | Type requiredType, 59 | Type objectType, 60 | bool allowSceneObjects) { 61 | 62 | label.text = $"{label.text} ({requiredType.Name})";; 63 | 64 | property.objectReferenceValue = EditorGUI.ObjectField(position, label, property.objectReferenceValue, objectType, allowSceneObjects); 65 | } 66 | 67 | private void DrawErrorOfType(Rect position) { 68 | var requiredObjectType = GetRequiredObjectType(); 69 | 70 | EditorGUI.HelpBox(position, $"{attribute.GetType().Name} works only with {requiredObjectType.Name} references", MessageType.Error); 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ObjectOfTypeDrawerBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7ad99890e53437b9407bd3b56e65550 3 | timeCreated: 1641843830 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Objects of type attributes 2 | 3 | - **GameObjectOfTypeAttribute** 4 | - **ScriptableObjectOfTypeAttribute** 5 | 6 | Use interfaces or abstract classes types to constrain your GameObjects prefab references or scene objects references or ScriptableObject configs references. 7 | 8 | ![image](https://user-images.githubusercontent.com/22970240/148835404-9d953f1e-6ebe-4cfa-b5c1-e6141a26724d.png) 9 | 10 | ![image](https://user-images.githubusercontent.com/22970240/148835500-1aa8e23d-0097-4ff7-8e09-0c9ed765c167.png) 11 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ScriptableObjectOfTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace VavilichevGD.Utils.Attributes.ObjectsOfType { 4 | public class ScriptableObjectOfTypeAttribute : ObjectOfTypeAttributeBase { 5 | public ScriptableObjectOfTypeAttribute(Type type, bool allowSceneObjects = true) : base(type, allowSceneObjects) { 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ScriptableObjectOfTypeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b05b36a6ccc43cf8fcdd87b45cb3244 3 | timeCreated: 1641843564 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ScriptableObjectOfTypeDrawer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | using Object = UnityEngine.Object; 5 | 6 | namespace VavilichevGD.Utils.Attributes.ObjectsOfType { 7 | [CustomPropertyDrawer(typeof(ScriptableObjectOfTypeAttribute))] 8 | public class ScriptableObjectOfTypeDrawer : ObjectOfTypeDrawerBase { 9 | protected override Type GetCurrentObjectType() { 10 | Type resultType = null; 11 | 12 | if (HasObjectType()) { 13 | resultType = typeof(ScriptableObject); 14 | } 15 | 16 | return resultType; 17 | } 18 | 19 | protected override Type GetRequiredObjectType() { 20 | return typeof(ScriptableObject); 21 | } 22 | 23 | protected override bool IsValidObject(Object o, Type requiredType) { 24 | bool result = false; 25 | 26 | var scrOb = o as ScriptableObject; 27 | 28 | if (scrOb != null) { 29 | var currentType = scrOb.GetType(); 30 | 31 | result = requiredType.IsAssignableFrom(currentType); 32 | } 33 | 34 | return result; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/ObjectsOfType/ScriptableObjectOfTypeDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43049e61c72e447a88a16f6a21f66b2a 3 | timeCreated: 1641843638 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/VavilichevGD. Attributes v. 0.11.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/Attributes/VavilichevGD. Attributes v. 0.11.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Attributes/VavilichevGD. Attributes v. 0.11.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85b9afd01cc4ab54496b9a8a91a4f9fb 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7249b7d8a6c4a7140807871b80fefd52 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53428f449d958da448a3995627029c72 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d7835502183f8b42ba7c7177dbc5f42 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android/AndroidBuildConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEditor; 3 | using UnityEngine; 4 | using Object = UnityEngine.Object; 5 | 6 | namespace VavilichevGD.Utils.Editor.Builder { 7 | public class AndroidBuildConfig : ScriptableObject { 8 | 9 | [SerializeField] private string m_keyStorePassword = "KeyStorePassword"; 10 | [SerializeField] private string m_keyAliasPassword = "KeyAliasPassword"; 11 | [SerializeField] private List m_scenes; 12 | 13 | public string keyStorePassword => this.m_keyStorePassword; 14 | public string keyAliasPassword => this.m_keyAliasPassword; 15 | public List scenes => this.m_scenes; 16 | 17 | 18 | 19 | public string[] GetScenesPaths() { 20 | var scenePaths = new List(); 21 | foreach (var scene in scenes) { 22 | var path = AssetDatabase.GetAssetPath(scene); 23 | scenePaths.Add(path); 24 | } 25 | 26 | return scenePaths.ToArray(); 27 | } 28 | 29 | 30 | private void OnValidate() { 31 | foreach (var scene in this.m_scenes) { 32 | if (scene != null && !(scene is SceneAsset)) { 33 | this.m_scenes.Remove(scene); 34 | Debug.Log($"You cannot add {scene.GetType().Name}, because it is not a scene."); 35 | break; 36 | } 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android/AndroidBuildConfig.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d3de78c96248435c920412b14cd812f7 3 | timeCreated: 1614287142 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android/AndroidBuildHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 694943b17a355e54f90a487dffc13bad 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android/Config.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 930daf0f6bd9433b9cd6fa2daf3c3e1a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android/Config/AndroidBuildConfig.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d3de78c96248435c920412b14cd812f7, type: 3} 13 | m_Name: AndroidBuildConfig 14 | m_EditorClassIdentifier: 15 | m_keyStorePassword: KeyStorePassword 16 | m_keyAliasPassword: KeyAliasPassword 17 | m_scenes: 18 | - {fileID: 102900000, guid: 56309035c5954ba428f47f11d2248414, type: 3} 19 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/Android/Config/AndroidBuildConfig.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9c9869a7a6571094da0698fa57f8673f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/EditorBuilder.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/Editor/Builder/EditorBuilder.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/EditorBuilder.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccba768ce3846f24abd92d777f58c4e1 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/README.md: -------------------------------------------------------------------------------- 1 | ## EditorBuilder 2 | 3 | This asset created by VavilichevGD for improving developing experience. You know that when you leave Unity and come bake to it after some time all passwords erased (keystorem, key alias). And you have to enter it every time when you have to build the project. Another annoying problem is different building settings - for development build, for release apk, aab etc. This asset allows you to build the project by two click independently on build settings. 4 | 5 | 6 | #### WARNING: 7 | `Strongly recommend to add AndroidBuildConfig.asset to your .gitignore file - for safety.` 8 | 9 | 10 | ## How to use 11 | 12 | **(Now asset available only for Android platform)** 13 | 14 | What asset does when build process run: 15 | 1. It setups player settings depence on your choice (dev/release APK/AAB etc). 16 | 2. Updates version of build if build is not AAB (step is 0.01). 17 | 3. If project contains GooglePlayServices, this asset runs resolving packages if it's needed 18 | 4. Ups the bundle version if build is AAB 19 | 5. Builds the .apk file or .aab in Builds folder in the project root folder 20 | 6. Opens Builds folder you can to work with built file 21 | 22 |
23 | 24 | #### 1. Go to Player Settings
25 | ![](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Utils/Editor/Builder/ScreenPlayerSettings.png) 26 | 27 |
28 | 29 | #### 2. Switch the platform to Android
30 | ![](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Utils/Editor/Builder/ScreenSwitchPlatform.png) 31 | 32 |
33 | 34 | #### 3. There is a Builds menu appeared at the top of the editor screen. Choose settings to setup the project
35 | ![](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Utils/Editor/Builder/ScreenChooseSettings.png) 36 | 37 |
38 | 39 | #### 4. Enter your passwords of keystore and key alias. And add scenes to the list.
40 | ![](https://github.com/vavilichev/UnityUserful/blob/main/Assets/VavilichevGD/Utils/Editor/Builder/ScreenSetupSettings.png) 41 | 42 |
43 | 44 | #### 5. Enjoy
45 | Now you can build project by two clicks! 46 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3c62fa35a0d9ff4b9cb06a1e90764bc 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenChooseSettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/Editor/Builder/ScreenChooseSettings.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenChooseSettings.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba1684a30987fa047ac02a70c821e2c1 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenPlayerSettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/Editor/Builder/ScreenPlayerSettings.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenPlayerSettings.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 103f90ce346feba44aa2f1ed1ab512e6 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenSetupSettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/Editor/Builder/ScreenSetupSettings.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenSetupSettings.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d825f75dceb31dd4e9a634dd6853b75a 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenSwitchPlatform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/Editor/Builder/ScreenSwitchPlatform.png -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/Builder/ScreenSwitchPlatform.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2728524323b1cd40aff1595c8fdecef 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/EditorHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Utils.Editor { 5 | public static class EditorHelper { 6 | 7 | public static T LoadOrCreateAsset(string path) where T : ScriptableObject { 8 | var loadedAsset = AssetDatabase.LoadAssetAtPath(path); 9 | if (loadedAsset) 10 | { 11 | EditorUtility.FocusProjectWindow(); 12 | Selection.activeObject = loadedAsset; 13 | return loadedAsset; 14 | } 15 | 16 | var createdAsset = ScriptableObject.CreateInstance(); 17 | 18 | AssetDatabase.CreateAsset(createdAsset, path); 19 | AssetDatabase.SaveAssets(); 20 | EditorUtility.FocusProjectWindow(); 21 | Selection.activeObject = createdAsset; 22 | return createdAsset; 23 | } 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Editor/EditorHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a011e113a244fdda46bd362bf86d69b 3 | timeCreated: 1614287532 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Math.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03fa01ac6c444de09d71d7298cdc182d 3 | timeCreated: 1613927301 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Math/Math.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace VavilichevGD.Utils.Math { 4 | public static class Math { 5 | 6 | public static int RandomSign() { 7 | return Random.Range(0, 2) * 2 - 1; 8 | } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Math/Math.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b42e9e953a1452789b265eb871179ea 3 | timeCreated: 1613927350 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Observable.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba1c0a651c5870a44ba5800b59e5b5ef 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Observable/ObservableVariable.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Utils.Observable { 2 | 3 | public delegate void ObservableVariableChangedEventHandler(T oldValue, T newValue); 4 | 5 | public sealed class ObservableVariable { 6 | 7 | public event ObservableVariableChangedEventHandler OnValueChangedEvent; 8 | 9 | private T _value; 10 | 11 | 12 | public T value { 13 | get => _value; 14 | set { 15 | if (_value == null || !_value.Equals(value)) { 16 | var oldValue = _value; 17 | _value = value; 18 | OnValueChangedEvent?.Invoke(oldValue, value); 19 | } 20 | } 21 | } 22 | 23 | public ObservableVariable() { 24 | _value = default; 25 | } 26 | 27 | public ObservableVariable(T valueByDefault) { 28 | _value = valueByDefault; 29 | } 30 | 31 | public override string ToString() { 32 | return value.ToString(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/Observable/ObservableVariable.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0db2e00f43700748a3d8e8f4a9a5c2c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/PoolMono.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Object = UnityEngine.Object; 5 | 6 | namespace VavilichevGD.Utils { 7 | public class PoolMono where T : MonoBehaviour { 8 | 9 | public bool autoExpand { get; set; } 10 | public T prefab { get; } 11 | public Transform container { get; } 12 | 13 | 14 | protected List pool; 15 | 16 | 17 | public PoolMono(T prefab, int count) { 18 | this.prefab = prefab; 19 | this.container = null; 20 | this.CreatePool(this.prefab, count, this.container); 21 | } 22 | 23 | public PoolMono(T prefab, int count, Transform container) { 24 | this.prefab = prefab; 25 | this.container = container; 26 | this.CreatePool(this.prefab, count, this.container); 27 | } 28 | 29 | 30 | 31 | private void CreatePool(T prefab, int count, Transform container) { 32 | this.pool = new List(); 33 | 34 | for (int i = 0; i < count; i++) 35 | this.CreateObject(prefab, container); 36 | } 37 | 38 | private T CreateObject(T prefab, Transform container, bool isActiveByDefault = false) { 39 | var createdObject = Object.Instantiate(prefab, container); 40 | createdObject.gameObject.SetActive(isActiveByDefault); 41 | this.pool.Add(createdObject); 42 | return createdObject; 43 | } 44 | 45 | 46 | 47 | 48 | public bool HasFreeElement(out T element) { 49 | foreach (var mono in pool) { 50 | if (!mono.gameObject.activeInHierarchy) { 51 | mono.gameObject.SetActive(true); 52 | element = mono; 53 | return true; 54 | } 55 | } 56 | 57 | element = null; 58 | return false; 59 | } 60 | 61 | public T GetFreeElement() { 62 | if (this.HasFreeElement(out var element)) 63 | return element; 64 | 65 | if (this.autoExpand) 66 | return this.CreateObject(this.prefab, this.container, true); 67 | 68 | throw new Exception($"The pool of type {typeof(T).Name} is empty. Current elements number is: {pool.Count}"); 69 | } 70 | 71 | public T[] GetFreeElements(int count) { 72 | var freeElements = new List(); 73 | 74 | foreach (var mono in this.pool) { 75 | if (!mono.gameObject.activeInHierarchy) { 76 | freeElements.Add(mono); 77 | mono.gameObject.SetActive(true); 78 | } 79 | } 80 | 81 | if (freeElements.Count < count) { 82 | if (this.autoExpand) { 83 | var difference = count - freeElements.Count; 84 | for (int i = 0; i < difference; i++) { 85 | var createdObject = this.CreateObject(this.prefab, this.container); 86 | createdObject.gameObject.SetActive(true); 87 | freeElements.Add(createdObject); 88 | } 89 | 90 | return freeElements.ToArray(); 91 | } 92 | 93 | throw new Exception($"Pool of type {typeof(T).Name} doesn't have so much free elements. Only {freeElements.Count}/{count}"); 94 | } 95 | 96 | return freeElements.ToArray(); 97 | } 98 | 99 | public T[] GetAllElements() { 100 | return this.pool.ToArray(); 101 | } 102 | 103 | public T[] GetAllActiveElements() { 104 | var activeElements = new List(); 105 | foreach (var element in this.pool) { 106 | if (element.gameObject.activeInHierarchy) 107 | activeElements.Add(element); 108 | } 109 | 110 | return activeElements.ToArray(); 111 | } 112 | 113 | public int GetFreeElementsCount() { 114 | var sum = 0; 115 | foreach (var mono in this.pool) { 116 | if (!mono.gameObject.activeInHierarchy) 117 | sum++; 118 | } 119 | 120 | return sum; 121 | } 122 | 123 | } 124 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/PoolMono.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49587b1c2b185cf4790f5aadd5ff10f2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e4c4ce968d5a7a4783c9edc36e8ac0e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d6588258ec5e5f419fd970eacd7f469 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc79ac2feaef44e4eaf8c219d5ee86a1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Prefabs/TimerWidget.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a67a4563c9df58c42872731c35924a4f 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a41fe516e2437b4e826bec7fe25584f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Scenes/TimerExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fb1fb7fd1fa00f44b7d463a9447cdcb 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca1d1fecc24f51d4482a2da86bf01ddb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Scripts/WidgetTimerExample.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace VavilichevGD.Utils.Timing.Example 5 | { 6 | public class WidgetTimerExample : MonoBehaviour 7 | { 8 | [SerializeField] private TimerType _timerType; 9 | [SerializeField] private float _remainingSeconds; 10 | [SerializeField] private Button _buttonStart; 11 | [SerializeField] private Button _buttonPause; 12 | [SerializeField] private Button _buttonStop; 13 | [Space] [SerializeField] private Text _textType; 14 | [SerializeField] private Text _textValue; 15 | 16 | private Color _colorPaused = Color.yellow; 17 | private Color _colorUnpaused = Color.white; 18 | private SyncedTimer _timer; 19 | 20 | private void Awake() 21 | { 22 | UpdatePauseButtonState(); 23 | UpdateTimerTypeField(); 24 | 25 | _textValue.text = $"Value: {_remainingSeconds.ToString()}"; 26 | } 27 | 28 | private void OnEnable() 29 | { 30 | _buttonStart.onClick.AddListener(OnStartButtonClick); 31 | _buttonPause.onClick.AddListener(OnPauseButtonClick); 32 | _buttonStop.onClick.AddListener(OnStopButtonClick); 33 | } 34 | 35 | private void OnDisable() 36 | { 37 | _buttonStart.onClick.RemoveListener(OnStartButtonClick); 38 | _buttonPause.onClick.RemoveListener(OnPauseButtonClick); 39 | _buttonStop.onClick.RemoveListener(OnStopButtonClick); 40 | } 41 | 42 | private void SubscribeOnTimerEvents() 43 | { 44 | _timer.TimerValueChanged += TimerValueChanged; 45 | _timer.TimerFinished += TimerFinished; 46 | } 47 | 48 | private void UnsubscribeFromTimerEvents() 49 | { 50 | _timer.TimerValueChanged -= TimerValueChanged; 51 | _timer.TimerFinished -= TimerFinished; 52 | } 53 | 54 | private void UpdatePauseButtonState() 55 | { 56 | if (_timer == null) 57 | { 58 | _buttonPause.image.color = _colorUnpaused; 59 | return; 60 | } 61 | 62 | var color = _timer.isPaused ? _colorPaused : _colorUnpaused; 63 | _buttonPause.image.color = color; 64 | 65 | var text = _timer.isPaused ? "Unpause" : "Pause"; 66 | var textField = _buttonPause.GetComponentInChildren(); 67 | textField.text = text; 68 | } 69 | 70 | private void UpdateTimerTypeField() 71 | { 72 | _textType.text = $"Type: {_timerType.ToString()}"; 73 | } 74 | 75 | private void OnStartButtonClick() 76 | { 77 | if (_timer == null) 78 | { 79 | _timer = new SyncedTimer(_timerType); 80 | SubscribeOnTimerEvents(); 81 | } 82 | 83 | UpdateTimerTypeField(); 84 | _timer.Start(_remainingSeconds); 85 | UpdatePauseButtonState(); 86 | } 87 | 88 | private void OnPauseButtonClick() 89 | { 90 | if (_timer == null) 91 | return; 92 | 93 | if (_timer.isPaused) 94 | _timer.Unpause(); 95 | else 96 | _timer.Pause(); 97 | 98 | UpdatePauseButtonState(); 99 | } 100 | 101 | private void OnStopButtonClick() 102 | { 103 | if (_timer == null) 104 | return; 105 | 106 | _timer.Stop(); 107 | UpdatePauseButtonState(); 108 | } 109 | 110 | private void TimerFinished() 111 | { 112 | _textValue.text = "Value: Finished (0)"; 113 | } 114 | 115 | private void TimerValueChanged(float remainingSeconds, TimeChangingSource timeChangingSource) 116 | { 117 | _textValue.text = $"Value: {remainingSeconds.ToString()}"; 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Example/Scripts/WidgetTimerExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca9f4b245582ce04f89fd0b44766ecb5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Synced timer 2 | 3 | Synced timer is a simple timer system allows you create timers just with next line of code: 4 | 5 | 6 | ``` 7 | var timer = new SyncedTimer(timerType); 8 | ``` 9 | 10 | *where **timerType** - is a type of timer. There are four types of timer now: 11 | 12 | - UpdateTick, 13 | - UpdateTickUnscaled, 14 | - OneSecTick, 15 | - OneSecTickUnscaled 16 | 17 | Chose those that more suit you and do the things. It has two events: TimerValueChanged, that frequence depends on the type of the timer. And TimerFinished - it's clean. 18 | 19 | ### Methods: 20 | 21 | - Start(); 22 | - Stop(); 23 | - Pause(); 24 | - Unpause(); 25 | - SetTime(float newRemainingSeconds); 26 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: efbb2b97ac3fdfa44aa927ce29d017b6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/SyncedTimer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bb3f7382d03431d877f0a286a97c9ff 3 | timeCreated: 1631627952 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/TimeChangingSource.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Utils.Timing 2 | { 3 | public enum TimeChangingSource 4 | { 5 | TimerStarted, 6 | TimerFinished, 7 | TimerPaused, 8 | TimerUnpaused, 9 | TimePassed, 10 | TimeForceChanged 11 | } 12 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/TimeChangingSource.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05db1f8d4c694c39a115acc547317625 3 | timeCreated: 1654249240 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/TimeInvoker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace VavilichevGD.Utils.Timing 5 | { 6 | public class TimeInvoker : MonoBehaviour 7 | { 8 | public event Action OnUpdateTimeTickedEvent; 9 | public event Action OnUpdateTimeUnscaledTickedEvent; 10 | public event Action OnOneSyncedSecondTickedEvent; 11 | public event Action OnOneSyncedSecondUnscaledTickedEvent; 12 | 13 | public static TimeInvoker instance 14 | { 15 | get 16 | { 17 | if (_instance == null) 18 | { 19 | var go = new GameObject("[TIME INVOKER]"); 20 | _instance = go.AddComponent(); 21 | DontDestroyOnLoad(go); 22 | } 23 | 24 | return _instance; 25 | } 26 | } 27 | 28 | private static TimeInvoker _instance; 29 | 30 | private float _oneSecTimer; 31 | private float _oneSecUnscaledTimer; 32 | 33 | private void Update() 34 | { 35 | var deltaTimer = Time.deltaTime; 36 | 37 | OnUpdateTimeTickedEvent?.Invoke(deltaTimer); 38 | 39 | _oneSecTimer += deltaTimer; 40 | 41 | if (_oneSecTimer >= 1f) 42 | { 43 | _oneSecTimer -= 1f; 44 | 45 | OnOneSyncedSecondTickedEvent?.Invoke(); 46 | } 47 | 48 | var unscaledDeltaTimer = Time.unscaledDeltaTime; 49 | 50 | OnUpdateTimeUnscaledTickedEvent?.Invoke(Time.unscaledDeltaTime); 51 | 52 | _oneSecUnscaledTimer += unscaledDeltaTimer; 53 | 54 | if (_oneSecUnscaledTimer >= 1f) 55 | { 56 | _oneSecUnscaledTimer -= 1f; 57 | 58 | OnOneSyncedSecondUnscaledTickedEvent?.Invoke(); 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/TimeInvoker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdfbac55d5c04e7e967a334a0dea9cb0 3 | timeCreated: 1631624688 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/TimerType.cs: -------------------------------------------------------------------------------- 1 | namespace VavilichevGD.Utils.Timing { 2 | public enum TimerType { 3 | UpdateTick, 4 | UpdateTickUnscaled, 5 | OneSecTick, 6 | OneSecTickUnscaled 7 | } 8 | } -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/Scripts/TimerType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c3499904a9c4cd9ab6a8b959c6d4120 3 | timeCreated: 1631624424 -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/SyncedTimer v.1.03.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vavilichev/UnityUserful/ffd809d22d74bb0ce896be7f70cfbcdd5c036653/Assets/VavilichevGD/Utils/SyncedTimer/SyncedTimer v.1.03.unitypackage -------------------------------------------------------------------------------- /Assets/VavilichevGD/Utils/SyncedTimer/SyncedTimer v.1.03.unitypackage.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04d65c77cd4c3fc45b0861acbfbfa1ad 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.2.16", 4 | "com.unity.ide.rider": "1.1.4", 5 | "com.unity.ide.vscode": "1.1.4", 6 | "com.unity.test-framework": "1.1.13", 7 | "com.unity.textmeshpro": "2.0.1", 8 | "com.unity.timeline": "1.2.14", 9 | "com.unity.ugui": "1.0.0", 10 | "com.unity.modules.ai": "1.0.0", 11 | "com.unity.modules.androidjni": "1.0.0", 12 | "com.unity.modules.animation": "1.0.0", 13 | "com.unity.modules.assetbundle": "1.0.0", 14 | "com.unity.modules.audio": "1.0.0", 15 | "com.unity.modules.cloth": "1.0.0", 16 | "com.unity.modules.director": "1.0.0", 17 | "com.unity.modules.imageconversion": "1.0.0", 18 | "com.unity.modules.imgui": "1.0.0", 19 | "com.unity.modules.jsonserialize": "1.0.0", 20 | "com.unity.modules.particlesystem": "1.0.0", 21 | "com.unity.modules.physics": "1.0.0", 22 | "com.unity.modules.physics2d": "1.0.0", 23 | "com.unity.modules.screencapture": "1.0.0", 24 | "com.unity.modules.terrain": "1.0.0", 25 | "com.unity.modules.terrainphysics": "1.0.0", 26 | "com.unity.modules.tilemap": "1.0.0", 27 | "com.unity.modules.ui": "1.0.0", 28 | "com.unity.modules.uielements": "1.0.0", 29 | "com.unity.modules.umbra": "1.0.0", 30 | "com.unity.modules.unityanalytics": "1.0.0", 31 | "com.unity.modules.unitywebrequest": "1.0.0", 32 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 33 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 34 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 35 | "com.unity.modules.unitywebrequestwww": "1.0.0", 36 | "com.unity.modules.vehicles": "1.0.0", 37 | "com.unity.modules.video": "1.0.0", 38 | "com.unity.modules.vr": "1.0.0", 39 | "com.unity.modules.wind": "1.0.0", 40 | "com.unity.modules.xr": "1.0.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.3.11f1 2 | m_EditorVersionWithRevision: 2019.3.11f1 (ceef2d848e70) 3 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } --------------------------------------------------------------------------------