Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
kinbei committed Apr 22, 2024
1 parent d4075ca commit d5e11f3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
21 changes: 16 additions & 5 deletions startup/pkg/vaststars.gamerender/ui_datamodel/detail_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -661,18 +661,29 @@ for k, v in pairs(DRONE_STATUS) do
end

local function _update_drone_infos(datamodel)
local drone_infos = {}
for idx, eid in ipairs(datamodel.drones) do
local de = assert(gameplay_core.get_entity(eid))

local item = assert(de.drone.item)
local building = objects:coord(de.drone.next_x, de.drone.next_y)

datamodel.drone_infos[idx] = {
item_icon = item ~= 0 and iprototype.queryById(item).item_icon or "",
building_icon = building and iprototype.queryByName(building.prototype_name).item_icon or "",
status = DRONE_STATUS[de.drone.status],
}
local item_icon = item ~= 0 and iprototype.queryById(item).item_icon
local building_icon = building and iprototype.queryByName(building.prototype_name).item_icon

if item_icon and building_icon then
local home_icon = iprototype.queryById(de.drone.home).item_icon
drone_infos[#drone_infos + 1] = {
item_icon = item_icon or home_icon,
building_icon = building_icon or home_icon,
status = DRONE_STATUS[de.drone.status],
}
else

end
end

datamodel.drone_infos = drone_infos
end

function M.create(object_id)
Expand Down
26 changes: 17 additions & 9 deletions startup/pkg/vaststars.resources/ui/detail_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,22 @@
scroll-item-list {
overflow: scroll;
}
@keyframes arrow-move {
@keyframes arrow-move-1 {
0% {
background-position-x: 0vmin;
}
100% {
background-position-x: 2.65vmin;
}
}
@keyframes arrow-move-2 {
0% {
background-position-x: 0vmin;
}
100% {
background-position-x: -2.65vmin;
}
}
</style>
<style path = "/pkg/vaststars.resources/ui/common/building_style.css"/>
<script type="text/x-lua" >
Expand Down Expand Up @@ -172,12 +180,12 @@
</div>

<!-- airport -->
<div style="margin-left: 3%; margin-right: 3%; flex-direction: row; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 1vmin;" data-if = "chest_style=='airport'" data-event-longpress="onLongPress(ev, 'expanded-airport-info')" data-event-click="onClick(ev, 'expanded-airport-info')">
<div style="padding: 1vmin; align-items: center; justify-content: space-between; flex-direction: row; margin-top: 1vmin; width: 100%;" data-for="drone_infos">
<div class="small-item1" data-style-border = "it.status == 'go_mov1' and '0.2vmin rgb(214, 3, 75)' or (it.status == 'go_mov2' and '0.2vmin rgb(3, 150, 217)' or '0.2vmin rgb(251, 177, 61)')" style="width:7vmin; height:7vmin;" data-style-background-image="it.item_icon" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow1.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov1'" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow2.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov2'" />
<div class="small-item1" data-style-border = "it.status == 'go_mov1' and '0.2vmin rgb(214, 3, 75)' or (it.status == 'go_mov2' and '0.2vmin rgb(3, 150, 217)' or '0.2vmin rgb(251, 177, 61)')" style="width:7vmin; height:7vmin;" data-style-background-image="it.building_icon" />
<div style="margin-left: 3%; margin-right: 3%; flex-direction: row; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 1vmin; padding-top: 1vmin;" data-if = "chest_style=='airport'" data-event-longpress="onLongPress(ev, 'expanded-airport-info')" data-event-click="onClick(ev, 'expanded-airport-info')">
<div style="padding: 0vmin 1vmin 0vmin 1vmin; align-items: center; justify-content: space-between; flex-direction: row; width: 100%;" data-for="drone_infos">
<div class="small-item1" data-style-border = "it.status == 'go_mov1' and '0.2vmin rgb(214, 3, 75)' or (it.status == 'go_mov2' and '0.2vmin rgb(3, 150, 217)' or '0.2vmin rgb(251, 177, 61)')" style="width: 6vmin; height: 6vmin;" data-style-background-image="it.item_icon" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow1.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move-1 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov1'" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow2.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move-2 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov2'" />
<div class="small-item1" data-style-border = "it.status == 'go_mov1' and '0.2vmin rgb(214, 3, 75)' or (it.status == 'go_mov2' and '0.2vmin rgb(3, 150, 217)' or '0.2vmin rgb(251, 177, 61)')" style="width: 6vmin; height: 6vmin;" data-style-background-image="it.building_icon" />
</div>
</div>

Expand Down Expand Up @@ -367,8 +375,8 @@
<expanded-panel style="justify-content: flex-start; align-items: center; padding: 5.00%;" data-if = "areaid == 'expanded-airport-info'" data-event-longpress="onLongPressExpandedPanel(ev)">
<div style="padding: 1vmin; align-items: center; justify-content: space-between; flex-direction: row; margin-top: 1vmin; width: 100%;" data-for="drone_infos">
<div class="small-item1" data-style-border = "it.status == 'go_mov1' and '0.2vmin rgb(214, 3, 75)' or (it.status == 'go_mov2' and '0.2vmin rgb(3, 150, 217)' or '0.2vmin rgb(251, 177, 61)')" style="width: 11vmin; height: 11vmin;" data-style-background-image="it.item_icon" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow1.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov1'" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow2.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov2'" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow1.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move-1 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov1'" />
<div style = "width: 6.60vmin; height: 3.50vmin; background-image: '/pkg/vaststars.resources/ui/textures/detail/arrow2.texture'; background-size: 2.65vmin 2.65vmin; animation: arrow-move-2 2s infinite linear; background-repeat: repeat-x;" data-if = "it.status == 'go_mov2'" />
<div class="small-item1" data-style-border = "it.status == 'go_mov1' and '0.2vmin rgb(214, 3, 75)' or (it.status == 'go_mov2' and '0.2vmin rgb(3, 150, 217)' or '0.2vmin rgb(251, 177, 61)')" style="width: 11vmin; height: 11vmin;" data-style-background-image="it.building_icon" />
</div>
</expanded-panel>
Expand Down

0 comments on commit d5e11f3

Please sign in to comment.