Ejemplo n.º 1
0
        public Level(string name, int width, int height, int layerCount, Point2I roomSize, Zone zone)
        {
            this.world			= null;
            this.roomSize		= roomSize;
            this.roomLayerCount = layerCount;
            this.dimensions		= Point2I.Zero;
            //this.zone			= zone;

            properties = new Properties(this);
            properties.BaseProperties = new Properties();

            properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "", "The id used to refer to this level.", false, true);

            properties.BaseProperties.Set("dungeon", "")
                .SetDocumentation("Dungeon", "dungeon", "", "", "The dungeon this level belongs to.");
            properties.BaseProperties.Set("dungeon_floor", 0)
                .SetDocumentation("Dungeon Floor", "", "", "", "The floor in the dungeon this level belongs to.");

            properties.BaseProperties.Set("discovered", false);

            properties.Set("id", name);

            properties.BaseProperties.Set("zone", "")
                .SetDocumentation("Zone", "zone", "", "", "The zone type for this room.", true, false);

            Zone = zone;

            Resize(new Point2I(width, height));
        }
Ejemplo n.º 2
0
        public Level(int width, int height, Point2I roomSize)
        {
            this.world			= null;
            this.roomSize		= roomSize;
            this.roomLayerCount = GameSettings.DEFAULT_TILE_LAYER_COUNT;
            this.dimensions		= Point2I.Zero;
            this.zone			= Resources.GetResource<Zone>("");
            this.properties		= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this level.", true, false);

            Resize(new Point2I(width, height));
        }
Ejemplo n.º 3
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Room(Level level, int x, int y)
        {
            this.level		= level;
            this.location	= new Point2I(x, y);
            this.tileData	= new TileDataInstance[level.RoomSize.X, level.RoomSize.Y, level.RoomLayerCount];
            this.eventData	= new List<EventTileDataInstance>();
            this.zone		= null;
            this.properties	= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this room.", true, false);
            this.properties.BaseProperties.Set("music", "")
                .SetDocumentation("Music", "song", "", "The music to play in this room. Select none to choose the default music.", true, false);
            this.properties.BaseProperties.Set("zone", "")
                .SetDocumentation("Zone", "zone", "", "The zone type for this room.", true, false);
        }
Ejemplo n.º 4
0
        //-----------------------------------------------------------------------------
        // Constructor
        //-----------------------------------------------------------------------------
        public Level(string name, int width, int height, int layerCount, Point2I roomSize, Zone zone)
        {
            this.world			= null;
            this.roomSize		= roomSize;
            this.roomLayerCount = layerCount;
            this.dimensions		= Point2I.Zero;
            this.zone			= zone;
            this.properties		= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            this.properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "The id used to refer to this level.", true, false);

            this.properties.Set("id", name);

            Resize(new Point2I(width, height));
        }
Ejemplo n.º 5
0
        private TileDataInstance[,,] tileData; // 3D grid of tile data (x, y, layer)

        #endregion Fields

        #region Constructors

        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Room(Level level, int x, int y, Zone zone = null)
        {
            this.level		= level;
            this.location	= new Point2I(x, y);
            this.tileData	= new TileDataInstance[level.RoomSize.X, level.RoomSize.Y, level.RoomLayerCount];
            this.eventData	= new List<EventTileDataInstance>();
            //this.zone		= zone;
            this.events		= new ObjectEventCollection();
            this.properties	= new Properties();
            this.properties.PropertyObject = this;
            this.properties.BaseProperties = new Properties();

            properties.BaseProperties.Set("id", "")
                .SetDocumentation("ID", "", "", "", "The id used to refer to this room.", true, false);
            properties.BaseProperties.Set("music", "")
                .SetDocumentation("Music", "song", "", "", "The music to play in this room. Select none to choose the default music.", true, false);
            properties.BaseProperties.Set("zone", "")
                .SetDocumentation("Zone", "zone", "", "", "The zone type for this room.", true, false);

            properties.BaseProperties.Set("discovered", false);
            properties.BaseProperties.Set("hidden_from_map", false);
            properties.BaseProperties.Set("boss_room", false);

            events.AddEvent("event_room_start", "Room Start", "Occurs when the room begins.");
            properties.BaseProperties.Set("event_room_start", "")
                .SetDocumentation("Room Start", "script", "", "Events", "Occurs when the room begins.");

            events.AddEvent("event_all_monsters_dead", "All Monsters Dead", "Occurs when all monsters are dead.");
            properties.BaseProperties.Set("event_all_monsters_dead", "")
                .SetDocumentation("All Monsters Dead", "script", "", "Events", "Occurs when all monsters are dead.");

            // Room Flags:
            // - sidescroll ??? could be in Zone
            // - underwater ??? could be in Zone
            // - discovered
            // - hiddenFromMap
            // - boss
            // - trasure
            // - signal

            /*if (zone != null)
                this.properties.Set("zone", zone.ID);*/
        }
