private int GetIndexFromLayerInfo(MapEditor.EditLayer layerType, int layer) { int layerIndex = 0; if (layerType == MapEditor.EditLayer.Fringe) { return(layerIndex + Processor.CurrentMap.FringeLayers.Count - 1 - layer); } layerIndex += Processor.CurrentMap.FringeLayers.Count; if (layerType == MapEditor.EditLayer.PropFront) { return(layerIndex + Processor.CurrentMap.PropFrontLayers.Count - 1 - layer); } layerIndex += Processor.CurrentMap.PropFrontLayers.Count; if (layerType == MapEditor.EditLayer.PropBack) { return(layerIndex + Processor.CurrentMap.PropBackLayers.Count - 1 - layer); } layerIndex += Processor.CurrentMap.PropBackLayers.Count; if (layerType == MapEditor.EditLayer.Ground) { return(layerIndex + Processor.CurrentMap.GroundLayers.Count - 1 - layer); } layerIndex += Processor.CurrentMap.GroundLayers.Count; if (layerType == MapEditor.EditLayer.Data) { return(layerIndex); } return(-1); }
private void chklbLayers_ItemCheck(object sender, ItemCheckEventArgs e) { MapEditor.EditLayer layerType = MapEditor.EditLayer.Data; int layerNum = -1; GetLayerInfoFromIndex(e.Index, ref layerType, ref layerNum); switch (layerType) { case MapEditor.EditLayer.Data: { MapEditor.showDataLayer = (e.NewValue == CheckState.Checked); break; } case MapEditor.EditLayer.Ground: { MapEditor.showGroundLayer[layerNum] = (e.NewValue == CheckState.Checked); break; } case MapEditor.EditLayer.PropBack: { MapEditor.showPropBackLayer[layerNum] = (e.NewValue == CheckState.Checked); break; } case MapEditor.EditLayer.PropFront: { MapEditor.showPropFrontLayer[layerNum] = (e.NewValue == CheckState.Checked); break; } case MapEditor.EditLayer.Fringe: { MapEditor.showFringeLayer[layerNum] = (e.NewValue == CheckState.Checked); break; } } }
void GetLayerInfoFromIndex(int index, ref MapEditor.EditLayer layerType, ref int layer) { if (Logic.Gameplay.Processor.CurrentMap.FringeLayers.Count > index) { layerType = MapEditor.EditLayer.Fringe; layer = Logic.Gameplay.Processor.CurrentMap.FringeLayers.Count - index - 1; return; } index -= Logic.Gameplay.Processor.CurrentMap.FringeLayers.Count; if (Logic.Gameplay.Processor.CurrentMap.PropFrontLayers.Count > index) { layerType = MapEditor.EditLayer.PropFront; layer = Logic.Gameplay.Processor.CurrentMap.PropFrontLayers.Count - index - 1; return; } index -= Logic.Gameplay.Processor.CurrentMap.PropFrontLayers.Count; if (Logic.Gameplay.Processor.CurrentMap.PropBackLayers.Count > index) { layerType = MapEditor.EditLayer.PropBack; layer = Logic.Gameplay.Processor.CurrentMap.PropBackLayers.Count - index - 1; return; } index -= Logic.Gameplay.Processor.CurrentMap.PropBackLayers.Count; if (Logic.Gameplay.Processor.CurrentMap.GroundLayers.Count > index) { layerType = MapEditor.EditLayer.Ground; layer = Logic.Gameplay.Processor.CurrentMap.GroundLayers.Count - index - 1; return; } layerType = MapEditor.EditLayer.Data; layer = 0; }