Browse Source

- Prototype ver.1.8.2

Фікси
master
Seraph 4 years ago
parent
commit
2be3434f7d
  1. BIN
      Assets/Prototype/Core/Core.dll
  2. 40
      Assets_DLL/Core/Ads/AdsManager.cs
  3. 4
      Assets_DLL/Core/Ads/RewardedButton.cs
  4. 13
      Assets_DLL/Core/Audio/AudioController.cs
  5. 5
      Assets_DLL/Core/Audio/AudioController2D.cs
  6. 3
      Assets_DLL/Core/IAP/PurchaseButton.cs
  7. 13
      Assets_DLL/Core/IAP/PurchaseManagerBase.cs
  8. 9
      Assets_DLL/Core/Localization/LocalizationManager.cs
  9. 4
      Assets_DLL/Core/SceneManagement/SceneLoader.cs
  10. 11
      Assets_DLL/Core/Settings/CoreSettingsData.cs
  11. 2
      Assets_DLL/Core/Tools/Pool/Particles/ParticlesPool.cs
  12. BIN
      Assets_DLL/Core/obj/Debug/netstandard2.0/Core.csproj.AssemblyReference.cache
  13. BIN
      Assets_DLL/Core/obj/Debug/netstandard2.0/Core.dll
  14. BIN
      Assets_DLL/CoreEditor/obj/Debug/netstandard2.0/CoreEditor.csproj.AssemblyReference.cache
  15. BIN
      Builds/Core_1.8.2.unitypackage

BIN
Assets/Prototype/Core/Core.dll

Binary file not shown.

40
Assets_DLL/Core/Ads/AdsManager.cs

