Search Unity

Mad Level Manager - Level chooser and manager

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

  1. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Ouch... it is private.
    I've just added a new method to MadLevelGridLayout. Hack in and add it too, so when you update your MLM nothing will get broken:

    Code (CSharp):
    1. public int GetCurrentPageNumber() {
    2.     return pageCurrentIndex + 1;
    3. }
     
  2. meom

    meom

    Joined:
    Feb 15, 2014
    Posts:
    24
    Thanks for the Skype offer, but I think I can figure this out with using the Animation system and uGUI like I am with the rest of the stuff on the panel. I just don't know what that solution is yet, but it's somewhat swirling around in my brain. So the best thing for me to do is go out and mow my lawn and see if I can figure it out.
     
  3. devandart

    devandart

    Joined:
    Jun 7, 2013
    Posts:
    143
    Oh man, I was just too lazy to check your source. I'm sorry for that.
    You should implement a property into your MadLevelGridLayout class to give other devs access to the pageCurrentIndex member, because it's private. :)
     
  4. kaplica

    kaplica

    Joined:
    Feb 20, 2014
    Posts:
    87
    I'm testing the level manager, and in playmaker I've got a variable "Count" and it's counting the failures, how would i go about integrating some kind of switch or compare method to work with the star rating system?? I've tried (int compare) and (int switch) but it doesn't seem to work properly... Piotrek pls help :(
     

    Attached Files:

  5. genail

    genail

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

    I'm not sure if I understand what are you trying to achieve. Could you describe it with more detail please?

    Cheers!
    Piotr
     
  6. kaplica

    kaplica

    Joined:
    Feb 20, 2014
    Posts:
    87
    Ok, so each time the player touches a word and if it's a wrong one it will count that failure. So for example he clicked twice so he has 2 failures counted, what I want to do though is with the star system make is so that if the player has for example only 1 failure, make it 3 stars on the level, if its equal to 2 then two stars and if its more than 2 then 1 star. So i tried using the int compare logic in playmaker, but that doesn't seem to work..
     
  7. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Oh... This doesn't seem like a MLM issue. I'm not using PlayMaker in my everyday's work, but if you're saying that int compare doesn't do its job then I am quite sure that your parameters have invalid values (like you expecting it to be something else).

    I would like recommend trying to debug your logic: https://hutonggames.fogbugz.com/default.asp?ixWiki=1&pg=pgSearchWiki&qWiki=tag:"debug"

    Then if you're sure that you're setting the star_x properties to true then you have to make sure that you're using identical properties names as your properties on your icon templates. If you're not sure about that, try using the names used by example scenes. It is star_1, star_2 and star_3, and then use any example icon prefab on your level select scene to see if it is working. If you're still not seeing any star property enabled, open Profile Browser tool (it is in the MLM menu) to see if star properties are set in the memory.

    Your question is quite broad so until you pinpoint your issue I cannot give you specific answer. Debugging is the key here :) Track your execution flow and you will find out what may be wrong.

    Hope it helps!
    Piotr
     
  8. bojan1986819

    bojan1986819

    Joined:
    Mar 11, 2015
    Posts:
    4
    After adding this asset to my project all my collisions based on findwithtag="*" stopped working. But not in the editor, only in the builds. Android and Windows builds. Is it a well known issue, is there a workaround?
     
  9. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    I'm not sure if I understand your issue. I'd like to ask you for more detailed description.

    P.S. I will get back to you tomorrow or on Monday.
     
  10. bojan1986819

    bojan1986819

    Joined:
    Mar 11, 2015
    Posts:
    4
    I have items which can be picked up by the player. How the code works is if the player object collides with with another object which has specific Tag, it will be picked up. For example if the player collides with objects with the tag Coin then it will pick those up and the ammount to your coins. But after adding this asset this doesnt work anymore. You can simply cross all the object like if they would not be there. And another strange thing that this happens only in built versions. If I hit play in editor over there it still works perfectly. I hope it is more clear now. And thanks in advance for the help.
     
  11. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi again,

    It does not sound like an MLM issue. Usually assets have very little control over how Unity is behaving. These can add additional features, but core Unity features cannot be modified in any way (or turned off). Does this happens on Windows/Mac build? If yes, then maybe you will find something useful in the logs like an error or something.

    If you will find this difficult, please contact me via support@madpixelmachine.com.

    P.S. I'm not fully active on the weekends so please wait until tomorrow if you will have more questions :)

    Cheers!
    Piotr
     
  12. HideMax

    HideMax

    Joined:
    Jul 15, 2015
    Posts:
    2
    Hi,
    Thank for your replay genail!

    I changed textures import settings of "bg12.png" to Non Power of 2.
    Because bg12.png is 2x1800 (Non Power of 2 size)

    But,Screen is still stretched...

    Any other crue to solve the problem?

    Can you build the sample scene "Theme2Scene.unity" for iOS correctly?
     
  13. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Most of these issues are caused by the fact that I am still maintaining MLM version for Unity 3.5.x. Soon I will drop support for 3.5.x because doing it for 3 different major versions is taking some time and can be troublesome.

    Please write to me to support@madpixelmachine.com with your invoice id and I will send you MLM version for Unity 4.6 and above with textures import settings fixed :)

    Cheers!
    Piotr
     
  14. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    Not sure if this has been asked before, how can I increase the touch drag speed in the mad level manager free layout ?
     
  15. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    HI!

    Please look at the Draggable object inspector. There are some settings that may be proven useful to you :)

    Screenshot_2.png

    Cheers!
    Piotr
     
  16. PrisonerOfLies

    PrisonerOfLies

    Joined:
    Dec 6, 2013
    Posts:
    105
    not available in mad free dragable script
     
  17. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Oh I'm sorry, you're right!
    Please write to me on support@madpixelmachine.com with your invoice no. I will send you updated version then :)

    Cheers!
    Piotr
     
  18. Shamtastik

    Shamtastik

    Joined:
    Jul 30, 2012
    Posts:
    14
    hey there, in Mad Level Manager i got all levels loading when i press each button (1 for lvl 1, 2 for lvl 2, etc) but when i lock lvl 2, i cannot unlock it when i finish lvl 1. How can i achieve that? is a match 3 game and i am using js, not C#.
     
  19. genail

    genail

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

    All you have to do is to mark level 1 as completed :) You can do it either way:

    MadLevelManager.MadLevel.SetCompleted("Level 1 name", true);

    or if you're still in that level:

    MadLevelManager.MadLevel.SetCompleted(MadLevelManager.MadLevel.currentLevelName, true);

    By default marking previous level as completed will unlock the next one :)

    Cheers!
    Piotr
     
  20. daudau505

    daudau505

    Joined:
    Jul 19, 2014
    Posts:
    27
    Hi, Is there a way to grab created profile with playmaker at the beginning of the game?
    Example: I have 3 Slot and would like to grab registered player name and display it in each slot? Thanks
     
  21. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    There is an action called Get Profile Name. Most probably this is what you're looking for :)
    http://madlevelmanager.madpixelmachine.com/doc/latest/integration/playmaker.html

    If you have more questions, please write!

    Cheers!
    Piotr
     
  22. Atzig

    Atzig

    Joined:
    Jul 17, 2014
    Posts:
    151
    Hi, just a quick question, is there a way to hide the icons until a button is pressed? I've tried enabling/disabling the camera, the Mad Level Root and a few others but the icons never reappear once they're deactivated.
     
  23. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Have you tried to disable the Camera component or Camera object? For what I can tell disabling Camera component will work just fine :) Please try it!

    Cheers!
    Piotr
     
  24. Atzig

    Atzig

    Joined:
    Jul 17, 2014
    Posts:
    151
    It worked, thanks! Now I can't seem to click any of the icons though. Is there some kind of conflict with having a Unity canvas in the same scene?

    EDIT: Nevermind, I got it, another camera was causing the issue.
     
  25. biscito

    biscito

    Joined:
    Apr 3, 2013
    Posts:
    86
    hey
    it's a bit silly, but how do i get the total score ? from all levels ?

    found it, i post it anyway :
    intscoreTotal = newMadLevelQuery().SelectProperty("score").SumIntegers();


    cheers
     
    Last edited: Aug 25, 2015
  26. genail

    genail

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

    Use queries :) http://madlevelmanager.madpixelmachine.com/doc/latest/advanced/queries.html
    A query like this may be appropriate:
    Code (CSharp):
    1. int scoreTotal = new MadLevelQuery().SelectProperty("score").SumIntegers();
    Cheers!
    Piotr
     
    biscito likes this.
  27. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Hi,

    I just started with Mad Level Manager and have some questions.

    1) Why the levels that are not set to "Locked by Default" are still locked? Sorry, this is probably a basic error on my part, but I would appreciate your help. locked levels.PNG

    2) On the same screenshot, the stars remain on Levels 1-3 even though I ran Tools>MLM>Initialize. How do I reset them for testing?

    3) Is it possible to manage locking/unlocking of levels entirely via my own code? If so, do you have any examples and are there any potential conflicts with the framework to look out for?

    Thanks!
     
  28. genail

    genail

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

    1. MLM persists the locked/unlocked state within player's profile when game is first launched. This means that if you will launch your game with Locked By Default levels, the locked state will became persistent until you will start over your game. I decided to not change this behavior during development even if it sometimes confusing. What you need to do now is to reset your profile using the Profile Tool :)

    2. Use the Profile Tool to reset your profile as in point 1.

    3. Yes, albeit unlocking in 2.3 is hard-coded and you will have the full control over it in MLM 2.5. In 2.3 just do not set level completed flag (MadLevelProfile.SetCompleted()) and the next level won't be automatically unlocked. If you will need to know if level has been completed, use custom property instead :) (MadLevelProfile.SetLevelBoolean()). Here's more info: http://madlevelmanager.madpixelmachine.com/doc/latest/basics/save_load_api.html

    Cheers!
    Piotr
     
    username132323232 likes this.
  29. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    250
    Hi Piotr, I can't change the font style in MLM, how can I add my custom font on MLM Texts ?

    Thanks,
     
  30. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
  31. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Hi Piotr,

    Thanks a lot for the quick response! I have some follow-up questions about writing a custom "unlocking" script. I'm thinking about adding a script to the Level Selector scene. It would check custom level properties, number of stars and IAP data. Then, it will lock/unlock levels based on that data and some custom logic.

    1) Based on your reply, this should work as long as I don't use MadLevelProfile.SetCompleted(). Is this correct? Sorry, I have to make sure to avoid user complaints :)

    2) For the "unlocking" script I would need to traverse all the levels. I understand that you already included a very powerful MadLevelQuery class, but what would be the right way to get level information inside a "for" loop?

    Thanks again. It's a pleasure to work with such a well-designed asset.
     
  32. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    1. Yes, that's right :)
    2. There's a level list in MadLevel.activeConfiguration.levels. You can iterate through it. This level list is ordered. You will find some useful information within this objects. Just look at MadLevelConfiguration.Level type.

    Thank you for your kind words! :)

    Cheers!
    Piotr
     
  33. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Hi Piotr, thank you for the response. So now that I can iterate over all levels, how would I lock/unlock a level? Sorry, I didn't see any MadLevelConfiguration.Level methods to do that directly.
     
  34. genail

    genail

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

    To lock or unlock the level (set as completed or set properties) use MadLevelProfile class with the level name as an argument :)

    MadLevelProfile.SetLocked("level name", false);

    If you have more questions, please ask! :)

    Cheers!
    Piotr
     
  35. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Thanks! Sorry I missed that one in the documentation :) I have another question (surprise!).

    If I wasn't going to write any special code to lock/unlock levels, how would I handle IAPs? For example, I have 20 levels. Initially, levels 2-20 are locked. Once the player completes a level, the next level gets unlocked. Additionally, to unlock levels 11-20, the player has to complete an IAP. I think this is a very typical scenario. Sorry, I couldn't find an example.

    PS. Just discovered the background feature. Very cool, especially the auto scroll.
     
  36. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    In order to have IAP in your game like these you:

    • Shouldn't use MadLevelProfile.SetCompleted() - it sets level as completed (it's just a flag) and it makes next level unlocked.
    • Instead use MadLevelProfile.SetLocked() on the next level (can be queried using MadLevel functions)
    • Use MadLevelProfile.SetLocked() on purchased levels when it will be adequate
    Please write to me on support@madpixelmachine.com with your invoice no. I have a yet unreleased version that allows to set more than one icon template. I think it will be wise to set different icons for paid levels - at least locked icons :)

    Cheers!
    Piotr
     
  37. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Hi Piotr, and thank you! The levels are working great and I'm happy with my current setup for a few more weeks. I appreciate the offer, but I can wait for the official version.

    What if I had all IAP levels hidden by default? For example, I would have 12 levels per page. So, on the first page there would be 12 free levels and a button "Unlock 24 more levels". When the player completes IAP, the "next page" arrow would appear giving access to two more pages with 12+12 levels. I think this would be less confusing to the players. Is this possible to set up?
     
  38. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    I haven't thought of hiding then revealing levels so it would require a small modification in sources :)

    If you'd like to use Grid Layout you can change how many icons will be displayed in MadLevelGridLayout.cs:488. Just decrease it by the number of IAP levels (that's the simplest solution).

    I will think of hiding levels in future releases :)

    If you will have issues with this, please let me know!

    Cheers!
    Piotr
     
  39. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    Hello,

    after watching some of your tutorials, I'am still not sure about, that this asset can do what I need. I just want to save and load a level, more accurate a running scene in a certain state. As example, save an RTS game in middle of a battle and next day load it and continue playing. And this all without writing my own serialisation. And at all, I dont need the rest of the level manager(would like to use the unity level manager), just saving and loading (if possible).

    Thanks in advance for your answer!
     
  40. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi mkgame!

    For saving and loading only I think more appropriate would be to use Easy Save 2 :) It's better than player prefs, because it can save to files without practical size limit. I think that middle-game RTS save state may be quite big depending of how many units and propertied you'd like to store. It also has some neat features like encryption or saving to a remote server.

    The author is very helpful so if you'd like some more info on that matter, please contact him :)

    Cheers!
    Piotr
     
  41. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    Thanks genail,

    Easy Save has its own forum and thats a bit stupid, if I just want to ask a question. I would like to serialize the whole game, like Save Game-JSON+Binary (must be updated for unity uGUI and unity 5 changes) it did. This asset looks awesome, automatically save all, or lot of Unity Classes, like Camera, Rigidbody, Animations and more. Also abel to save user classes (public members can be written automatically), just have to set the private/protected member to write them out. But I guess, It cannot load the whole scene from file.

    At first, I don't care about large files and long saving procedures. We will all have SSD's in some years.

    If I'am correct, Mad Level Manager is able to load (deserialize) a scene from a file and it should be also able to save a scene in runtime, in a running scene. If I would go the way that I load the default level and then load the saved informations, then I would have lot of trouble with synchronisations, what units must be removed what units must be created. And for this reason, why not just serialize/deserialize the whole state...
     
  42. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    MLM uses rather simple saving system and it is very similar to Player Prefs - you should set what should be saved. It is using PlayerPrefs under the hood so there may be problem with size. PlayerPrefs has (had?) 65K limit per key and I believe you may reach that limit if you want to store all the data.

    I don't have experience with assets that are saving whole scene state and then try to recreate that. I would write my own method of saving / loading scenes like that :)
     
  43. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    584
    Thanks for the information!
     
  44. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Hi Piotr, thank you. How about using groups? I found your example (http://madlevelmanager.madpixelmachine.com/demos/groups.html) that seems to be almost exactly what I need. I would just have to change the group unlocking script so that it reads IAP info. Do you see any problems with this approach?
     
  45. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    One more question. I noticed two thin lines (about 5 pixels wide) on the background of the Level Selector screen. I tried a couple of background images with the same results. The lines are not visible in the Editor, but appear on all Android devices that I tried.

    Here is a screenshot where you can see gray lines on the bottom and the left screen edges. The background scale mode it set to "Fill".

    Screenshot_lines.png
     
  46. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    No, you should be just fine :) If you will find yourself in a trouble, please contact me immediately!

    About your edges question, this usually can be solved by setting up the negative margin:

    Screenshot_1.png

    But if you're planing to make your background solid, it may be better to change camera clear color instead of displaying background texture :)

    Cheers!
    Piotr
     
  47. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    444
    Hi Piotr. Negative margins worked great. Thanks!

    Another question :). On the Level Selector screen I need to show an Options dialog box. Obviously, I don't want a random level to open when the user interacts with that dialog box. To make sure that touch events aren't received by the level buttons, I put a semi-transparent panel over the entire scene. It works inside the Editor, but not on mobile devices. The touch somehow "reaches" the level buttons. Just for testing, I added a regular UI button and it works as expected.

    Is it possible to make a panel work as a "shield" for touch events? If not, is it possible to temporarily disable all the level buttons without changing how they look?
     
  48. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    I think that you may programmatically disable the panel input:

    MadPanel.UniqueOrNull().ignoreInput = true;

    and set it back to false if your options dialog is closed:

    MadPanel.UniqueOrNull().ignoreInput = false;

    Please let me know if you will encounter any issues :)

    Cheers!
    Pitor
     
  49. albinochicken

    albinochicken

    Joined:
    Oct 18, 2010
    Posts:
    20
    Hi Piotr,

    Thanks again for such a wonderful tool! I'm making nice progress with it... but have spent hours looking through documentation, examples, etc. and must be missing something.

    How can one DELETE or RESET all custom profile properties without actually deleting the entire profile? I have tried everything I can think of revolving around some of the following:
    Code (CSharp):
    1. MadLevelProfile.GetProfilePropertyNames();
    2. MadLevelProfile.GetProfilePropertyNames().Clear();
    3. MadLevelProfile.GetProfilePropertyNames().Remove("name");
    4. MadLevelProfile.SetProfileBoolean("name", true);
    5. MadLevelProfile.profileList;
    I was a little nervous trying anything around the following though:
    Code (CSharp):
    1. MadLevelProfile.Init();
    Please help... is there any way to do this? The reason for this is:
    1. Testing purposes... don't want to reset level progress
    2. Possibility of allowing user to reset custom properties that were added without losing/resetting the whole profile.

    Thanks again!
     
  50. genail

    genail

    Joined:
    Jul 2, 2012
    Posts:
    1,034
    Hi!
    I'm sorry for the late reply. I think I am having notifications issues :/

    There's currently no method for reseting all properties without reseting the whole profile (it is the same as removing and adding it again). But for testing purposes you may find Profile Tool useful. It allows you to unlock all levels.

    You can also do it from code. I think that a Query would be the easiest way :)

    If you have more questions, please let me know!

    Cheers!
    Piotr
     
unityunity