- Add a third parameter to the text template: text colour. This way, not all plates are locked-in to using the same text colour.
- Add a third parameter to the background template: index. This way, there may be more than one background design, and it can be tied to the appropriate serial format(s).
- For license_plate_data, add one more attribute: colors, of the type 'string_array'. Implement the 'templates' and 'colors' attributes as ordered arrays, so that the array indices correspond with the associated background.
- Let's make this really versatile. Add another attribute to license_plate_data: voffset, an integer array. This will be the vertical offset in pixels from the centered position and its indices will also correspond with those of 'templates' and 'colors'.
Here's how the various files/units involved change:
//ui/license_plate/template.sii (current)
Code: Select all
ui::text_common : _nameless.00dc463c0 {
value: "california|3A38973"
look_template: txt.license_pl.txt
text: ""
coords_l: 0
coords_r: 160
coords_t: 55
coords_b: 13
area_l: 1
area_r: 0
area_t: 0
area_b: 1
id: 1
layer: 2
tab: -1
pointer: -1
apparent_depth: 0
my_parent: _nameless.00dc41970
}
ui::text_common : _nameless.00f2b2a90 {
value: "california|rear"
look_template: txt.license_pl.bcg
text: ""
coords_l: 0
coords_r: 160
coords_t: 80
coords_b: 0
area_l: 1
area_r: 0
area_t: 0
area_b: 1
id: 2
layer: 0
tab: -1
pointer: -1
apparent_depth: 0
my_parent: _nameless.00dc41970
}
Code: Select all
ui::text_common : _nameless.00dc463c0 {
value: "california|3A38973|FF430100|0" // The third parameter here is the default ARGB font face colour to be filled in from the colors attribute of license_plate_data
// The fourth is the default voffset value to be filled in from the voffset attribute of license_plate_data
look_template: txt.license_pl.txt
text: ""
coords_l: 0
coords_r: 160
coords_t: 55
coords_b: 13
area_l: 1
area_r: 0
area_t: 0
area_b: 1
id: 1
layer: 2
tab: -1
pointer: -1
apparent_depth: 0
my_parent: _nameless.00dc41970
}
ui::text_common : _nameless.00f2b2a90 {
value: "california|rear|0" // The third parameter here is the default background index to be filled in with the array index from the templates/colors attributes in license_plate_data
look_template: txt.license_pl.bcg
text: ""
coords_l: 0
coords_r: 160
coords_t: 80
coords_b: 0
area_l: 1
area_r: 0
area_t: 0
area_b: 1
id: 2
layer: 0
tab: -1
pointer: -1
apparent_depth: 0
my_parent: _nameless.00dc41970
}
//ui/templates/text.sii (current)
Code: Select all
ui::text_template : txt.license_pl.txt {
name: "License plate text"
text: "<nowrap><align hstyle=center vstyle=center><color value=FF430100><font face=/font/license_plate/%0.font>%1</font></align></nowrap>"
}
ui::text_template : txt.license_pl.bcg {
name: "License plate background"
text: "<img src=/material/ui/lp/%0/%1.mat xscale=stretch yscale=stretch>"
}
Code: Select all
ui::text_template : txt.license_pl.txt {
name: "License plate text"
text: "<nowrap><align hstyle=center vstyle=center><offset vshift=%3><color value=%2><font face=/font/license_plate/%0.font>%1</font></align></nowrap>"
// Note the addition of the offset tag with parameter 3, and how the color tag's value now uses parameter 2
}
ui::text_template : txt.license_pl.bcg {
name: "License plate background"
text: "<img src=/material/ui/lp/%0/%1_%2.mat xscale=stretch yscale=stretch>"
// Note the addition of parameter 2 to the material file name
}
license_plate_data (current)
Code: Select all
"license_plate_data":{
"superclass":"unit",
"attrs":{
"type":{
"type": "token"
},
"templates":{
"type": "string_array"
},
"def0":{
"type": "string_array"
},
"def1":{
"type": "string_array"
},
"def2":{
"type": "string_array"
},
"def3":{
"type": "string_array"
},
"def4":{
"type": "string_array"
},
"def5":{
"type": "string_array"
}
}
}
Code: Select all
"license_plate_data":{
"superclass":"unit",
"attrs":{
"type":{
"type": "token"
},
"templates":{
"type": "string_array"
},
"colors":{
"type": "string_array"
},
"voffset":{
"type": "int_array"
},
"def0":{
"type": "string_array"
},
"def1":{
"type": "string_array"
},
"def2":{
"type": "string_array"
},
"def3":{
"type": "string_array"
},
"def4":{
"type": "string_array"
},
"def5":{
"type": "string_array"
}
}
}