Browse Source

- Фікси

master
Seraph 4 years ago
parent
commit
e209f64589
  1. BIN
      Assets/Prototype/Core/Core.dll
  2. BIN
      Assets/Prototype/Core/CoreEditor.dll
  3. 3
      Assets_DLL/Core/Ads/AdsManager.cs
  4. 6
      Assets_DLL/Core/Audio/AudioController.cs
  5. 4
      Assets_DLL/Core/Audio/AudioController2D.cs
  6. 22
      Assets_DLL/Core/Audio/AudioController3D.cs
  7. 139
      Assets_DLL/Core/Audio/PlayAudioFile.cs
  8. 2
      Assets_DLL/Core/CoreInitializer.cs
  9. 2
      Assets_DLL/Core/Tools/AspectAdapters/CameraVerticalStretchingAdapter.cs
  10. 2
      Assets_DLL/Core/Tools/AspectAdapters/CanvasAspectAdapter.cs
  11. 4
      Assets_DLL/Core/Tools/Pool/Particles/ParticlesPool.cs
  12. 8
      Assets_DLL/Core/Tools/Saves/SaveData.cs
  13. 11
      Assets_DLL/Core/Tools/Saves/SaveManager.cs
  14. BIN
      Assets_DLL/Core/obj/Debug/netstandard2.0/Core.csproj.AssemblyReference.cache
  15. 2
      Assets_DLL/Core/obj/Debug/netstandard2.0/Core.csproj.CoreCompileInputs.cache
  16. BIN
      Assets_DLL/Core/obj/Debug/netstandard2.0/Core.dll
  17. 18
      Assets_DLL/CoreEditor/Tools/Pool/Particles/ParticlesPoolEditor.cs
  18. 4
      Assets_DLL/CoreEditor/Tools/UnusedAssetsMarker.cs
  19. 61
      Assets_DLL/CoreEditor/obj/CoreEditor.csproj.nuget.dgspec.json
  20. BIN
      Assets_DLL/CoreEditor/obj/Debug/netstandard2.0/CoreEditor.csproj.AssemblyReference.cache
  21. BIN
      Assets_DLL/CoreEditor/obj/Debug/netstandard2.0/CoreEditor.dll
  22. 22
      Assets_DLL/CoreEditor/obj/project.assets.json
  23. 2
      Assets_DLL/CoreEditor/obj/project.nuget.cache
  24. BIN
      Builds/Core_1.9.unitypackage

BIN
Assets/Prototype/Core/Core.dll

Binary file not shown.

BIN
Assets/Prototype/Core/CoreEditor.dll

Binary file not shown.

3
Assets_DLL/Core/Ads/AdsManager.cs

@ -17,6 +17,9 @@ namespace Core.Ads
internal static void Init()
{
if (!CoreSettings.data.needInterstitial && !CoreSettings.data.needBanner && !CoreSettings.data.needRewarded)
return;
GameObject holder = new GameObject("[AdsManager]");
GameObject bridge = null;

6
Assets_DLL/Core/Audio/AudioController.cs

@ -83,8 +83,8 @@ namespace Core.Audio
}
}
public static float PlayMusic(string name) =>
_audio2D.PlayMusic(name);
public static float PlayMusic(string name, bool isLoop = false) =>
_audio2D.PlayMusic(name, isLoop);
public static void StopMusic() =>
_audio2D.StopMusic();
@ -121,7 +121,7 @@ namespace Core.Audio
{
AudioListener listener = FindObjectOfType<AudioListener>();
if (listener == null)
if (listener != null)
_currentTarget = listener.transform;
}
else

4
Assets_DLL/Core/Audio/AudioController2D.cs

