Skip to content

Commit

Permalink
CommonClient: Add a hints tab (ArchipelagoMW#2392)
Browse files Browse the repository at this point in the history
Co-authored-by: el-u <[email protected]>
  • Loading branch information
Silvris and el-u authored Nov 7, 2023
1 parent 779a312 commit ced35c5
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 83 deletions.
7 changes: 6 additions & 1 deletion CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
ctx.slot_info = {int(pid): data for pid, data in args["slot_info"].items()}
ctx.hint_points = args.get("hint_points", 0)
ctx.consume_players_package(args["players"])
ctx.stored_data_notification_keys.add(f"_read_hints_{ctx.team}_{ctx.slot}")
msgs = []
if ctx.locations_checked:
msgs.append({"cmd": "LocationChecks",
Expand Down Expand Up @@ -836,10 +837,14 @@ async def process_server_cmd(ctx: CommonContext, args: dict):

elif cmd == "Retrieved":
ctx.stored_data.update(args["keys"])
if ctx.ui and f"_read_hints_{ctx.team}_{ctx.slot}" in args["keys"]:
ctx.ui.update_hints()

elif cmd == "SetReply":
ctx.stored_data[args["key"]] = args["value"]
if args["key"].startswith("EnergyLink"):
if ctx.ui and f"_read_hints_{ctx.team}_{ctx.slot}" == args["key"]:
ctx.ui.update_hints()
elif args["key"].startswith("EnergyLink"):
ctx.current_energy_link_value = args["value"]
if ctx.ui:
ctx.ui.set_new_energy_link_value()
Expand Down
75 changes: 70 additions & 5 deletions data/client.kv
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
color: "FFFFFF"
<TabbedPanel>:
tab_width: root.width / app.tab_count
<TooltipLabel>:
text_size: self.width, None
size_hint_y: None
height: self.texture_size[1]
font_size: dp(20)
markup: True
<SelectableLabel>:
canvas.before:
Color:
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1)
Rectangle:
size: self.size
pos: self.pos
text_size: self.width, None
size_hint_y: None
height: self.texture_size[1]
font_size: dp(20)
markup: True
<UILog>:
messages: 1000 # amount of messages stored in client logs.
cols: 1
Expand All @@ -44,6 +45,70 @@
height: self.minimum_height
orientation: 'vertical'
spacing: dp(3)
<HintLabel>:
canvas.before:
Color:
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1) if self.striped else (0.18, 0.18, 0.18, 1)
Rectangle:
size: self.size
pos: self.pos
height: self.minimum_height
receiving_text: "Receiving Player"
item_text: "Item"
finding_text: "Finding Player"
location_text: "Location"
entrance_text: "Entrance"
found_text: "Found?"
TooltipLabel:
id: receiving
text: root.receiving_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: item
text: root.item_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: finding
text: root.finding_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: location
text: root.location_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: entrance
text: root.entrance_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: found
text: root.found_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
<HintLog>:
cols: 1
viewclass: 'HintLabel'
scroll_y: self.height
scroll_type: ["content", "bars"]
bar_width: dp(12)
effect_cls: "ScrollEffect"
SelectableRecycleBoxLayout:
default_size: None, dp(20)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(3)
<ServerLabel>:
text: "Server:"
size_hint_x: None
Expand Down
Loading

0 comments on commit ced35c5

Please sign in to comment.