// loads level select screen or tries to found one public void LoadLevelSelectScreen() { // load Level Select if exists if (MadLevel.activeConfiguration.FindLevelByName("Level Select") != null) { MadLevel.LoadLevelByName("Level Select"); } else { // if not, load first level of type other in this group string groupName = MadLevel.currentGroupName; var g = MadLevel.activeConfiguration.FindGroupByName(groupName); var query = from level in MadLevel.activeConfiguration.levels where level.groupId == g.id && level.type == MadLevel.Type.Other orderby level.order select level; var levelFound = query.FirstOrDefault(); if (levelFound != null) { MadLevel.LoadLevelByName(levelFound.name); } else { Debug.LogError("Cannot found level to get back to :-("); } } }
private void Execute() { // gain stars for (int i = 1; i <= starsCount; i++) // i = 1, 2, 3... { string starName = "star_" + i; // this is the star property name MadLevelProfile.SetLevelBoolean(MadLevel.currentLevelName, starName, true); } // gain Water for (int i = 1; i <= starsCount; i++) { // i = 1, 2, 3... string waterName = "Waterdrop_" + i; // this is the star property name MadLevelProfile.SetLevelBoolean(MadLevel.currentLevelName, waterName, true); } // complete level if (completeLevel) { MadLevelProfile.SetCompleted(MadLevel.currentLevelName, true); } // go back to level select screen MadLevel.LoadLevelByName("Select Level"); // name from level configuration }
private void TestLoadLevel(bool async) { if (HasExtensionScene(testLevelToLoad)) { if (async) { loadingOperation = MadLevel.LoadLevelByNameAsync(testLevelToLoad); } else { MadLevel.LoadLevelByName(testLevelToLoad); } } else { if (async) { loadingOperation = Application.LoadLevelAsync(testLevelToLoad); } else { Application.LoadLevel(testLevelToLoad); } } }
void OnMouseDown() { Debug.Log("Level won", this); MadLevelProfile.SetCompleted(MadLevel.currentLevelName, true); MadLevelProfile.SetLevelInteger(MadLevel.currentLevelName, "score", points); MadLevel.LoadLevelByName("Level Select"); }
// =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== void Start() { levelNameText.text = "Level Name: '" + MadLevel.currentLevelName + "'"; if (!string.IsNullOrEmpty(MadLevel.arguments)) { argumentsText.text = "Arguments: " + MadLevel.arguments; } backToMenu.onMouseDown += backToMenu.onTap = (sprite) => { MadLevel.LoadLevelByName("Level Select"); }; }
void UpdateHandleMobileBackButton() { if (SystemInfo.deviceType == DeviceType.Handheld) { if (handleMobileBackButton && Input.GetKey(KeyCode.Escape)) { switch (handleMobileBackButtonAction) { case OnMobileBack.LoadPreviousLevel: MadLevel.LoadPrevious(); break; case OnMobileBack.LoadSpecifiedLevel: MadLevel.LoadLevelByName(handleMobileBackButtonLevelName); break; default: Debug.LogError("Unknown action: " + handleMobileBackButtonAction); break; } } } }
public void LoadLevel() { if (hasLevelConfiguration) { var level = configuration.GetLevel(MadLevel.Type.Level, levelGroup, levelIndex); MadLevel.LoadLevelByName(level.name); } else { if (!string.IsNullOrEmpty(levelSceneName)) { MadLevelProfile.recentLevelSelected = level.name; MadLevel.currentLevelName = level.name; MadLevel.arguments = ""; Application.LoadLevel(levelSceneName); } else { Debug.LogError("Level scene name not set. I don't know what to load!"); return; } } }
void OnMouseDown() { Debug.Log("Level lost", this); MadLevel.LoadLevelByName("Level Select"); }
// =========================================================== // Methods // =========================================================== /// <summary> /// Reloads current level. If this level has an extension, it will load first scene of its extension. /// </summary> public static void ReloadCurrent() { MadLevel.LoadLevelByName(currentLevelName); }