public static Level CreateLevelFromMetaLevel(MetaLevel metaLevel, SongOfIce game)
        {
            if (metaLevel.Id == "oneup") {
                return new MushroomLevel(game, metaLevel);
            }

            if (metaLevel.Id == "tr") {
                return new TronLevel(game, metaLevel);
            }

            if (metaLevel.Id == "cr") {
                return new CreditsLevel(game, metaLevel);
            }

            return null;
        }
        public static List<MetaLevel> CreateDefaultMetaLevelList()
        {
            List<MetaLevel> levels = new List<MetaLevel>();

            MetaLevel current = new MetaLevel("Tron", "tr", "trondaftpunk_thumb");
            levels.Add(current);

            current = new MetaLevel("1-up", "oneup", "1upheart_thumb");
            levels.Add(current);

            //current = new MetaLevel("Star Wars", "sw", "questionmark");
            //levels.Add(current);

            current = new MetaLevel("Credits", "cr", "credits_thumb");
            levels.Add(current);

            return levels;
        }
 public MushroomLevel(SongOfIce game, MetaLevel meta)
     : base(game, meta)
 {
     setup = false;
 }
Exemple #4
0
        internal void UnlockLevel(MetaLevel level)
        {
            RegistryKey hkcu = Registry.CurrentUser;
            RegistryKey software = hkcu.CreateSubKey("Software");
            RegistryKey adundas = software.CreateSubKey("Adundas");
            RegistryKey pieces = adundas.CreateSubKey("Ice");
            RegistryKey levels = pieces.CreateSubKey("levels");

            bool found = false;
            foreach (MetaLevel l in metas) {
                if (found) {
                    if (l.State == LevelState.LOCKED) {
                        l.State = LevelState.UNKNOWN;
                        levels.SetValue(l.Id, 1, RegistryValueKind.DWord); /* 0 - KNOWN, 1 - UNKNOWN, 2 - LOCKED */
                    }
                    break;
                }
                if (l.Equals(level)) {
                    l.State = LevelState.KNOWN;
                    levels.SetValue(l.Id, 0, RegistryValueKind.DWord);
                    found = true;
                }
            }

            if (metaLevelUpdatedDelegate != null) {
                metaLevelUpdatedDelegate();
            }
        }
Exemple #5
0
        internal void SwitchToLevel(MetaLevel meta)
        {
            Level level = LevelFactory.CreateLevelFromMetaLevel(meta, this);
            if (level == null) {
                return;
            }

            if (state == GameState.MENU) {
                /* Transition from the menu to the level. Don't dispose MENU. */
                currentLevel = level;
                currentLevel.Load();

                mainMenu.Sound = false;
                state = GameState.LEVEL;
            } else if (state == GameState.LEVEL) {
                /* Transition from the prior level to the new level. Dispose resources immediately. */
                if (currentLevel != null) {
                    currentLevel.Unload();
                }
                currentLevel = level;
                currentLevel.Load();
            }
            currentView = currentLevel;
            currentView.Sound = true;
        }
Exemple #6
0
        internal MetaLevel GetNextLevel(MetaLevel current)
        {
            if (metas == null) {
                return null;
            }

            int index = metas.IndexOf(current);

            if (index < 0) {
                return null;
            }

            index++;

            if (index >= metas.Count()) {
                return null;
            }

            MetaLevel next = metas[index];
            return next;
        }
Exemple #7
0
 public TronLevel(SongOfIce game, MetaLevel meta)
     : base(game, meta)
 {
     setup = false;
 }
 public CreditsLevel(SongOfIce game, MetaLevel meta)
     : base(game, meta)
 {
 }
Exemple #9
0
 private bool Equals(MetaLevel other)
 {
     return (this.Id == other.Id);
 }