Search Unity

Mad Level Manager - Level chooser and manager

Discussion in 'Assets and Asset Store' started by genail, Jul 13, 2013.

  1. shoni-wheeler

    shoni-wheeler

    Joined:
    Oct 25, 2014
    Posts:
    102
    Hi,
    Thankyou, works out great.
    John
     
    genail likes this.
  2. PedroNeves

    PedroNeves

    Joined:
    Feb 23, 2014
    Posts:
    10
    Can i use your script in a 3d environment?
    I want to create a island as main menu with buildings, the buildings are locked if that level is locked and i want to replace the unlocked building if level is unlocked. can it be donne with your script?
     
  3. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello PedroNeves,
    Yes, you can! Of course you will have to ditch level select screen script (because it is working with 2D icons only) and script your buildings in that way:

    - Each building needs a level name from Level Configuration
    - You can query if level is locked by executing MadLevelProfile.IsLocked(levelName);
    - When you complete a level you have to unlock the next level using this code (executed from completed level):

    Code (CSharp):
    1. var nextLevel = MadLevel.GetNextLevelName(MadLevel.Type.Level);
    2. if (!string.isNullOrEmpty(nextLevel)) {
    3.     MadLevel.SetLocked(levelName, false);
    4. }
    If you will have any issues please let me know! I think of preparing a working example, because you're not the first one asking for something like this :)

    Cheers!
    Piotr
     
  4. PedroNeves

    PedroNeves

    Joined:
    Feb 23, 2014
    Posts:
    10
    thanks, i will be waiting for a 3d example ;)
     
  5. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    OK I think I will be able to create one next week :)
     
  6. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Mad Level Manager 2.3.1 has been released! Of course this is mainly bug fix release but there is also a room for some new features and improvements.
    upload_2015-4-7_17-26-0.gif

    New Features
    Improvements
    • MLM_Settings: Better error messages
    Bug Fixes
    • Fixed NRE when assigning font to a text object
    • Unity 5: Workaround for Unity 5 finally bug (#675175)
    • Queries: Fixed errors on summing up integers and floats whey those are not set to any value
    • Level Configurator: Fixed NRE when opening new scene
     
  7. meom

    meom

    Joined:
    Feb 15, 2014
    Posts:
    24
    I added a Main Menu as the first level, and added to the build as such, to my LevelConfig as a type 'Other' and now I'm getting this warning:

    Code (CSharp):
    1. Level Main Menu is of wrong type. Won't look at it.
    2. UnityEngine.Debug:LogWarning(Object)
    3. MadLevelManager.MadLevelAbstractLayout:LookAtLevel(String) (at Assets/Mad Level Manager/Scripts/Base/Layouts/MadLevelAbstractLayout.cs:302)
    4. MadLevelManager.MadLevelAbstractLayout:LookAtLastPlayedLevel() (at Assets/Mad Level Manager/Scripts/Base/Layouts/MadLevelAbstractLayout.cs:333)
    5. MadLevelManager.MadLevelAbstractLayout:Start() (at Assets/Mad Level Manager/Scripts/Base/Layouts/MadLevelAbstractLayout.cs:417)
    6. MadLevelManager.MadLevelGridLayout:Start() (at Assets/Mad Level Manager/Scripts/Base/Layouts/MadLevelGridLayout.cs:232)



    Also, I purchased your Loading Screen Addon and not only does my U-GUI element, music and sound effects appear before the game screen loads, but the entire game is already in play. For instance, when the scene opens, the player should be in the air and dropping into the game and there's a sound effect that goes along with this. Now when I use the loading scene script from the addon, the scene opens and the player is already on the ground with the sound effect already played in the background (when the player was dropping) on the loading screen scene. Also note, when I just use the dummy default loading scene with MLM everything works fine.
     
  8. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi meom,
    Thank you for purchasing my assets! :)

    Don't worry about this warning. This simply means that you have "look at last level" selected, and the last level you were in was "Level Main Menu", so Mad Level Manager cannot look on its icon. I have to make this warning a little more scary though :D

    This is a matter of configuration and how Unity is working. When level is loaded, there's no way to preserve it from launching. This means that if you have "wait for touch", "wait for fill" or "wait x seconds" options enabled then your level will be playing in the background for the time being.

    To get around this matter Loading Screens are making use of Time.timeScale property and you can read about this right here. Usually when Time.timeScale is set to 0 game is considered as paused. Please modify your scripts so when Time.timeScale is set at 0 then nothing will start until it changes.

    Please let me know if you will have any issues!

    Cheers!
    Piotr
     
  9. meom

    meom

    Joined:
    Feb 15, 2014
    Posts:
    24

    I read the FAQ before originally posting and I'm not running any camera depth greater than 1 for the GUI issue, and I did a search on my scripts for Time.timeScale and didn't find it referenced, so I'm kind of at a loss what to do. I'm not the strongest coder. Yet. Also, the premature loading issue happens even if I select 'Show Immediately. ' I'm using the MasterAudio plugin for the sound, the Complete Physics Platform Kit for my player and UGUI for my GUI.

    Also, why does everything work ok with the MLM default loading scene?
     
  10. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    You misunderstood me. You have to change your code to include Time.timeScale check just like in the example. And I see a mistake in documentation as well. Should be "Please adjust your scripts so nothing will play/start while Time.timeScale is equal to 0. It may look like this.". You just have to make sure to not play any music and sounds while Time.timeScale is 0.
    The default loading scene is working, because it is a lot simpler. It does not wait for anything when scene is loaded. It just replaces the scene. I believe that besides "show immediately" you still have "wait to fill up" enabled, am I right?

    I'm also using Master Audio and Loading Screens in my game project :) I have a GameController object that contains StartGame() method. It looks something like that:

    Code (CSharp):
    1. class GameController : MonoBehaviour {
    2.     private bool gameStarted;
    3.  
    4.     void Update() {
    5.         if (Time.timeScale != 0) { // if loading screens is working, do not go any further
    6.             if (!gameStarted) { // game can be started only once
    7.                 StartGame();
    8.                 gameStarted = true;
    9.             }
    10.         }
    11.     }
    12.  
    13.     void StartGame() {
    14.         // play music now!
    15.         MasterAudio.ResumeAllPlaylists();
    16.         MasterAudio.FadeAllPlaylistsToVolume(1, 1);
    17.     }
    18. }
    Cheers!
    Piotr
     
  11. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    I know that this is a little late, but here's the announcement about the release of Loading Screens 1.3 :)

    The time has come for Loading Screens 1.3.0 to see the daylight! Read more to see what has been changed!

    Loading Screens for Mad Level Manager 1.3.0 will be useful especially for those who are creating WebPlayer streamed builds. Now Loading Screens are detecting whether the level is already streamed, and if not, loading bar will indicate streaming progress. When level streaming is finished, it will act as usual.


    Next important feature is random object enable script that is useful for displaying tips on loading screens. It works just like that:


    Also 1.3.0 is fixing an issue when loading screen is launched while Time.timeScale is set to 0. In the previous version this scenario caused it to freeze without any chance to get out.

    As usual the new version is available in the Asset Store!

    Also here's a little preview of new theme that will be available soon!

     
  12. meom

    meom

    Joined:
    Feb 15, 2014
    Posts:
    24

    Correct - I did have 'Wait to Fill' enabled. After I unchecked that, the level loads fine. As far as the above code is concerned ,I don't know enough, at this time, how to implement it.

    Thanks,
     
  13. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Here's the example as promised!
    https://www.dropbox.com/s/xox9mx6oxl24psr/mlm-3denv-example.unitypackage?dl=0

    There are two C# scripts. Please read them carefully :)
    Also you have to activate manually bundled configuration in 3D Env/Resources/LevelConfig or you will get errors.

    desktop.png

    Open doors are houses (levels which you can enter (unlocked). I did this simply by disabling the door object :)

    Cheers!
    Piotr
     
  14. PedroNeves

    PedroNeves

    Joined:
    Feb 23, 2014
    Posts:
    10
    wow, thanks!!
     
  15. kaloskagatos

    kaloskagatos

    Joined:
    Aug 26, 2014
    Posts:
    10
    Hi, sorry for my late answer, I thought I was receiving emails but actually no... Thank you for offering your help, but for the moment I'll go with a defined number of levels.

    I have a general question about your asset : what's the difference between creating a menu with Mad Level Manager and with Unity UI system ? Are the Unity UI object incompatible with MLM ones, and the Event System ? Do you recode everything because you can't do whatever you want with standard UI ? If I make a "main menu" in my game, with let's say one "play" and "settings" button, can I do it with Mad Level Manager ? What would be the difference with a standard menu ? Sorry if I seem confused, but I try to use all the benefits of your work ;)
     
  16. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!

    The reason why Mad Level Manager is not using Unity UI is because MLM 1.0 has been released somewhere around October 2013 when I don't even remember if someone was talking about uGUI. The built-in GUI subsystem was awful and I didn't want to make MLM to be dependent of any other asset in the store.

    MLM GUI subsystem is only good for drawing icons. It's highly recommended to use uGUI or any other GUI asset along with it. Personally I am using NGUI to do the menus and event to draw something on top of level select screen.

    7d438e2a3513d96dfb04e3f6f11105bd.gif

    The window that appears above is a uGUI window. I have my layout set to SendMessage() instead of load level, so I can store what level has been pressed and display information about this level :)

    Cheers!
    Piotr
     
  17. kaloskagatos

    kaloskagatos

    Joined:
    Aug 26, 2014
    Posts:
    10
    Thank you, it's much clearer now :)
     
  18. kocabuza

    kocabuza

    Joined:
    Mar 10, 2015
    Posts:
    3
    Can we add level scoped properties and access those variables from mad level manager apis. properties like star 1 and star 2. Where can we get the list of current properties of a level?
    Thanks a lot.
     
  19. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!

    Sure you can! To set/get level-scoped properties use SetLevel*() functions from MadLevelProfile class:
    http://madlevelmanager.madpixelmachine.com/doc/latest/basics/save_load_api.html

    To get list of all level properties use MadLevelProfile.GetLevelPropertyNames():
    http://madlevelmanager.madpixelmach..._mad_level_manager_1_1_mad_level_profile.html

    Or use Tools -> Mad Level Manager -> Profile browser to browse it from the editor (undocumented because it's not fully finished).

    Cheers!
    Piotr
     
  20. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Hey there... I want to fully use NGUI for my level selection...
    Is there a way to get a list of all the levels in order? So I can extract their properties, and then set my NGUI sprites on awake, depending on the Mad Level Manager properties (Like bool locked, number of stars, and, perhaps, level number).

    I had a quick glance at the docs, and I think GetLevelNames () is a strong candidate, and then, something like GetLevelBoolean().

    As soon as I install blender, I will take a look at your 3D example, my answer might be there.
     
  21. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Now that I think about it... What I wanna do is similar to what you have done in this *.gif...
     
  22. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Done, it was easy to implement, thanks.
     
    genail likes this.
  23. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Whoa!
    I haven't even got the chance to get back to you!

    Looks like you've figured that out, great! :) If you will have more questions, please write. I may write back with some delay due to time zone differences.

    Cheers!
    Piotr
     
  24. kotor

    kotor

    Joined:
    Dec 3, 2013
    Posts:
    140
    In my game the level is generated dynamically. There is only one level. Based on certain parameter, the scene is generated. I was wondering if this will work for my case ?. In case player wants to re-play the level, he/she needs to go back to that level and pass the same parameter to re-generate the level again.

    Thanks
     
  25. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello kotor,
    Is the parameter a seed? You can pass it as an argument :)

    This may work. You only have to store all your seeds in player's profile (maybe comma-separated?). Then your base level configuration should include a single playable level that will be used to create other Levels. It will require you to hack MadLevelConfiguration.Level class a little to add a copy-constructor (if you'd like, I can do it for you). Then append this new level to MadLevel.activeConfiguration.levels and from now it should be visible on the level select screen.

    Some people did this with MLM but I never did this before. If you will have any issues please let me know. Also I may prepare a working example for you if you'd like, but this would be ready next week (it's nearly end of my work day).

    API reference: http://madlevelmanager.madpixelmachine.com/doc/2.3.1/api/namespace_mad_level_manager.html

    Cheers!
    Piotr
     
  26. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Do not worry about the time delay... Unlike a lot of people who buy assets, I do not expect immediate support. I just have one question... I do not know if this is a bug... But everytime I do Reset the profile, my first level (Which is unlocked by default), locks, and it only unlocks once I close and reopen the App...

    What I decided to do, is when I load the level selector, I do check if that level has a previous level, if not, I setLocked to false; however, is this the intended behaviour.
     
  27. kotor

    kotor

    Joined:
    Dec 3, 2013
    Posts:
    140
    Here is my PlayLevel method :

    public override void PlayLevel(LevelSceneViewModel levelScene, int arg)
    {
    base.PlayLevel(levelScene, arg);



    _LevelIndex = arg;
    LevelScene.LevelCount = _LevelIndex;


    UnityEngine.Application.LoadLevel("Level");
    UnityEngine.Debug.Log("Rooms# :" + levelScene.GeneratedLevel.Rooms.Count);



    }

    Where arg is the level# you want to play. Based on the level#, it picks up the correct config file. For e.g. if the level# = 3 so it picks up L3_DungeonFlow file to generate the new level. Can you still save the level (score, stars) and go back to it later on to replay it ? I may have confused you totally. In angry birds or cut the rope, I think they are generating the level on the fly rather then creating every scene separately, I could be wrong.
     
  28. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Ohh I think that you're not talking about level generating per-se, but about using one scene and data files to fill it up with entities. Mad Level Manager was actually created for cases like this! :)

    You can create many levels using only one scene using level configuration and set arguments that will be passed to them. Then arguments can be accessed using MadLevel.arguments, so if you want to load the data file usually you will do something like Resources.Load(MadLevel.arguments).

    Of course all player data will be preserved and player can get back and play again anytime!

    Also if you will be using MLM in your project, please be aware of the rules :)

    Cheers!
    Piotr
     
  29. kotor

    kotor

    Joined:
    Dec 3, 2013
    Posts:
    140
    I was wondering if you have a example like this :
     

    Attached Files:

  30. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Yes, this example can be found in the package as Example 6 - Grid Horizontal Zoom :)
     
  31. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Damn! I'm sorry, I don't know how but I missed your message :-/ Please "poke" me next time this happens. Lately I have too much on my mind and something like this may happen.

    I cannot reproduce it on example scenes, at least in the editor. What MLM version do you have?

    Cheers!
    Piotr
     
  32. matteo-piccioni

    matteo-piccioni

    Joined:
    Jul 4, 2014
    Posts:
    49
    Hello,
    I have a question
    Your asset is usable to make a group of level organized as tree or graph, where the Player can go back and forward through the World (for example when found the right key)?
    Thanks
     
  33. indroe

    indroe

    Joined:
    Mar 29, 2015
    Posts:
    7
    Hello,
    How to check some energy/life before load level?
    I want to implement this statement using MLM,
    Thanks before

    Code (CSharp):
    1. if(energy <= 0)
    2. {
    3.      Debug.Log("You play to much, come back tomorrow!");
    4. } else
    5. {
    6.      Application.LoadLevel(level);
    7. }
     
  34. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    There's no hierarchy setup for levels, but you can set some levels to be not visible on the level select screen (extra levels). These levels can be loaded only by code, so you could write a logic that will enter such level if the player finds a key or a secret passage. Of course you need to know that extra level name in that case :)

    There's no limit how many extra levels you can add, and you can load extra level from another extra level, so you should be fine :)

    Cheers!
    Piotr
     
  35. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    You can set your level select screen to SendMessage() instead of loading a level. Then you can write it like this:

    Code (CSharp):
    1. void OnIconActivate(MadLevelIcon icon) {
    2.     if (energy <= 0) {
    3.         Debug.Log("Your message");
    4.     } else {
    5.         MadLevel.LoadLevelByName(icon.level.name);
    6.     }
    7. }
    Important: Please do not use Application.LoadLevel() with Mad Level Manager :)

    Cheers!
    Piotr
     
  36. indroe

    indroe

    Joined:
    Mar 29, 2015
    Posts:
    7
    okay, sankyuuu..
     
  37. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Hello,

    What about adding a feature that allow us to select an image/texture/sprite for each level ? it will be great for games like racing games where you show a screenshot for that level :)
     
  38. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    It's possible if you switch to the Manual mode. It allows you to edit each icon instance freely (that's one way).

    Manual mode has its downsides so if you're a programmer, consider adding a script to a child sprite for your level icon. This sprite will display your level texture if you set its MadSprite.texture field. All you have to do is to map level names with texture reference (level name can be retrieved from MadLevelIcon.level.name).

    If you're interested in the second solution and you don't know how to do it, please let me know. I think I may add a script like this one to Mad Level Manager :)

    Cheers!
    Piotr
     
  39. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Hey, do not worry... It is working prime now... Also, I am not using your default GUI, so, any problem I have might be on me.

    Working with MadLevel Manager has been really smooth for me so far. I just have another question. When working with Easy Save 2 as backend, should I still make my save and load calls using MadLevelManager as MadLevelManager.MadLevelProfile? Or should I use Easy Save 2 save and loading calls?
     
  40. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!
    I'm glad that you're not angry about it :)

    Please use MadLevelProfile API, so your game data will be always stored in one place. If you would use both at once, part of your data will be stored on ES2 storage and the other part in PlayerPrefs which is generally a bad idea :)

    Cheers!
    Piotr
     
  41. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Yes please :)
     
  42. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    I believe I will manage do to it tomorrow. Monday or Tuesday is the worst case scenario ;-)
     
  43. SIV

    SIV

    Joined:
    May 7, 2014
    Posts:
    219
    Okay thank you ;)
     
  44. DalerHakimov

    DalerHakimov

    Joined:
    Mar 14, 2014
    Posts:
    302
    Hello,

    I'm in the process of creating my own theme for Mad Manager. I got stuck at adding different fonts. How can I add different *.ttf fonts?? As I can see in the Mad Level you do use some texture, and prefab etc things. but I don't know how to create those out of *.ttf . I'll be glad for your help.
     
  45. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    I want my first level to say "Intro" and the second level starts the level numbers.
    How can I do this?
     
  46. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!

    Mad Level Manager currently does not support ttf fonts, but it has quite advanced support for bitmap fonts (which can be created from ttf fonts). Just use your ttf as a base for BMFont or Glyph Designer: http://madlevelmanager.madpixelmachine.com/doc/latest/advanced/fonts/bitmap.html

    Here's BMFont + NGUI tutorial:
    but Mad Level Manager is very similar to NGUI on this case.

    Then your generated fnt file can be imported by Mad Level Manager and used within its icons objects.

    If you have more questions, just ask! :)

    Cheers!
    Piotr
     
    DalerHakimov likes this.
  47. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hi!

    I think that the best would be if you will hack the code a little (there's also the manual mode, but it's not worth touching in this case).

    First set your grid layout enumeration to have -1 offset. This will make the first level be displayed as 0.

    desktop.png

    Then go to MadLevelAbstractLayout.cs, find GetEnumerationValue() method and on top if it add something like this:

    Code (CSharp):
    1. if (index == 0) {
    2.     return "INTRO";
    3. }
    Here's how the whole method should look like:

    Code (CSharp):
    1.     protected string GetEnumerationValue(int index) {
    2.         if (index == 0) {
    3.             return "INTRO";
    4.         }
    5.  
    6.         switch (enumerationType) {
    7.             case LevelsEnumerationType.Numbers:
    8.                 return (index + 1 + enumerationOffset).ToString();
    9.             case LevelsEnumerationType.Letters:
    10.                 return EnumerationLetter(index + Mathf.Max(enumerationOffset, 0));
    11.             case LevelsEnumerationType.LettersLower:
    12.                 return EnumerationLetter(index + Mathf.Max(enumerationOffset, 0)).ToLower();
    13.             case LevelsEnumerationType.Roman:
    14.                 return MadMath.ToRoman(index + 1 + Mathf.Max(enumerationOffset, 0));
    15.             default:
    16.                 throw new ArgumentOutOfRangeException();
    17.         }
    18.     }
    And this is the result (the font is too big :))

    desktop.png

    Let me know if you will have any issues!

    Cheers!
    Piotr
     
  48. mmvlad

    mmvlad

    Joined:
    Dec 31, 2014
    Posts:
    98
    Hi, how can I add a custom button to mad level grid layout?

    Thank you.
     
  49. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    Hello mmvlad,
    Will be the best if you will use any other GUI library (uGUI, NGUI etc) to add the button on top of Mad Level Manager scene. There's no difference in adding a GUI to game scene and level select scene, so you shouldn't have any problems with it :)

    Please see: http://forum.unity3d.com/threads/ma...ooser-and-manager.190391/page-14#post-2088528

    Cheers!
    Piotr
     
  50. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,045
    @SIV Got it! I will send you a private message in a moment (with the package). Here's the instruction how it should be set:
    http://genail.clarify-it.com/d/7l2gmp

    I wanted to create example scene, but I need to find suitable graphics to make it at least not ugly :)

    Cheers!
    Piotr