Changes

no edit summary
Line 8: Line 8:  
_battle_card_size_hd = "240x60px",
 
_battle_card_size_hd = "240x60px",
 
_battle_card_layers = {
 
_battle_card_layers = {
 +
    hell_ = { image = "Hell plane 2.png", top = 5, left = 50, width = 30 },
 
takoyaki = {image = "Hell plane 2.png", style = {top = "5px", left = "50px"}, size = "30x30px"},
 
takoyaki = {image = "Hell plane 2.png", style = {top = "5px", left = "50px"}, size = "30x30px"},
 
hell = {image = "Hell plane 2.png", style = {top = "5px", left = "50px"}, size = "30x30px"},
 
hell = {image = "Hell plane 2.png", style = {top = "5px", left = "50px"}, size = "30x30px"},
Line 73: Line 74:  
end
 
end
   −
function ShipBattleCardKai:get_layer(hd, layer)
+
local function scaleLayer(hd, layer)
     return hd and self._battle_card_layers[layer .. "_hd"] or self._battle_card_layers[layer]
+
     local top, left, width, height = layer.top, layer.left, layer.width, layer.height or layer.width
 +
    layer.style = layer.style or {}
 +
    if top then
 +
        layer.style.top = top * (hd and 1.5 or 1) .. 'px'
 +
    end
 +
    if left then
 +
        layer.style.left = left * (hd and 1.5 or 1) .. 'px'
 +
    end
 +
    if width then
 +
        layer.style.size = width * (hd and 1.5 or 1) .. 'x' .. height * (hd and 1.5 or 1) .. 'px'
 +
    end
 +
    return layer
 +
end
 +
 
 +
function ShipBattleCardKai:get_layer(hd, layer_name)
 +
    return scaleLayer(hd, self._battle_card_layers[layer_name])
 
end
 
end
  
cssedit, gkautomate
7,064

edits