99using SerialLoops . Lib . Script . Parameters ;
1010using SerialLoops . Lib . Util ;
1111using SkiaSharp ;
12+ using SoftCircuits . Collections ;
1213using static HaruhiChokuretsuLib . Archive . Event . EventFile ;
1314
1415namespace SerialLoops . Lib . Items ;
@@ -29,19 +30,18 @@ public ScriptItem(EventFile evt, EventTable evtTbl, Func<string, string> localiz
2930 evt . Name [ 0 ..^ 1 ] , ItemType . Script )
3031 {
3132 Event = evt ;
32- UpdateEventTableInfo ( evtTbl ) ;
3333 _localize = localize ;
3434
3535 PruneLabelsSection ( log ) ;
3636 Graph . AddVertexRange ( Event . ScriptSections ) ;
3737 }
3838
39- public Dictionary < ScriptSection , List < ScriptItemCommand > > GetScriptCommandTree ( Project project , ILogger log )
39+ public OrderedDictionary < ScriptSection , List < ScriptItemCommand > > GetScriptCommandTree ( Project project , ILogger log )
4040 {
4141 ScriptCommandInvocation currentCommand = null ;
4242 try
4343 {
44- Dictionary < ScriptSection , List < ScriptItemCommand > > commands = [ ] ;
44+ OrderedDictionary < ScriptSection , List < ScriptItemCommand > > commands = [ ] ;
4545 foreach ( ScriptSection section in Event . ScriptSections )
4646 {
4747 commands . Add ( section , [ ] ) ;
@@ -64,7 +64,7 @@ public Dictionary<ScriptSection, List<ScriptItemCommand>> GetScriptCommandTree(P
6464 }
6565 }
6666
67- public void CalculateGraphEdges ( Dictionary < ScriptSection , List < ScriptItemCommand > > commandTree , ILogger log )
67+ public void CalculateGraphEdges ( OrderedDictionary < ScriptSection , List < ScriptItemCommand > > commandTree , ILogger log )
6868 {
6969 try
7070 {
@@ -194,7 +194,7 @@ public void CalculateGraphEdges(Dictionary<ScriptSection, List<ScriptItemCommand
194194 }
195195 }
196196
197- public ScriptPreview GetScriptPreview ( Dictionary < ScriptSection , List < ScriptItemCommand > > commandTree ,
197+ public ScriptPreview GetScriptPreview ( OrderedDictionary < ScriptSection , List < ScriptItemCommand > > commandTree ,
198198 ScriptItemCommand currentCommand , Project project , ILogger log )
199199 {
200200 ScriptPreview preview = new ( ) ;
@@ -1069,12 +1069,36 @@ public static (SKBitmap PreviewImage, string ErrorImage) GeneratePreviewImage(Sc
10691069 }
10701070 }
10711071
1072+ // Draw select choices
1073+ if ( preview . CurrentChocies ? . Count > 0 )
1074+ {
1075+ List < SKBitmap > choiceGraphics = [ ] ;
1076+ foreach ( string choice in preview . CurrentChocies )
1077+ {
1078+ SKBitmap choiceGraphic = new ( 218 , 18 ) ;
1079+ SKCanvas choiceCanvas = new ( choiceGraphic ) ;
1080+ choiceCanvas . DrawRect ( 1 , 1 , 216 , 16 , new ( ) { Color = new ( 146 , 146 , 146 ) } ) ;
1081+ choiceCanvas . DrawRect ( 2 , 2 , 214 , 14 , new ( ) { Color = new ( 69 , 69 , 69 ) } ) ;
1082+ int choiceWidth = project . LangCode . Equals ( "ja" ) ? choice . Length * 14 : choice . Sum ( c => project . FontReplacement . ReverseLookup ( c ) . Offset ) ;
1083+ choiceCanvas . DrawHaroohieText ( choice , DialogueScriptParameter . Paint00 , project , ( 218 - choiceWidth ) / 2 , 2 ) ;
1084+ choiceCanvas . Flush ( ) ;
1085+ choiceGraphics . Add ( choiceGraphic ) ;
1086+ }
1087+
1088+ int graphicY = ( 192 - ( choiceGraphics . Count * 18 + ( choiceGraphics . Count - 1 ) * 8 ) ) / 2 + 184 ;
1089+ foreach ( SKBitmap choiceGraphic in choiceGraphics )
1090+ {
1091+ canvas . DrawBitmap ( choiceGraphic , 19 , graphicY ) ;
1092+ graphicY += 26 ;
1093+ }
1094+ }
1095+
10721096 canvas . Flush ( ) ;
10731097 return ( previewBitmap , null ) ;
10741098 }
10751099
10761100 public ( SKBitmap PreviewImage , string ErrorImage ) GeneratePreviewImage (
1077- Dictionary < ScriptSection , List < ScriptItemCommand > > commandTree , ScriptItemCommand currentCommand ,
1101+ OrderedDictionary < ScriptSection , List < ScriptItemCommand > > commandTree , ScriptItemCommand currentCommand ,
10781102 Project project , ILogger log )
10791103 {
10801104 return GeneratePreviewImage ( GetScriptPreview ( commandTree , currentCommand , project , log ) , project ) ;
0 commit comments