aleksey 3 лет назад
Родитель
Сommit
c6285cdb8b

+ 18 - 2
Unity3/Assets/GameCore/Managers/MenuManager.cs

@@ -1154,7 +1154,7 @@ public class MenuManager : MonoBehaviour
 		}
         else
         {
-			var videoManager = VideoManager.Instance.Timer = 8f;
+			VideoManager.Instance.Timer = 8f;
 			DownloadVideoFromServer.Instance.GetVideo();
 			VideoManager.Instance.PlayAd();
 			VideoAd.Show();
@@ -1208,9 +1208,25 @@ public class MenuManager : MonoBehaviour
     }
 	public void OnLeavingViewingAd()
 	{
+		if (PlayerPrefs.GetInt("PlayAdForLifes") == 1)
+		{
+			VideoAd.Hide();
+			VideoManager.Instance.StopAd();
+			AudioListener.pause = false;
+			return;
+		}
 		if (CounterAd % 2 == 0)
 		{
-			ad.Hide();
+			if (ad.isActiveAndEnabled)
+			{
+				ad.Hide();
+			}
+			else
+			{
+				VideoAd.Hide();
+				VideoManager.Instance.StopAd();
+				AudioListener.pause = false;
+			}
 		}
 		else
         {

+ 13 - 2
Unity3/Assets/GameCore/Managers/VideoManager.cs

@@ -38,14 +38,25 @@ public class VideoManager : MonoBehaviour
         {
             if (Timer <= 0 && MenuManager._instance.VideoAd.isActiveAndEnabled)
             {
-                NotificationCenter.Post(NotificationType.CelebrityDisappeared);
+                if (PlayerPrefs.GetInt("PlayAdForLifes") == 0)
+                {
+                    NotificationCenter.Post(NotificationType.CelebrityDisappeared);
+                    
+                }
+                else
+                {
+                    LivesManager.Instance.RechargeLife();
+                    
+                }
                 MenuManager._instance.OnLeavingViewingAd();
-                
+                PlayerPrefs.SetInt("PlayAdForLifes", 0);
+                PlayerPrefs.Save();
             }
         }
     }
     public void PlayAd()
     {
+        Timer = 8;
         Debug.Log("PlayAd");
         VideoPlayer.frame = 0;
         VideoPlayer.Play();

+ 1 - 2
Unity3/Assets/LivesManager/LivesManager/LivesManager.cs

@@ -32,7 +32,7 @@ public class LivesManager : MonoBehaviour
 	private const string TIMESTAMP_KEY = "timestamp";
 
 	public const int LIFE_RECHARGE_TIME = 0;
-	public const int MAX_RECHARGABLE_LIVES = 25;
+	public const int MAX_RECHARGABLE_LIVES = 4;
 
 	private SecureIntValue _lives;
 	private bool _isReplenishing = false;
@@ -438,7 +438,6 @@ public class LivesManager : MonoBehaviour
 
     public void ResetLive()
     {
-		Lives = 0;
         RechargeLife();
     }
     #endregion

+ 2 - 2
Unity3/Assets/Text/Icelandic.txt

@@ -139,7 +139,7 @@ facebook.login.failed.text = Vinsamlegast reynið aftur síðar.
 facebook.login.failedCheckSingleSignonSettings.text = Athugaðu hvort kveikt sé á hnappi Smokkaleiksins í Facebook stillingunum þínum. Þú nálgast þetta undir Facebook í Stillinga appinu á þínu tæki.
 facebook.login.failedAcceptingPublishPermissions.text = Til þess að taka þátt í keppninni þarftu að gefa Smokkaleiknum umbeðin leyfi á Facebook. Vinsamlegast reyndu að skrá þig inn á Facebook aftur.
 facebook.loginRequired.title = FACEBOOK INNSKRÁNING NAUÐSYNLEG
-facebook.loginRequired.text = Vinsamlegast skráðu þig inn á Facebook til að fá aðgang að leiknum. Glæsileg gjafakort frá Kringlunni og Sambíó í verðlaun og því oftar sem þú klárar leikinn, því oftar fer nafn þitt í verðlaunapottinn! Við drögum út 1.ágúst 2021 n.k.
+facebook.loginRequired.text = Vinsamlegast skráðu þig inn á Facebook til að fá aðgang að leiknum. Glæsileg gjafakort frá Kringlunni og Sambíó í verðlaun og því oftar sem þú klárar leikinn, því oftar fer nafn þitt í verðlaunapottinn! Við drögum út 1.nóvember 2021 n.k.
 facebook.loginRequired.login = INNSKRÁNING
 facebook.loginRequired.cancel = HÆTTA VIÐ
 
@@ -191,7 +191,7 @@ spermicidalWave.limitPerLevelReached = Þú getur bara notað {0} vopn á hverju
 prize.OnActionFirstEnterGame = If you win 10 levels you have a chance to receive a prize.
 prize.OnActionLevelSixStart = You have already passed the half. Keep it up!
 prize.OnActionLevelNineStart = You almost took the game. Do not give up!
-FirstEnterGame.text = Því oftar sem þú klárar leikinn, því oftar fer nafn þitt í vinningspottinn en í pottinum eru vegleg gjafakort að verðmæti 10.000 krónur sem og bíómiðar frá Sambíóunum. Við drögum út þann 20. október 2021.
+FirstEnterGame.text = Því oftar sem þú klárar leikinn, því oftar fer nafn þitt í vinningspottinn en í pottinum eru vegleg gjafakort að verðmæti 10.000 krónur sem og bíómiðar frá Sambíóunum. Við drögum út þann 1.nóvember 2021.
 prize.OnActionGameEnd = Play it Again! Increase your chances to win a prize!
 
 levelButton.text = BORÐ {0}

+ 13 - 3
Unity3/Assets/UI/Buttons/ButtonMenuTransitionEvent.cs

@@ -69,7 +69,11 @@ public class ButtonMenuTransitionEvent : MonoBehaviour
                         NotificationCenter.Post(NotificationType.MenuTransition,
                             MenuManager.MenuTransition.ExitToMainMenu);
                         LivesManager.Instance.ResetLive();
-                        MenuManager._instance.FBShareDialog.Show();
+                        if (PlayerPrefs.GetInt("GUEST") == 1)
+                        {
+                            MenuManager._instance.FBShareDialog.Show();
+                        }
+                        
                         PlayerPrefs.SetInt("Level", 0);
                         PlayerPrefs.Save();
                     }
@@ -146,7 +150,10 @@ public class ButtonMenuTransitionEvent : MonoBehaviour
                             NotificationCenter.Post(NotificationType.MenuTransition,
                                 MenuManager.MenuTransition.ExitToMainMenu);
                             LivesManager.Instance.ResetLive();
-                            MenuManager._instance.FBShareDialog.Show();
+                            if (PlayerPrefs.GetInt("GUEST") == 1)
+                            {
+                                MenuManager._instance.FBShareDialog.Show();
+                            }
                             PlayerPrefs.SetInt("Level", 0);
                             PlayerPrefs.Save();
                         }