Ejemplo n.º 6
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public EditorControl()
        {
            this.propertyGridControl	= null;
            this.worldFilePath	= String.Empty;
            this.worldFileName	= "untitled";
            this.world			= null;
            this.level			= null;
            this.tileset		= null;
            this.zone			= null;
            this.rewardManager	= null;
            this.inventory		= null;
            this.timer			= null;
            this.ticks			= 0;
            this.roomSpacing	= 1;
            this.playAnimations	= false;
            this.isInitialized	= false;
            this.hasMadeChanges	= false;

            this.currentLayer				= 0;
            this.currentToolIndex			= 0;
            this.aboveTileDrawMode			= TileDrawModes.Fade;
            this.belowTileDrawMode			= TileDrawModes.Fade;
            this.showRewards				= true;
            this.showGrid					= false;
            this.showEvents					= false;
            this.highlightMouseTile			= true;
            this.selectedRoom				= -Point2I.One;
            this.selectedTile				= -Point2I.One;
            this.selectedTilesetTile		= Point2I.Zero;
            this.selectedTilesetTileData	= null;
            this.playerPlaceMode			= false;
            this.sampleFromAllLayers		= false;
        }
Ejemplo n.º 7
0
        public void Initialize(ContentManager contentManager, GraphicsDevice graphicsDevice)
        {
            if (!isInitialized) {
                Resources.Initialize(contentManager, graphicsDevice);
                GameData.Initialize();
                EditorResources.Initialize();

                this.inventory		= new Inventory(null);
                this.rewardManager	= new RewardManager(null);
                this.timer			= Stopwatch.StartNew();
                this.ticks			= 0;
                this.roomSpacing	= 1;
                this.playAnimations = false;
                this.tileset		= GameData.TILESET_CLIFFS;
                this.zone			= GameData.ZONE_PRESENT;
                this.selectedTilesetTileData = this.tileset.TileData[0, 0];
                this.eventMode		= false;

                GameData.LoadInventory(inventory);
                GameData.LoadRewards(rewardManager);

                // Create tileset combo box.
                editorForm.ComboBoxTilesets.Items.Clear();
                foreach (KeyValuePair<string, Tileset> entry in Resources.GetResourceDictionary<Tileset>()) {
                    editorForm.ComboBoxTilesets.Items.Add(entry.Key);
                }
                editorForm.ComboBoxTilesets.SelectedIndex = 0;

                // Create zone combo box.
                editorForm.ComboBoxZones.Items.Clear();
                foreach (KeyValuePair<string, Zone> entry in Resources.GetResourceDictionary<Zone>()) {
                    if (tileset.SpriteSheet.Image.HasVariant(entry.Key))
                        editorForm.ComboBoxZones.Items.Add(entry.Key);
                }
                editorForm.ComboBoxZones.SelectedIndex = 0;

                // Create controllers.
                propertyGridControl = new PropertyGridControl(this, editorForm.PropertyGrid);

                // Create tools.
                tools = new List<EditorTool>();
                AddTool(toolPointer		= new ToolPointer());
                AddTool(toolPlace		= new ToolPlace());
                AddTool(toolSelection	= new ToolSelection());
                AddTool(toolEyedrop		= new ToolEyedrop());
                currentToolIndex = 0;
                tools[currentToolIndex].OnBegin();

                this.isInitialized = true;
            }
        }
Ejemplo n.º 8
0
 public void ChangeZone(string name)
 {
     if (name != "(none)") {
         zone = Resources.GetResource<Zone>(name);
         editorForm.TileDisplay.UpdateZone();
     }
 }
Ejemplo n.º 9
0
        public void ChangeTileset(string name)
        {
            tileset = Resources.GetResource<Tileset>(name);

            int index = 0;
            if (!tileset.SpriteSheet.Image.HasVariant(zone.ID))
                zone = Resources.GetResource<Zone>(tileset.SpriteSheet.Image.VariantName);
            editorForm.ComboBoxZones.Items.Clear();
            foreach (KeyValuePair<string, Zone> entry in Resources.GetResourceDictionary<Zone>()) {
                if (tileset.SpriteSheet.Image.HasVariant(entry.Key)) {
                    editorForm.ComboBoxZones.Items.Add(entry.Key);
                    if (entry.Key == zone.ID)
                        editorForm.ComboBoxZones.SelectedIndex = index;
                    index++;
                }
            }
            editorForm.TileDisplay.UpdateTileset();
            editorForm.TileDisplay.UpdateZone();
        }
Ejemplo n.º 10
0
        public void ChangeTileset(string name)
        {
            if (Resources.ExistsResource<Tileset>(name))
                tileset = Resources.GetResource<Tileset>(name);
            else if (Resources.ExistsResource<EventTileset>(name))
                tileset = Resources.GetResource<EventTileset>(name);

            if (tileset.SpriteSheet != null) {
                // Determine which zone to begin using for this tileset.
                int index = 0;
                if (!tileset.SpriteSheet.Image.HasVariant(zone.ID)) {
                    zone = Resources.GetResource<Zone>(tileset.SpriteSheet.Image.VariantName);
                    if (zone == null)
                        zone = GameData.ZONE_DEFAULT;
                }

                // Setup zone combo box for the new tileset.
                editorForm.ComboBoxZones.Items.Clear();
                foreach (KeyValuePair<string, Zone> entry in Resources.GetResourceDictionary<Zone>()) {
                    if (tileset.SpriteSheet.Image.HasVariant(entry.Key)) {
                        editorForm.ComboBoxZones.Items.Add(entry.Key);
                        if (entry.Key == zone.ID)
                            editorForm.ComboBoxZones.SelectedIndex = index;
                        index++;
                    }
                }
            }

            editorForm.TileDisplay.UpdateTileset();
            editorForm.TileDisplay.UpdateZone();
        }