@ -65,12 +65,11 @@ namespace Core.Audio
}
}
internal float PlayMusic(string name)
internal float PlayMusic(string name, bool isLoop = true)
{
if (_musicSource == null)
{
_musicSource = _musicParent.AddComponent<AudioSource>();
_musicSource.loop = true;
_musicSource.playOnAwake = false;
_musicSource.volume = CoreSettings.data.musicVolume * MusicVolume;
}
@ -78,6 +77,7 @@ namespace Core.Audio
if (_musicAndSounds.ContainsKey(name))
{
_musicSource.clip = _musicAndSounds[name];
_musicSource.loop = isLoop;
_musicSource.Play();
return _musicAndSounds[name].length;

22
Assets_DLL/Core/Audio/AudioController3D.cs

@ -16,10 +16,6 @@ namespace Core.Audio
_voicesDictionary = voicesDictionary;
}
private GameObject _musicParent = null;
private GameObject _soundsParent = null;
private GameObject _voicesParent = null;
private List<AudioSource> _soundsSources = new List<AudioSource>();
private List<AudioSource> _voicesSources = new List<AudioSource>();
@ -58,9 +54,13 @@ namespace Core.Audio
if (playSource == null)
{
playSource = _soundsParent.AddComponent<AudioSource>();
GameObject sound = new GameObject("Sound");
playSource = sound.AddComponent<AudioSource>();
playSource.playOnAwake = false;
playSource.volume = CoreSettings.data.soundsVolume * SoundsVolume;
playSource.spatialBlend = 1f;
playSource.rolloffMode = AudioRolloffMode.Custom;
playSource.SetCustomCurve(AudioSourceCurveType.CustomRolloff, AnimationCurve.Linear(0f, 1f, 1f, 0f));
_soundsSources.Add(playSource);
}
@ -73,6 +73,9 @@ namespace Core.Audio
playSource.maxDistance = maxDistance;
playSource.transform.SetParent(target);
playSource.transform.localPosition = Vector3.zero;
playSource.spatialBlend = 1f;
playSource.rolloffMode = AudioRolloffMode.Custom;
playSource.SetCustomCurve(AudioSourceCurveType.CustomRolloff, AnimationCurve.Linear(0f, 1f, 1f, 0f));
playSource.Play();
return _musicAndSounds[name].length;
@ -95,10 +98,14 @@ namespace Core.Audio
if (playSource == null)
{
playSource = _voicesParent.AddComponent<AudioSource>();
GameObject voice = new GameObject("Voice");
playSource = voice.AddComponent<AudioSource>();
playSource.loop = false;
playSource.playOnAwake = false;
playSource.volume = CoreSettings.data.voicesVolume * VoicesVolume;
playSource.spatialBlend = 1f;
playSource.rolloffMode = AudioRolloffMode.Custom;
playSource.SetCustomCurve(AudioSourceCurveType.CustomRolloff, AnimationCurve.Linear(0f, 1f, 1f, 0f));
_voicesSources.Add(playSource);
}
@ -112,6 +119,9 @@ namespace Core.Audio
playSource.maxDistance = maxDistance;
playSource.transform.SetParent(target);
playSource.transform.localPosition = Vector3.zero;
playSource.spatialBlend = 1f;
playSource.rolloffMode = AudioRolloffMode.Custom;
playSource.SetCustomCurve(AudioSourceCurveType.CustomRolloff, AnimationCurve.Linear(0f, 1f, 1f, 0f));
playSource.Play();
return _voicesDictionary[LocalizationManager.CurrentLanguage][name].length;

139
Assets_DLL/Core/Audio/PlayAudioFile.cs

@ -0,0 +1,139 @@
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace Core.Audio
{
public sealed class PlayAudioFile : MonoBehaviour
{
public enum SourceType
{
Flat = 0,
Surround = 1,
}
public enum AudioFileType
{
Music = 0,
Sound = 1,
Voice = 2,
}
public enum PlayType
{
OnStart = 0,
OnClickButton = 1,
OnClickCollider = 2,
OnPlayParticle = 3,
}
[SerializeField] private SourceType _sourceType = SourceType.Flat;
[SerializeField] private AudioFileType _audioFileType = AudioFileType.Music;
[SerializeField] private PlayType _playType = PlayType.OnStart;
[SerializeField] private float _startDelay = 0f;
[SerializeField] private bool _loop = false;
[SerializeField] private float _minDistance = 0f;
[SerializeField] private float _maxDistance = 100f;
[SerializeField] private string[] _audioFileNames = new string[0];
private ParticleSystem _particleSystem = null;
private Button _button = null;
private bool _isPlaying = false;
private void Awake()
{
_button = GetComponent<Button>();
_particleSystem = GetComponent<ParticleSystem>();
if (_particleSystem == null)
_particleSystem = GetComponentInChildren<ParticleSystem>();
}
private IEnumerator Start()
{
while (true)
{
switch (_playType)
{
case PlayType.OnStart:
StartCoroutine(CallPlay());
yield break;
case PlayType.OnPlayParticle:
while (!_particleSystem.isPlaying)
yield return null;
yield return StartCoroutine(CallPlay());
while (_particleSystem.isPlaying)
yield return null;
break;
case PlayType.OnClickButton:
_button.onClick.AddListener(() =>
{
StartCoroutine(CallPlay());
});
yield break;
case PlayType.OnClickCollider:
yield break;
}
}
}
private void OnMouseDown()
{
if (_isPlaying || _playType != PlayType.OnClickCollider)
return;
StartCoroutine(CallPlay());
}
private IEnumerator CallPlay()
{
float time = 0f;
if (_startDelay != 0f)
yield return new WaitForSeconds(_startDelay);
switch (_audioFileType)
{
case AudioFileType.Music:
time = AudioController.PlayMusic(_audioFileNames[Random.Range(0, _audioFileNames.Length)], _loop);
break;
case AudioFileType.Sound:
if (_sourceType == SourceType.Flat)
time = AudioController.PlaySound(_audioFileNames[Random.Range(0, _audioFileNames.Length)], _loop);
else
time = AudioController.PlaySound(_audioFileNames[Random.Range(0, _audioFileNames.Length)], transform, _minDistance, _maxDistance, _loop);
break;
case AudioFileType.Voice:
if (_sourceType == SourceType.Flat)
time = AudioController.PlayVoice(_audioFileNames[Random.Range(0, _audioFileNames.Length)]);
else
time = AudioController.PlayVoice(_audioFileNames[Random.Range(0, _audioFileNames.Length)], transform, _minDistance, _maxDistance);
break;
}
_isPlaying = true;
yield return new WaitForSeconds(time);
_isPlaying = false;
}
}
}

2
Assets_DLL/Core/CoreInitializer.cs

@ -26,7 +26,7 @@ namespace Core
private static void Init()
{
SaveManager.Load();
SaveManager.Init();
PurchaseManager.Init();
AdsManager.Init();
LocalizationManager.Init();

2
Assets_DLL/Core/Tools/AspectAdapters/CameraVerticalStretchingAdapter.cs

@ -14,7 +14,7 @@ namespace Core.Tools.AspectAdapters
private void Reset() =>
_camera = GetComponent<Camera>();
private void Awake() =>
private void Start() =>
SetCameraSize();
private void Update()

2
Assets_DLL/Core/Tools/AspectAdapters/CanvasAspectAdapter.cs

@ -13,7 +13,7 @@ namespace Core.Tools.AspectAdapters
private void Reset() =>
_canvasScaler = GetComponent<CanvasScaler>();
private void Awake()
private void Start()
{
_canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
_canvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;

4
Assets_DLL/Core/Tools/Pool/Particles/ParticlesPool.cs

@ -18,7 +18,7 @@ namespace Core.Tools.Pool.Particles
return _current._particles.Select(p => p.ID).ToArray();
}
public static void PlayParticle(string id, Vector3 position, Quaternion rotation, Vector3 scale, Transform parent)
public static ParticleSystem PlayParticle(string id, Vector3 position, Quaternion rotation, Vector3 scale, Transform parent)
{
if (_current == null)
throw new ArgumentNullException("ParticlesPool not found on scene");
@ -36,6 +36,8 @@ namespace Core.Tools.Pool.Particles
particleSystem.transform.localScale = scale;
particleSystem.Play();
return particleSystem;
}
[SerializeField] private Particle[] _particles = new Particle[0];

8
Assets_DLL/Core/Tools/Saves/SaveData.cs

@ -52,8 +52,6 @@ namespace Core.Tools.Saves
_intData.Where(d => d.key == key).First().value = value;
else
_intData.Add(new IntData { key = key, value = value });
SaveManager.Save();
}
public int GetInt(string key, int defaultValue = 0)
@ -73,8 +71,6 @@ namespace Core.Tools.Saves
_floatData.Where(d => d.key == key).First().value = value;
else
_floatData.Add(new FloatData { key = key, value = value });
SaveManager.Save();
}
public float GetFloat(string key, float defaultValue = 0f)
@ -94,8 +90,6 @@ namespace Core.Tools.Saves
_stringData.Where(d => d.key == key).First().value = value;
else
_stringData.Add(new StringData { key = key, value = value });
SaveManager.Save();
}
public string GetString(string key, string defaultValue = "")
@ -115,8 +109,6 @@ namespace Core.Tools.Saves
_boolData.Where(d => d.key == key).First().value = value;
else
_boolData.Add(new BoolData { key = key, value = value });
SaveManager.Save();
}
public bool GetBool(string key, bool defaultValue = false)

