Nlgp1.StageEditor.Notifiers.LayerNotifier.ChipTableを削除
@@ -31,12 +31,6 @@ | ||
31 | 31 | private set; |
32 | 32 | } |
33 | 33 | |
34 | - public Dictionary<int , ChipNotifier> ChipTable { | |
35 | - get { | |
36 | - return ChipList.ToDictionary( data => data.Index ); | |
37 | - } | |
38 | - } | |
39 | - | |
40 | 34 | public LayerNotifier( int row , int column ) { |
41 | 35 | this.ChipsetImage = new ChipsetImage(); |
42 | 36 | this.ChipList = new List<ChipNotifier>(); |
@@ -115,27 +115,20 @@ | ||
115 | 115 | } |
116 | 116 | |
117 | 117 | private static ChipData[,] GetMap( LayerNotifier layer ) { |
118 | - var chipTable = layer.ChipTable; | |
119 | - var commonChipset = chipTable.ToDictionary< | |
120 | - KeyValuePair<int , ChipNotifier> , int , ChipData>( | |
121 | - source => source.Key , | |
122 | - source => ConvertChip( source.Value ) ); | |
118 | + var chipList = layer.ChipList; | |
119 | + var chipDataList = chipList.Select( ( chipNotify ) => ConvertChip( chipNotify ) ).ToArray(); | |
123 | 120 | |
124 | 121 | var map = layer.Map; |
125 | - var commonMap = new ChipData[map[0].Count , map.Count]; | |
122 | + var chipDataMap = new ChipData[map[0].Count , map.Count]; | |
126 | 123 | for( int y = 0 ; y < map.Count ; y++ ) { |
127 | 124 | var row = map[y]; |
128 | 125 | for( int x = 0 ; x < row.Count ; x++ ) { |
129 | 126 | var chipIndex = row[x]; |
130 | - if( commonChipset.ContainsKey( chipIndex ) ){ | |
131 | - var chip = commonChipset[chipIndex]; | |
132 | - commonMap[x , y] = chip; | |
133 | - }else if( commonChipset.ContainsKey( 0 ) ){ | |
134 | - commonMap[x , y] = commonChipset[0]; | |
135 | - } | |
127 | + var chip = chipDataList[chipIndex]; | |
128 | + chipDataMap[x , y] = chip; | |
136 | 129 | } |
137 | 130 | } |
138 | - return commonMap; | |
131 | + return chipDataMap; | |
139 | 132 | } |
140 | 133 | } |
141 | 134 | } |
@@ -35,9 +35,8 @@ | ||
35 | 35 | } |
36 | 36 | public void SetCurrentLayerChip(LayerNotifier layer, int chipIndex) |
37 | 37 | { |
38 | - ChipNotifier chip; | |
39 | - if (layer.ChipTable.TryGetValue(chipIndex, out chip)) { | |
40 | - layerCurrentChipTable[layer] = chip; | |
38 | + if (chipIndex < layer.ChipList.Count) { | |
39 | + layerCurrentChipTable[layer] = layer.ChipList[chipIndex]; | |
41 | 40 | } |
42 | 41 | } |
43 | 42 | private Dictionary<LayerNotifier, ChipNotifier> layerCurrentChipTable; |
@@ -73,7 +73,7 @@ | ||
73 | 73 | } |
74 | 74 | |
75 | 75 | private static void SetMap( LayerData commonLayer , LayerNotifier layer ) { |
76 | - var chipTable = layer.ChipTable; | |
76 | + var chipList = layer.ChipList; | |
77 | 77 | var commonMap = commonLayer.Map; |
78 | 78 | |
79 | 79 | var map = new List<List<ChipNotifier>>(); |
@@ -83,7 +83,7 @@ | ||
83 | 83 | var commonChip = commonMap[x , y]; |
84 | 84 | if( commonChip == null ) |
85 | 85 | continue; |
86 | - var chip = chipTable[commonChip.Index]; | |
86 | + var chip = chipList[commonChip.Index]; | |
87 | 87 | row.Add( chip ); |
88 | 88 | } |
89 | 89 | map.Add( row ); |
@@ -397,7 +397,7 @@ | ||
397 | 397 | private void DrawChipImage(Graphics graphics, LayerNotifier layer) |
398 | 398 | { |
399 | 399 | var chipsetImage = layer.ChipsetImage; |
400 | - var chipTable = layer.ChipTable; | |
400 | + var chipList = layer.ChipList; | |
401 | 401 | |
402 | 402 | var scale = editor.Scale; |
403 | 403 | var chipSize = stage.ChipSize * scale; |
@@ -412,7 +412,7 @@ | ||
412 | 412 | { |
413 | 413 | var x = (j - hScroll.Value) * chipSize; |
414 | 414 | var y = (i - vScroll.Value) * chipSize; |
415 | - var chip = chipTable[chipIndex]; | |
415 | + var chip = chipList[chipIndex]; | |
416 | 416 | var imageIndex = chip.Index; |
417 | 417 | var image = chipsetImage[imageIndex]; |
418 | 418 | graphics.DrawImage(image, x, y, chipSize, chipSize); |
@@ -423,7 +423,7 @@ | ||
423 | 423 | |
424 | 424 | private void DrawChipFrame(Graphics graphics, LayerNotifier layer) |
425 | 425 | { |
426 | - var chipTable = layer.ChipTable; | |
426 | + var chipList = layer.ChipList; | |
427 | 427 | |
428 | 428 | var color = editor.GetLayerViewerSetting(layer).FrameColor; |
429 | 429 | var penmWidth = 3; |
@@ -439,7 +439,7 @@ | ||
439 | 439 | { |
440 | 440 | var chipIndex = chipRow[j]; |
441 | 441 | if (chipIndex > ChipNotifier.NoneIndex) { |
442 | - var chip = chipTable[chipIndex]; | |
442 | + var chip = chipList[chipIndex]; | |
443 | 443 | var x = j * chipSize; |
444 | 444 | var y = i * chipSize; |
445 | 445 | graphics.DrawRectangle(pen, x + 1, y + 1, chipSize - 2, chipSize - 2); |