Line 13: |
Line 13: |
| _column_cell_templates = { | | _column_cell_templates = { |
| ship = [[| rowspan="4" style="background: transparent;" |${values.ship_card}]], | | ship = [[| rowspan="4" style="background: transparent;" |${values.ship_card}]], |
− | equips = [[| style="background: whitesmoke;" |${values.equips1} | + | equips = [[| style="background: whitesmoke;" |${values.equips}]], |
− | |-
| |
− | | style="background: whitesmoke;" |${values.equips2}
| |
− | |-
| |
− | | style="background: whitesmoke;" |${values.equips3}
| |
− | |-
| |
− | | style="background: whitesmoke;" |${values.equips4}]],
| |
| ship2 = [[| rowspan="4" style="background: transparent;" |${values.ship_card}]], | | ship2 = [[| rowspan="4" style="background: transparent;" |${values.ship_card}]], |
− | equips2 = [[| style="background: whitesmoke;" |${values.equips1} | + | equips2 = [[| style="background: whitesmoke;" |${values.equips}]] |
− | |-
| |
− | | style="background: whitesmoke;" |${values.equips2}
| |
− | |-
| |
− | | style="background: whitesmoke;" |${values.equips3}
| |
− | |-
| |
− | | style="background: whitesmoke;" |${values.equips4}]]
| |
| }, | | }, |
| _columns = { | | _columns = { |
Line 45: |
Line 33: |
| function NanaminFleet:ship(row) | | function NanaminFleet:ship(row) |
| local value | | local value |
− | if row[1] == false then | + | if row[1] == nil or row[1] == "break" then |
| + | return false |
| + | elseif row[1] == false then |
| value = Formatting:format_image{self._blank, size = self._size} | | value = Formatting:format_image{self._blank, size = self._size} |
| else | | else |
Line 59: |
Line 49: |
| | | |
| function NanaminFleet:equips(row) | | function NanaminFleet:equips(row) |
− | local value1 = "Lol" | + | value = "Lol" |
− | local value2 = "Lol2"
| + | return {values = {equips = value}, bg_color = self._equip_bg, text_align = self._center_align} |
− | local value3 = "Lol3"
| |
− | local value4 = "Lol4"
| |
− | return {values = {equips1 = value1, equips2 = value2, equips3 = value3, equips4 = value4}, bg_color = self._equip_bg, text_align = self._center_align} | |
| end | | end |
| | | |
Line 85: |
Line 72: |
| | | |
| function NanaminFleet:create_items() | | function NanaminFleet:create_items() |
− | local count = 0 | + | local row1, row2, row3, row4 = {}, {}, {}, {} |
− | local row = {}
| |
| for index, item_key in ipairs(self._args) do | | for index, item_key in ipairs(self._args) do |
− | count = count + 1
| |
| local item | | local item |
| + | |
| if item_key == "-" then | | if item_key == "-" then |
| item = false | | item = false |
Line 99: |
Line 85: |
| end | | end |
| end | | end |
− | if count % 5 == 1 or count % 5 == 2 then | + | |
− | table.insert(row, item) | + | local row_number = {1, 1, 2, 3, 4, 1, 1, 2, 3, 4} |
| + | if row_number[index % 10] == 1 then |
| + | table.insert(row1, item) |
| + | elseif row_number[index % 10] == 2 then |
| + | table.insert(row2, "break") |
| + | table.insert(row2, item) |
| + | elseif row_number[index % 10] == 3 then |
| + | table.insert(row3, "break") |
| + | table.insert(row3, item) |
| + | else |
| + | table.insert(row4, "break") |
| + | table.insert(row4, item) |
| end | | end |
− | if count % 10 == 0 then | + | |
− | table.insert(self._items, row) | + | if index % 10 == 0 then |
− | row = {} | + | table.insert(self._items, row1) |
| + | table.insert(self._items, row2) |
| + | table.insert(self._items, row3) |
| + | table.insert(self._items, row4) |
| + | row1, row2, row3, row4 = {}, {}, {}, {} |
| end | | end |
| end | | end |
Line 113: |
Line 114: |
| local row_values = {} | | local row_values = {} |
| for _, column in ipairs(self._columns) do | | for _, column in ipairs(self._columns) do |
− | row_values[column] = self[column](self, item) | + | local value = self[column](self, item) |
− | row_values[column].rowspan = item.class ~= nil and 4 or 1 | + | if value then |
− | row_values[column].colspan = 1
| + | row_values[column] = value |
| + | row_values[column].rowspan = item.class ~= nil and 4 or 1 |
| + | row_values[column].colspan = 1 |
| + | end |
| end | | end |
| table.insert(self._data_rows, row_values) | | table.insert(self._data_rows, row_values) |
| end | | end |
− | end
| |
− |
| |
− | function NanaminFleet:create_header()
| |
− | self._header = format(self._header_template, {})
| |
| end | | end |
| | | |
| return NanaminFleet | | return NanaminFleet |