@ -31,7 +31,7 @@ namespace Core.Ads
else else
{ {
if (CoreSettings.data.adsBridgeObiect == null) if (CoreSettings.data.adsBridgeObiect == null)
throw new NullReferenceException("ads bridge object is null"); throw new NullReferenceException("Ads bridge object is null");
bridge = GameObject.Instantiate(CoreSettings.data.adsBridgeObiect, holder.transform); bridge = GameObject.Instantiate(CoreSettings.data.adsBridgeObiect, holder.transform);
} }
@ -44,7 +44,7 @@ namespace Core.Ads
_interstitial = bridge.GetComponent<IInterstitialBridge>(); _interstitial = bridge.GetComponent<IInterstitialBridge>();
if (_interstitial == null) if (_interstitial == null)
throw new NullReferenceException("ads bridge object does not implement IInterstitialBridge"); throw new NullReferenceException("Ads bridge object does not implement IInterstitialBridge");
_interstitial.OnEnded += () => OnInterstitialShowed?.Invoke(); _interstitial.OnEnded += () => OnInterstitialShowed?.Invoke();
} }
@ -57,14 +57,14 @@ namespace Core.Ads
_banner = bridge.GetComponent<IBannerBridge>(); _banner = bridge.GetComponent<IBannerBridge>();
if (_banner == null) if (_banner == null)
throw new NullReferenceException("ads bridge object does not implement IBannerBridge"); throw new NullReferenceException("Ads bridge object does not implement IBannerBridge");
PurchaseManager.OnPurchaseSuccess += (productId) => PurchaseManager.OnPurchaseSuccess += (productId) =>
{ {
if (!CoreSettings.data.nonConsumableProducts.Contains(productId)) if (CoreSettings.data.IsProductConsumable(productId))
return; return;
if (CoreSettings.data.nonConsumableProductsDisableAds[CoreSettings.data.nonConsumableProducts.IndexOf(productId)]) if (CoreSettings.data.IsOnAdsProduct(productId))
HideBanner(); HideBanner();
}; };
} }
@ -77,17 +77,15 @@ namespace Core.Ads
_rewarded = bridge.GetComponent<IRewardedBridge>(); _rewarded = bridge.GetComponent<IRewardedBridge>();
if (_rewarded == null) if (_rewarded == null)
throw new NullReferenceException("ads bridge object does not implement IRewardedBridge"); throw new NullReferenceException("Ads bridge object does not implement IRewardedBridge");
} }
} }
public static bool IsAdsDisabled() public static bool IsAdsDisabled()
{ {
for (int i = 0; i < CoreSettings.data.nonConsumableProducts.Count; i++) for (int i = 0; i < CoreSettings.data.nonConsumableProducts.Count; i++)
{ {
if (CoreSettings.data.nonConsumableProductsDisableAds[i] && PurchaseManager.IsProductPurchased(CoreSettings.data.nonConsumableProducts[i])) if (PurchaseManager.IsProductPurchased(CoreSettings.data.nonConsumableProducts[i]))
return true; return true;
} }
@ -100,7 +98,7 @@ namespace Core.Ads
return false; return false;
if (_interstitial == null) if (_interstitial == null)
throw new NullReferenceException("ads bridge object does not implement IInterstitialBridge"); throw new NullReferenceException("Ads bridge object does not implement IInterstitialBridge");
if (CoreSettings.data.needInterstitial) if (CoreSettings.data.needInterstitial)
return _interstitial.IsReady(); return _interstitial.IsReady();
@ -111,7 +109,7 @@ namespace Core.Ads
public static bool IsInterstitialVisible() public static bool IsInterstitialVisible()
{ {
if (_interstitial == null) if (_interstitial == null)
throw new NullReferenceException("ads bridge object does not implement IInterstitialBridge"); throw new NullReferenceException("Ads bridge object does not implement IInterstitialBridge");
if (CoreSettings.data.needInterstitial) if (CoreSettings.data.needInterstitial)
return _interstitial.IsVisible(); return _interstitial.IsVisible();
@ -121,11 +119,13 @@ namespace Core.Ads
public static void ShowInterstitial() public static void ShowInterstitial()
{ {
Debug.Log("Called show interstitial");
if (IsAdsDisabled()) if (IsAdsDisabled())
return; return;
if (_interstitial == null) if (_interstitial == null)
throw new NullReferenceException("ads bridge object does not implement IInterstitialBridge"); throw new NullReferenceException("Ads bridge object does not implement IInterstitialBridge");
if (CoreSettings.data.needInterstitial) if (CoreSettings.data.needInterstitial)
_interstitial.Show(); _interstitial.Show();
@ -139,7 +139,7 @@ namespace Core.Ads
return false; return false;
if (_rewarded == null) if (_rewarded == null)
throw new NullReferenceException("ads bridge object does not implement IRewardedBridge"); throw new NullReferenceException("Ads bridge object does not implement IRewardedBridge");
if (CoreSettings.data.needRewarded) if (CoreSettings.data.needRewarded)
return _rewarded.IsReady(); return _rewarded.IsReady();
@ -149,11 +149,13 @@ namespace Core.Ads
public static void ShowRewarded(Action onSucces, Action onFailed) public static void ShowRewarded(Action onSucces, Action onFailed)
{ {
Debug.Log("Called show rewarded");
if (IsAdsDisabled()) if (IsAdsDisabled())
return; return;
if (_rewarded == null) if (_rewarded == null)
throw new NullReferenceException("ads bridge object does not implement IRewardedBridge"); throw new NullReferenceException("Ads bridge object does not implement IRewardedBridge");
if (CoreSettings.data.needRewarded) if (CoreSettings.data.needRewarded)
_rewarded.Show(onSucces, onFailed); _rewarded.Show(onSucces, onFailed);
@ -164,7 +166,7 @@ namespace Core.Ads
public static bool IsBannerVisible() public static bool IsBannerVisible()
{ {
if (_banner == null) if (_banner == null)
throw new NullReferenceException("ads bridge object does not implement IBannerBridge"); throw new NullReferenceException("Ads bridge object does not implement IBannerBridge");
if (CoreSettings.data.needBanner) if (CoreSettings.data.needBanner)
_banner.IsVisible(); _banner.IsVisible();
@ -176,11 +178,13 @@ namespace Core.Ads
public static void ShowBanner(BannerPositions position) public static void ShowBanner(BannerPositions position)
{ {
Debug.Log("Called show banner");
if (IsAdsDisabled()) if (IsAdsDisabled())
return; return;
if (_banner == null) if (_banner == null)
throw new NullReferenceException("ads bridge object does not implement IBannerBridge"); throw new NullReferenceException("Ads bridge object does not implement IBannerBridge");
if (CoreSettings.data.needBanner) if (CoreSettings.data.needBanner)
_banner.Show(position); _banner.Show(position);
@ -190,8 +194,10 @@ namespace Core.Ads
public static void HideBanner() public static void HideBanner()
{ {
Debug.Log("Called hide banner");
if (_banner == null) if (_banner == null)
throw new NullReferenceException("ads bridge object does not implement IBannerBridge"); throw new NullReferenceException("Ads bridge object does not implement IBannerBridge");
if (CoreSettings.data.needBanner) if (CoreSettings.data.needBanner)
_banner.Hide(); _banner.Hide();

4
Assets_DLL/Core/Ads/RewardedButton.cs

@ -49,10 +49,10 @@ namespace Core.Ads
private void CheckAdsEnablingAfterPurchasing(string productId) private void CheckAdsEnablingAfterPurchasing(string productId)
{ {
if (!CoreSettings.data.nonConsumableProducts.Contains(productId)) if (CoreSettings.data.IsProductConsumable(productId))
return; return;
if (CoreSettings.data.nonConsumableProductsDisableAds[CoreSettings.data.nonConsumableProducts.IndexOf(productId)]) if (CoreSettings.data.IsOnAdsProduct(productId))
gameObject.SetActive(false); gameObject.SetActive(false);
} }
} }

13
Assets_DLL/Core/Audio/AudioController.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using Core.Settings; using Core.Settings;
using Core.Tools.Saves;
namespace Core.Audio namespace Core.Audio
{ {
@ -48,30 +49,30 @@ namespace Core.Audio
public static float MusicVolume public static float MusicVolume
{ {
get => PlayerPrefs.GetFloat("MusicVolume", 1f); get => SaveManager.GetFloat("MusicVolume", 1f);
set set
{ {
PlayerPrefs.SetFloat("MusicVolume", value); SaveManager.SetFloat("MusicVolume", value);
_audio2D.MusicVolume = value; _audio2D.MusicVolume = value;
} }
} }
public static float SoundsVolume public static float SoundsVolume
{ {
get => PlayerPrefs.GetFloat("MusicVolume", 1f); get => SaveManager.GetFloat("MusicVolume", 1f);
set set
{ {
PlayerPrefs.SetFloat("MusicVolume", value); SaveManager.SetFloat("MusicVolume", value);
_audio2D.SoundsVolume = value; _audio2D.SoundsVolume = value;
} }
} }
public static float VoicesVolume public static float VoicesVolume
{ {
get => PlayerPrefs.GetFloat("MusicVolume", 1f); get => SaveManager.GetFloat("MusicVolume", 1f);
set set
{ {
PlayerPrefs.SetFloat("MusicVolume", value); SaveManager.SetFloat("MusicVolume", value);
_audio2D.VoicesVolume = value; _audio2D.VoicesVolume = value;
} }
} }

5
Assets_DLL/Core/Audio/AudioController2D.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using Core.Settings; using Core.Settings;
using Core.Tools.Saves;
namespace Core.Audio namespace Core.Audio
{ {
@ -39,13 +40,13 @@ namespace Core.Audio
internal float MusicVolume internal float MusicVolume
{ {
get => PlayerPrefs.GetFloat("MusicVolume", 1f); get => SaveManager.GetFloat("MusicVolume", 1f);
set => _musicSource.volume = CoreSettings.data.musicVolume * value; set => _musicSource.volume = CoreSettings.data.musicVolume * value;
} }
internal float SoundsVolume internal float SoundsVolume
{ {
get => PlayerPrefs.GetFloat("MusicVolume", 1f); get => SaveManager.GetFloat("MusicVolume", 1f);
set set
{ {
for (int i = 0; i < _soundsSources.Count; i++) for (int i = 0; i < _soundsSources.Count; i++)

3
Assets_DLL/Core/IAP/PurchaseButton.cs

@ -1,4 +1,5 @@
using Core.IAP; using Core.IAP;
using Core.Settings;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.Purchasing; using UnityEngine.Purchasing;
@ -40,7 +41,7 @@ namespace Core.Ads
private void CheckAdsEnablingAfterPurchasing(string productId) private void CheckAdsEnablingAfterPurchasing(string productId)
{ {
if (_productId == productId) if (_productId == productId && !CoreSettings.data.IsProductConsumable(productId))
{ {
_onSucces?.Invoke(); _onSucces?.Invoke();
gameObject.SetActive(false); gameObject.SetActive(false);

13
Assets_DLL/Core/IAP/PurchaseManagerBase.cs

@ -1,4 +1,5 @@
using Core.Settings; using Core.Settings;
using Core.Tools.Saves;
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Purchasing; using UnityEngine.Purchasing;
@ -17,7 +18,7 @@ namespace Core.IAP
_storeController != null && _storeExtensionProvider != null; _storeController != null && _storeExtensionProvider != null;
public bool IsProductPurchased(string productID) => public bool IsProductPurchased(string productID) =>
PlayerPrefs.GetString(productID.ToString() + "_purchased", "false") == "true"; SaveManager.GetString(productID.ToString() + "_purchased", "false") == "true";
public void InitializePurchasing() public void InitializePurchasing()
{ {
@ -36,7 +37,8 @@ namespace Core.IAP
{ {
if (Application.isEditor) if (Application.isEditor)
{ {
PlayerPrefs.SetString(productId + "_purchased", "true"); if (!CoreSettings.data.IsProductConsumable(productId))
SaveManager.SetString(productId + "_purchased", "true");
if (OnPurchaseSuccess != null) if (OnPurchaseSuccess != null)
OnPurchaseSuccess(productId); OnPurchaseSuccess(productId);
@ -72,12 +74,12 @@ namespace Core.IAP
{ {
string price = _storeController.products.WithID(productID).metadata.localizedPriceString; string price = _storeController.products.WithID(productID).metadata.localizedPriceString;
PlayerPrefs.SetString(productID + "_last_price", price); SaveManager.SetString(productID + "_last_price", price);
return price; return price;
} }
else else
return PlayerPrefs.GetString(productID + "_last_price", "0.99$"); return SaveManager.GetString(productID + "_last_price", "0.99$");
} }
public void OnInitialized(IStoreController controller, IExtensionProvider extensions) public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
@ -101,7 +103,8 @@ namespace Core.IAP
{ {
string productId = purchaseEvent.purchasedProduct.definition.id; string productId = purchaseEvent.purchasedProduct.definition.id;
PlayerPrefs.SetString(productId + "_purchased", "true"); if (!CoreSettings.data.IsProductConsumable(productId))
SaveManager.SetString(productId + "_purchased", "true");
OnPurchaseSuccess?.Invoke(productId); OnPurchaseSuccess?.Invoke(productId);

9
Assets_DLL/Core/Localization/LocalizationManager.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Core.Settings; using Core.Settings;
using Core.Localization.Utils; using Core.Localization.Utils;
using Core.Tools.Saves;
namespace Core.Localization namespace Core.Localization
{ {
@ -17,11 +18,11 @@ namespace Core.Localization
public static SystemLanguage CurrentLanguage public static SystemLanguage CurrentLanguage
{ {
get => ConvertToAvailableLanguage((SystemLanguage)PlayerPrefs.GetInt("CurrentLanguage", (int)Application.systemLanguage)); get => ConvertToAvailableLanguage((SystemLanguage)SaveManager.GetInt("CurrentLanguage", (int)Application.systemLanguage));
set set
{ {
SystemLanguage language = ConvertToAvailableLanguage(value); SystemLanguage language = ConvertToAvailableLanguage(value);
PlayerPrefs.SetInt("CurrentLanguage", (int)language); SaveManager.SetInt("CurrentLanguage", (int)language);
OnLocalizationChanged?.Invoke(language); OnLocalizationChanged?.Invoke(language);
} }
} }
@ -114,10 +115,10 @@ namespace Core.Localization
if (_dictionary.ContainsKey(CurrentLanguage)) if (_dictionary.ContainsKey(CurrentLanguage))
return _dictionary[CurrentLanguage][_keys.IndexOf(key)]; return _dictionary[CurrentLanguage][_keys.IndexOf(key)];
else else
throw new KeyNotFoundException($"language \"{CurrentLanguage}\" not found"); throw new KeyNotFoundException($"Language \"{CurrentLanguage}\" not found");
} }
else else
throw new KeyNotFoundException($"key \"{key}\" not found"); throw new KeyNotFoundException($"Key \"{key}\" not found");
} }
private static SystemLanguage ConvertToAvailableLanguage(SystemLanguage language) private static SystemLanguage ConvertToAvailableLanguage(SystemLanguage language)

4
Assets_DLL/Core/SceneManagement/SceneLoader.cs

@ -53,7 +53,7 @@ namespace Core.SceneManagement
public static void LoadScene(string scene) public static void LoadScene(string scene)
{ {
if (_isSceneLoading) if (_isSceneLoading)
throw new InvalidOperationException("scene is already loading"); throw new InvalidOperationException("Scene is already loading");
OnLoadedStart?.Invoke(scene); OnLoadedStart?.Invoke(scene);
@ -64,6 +64,8 @@ namespace Core.SceneManagement
{ {
_isSceneLoading = true; _isSceneLoading = true;
Debug.Log($"Started loading scene \"{scene}\"");
if (CoreSettings.data.needBanner) if (CoreSettings.data.needBanner)
AdsManager.HideBanner(); AdsManager.HideBanner();

11
Assets_DLL/Core/Settings/CoreSettingsData.cs

@ -51,6 +51,17 @@ namespace Core.Settings
public List<string> nonConsumableProducts = new List<string>(); public List<string> nonConsumableProducts = new List<string>();
public List<bool> nonConsumableProductsDisableAds = new List<bool>(); public List<bool> nonConsumableProductsDisableAds = new List<bool>();
public bool IsProductConsumable(string productId) =>
consumableProducts.Contains(productId);
public bool IsOnAdsProduct(string productId)
{
if (IsProductConsumable(productId))
return false;
return nonConsumableProductsDisableAds[nonConsumableProducts.IndexOf(productId)];
}
#endregion #endregion
#region Localization #region Localization

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

@ -26,7 +26,7 @@ namespace Core.Tools.Pool.Particles
Particle particle = _current._particles.Where(p => p.ID == id).FirstOrDefault(); Particle particle = _current._particles.Where(p => p.ID == id).FirstOrDefault();
if (particle == null) if (particle == null)
throw new KeyNotFoundException($"particle with id={id} not found!!!"); throw new KeyNotFoundException($"Particle with id={id} not found!!!");
ParticleSystem particleSystem = particle.GetParticleFromPool(); ParticleSystem particleSystem = particle.GetParticleFromPool();

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

BIN
Builds/Core_1.8.2.unitypackage

Binary file not shown.
Loading…
Cancel
Save