Example #1
0
    public void Load()
    {
        level = Resources.Load("Levels/" + levelName) as Level;
        if (level != null)
        {
            for (int i = 0; i < level.classes.Count; i++)
            {
                PlayerClassMarker marker =
                    AddLevelObject <PlayerClassMarker>(-1, i);
                marker.Init(level.classes[i]);
            }
            foreach (Position wallPos in level.walls)
            {
                WallPreview wall = AddLevelObject <WallPreview>(
                    wallPos.row, wallPos.col);
                wall.Init(wallPos.row, wallPos.col);
            }
            foreach (Position spawnPos in level.spawnPoints)
            {
                SpawnPointPreview sp = AddLevelObject <SpawnPointPreview>(
                    spawnPos.row, spawnPos.col);
                sp.Init(spawnPos.row, spawnPos.col);
            }
            foreach (Position spawnPos in level.coins)
            {
                CoinPreview coin = AddLevelObject <CoinPreview>(
                    spawnPos.row, spawnPos.col);
                coin.Init(spawnPos.row, spawnPos.col);
            }
            foreach (Level.EnemyInstance inst in level.enemies)
            {
                EnemyPreview enemy = AddLevelObject <EnemyPreview>(
                    inst.position.row, inst.position.col);
                enemy.Init(inst.enemyType, inst.position);
                inst.plan.ForEach(
                    action => enemy.AddAction(action));
            }
            if (level.button.row != -1 && level.button.col != -1 && level.door.row != -1 && level.door.col != -1)
            {
                ButtonPreview button = AddLevelObject <ButtonPreview>(
                    level.button.row, level.button.col);
                button.Init(level.button.row, level.button.col);

                DoorPreview door = AddLevelObject <DoorPreview>(
                    level.door.row, level.door.col);
                door.Init(level.door.row, level.door.col);
            }
            ExitPreview exit = AddLevelObject <ExitPreview>(
                level.exit.row, level.exit.col);
            exit.Init(level.exit.row, level.exit.col);
        }
        else
        {
            Debug.LogError("No such level: " + levelName);
        }
    }
Example #2
0
        public ThemeSelectionDialog(Project project)
            : base("ThemeSelectionDialog.ui", "themeselection")
        {
            this.project = project;
            hpaned.Position = 200; // W (left)
            selected_theme = null;
            menu_drawing_area = new MenuBackgroundPreview ();
            selectbutton_drawing_area = new ButtonPreview (project);
            highlightbutton_drawing_area = new ButtonPreview (project);

            browse_file = new BrowseFile (file_hbox, project.Details.CustomMenuBackground, true);
            browse_file.DefaultDirectory = Mistelix.Preferences.GetStringValue (Preferences.ImagesDirectoryKey);
            menu_drawing_area.CustomMenuBackground = project.Details.CustomMenuBackground;

            color = author_label.Style.Background (StateType.Normal);
            textview_intro.ModifyBase (Gtk.StateType.Normal, color);

            Gtk.Button clean_button = new Gtk.Button (Catalog.GetString ("Clean"));
            clean_button.Clicked += delegate
            {
                browse_file.Filename = null;
                menu_drawing_area.CustomMenuBackground = null;
            };

            file_hbox.Add (clean_button);
            file_hbox.ShowAll ();

            PrepareTree ();
            backpreview_box.Add (menu_drawing_area);
            backpreview_box.ShowAll ();

            highlightbutton_box.Add (highlightbutton_drawing_area);
            highlightbutton_box.ShowAll ();

            selectbutton_box.Add (selectbutton_drawing_area);
            selectbutton_box.ShowAll ();

            browse_file.FileSelectedChanged += delegate
            {
                menu_drawing_area.CustomMenuBackground = browse_file.Filename;
            };

            Gtk.TextBuffer buffer_intro = new Gtk.TextBuffer (new Gtk.TextTagTable ());
            textview_intro.Buffer = buffer_intro;
            buffer_intro.Text = String.Format (
                Catalog.GetString ("Menu themes define how the main DVD menu looks. Here you define the default background image and the type of buttons. For more information visit: {0}"),
                Defines.THEMES_URL);
        }