internal void UpdateLevelData() { string dirPath = Path.Combine(Application.persistentDataPath, "LevelData"); if (Directory.Exists(dirPath)) { DirectoryInfo levelDir = new DirectoryInfo(dirPath); FileInfo[] saveInfo = levelDir.GetFiles("*.json"); foreach (FileInfo f in saveInfo) { string key = f.Name.Split('.')[0]; if (!AllLevels.ContainsKey(key)) { string json = File.ReadAllText(f.FullName); LevelData asset = JsonUtility.FromJson<LevelData>(json); AllLevels.Add(asset.Name, new LevelAsset(asset)); } } } HallScene.DispatchRenderLevels(); }
private void Initialization() { AllLevels = new Dictionary<string, LevelAsset>(); AllSaves = new Dictionary<string, LevelAsset>(); // Initialize the Google Mobile Ads SDK. #if UNITY_ANDROID string appId = "ca-app-pub-7959728254107074~3791366270"; #elif UNITY_IOS string appId = "ca-app-pub-7959728254107074~6556473878"; #else string appId = "unexpected_platform"; #endif MobileAds.Initialize(appId); interstitialAdCDRunning = false; LoadLevelData(); LoadSaveData(); LoadLoveLevels(); LoadSortData(); HallScene.DispatchRenderLevels(); }
public void OnBackClicked() { SceneManager.LoadScene("Hall"); if (touched == true) { SaveGame(); } HallScene.DispatchRenderLevels(); // ads behaviour when exit bannerView.Destroy(); if (interstitial != null) { if (interstitial.IsLoaded()) { interstitial.Show(); } else { interstitial.Destroy(); } } }