public static void UnlockThisLevel(FreshLevels.Type type, bool noSave)
    {
        if (type == FreshLevels.Type.None)
        {
            //Debug.Log("Error: Level type was None. Level not unlocked!");
            return;
        }

        //special cases (when you go to these text intros, also unlock the next level, in case the player quits during the story)
        if (type == FreshLevels.Type.PreSlimeDaddyStory)
        {
            type = FreshLevels.Type.SlimeDaddy_BatterUp;
        }
        if (type == FreshLevels.Type.PostSatanStory)
        {
            type = FreshLevels.Type.MusicLvl1;
        }

        string strictLabel = FreshLevels.GetStrictLabelForType(type);

        if (strictLabel == null)
        {
            //Debug.Log("Error: Level name was NULL. Level not unlocked!");
            return;
        }
        PlayerPrefs.SetInt("nu_" + strictLabel, 1);
        if (!noSave)
        {
            PlayerPrefs.Save();
        }

        //Debug.Log("Unlocked level. " + type + ", " + strictLabel);
    }
Exemplo n.º 2
0
    public static bool LoadLevelUnlocked(FreshLevels.Type fType)
    {
        FreshLevels.Type type = fType;
        if (type == FreshLevels.Type.IntroStory)
        {
            return(true);
        }                                                                  //Always unlocked

        int result = 0;

        /*
         * if (PlayerPrefs.HasKey("LevelUnlocked_" + type))
         * {
         *      result = PlayerPrefs.GetInt("LevelUnlocked_" + type, 0);
         * }*/

        if (fType != FreshLevels.Type.None)
        {
            string s = FreshLevels.GetStrictLabelForType(fType);
            if (PlayerPrefs.HasKey("nu_" + s))
            {
                result = PlayerPrefs.GetInt("nu_" + type, 0);
            }
        }


        return(result == 1);
    }
Exemplo n.º 3
0
    public static void AddToQueue(FreshLevels.Type type, float speedruntime)
    {
        //Fail out, if:
        if (fa.dontConnectSteam)
        {
            return;
        }
        if (!SteamManager.Initialized)
        {
            return;
        }
        if (speedruntime < 2)
        {
            return;
        }                                        //less than 2 seconds is always impossible
        if (speedruntime < FreshLevels.GetImpossibleTimeForLevel(type))
        {
            return;
        }                                                                                  //time was impossible
        if (FreshLevels.DoNotSyncLevel(type))
        {
            return;
        }                                                      //don't sync this level if it's got a secret exit or other reason to not keep old scores

        Item a = new Item();

        a.leaderboard = FreshLevels.GetStrictLabelForType(type);
        a.score       = Mathf.FloorToInt(speedruntime * 1000);
        a.type        = type;
        queue.Add(a);
    }
Exemplo n.º 4
0
    void InitNodes()
    {
        //Load lvlNum (for now, fake it)
        //lvlNum = 10;//(10 is the starting number);
        lvlNums  = new int[100];              //Max 100 levels then
        lvlTypes = new FreshLevels.Type[100]; //Max 100 levels then
        int lvlNumIndex = 0;

        nodesGOs = GameObject.FindGameObjectsWithTag("metaMapNode");
        nodes    = new NodeScript[nodesGOs.Length];
        for (int i = 0; i < nodesGOs.Length; i++)
        {
            nodes[i] = nodesGOs[i].GetComponent <NodeScript>();
            lvlTypes[lvlNumIndex] = nodes[i].levelType;



            //unlock with the new system
            bool alwaysUnlocked = false;
            if (nodes[i].levelType == FreshLevels.Type.IntroStory)
            {
                alwaysUnlocked = true;
            }

            //check if you own these DLC
            if (nodes[i].levelType == FreshLevels.Type.AlpDLC_IntroStory && (xa.hasAlpDLC || fa.forceUnlockOfAlpDLC))
            {
                alwaysUnlocked = true;
            }
            if (nodes[i].levelType == FreshLevels.Type.IsThisADaggerISeeBeforeMe && xa.hasBonusDLC)
            {
                alwaysUnlocked = true;
            }

            if (alwaysUnlocked)
            {
                nodes[i].locked = false;
                if (nodes[i].lockObj != null)
                {
                    nodes[i].lockObj.SetActive(nodes[i].locked);
                }
            }
            else
            {
                string strictName = FreshLevels.GetStrictLabelForType(nodes[i].levelType);
                if (PlayerPrefs.HasKey("nu_" + strictName))
                {
                    nodes[i].locked = false;
                    if (nodes[i].lockObj != null)
                    {
                        nodes[i].lockObj.SetActive(nodes[i].locked);
                    }
                }
                else
                {
                    nodes[i].locked = true;
                    nodes[i].lockObj.SetActive(nodes[i].locked);
                }
            }


            /*
             * lvlNums[lvlNumIndex] = nodes[i].lvlNum;
             * lvlNumIndex++;
             *
             * if (nodes[i].lvlNum != -1 && lvlNum < nodes[i].lvlNum)
             * {
             *      nodes[i].locked = true;
             *      nodes[i].lockObj.SetActive(nodes[i].locked);
             * }
             * else if (!xa.hasBonusDLC && nodes[i].BonusDLC)
             * {
             *      nodes[i].locked = true;
             *      nodes[i].lockObj.SetActive(nodes[i].locked);
             * }
             * else
             * {
             *      nodes[i].locked = false;
             *      if (nodes[i].lockObj != null) { nodes[i].lockObj.SetActive(nodes[i].locked); }
             * }*/
        }
    }