Skip to content

Commit

Permalink
UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kinbei committed Apr 12, 2024
1 parent c4fabfe commit 7e2fab6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 12 additions & 0 deletions startup/pkg/vaststars.gamerender/ui_datamodel/detail_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,18 @@ click_item_handers["assembler"] = function(datamodel, e, itype, index)
end
end

click_item_handers["depot"] = function(datamodel, e, index)
local gameplay_world = gameplay_core.get_world()
local base = ibackpack.get_base_entity(gameplay_world)
local slot = assert(ichest.get(gameplay_world, e.chest, index))
local c = math.min(ibackpack.query(gameplay_world, base, slot.item), slot.limit - slot.amount)
if c > 0 then
assert(ibackpack.pickup(gameplay_world, base, slot.item, c))
ichest.place_at(gameplay_world, e, index, c)
itask.update_progress("backpack_to_building", iprototype.queryById(e.building.prototype).name, iprototype.queryById(slot.item).name, c)
end
end

---------------
local M = {}
local update_interval = 3 --update per 25 frame
Expand Down
14 changes: 8 additions & 6 deletions startup/pkg/vaststars.resources/ui/detail_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,16 @@

<!-- expanded panel - depot -->
<div class="tips-bg" style="flex-direction: row;" data-if = "areaid == 'expanded-depot-info'" data-event-longpress="onLongPressExpandedPanel(ev)">
<div style="width:80%; flex-direction: row; justify-content: center; align-items: center; flex-wrap: wrap;">
<div style='flex-direction: column; align-items: center;' data-for = "chest : chest_list_1">
<div class="small-item1" style="margin: 0.4vmin; width: 12.5vmin; height: 12.5vmin;" data-style-border = "chest.type == 'supply' and '0.3vmin rgb(254, 98, 124);' or (chest.type == 'demand' and '0.3vmin rgb(23, 176, 240);' or '0.2vmin rgb(255, 255, 255);')" data-style-background-image="chest.icon">
<div style="font-size: 5.00vmin; -webkit-text-stroke:0.25vmin rgb(0, 0, 0); position:absolute; top:-1vmin; right:0;" data-if="chest.icon ~= ''">x{{chest.count}}</div>
<scroll-item-list style="width: 100.00%; height: 80%; gap: 1vmin;">
<div style = "width: 100%; gap: 1vmin; align-items: center;" data-for="chest, index : chest_list_1" data-event-click = "clickItem('depot', index)">
<div style="flex-direction: row; width: 75%; height: 12.5vmin;">
<div class = "small-item1" style="width: 12.5vmin; height: 12.5vmin;" data-style-border = "chest.type == 'supply' and '0.3vmin rgb(254, 98, 124);' or ((chest.type == 'demand' or chest.type == 'transit') and '0.3vmin rgb(23, 176, 240);' or '0.2vmin rgb(255, 255, 255);')" data-style-background-image="chest.icon" />
<div style = "width: 60%; font-size: 4vmin; justify-content: flex-end; word-break: break-all;">{{chest.name}}</div>
<div style = "width: 20%; font-size: 3.5vmin; justify-content: flex-end;">x {{chest.count}}</div>
</div>
<div style='font-size: 2.5vmin; color:rgb(255, 166, 0); -webkit-text-stroke: 0.26vmin rgb(0,0,0);'>{{chest.name}}</div>
<div style="width: 82%; height: 0.10vmin; background-color: rgb(114, 108, 104);" />
</div>
</div>
</scroll-item-list>
</div>

<!-- expanded panel - laboratory -->
Expand Down

0 comments on commit 7e2fab6

Please sign in to comment.