11
Assets_DLL/Core/Tools/Saves/SaveManager.cs

@ -4,12 +4,21 @@ using UnityEngine;
namespace Core.Tools.Saves
{
public static class SaveManager
public sealed class SaveManager
{
private static SaveData _save = null;
private const string SAVE_KEY = "{@rew_O39U*#H{EFSF";
internal static void Init()
{
Application.quitting += OnQuit;
Load();
}
private static void OnQuit() =>
Save();
public static string GetPathToSave()
{
if (Application.isEditor || Application.isMobilePlatform)

BIN
Assets_DLL/Core/obj/Debug/netstandard2.0/Core.csproj.AssemblyReference.cache

Binary file not shown.

2
Assets_DLL/Core/obj/Debug/netstandard2.0/Core.csproj.CoreCompileInputs.cache

@ -1 +1 @@
7fd1797d3498be18a922a7bf796a7fa6c67322c0
9862dcf43a2537ba94419b6dd7bcafa73d8c1851

BIN
Assets_DLL/Core/obj/Debug/netstandard2.0/Core.dll

Binary file not shown.

18
Assets_DLL/CoreEditor/Tools/Pool/Particles/ParticlesPoolEditor.cs

@ -17,10 +17,13 @@ namespace CoreEditor.Localization
EditorGUILayout.BeginHorizontal("BOX");
GUILayout.Label("ID", EditorStyles.label);
GUILayout.Label("Prefab", EditorStyles.label);
GUILayout.Label("StartCount", EditorStyles.label, GUILayout.MaxWidth(64));
GUILayout.Label("", EditorStyles.label, GUILayout.MaxWidth(64));
GUIStyle header = new GUIStyle(EditorStyles.label);
header.alignment = TextAnchor.MiddleCenter;
GUILayout.Label("ID", header);
GUILayout.Label("Prefab", header);
GUILayout.Label("StartCount", header, GUILayout.MinWidth(128), GUILayout.MaxWidth(128));
GUILayout.Label("", EditorStyles.label, GUILayout.MinWidth(64), GUILayout.MaxWidth(64));
EditorGUILayout.EndHorizontal();
@ -36,16 +39,13 @@ namespace CoreEditor.Localization
SerializedProperty prefab = particle.FindPropertyRelative("_prefab");
SerializedProperty count = particle.FindPropertyRelative("_startCount");
id.stringValue = EditorGUILayout.TextField(id.stringValue);
prefab.objectReferenceValue = (ParticleSystem)EditorGUILayout.ObjectField((ParticleSystem)prefab.objectReferenceValue, typeof(ParticleSystem), true);
EditorGUILayout.PropertyField(prefab, GUIContent.none);
count.intValue = EditorGUILayout.IntField(count.intValue, GUILayout.MaxWidth(64));
count.intValue = EditorGUILayout.IntField(count.intValue, GUILayout.MinWidth(128), GUILayout.MaxWidth(128));
if (GUILayout.Button("Remove", GUILayout.MaxWidth(64)))
if (GUILayout.Button("Remove", GUILayout.MinWidth(64), GUILayout.MaxWidth(64)))
particles.DeleteArrayElementAtIndex(i);
EditorGUILayout.EndHorizontal();

4
Assets_DLL/CoreEditor/Tools/UnusedAssetsMarker.cs

@ -96,13 +96,13 @@ namespace Core.Tools
style.alignment = TextAnchor.MiddleRight;
Rect newRect = rect;
newRect.x += rect.width - 305;
newRect.x += rect.width - 150;
newRect.width = 200;
GUI.Label(newRect, $"Used: {usedCount}");
newRect = rect;
newRect.x += rect.width - 155;
newRect.x += rect.width - 80;
newRect.width = 200;
GUI.Label(newRect, $"Unused: {unusedCount}");

61
Assets_DLL/CoreEditor/obj/CoreEditor.csproj.nuget.dgspec.json

@ -24,67 +24,6 @@
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {
"C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj": {
"projectPath": "C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"dependencies": {
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "c:\\program files\\dotnet\\sdk\\5.0.404\\RuntimeIdentifierGraph.json"
}
}
},
"C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj",
"projectName": "Core",
"projectPath": "C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj",
"packagesPath": "C:\\Users\\Seraph\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Seraph\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",

BIN
Assets_DLL/CoreEditor/obj/Debug/netstandard2.0/CoreEditor.csproj.AssemblyReference.cache

Binary file not shown.

BIN
Assets_DLL/CoreEditor/obj/Debug/netstandard2.0/CoreEditor.dll

Binary file not shown.

22
Assets_DLL/CoreEditor/obj/project.assets.json

@ -25,16 +25,6 @@
"build": {
"build/netstandard2.0/NETStandard.Library.targets": {}
}
},
"Core/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v2.0",
"compile": {
"bin/placeholder/Core.dll": {}
},
"runtime": {
"bin/placeholder/Core.dll": {}
}
}
}
},
@ -182,16 +172,10 @@
"netstandard.library.2.0.3.nupkg.sha512",
"netstandard.library.nuspec"
]
},
"Core/1.0.0": {
"type": "project",
"path": "../Core/Core.csproj",
"msbuildProject": "../Core/Core.csproj"
}
},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.0": [
"Core >= 1.0.0",
"NETStandard.Library >= 2.0.3"
]
},
@ -221,11 +205,7 @@
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {
"C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj": {
"projectPath": "C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\Core\\Core.csproj"
}
}
"projectReferences": {}
}
},
"warningProperties": {

2
Assets_DLL/CoreEditor/obj/project.nuget.cache

@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "qkhVuOlYEkmi2DHHRuNMcqs1P4fYmJt3cqFX3P/k5v4drA4rQrEghTaCrhMF/yOC3iYsVvnOva+Ai9WkMlaKTQ==",
"dgSpecHash": "uzXWsU/BEJvCRmjWWM6TZjTxNu+Z6tQFk8xjQC2Bz+y3D/HGlBvlPGCLzPoOr1ASW2YZi5rmPP/euqHv5CY+wA==",
"success": true,
"projectFilePath": "C:\\Users\\Seraph\\Desktop\\Prototype\\Assets_DLL\\CoreEditor\\CoreEditor.csproj",
"expectedPackageFiles": [

BIN
Builds/Core_1.9.unitypackage

Binary file not shown.
Loading…
Cancel
Save