예제 #1
0
        public void MoveEnemyGfxDown()
        {
            if (ActiveRoomState?.MyEnemyGfx == null || EnemyGfxIndex == IndexNone)
            {
                return;
            }
            if (EnemyGfxIndex + 1 < ActiveRoomState.MyEnemyGfx.EnemyGfxCount)
            {
                var temp1 = ActiveRoomState.MyEnemyGfx.EnemyIDs [EnemyGfxIndex];
                ActiveRoomState.MyEnemyGfx.EnemyIDs [EnemyGfxIndex] =
                    ActiveRoomState.MyEnemyGfx.EnemyIDs [EnemyGfxIndex + 1];
                ActiveRoomState.MyEnemyGfx.EnemyIDs [EnemyGfxIndex + 1] = temp1;

                var temp2 = ActiveRoomState.MyEnemyGfx.Palettes [EnemyGfxIndex];
                ActiveRoomState.MyEnemyGfx.Palettes [EnemyGfxIndex] =
                    ActiveRoomState.MyEnemyGfx.Palettes [EnemyGfxIndex + 1];
                ActiveRoomState.MyEnemyGfx.Palettes [EnemyGfxIndex + 1] = temp2;

                var temp3 = ActiveRoomState.MyEnemyGfx.MyEnemyTypes [EnemyGfxIndex];
                ActiveRoomState.MyEnemyGfx.MyEnemyTypes [EnemyGfxIndex] =
                    ActiveRoomState.MyEnemyGfx.MyEnemyTypes [EnemyGfxIndex + 1];
                ActiveRoomState.MyEnemyGfx.MyEnemyTypes [EnemyGfxIndex + 1] = temp3;

                EnemyGfxIndex++;
                HandlingSelection = true;
                EnemyGfxListChanged?.Invoke(this, new ListLoadEventArgs(EnemyGfxIndex));
                HandlingSelection = false;
                ChangesMade       = true;
            }
        }
예제 #2
0
 public void AddEnemyGfx()
 {
     if (ActiveRoomState?.MyEnemyGfx == null)
     {
         return;
     }
     if (ForceAddEnemyGfx())
     {
         HandlingSelection = true;
         ForceSelectEnemyGfx(ActiveRoomState.MyEnemyGfx.EnemyGfxCount - 1);
         EnemyGfxListChanged?.Invoke(this, new ListLoadEventArgs(EnemyIndex));
         HandlingSelection = false;
     }
 }
예제 #3
0
        public void DeleteEnemyGfx()
        {
            if (ActiveRoomState?.MyEnemyGfx == null || EnemyGfxIndex == IndexNone)
            {
                return;
            }
            var a = new ActiveItems(this);

            if (ForceDeleteEnemyGfx())
            {
                HandlingSelection = true;
                int newIndex = Math.Min(EnemyGfxIndex,
                                        ActiveRoomState.MyEnemyGfx.EnemyGfxCount - 1);
                ForceSelectEnemyGfx(newIndex);
                EnemyGfxListChanged?.Invoke(this, new ListLoadEventArgs(EnemyGfxIndex));
                RaiseChangeEvents(a);
                HandlingSelection = false;
            }
        }
예제 #4
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);
     }
 }