Fix typed tactics command view generation
ober
a89df570a6d6f995dfe7cb8404a835ce141cee8c
--- a/templates/original-tactics-parts/BattleCommandView.kt.ss +++ b/templates/original-tactics-parts/BattleCommandView.kt.ss @@ -8,6 +8,8 @@ (android graphics Canvas) (android graphics Color) (android graphics Paint) + (android graphics Paint Style) + (android graphics Paint Align) (android graphics RectF) (android view View) (android util DisplayMetrics) @@ -21,8 +23,8 @@ (type DisplayMetrics) (type Canvas) (type Paint) - (type PaintStyle) - (type PaintAlign) + (type Style) + (type Align) (type RectF) (type View) (type JSONArray) @@ -33,15 +35,15 @@ (extern (bcvPaintAntiAliasFlag) : Int32 (kotlin-value Paint ANTI_ALIAS_FLAG)) - (extern (bcvPaintStyleFill) : PaintStyle + (extern (bcvPaintStyleFill) : Style (kotlin-value Paint Style FILL)) - (extern (bcvPaintStyleStroke) : PaintStyle + (extern (bcvPaintStyleStroke) : Style (kotlin-value Paint Style STROKE)) - (extern (bcvPaintAlignLeft) : PaintAlign + (extern (bcvPaintAlignLeft) : Align (kotlin-value Paint Align LEFT)) - (extern (bcvPaintAlignCenter) : PaintAlign + (extern (bcvPaintAlignCenter) : Align (kotlin-value Paint Align CENTER)) - (extern (bcvPaintAlignRight) : PaintAlign + (extern (bcvPaintAlignRight) : Align (kotlin-value Paint Align RIGHT)) (extern (bcvColorWhite) : Int32 (kotlin-value Color WHITE)) @@ -49,7 +51,7 @@ (kotlin-call Color rgb)) (extern (bcvPaintColorSet (paint : Paint) (value : Int32)) : Unit (kotlin-member-set color)) - (extern (bcvPaintStyleSet (paint : Paint) (value : PaintStyle)) : Unit + (extern (bcvPaintStyleSet (paint : Paint) (value : Style)) : Unit (kotlin-member-set style)) (extern (bcvPaintStrokeWidthSet (paint : Paint) (value : Float32)) : Unit (kotlin-member-set strokeWidth)) @@ -57,7 +59,7 @@ (kotlin-member-set textSize)) (extern (bcvPaintFakeBoldSet (paint : Paint) (value : Bool)) : Unit (kotlin-member-set isFakeBoldText)) - (extern (bcvPaintTextAlignSet (paint : Paint) (value : PaintAlign)) : Unit + (extern (bcvPaintTextAlignSet (paint : Paint) (value : Align)) : Unit (kotlin-member-set textAlign)) (extern (bcvPaintMeasureText (paint : Paint) (text : String)) : Float32 (kotlin-member-call measureText)) @@ -137,7 +139,7 @@ (kotlin-call shipDisplayLabel)) (def (bcvConfigurePaint (paint : Paint) (color : Int32) - (style : PaintStyle) + (style : Style) (strokeWidth : Float32)) : Paint (begin (bcvPaintColorSet paint color) --- a/templates/original-tactics-parts/BridgeHudView.kt.ss +++ b/templates/original-tactics-parts/BridgeHudView.kt.ss @@ -8,6 +8,8 @@ (android graphics Canvas) (android graphics Color) (android graphics Paint) + (android graphics Paint Style) + (android graphics Paint Align) (android graphics RectF) (android view View) (android util DisplayMetrics) @@ -21,8 +23,8 @@ (type DisplayMetrics) (type Canvas) (type Paint) - (type PaintStyle) - (type PaintAlign) + (type Style) + (type Align) (type RectF) (type View) (type JSONArray) @@ -32,17 +34,17 @@ (type Float32) (extern (bhvPaintAntiAliasFlag) : Int32 (kotlin-value Paint ANTI_ALIAS_FLAG)) - (extern (bhvPaintStyleFill) : PaintStyle (kotlin-value Paint Style FILL)) - (extern (bhvPaintStyleStroke) : PaintStyle (kotlin-value Paint Style STROKE)) - (extern (bhvPaintAlignLeft) : PaintAlign (kotlin-value Paint Align LEFT)) - (extern (bhvPaintAlignCenter) : PaintAlign (kotlin-value Paint Align CENTER)) - (extern (bhvPaintAlignRight) : PaintAlign (kotlin-value Paint Align RIGHT)) + (extern (bhvPaintStyleFill) : Style (kotlin-value Paint Style FILL)) + (extern (bhvPaintStyleStroke) : Style (kotlin-value Paint Style STROKE)) + (extern (bhvPaintAlignLeft) : Align (kotlin-value Paint Align LEFT)) + (extern (bhvPaintAlignCenter) : Align (kotlin-value Paint Align CENTER)) + (extern (bhvPaintAlignRight) : Align (kotlin-value Paint Align RIGHT)) (extern (bhvColorWhite) : Int32 (kotlin-value Color WHITE)) (extern (bhvColorRgb (r : Int32) (g : Int32) (b : Int32)) : Int32 (kotlin-call Color rgb)) (extern (bhvPaintColorSet (paint : Paint) (value : Int32)) : Unit (kotlin-member-set color)) - (extern (bhvPaintStyleSet (paint : Paint) (value : PaintStyle)) : Unit + (extern (bhvPaintStyleSet (paint : Paint) (value : Style)) : Unit (kotlin-member-set style)) (extern (bhvPaintStrokeWidthSet (paint : Paint) (value : Float32)) : Unit (kotlin-member-set strokeWidth)) @@ -50,7 +52,7 @@ (kotlin-member-set textSize)) (extern (bhvPaintFakeBoldSet (paint : Paint) (value : Bool)) : Unit (kotlin-member-set isFakeBoldText)) - (extern (bhvPaintTextAlignSet (paint : Paint) (value : PaintAlign)) : Unit + (extern (bhvPaintTextAlignSet (paint : Paint) (value : Align)) : Unit (kotlin-member-set textAlign)) (extern (bhvPaintMeasureText (paint : Paint) (text : String)) : Float32 (kotlin-member-call measureText)) @@ -120,7 +122,7 @@ (kotlin-call shipTechnicalLabel)) (def (bhvConfigurePaint (paint : Paint) (color : Int32) - (style : PaintStyle) (stroke : Float32)) : Paint + (style : Style) (stroke : Float32)) : Paint (begin (bhvPaintColorSet paint color) (bhvPaintStyleSet paint style) @@ -453,14 +455,15 @@ (string-append (string-append (string-append - (string-append - (string-append "SPD " speed) "/") planned) - " PWR ") + (string-append (string-append "SPD " speed) "/") + planned) + " PWR ") + (string-append (int32->string (bhvNullableIntField power "unspent-energy" (int32 0))) - (string-append "/" - (int32->string - (bhvNullableIntField power "total-power" (int32 0))))) + (string-append "/" + (int32->string + (bhvNullableIntField power "total-power" (int32 0)))))) smallPaint (- (bhvRectWidth rect) (float32 16.0))) (+ (bhvRectLeft rect) (float32 8.0)) (+ y (float32 19.0)) smallPaint)))) @@ -495,7 +498,7 @@ (- (bhvRectWidth rect) (float32 16.0)) "ARMED" (counterTotal (bhvNullableAnyField ship "armed-weapons")) (bhvMaxInt (int32 1) - (counterTotal (bhvNullableAnyField ship "weapons")))))))))) + (counterTotal (bhvNullableAnyField ship "weapons"))))))))))) (def (drawCenterBlock (canvas : Canvas) (rect : RectF) (current : JSONObject) (battle : JSONObject) @@ -561,7 +564,8 @@ (if (> seekers (int32 0)) warningPaint readyPaint)) (drawCountPill canvas rect (+ y (float32 44.0)) "UNITS" smallUnits - (if (> smallUnits (int32 0)) warningPaint readyPaint))))) + (if (> smallUnits (int32 0)) warningPaint readyPaint)) + (begin)))) (bhvPaintTextAlignSet smallPaint (bhvPaintAlignCenter)) (bhvCanvasDrawText canvas (fitText (latestEventText events) smallPaint @@ -713,7 +717,8 @@ (+ (bhvRectLeft cell) (/ cellWidth (float32 2.0))) (+ y (float32 24.0)) shieldTextPaint) (begin)) - ignored))))))))))))))) + ignored)))))) + (begin)))))))))) (def (shipName (ship : (Nullable JSONObject)) (statusShip : (Nullable JSONObject))) : String