@@ -267,7 +274,10 @@ public class ButtonMenuTransitionEvent : MonoBehaviour
                                 NotificationCenter.Post(NotificationType.MenuTransition,
                                     MenuManager.MenuTransition.ExitToMainMenu);
                                 LivesManager.Instance.ResetLive();
-                                MenuManager._instance.FBShareDialog.Show();
+                                if (PlayerPrefs.GetInt("GUEST") == 1)
+                                {
+                                    MenuManager._instance.FBShareDialog.Show();
+                                }
                                 PlayerPrefs.SetInt("Level", 0);
                                 //if (FlurryLogger.Instance)
                                 //{

+ 8 - 1
Unity3/Assets/UI/LifeBank/LivesCounterUI.cs

@@ -101,7 +101,14 @@ public class LivesCounterUI : MonoBehaviour
 	void UpdateLivesCounterAndLivesCircle()
 	{
 		int numOfLives = LivesManager.Instance.Lives;
-
+		if (!PlayerPrefs.HasKey("Live"))
+		{
+			PlayerPrefs.SetInt("Live", LivesManager.MAX_RECHARGABLE_LIVES);
+			numOfLives = LivesManager.MAX_RECHARGABLE_LIVES;
+			PlayerPrefs.Save();
+			LivesManager.Instance.Lives = LivesManager.MAX_RECHARGABLE_LIVES;
+		}
+		
 		livesCountLabel.text = numOfLives.ToString();
 
 		float newFilledAmount = numOfLives / (float)LivesManager.MAX_RECHARGABLE_LIVES;

+ 7 - 2
Unity3/Assets/UI/Screens/NoLivesLeftDialog.cs

@@ -44,7 +44,7 @@ public class NoLivesLeftDialog : MonoBehaviour
 		StoreManager.Instance.Purchase(StoreProductId.lives_5);
 	}
 
-    void OnRequestShowAdButton()
+    public void OnRequestShowAdButton()
     {
         //screen.Hide();
 
@@ -53,9 +53,14 @@ public class NoLivesLeftDialog : MonoBehaviour
             MenuManager._instance.scoresScreen.GetComponent<FacebookDialogManager>().noInternetDialog.Show();
             return;
         }
-        LivesManager.Instance.RechargeLife();
+        PlayerPrefs.SetInt("PlayAdForLifes", 1);
+        PlayerPrefs.Save();
+        
+        MenuManager._instance.VideoAd.Show();
+        VideoManager.Instance.PlayAd();
         screen.Hide();
         //MediaPlayerCtrl.Instance.PlayAd();
     }
+    
 
 }