public void LoadLevelDataFromSave() { activeLevelData.partTheme = (PartTheme)Enum.GetValues(typeof(PartTheme)).GetValue(PlayerDataController.data.levelPartTheme); var loadedTheme = Resources.LoadAll("Parts/" + activeLevelData.partTheme.ToString(), typeof(Sprite)); lastPartTheme = activeLevelData.partTheme; activeLevelData.levelPartSprites = new List <Sprite>(); foreach (var theme in loadedTheme) { activeLevelData.levelPartSprites.Add(theme as Sprite); } foreach (var cell in PlayerDataController.data.uncompletedLevel) { if (cell.isFull) { GameManager.instance.SpawnPart(GameManager.cells[new Tuple <int, int>(cell.x, cell.y)]); } } int k = 0; bool isLevelCompleted = true; foreach (var mission in activeLevelData.missions) { string animalPlayerPrefsName = "animalProgress" + LevelManager.instance.activeLevelData.animalIndex[k]; mission.RewindMissionCount(PlayerDataController.GetData <int>(animalPlayerPrefsName)); k++; if (!mission.missionCompleted) { isLevelCompleted = false; } } GameManager.instance.GameModeType = (GameManager.ModeTypes)Enum.GetValues(typeof(GameManager.ModeTypes)) .GetValue(PlayerDataController.data.levelModIndex); GameManager.instance.CheckMode(); foreach (var shape in PlayerDataController.data.savedShapes) { GameManager.instance.SpawnShape(shape.x, shape.y); } Player.main.goldAccuiredThisLevel = PlayerDataController.data.goldAccuiredThisLevel; if (isLevelCompleted) { UIManager.instance.OpenScreen((int)UIManager.Screens.SuccessUI); } else { UIManager.instance.OpenScreen((int)UIManager.Screens.LevelInfoUI); } GameManager.instance.CheckEmptyCellCount(); GameManager.instance.CanShapesFit(); }
public void ShowRewarded(string rewardName, Action <string, AD_STATES> onState, Action <string, AD_STATES> onCmplt) { if (onCmplt != null) { onComplete = onCmplt; } if (PlayerDataController.data.isTest && Application.platform != RuntimePlatform.IPhonePlayer && Application.platform != RuntimePlatform.Android) { if (onState != null) { onState(rewardName, AD_STATES.READY); } isIntersititialOpen = false; PlayerDataController.SaveData("whichVideoFor", rewardName); Debug.Log("==========" + PlayerDataController.GetData <string>("whichVideoFor").ToString()); Simulator.SetActive(true); Simulator.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Rewarded Video Ad"; AMR.AMRSdkConfig.instance.OnVideoShow(); if (testCoroutine != null) { StopCoroutine(testCoroutine); } Simulator.transform.Find("FinishItNow").gameObject.SetActive(true); testCoroutine = StartCoroutine(TestAdsDelay(PlayerDataController.data.rewardedDurationForTest)); return; } if (AMR.AMRSDK.isRewardedVideoReady()) { if (onState != null) { onState(rewardName, AD_STATES.READY); } } else { if (onState != null) { onState(rewardName, AD_STATES.NOT_READY); } } }