Exemple #1
0
 public void DeleteEnemy()
 {
     if (ActiveEnemySet == null || ActiveEnemy == null)
     {
         return;
     }
     if (ForceDeleteEnemy())
     {
         HandlingSelection = true;
         var a        = new ActiveItems(this);
         int newIndex = Math.Min(EnemyIndex, ActiveEnemySet.EnemyCount - 1);
         ForceSelectEnemy(newIndex);
         EnemyListChanged?.Invoke(this, new ListLoadEventArgs(EnemyIndex));
         var e = new LevelDataEventArgs()
         {
             ScreenXmin = 0,
             ScreenXmax = RoomWidthInScreens - 1,
             ScreenYmin = 0,
             ScreenYmax = RoomHeightInScreens - 1
         };
         LevelDataModified?.Invoke(this, e);
         RaiseChangeEvents(a);
         HandlingSelection = false;
     }
 }
Exemple #2
0
        public void AddEnemy(int x, int y)
        {
            if (ActiveEnemySet == null)
            {
                return;
            }
            var a = new ActiveItems(this);

            if (ForceAddEnemy(x, y))
            {
                HandlingSelection = true;
                ForceSelectEnemy(ActiveEnemySet.EnemyCount - 1);
                EnemyListChanged?.Invoke(this, new ListLoadEventArgs(EnemyIndex));
                var e = new LevelDataEventArgs()
                {
                    ScreenXmin = 0,
                    ScreenXmax = RoomWidthInScreens - 1,
                    ScreenYmin = 0,
                    ScreenYmax = RoomHeightInScreens - 1
                };
                LevelDataModified?.Invoke(this, e);
                RaiseChangeEvents(a);
                HandlingSelection = false;
            }
        }
Exemple #3
0
        // Delete active room state.
        public void DeleteRoomState()
        {
            if (ActiveRoom == null || ActiveRoomState == null ||
                RoomStateIndex == ActiveRoom.RoomStates.Count - 1)
            {
                return;
            }
            var a = new ActiveItems(this);

            if (ForceDeleteRoomState())
            {
                HandlingSelection = true;
                ForceSelectRoomState(RoomStateIndex);
                RoomStateListChanged?.Invoke(this, new ListLoadEventArgs(RoomStateIndex));
                var e = new LevelDataEventArgs()
                {
                    ScreenXmin = 0,
                    ScreenXmax = RoomWidthInScreens - 1,
                    ScreenYmin = 0,
                    ScreenYmax = RoomHeightInScreens - 1
                };
                LevelDataModified?.Invoke(this, e);
                RaiseChangeEvents(a);
                HandlingSelection = false;
            }
        }
Exemple #4
0
 // Add a new PLM.
 public void AddPlm(int col, int row)
 {
     if (ActivePlmSet == null || ActivePlmType == null)
     {
         return;
     }
     if (ForceAddPlm(col, row))
     {
         HandlingSelection = true;
         var a = new ActiveItems(this);
         ForceSelectPlm(ActivePlmSet.PlmCount - 1);
         PlmListChanged?.Invoke(this, new ListLoadEventArgs(PlmIndex));
         var e = new LevelDataEventArgs()
         {
             ScreenXmin = 0,
             ScreenXmax = RoomWidthInScreens - 1,
             ScreenYmin = 0,
             ScreenYmax = RoomHeightInScreens - 1
         };
         LevelDataModified?.Invoke(this, e);
         RaiseChangeEvents(a);
         HandlingSelection = false;
     }
 }
Exemple #5
0
 // Checks which selected items have changed and raises the corresponding events.
 // [wip] Order the statements according to call hierarchy?
 private void RaiseChangeEvents(ActiveItems a)
 {
     if (a.ActiveTileSet != ActiveTileSet || a.ActiveBackground != ActiveBackground)
     {
         LoadBackground();
     }
     if (a.ActiveTileSet != ActiveTileSet)
     {
         LoadRoomTiles(TileSetIndex);
         TileSetSelected?.Invoke(this, null);
     }
     if (a.ActiveScrollColor != ActiveScrollColor)
     {
         ScrollColorSelected?.Invoke(this, null);
     }
     if (a.ActiveEnemyType != ActiveEnemyType)
     {
         EnemyTypeSelected(this, null);
     }
     if (a.ActiveEnemyGfx != ActiveEnemyGfx)
     {
         EnemyGfxSelected?.Invoke(this, null);
     }
     if (a.ActiveEnemy != ActiveEnemy)
     {
         EnemySelected?.Invoke(this, null);
     }
     if (a.ActivePlmType != ActivePlmType)
     {
         PlmTypeSelected?.Invoke(this, null);
     }
     if (a.ActivePlm != ActivePlm)
     {
         PlmSelected?.Invoke(this, null);
     }
     if (a.ActiveDoor != ActiveDoor)
     {
         DoorSelected?.Invoke(this, null);
     }
     if (a.ActiveRoomState != ActiveRoomState)
     {
         RoomStateSelected?.Invoke(this, null);
         LevelDataSelected?.Invoke(this, null);
         PlmListChanged?.Invoke(this, new ListLoadEventArgs(PlmIndex));
         EnemyListChanged?.Invoke(this, new ListLoadEventArgs(EnemyIndex));
         EnemyGfxListChanged?.Invoke(this, new ListLoadEventArgs(EnemyGfxIndex));
         ScrollDataListChanged?.Invoke(this, new ListLoadEventArgs(ScrollDataIndex));
     }
     else if (a.ActiveLevelData != ActiveLevelData)
     {
         LevelDataSelected.Invoke(this, null);
     }
     if (a.ActiveRoom != ActiveRoom)
     {
         RoomSelected?.Invoke(this, null);
         RoomStateListChanged?.Invoke(this, new ListLoadEventArgs(RoomStateIndex));
         DoorListChanged?.Invoke(this, new ListLoadEventArgs(DoorIndex));
     }
     if (a.ActiveArea != AreaIndex)
     {
         AreaSelected?.Invoke(this, null);
         RoomListChanged?.Invoke(this, new ListLoadEventArgs(RoomIndex));
     }
     if (a.ActiveScrollData != ActiveScrollData)
     {
         ScrollDataSelected?.Invoke(this, null);
         var e = new LevelDataEventArgs()
         {
             AllScreens = true
         };
         LevelDataModified?.Invoke(this, e);
     }
     if (a.ActiveFx != ActiveFx)
     {
         FxSelected?.Invoke(this, null);
         FxDataListChanged?.Invoke(this, new ListLoadEventArgs(FxDataIndex));
     }
     if (a.ActiveFxData != ActiveFxData)
     {
         FxDataSelected?.Invoke(this, null);
     }
 }