Code: Select all
init -1500 python:
class MouseTooltip(Tooltip, renpy.Displayable):
"""A Tooltip whose x/y position follows the mouse's."""
action = Action
def __init__(self, default, padding=None, *args, **kwargs):
super(renpy.Displayable, self).__init__(*args, **kwargs)
self.default = default
self.value = default
self.padding = padding or {}
self.pad_x = padding.get('x', 0)
self.pad_y = padding.get('y', 0)
self.x = 0
self.y = 0
self._redraw = False
@property
def redraw(self):
return self._redraw
@redraw.setter
def redraw(self, new_value):
self._redraw = new_value
renpy.redraw(self, 0)
def render(self, width, height, st, at):
# Only Text() displayables have a size method
try:
w, h = self.value.size()
except AttributeError:
child_render = renpy.render(self.value, width, height, st, at)
w, h = child_render.get_size()
render = renpy.Render(w, h)
render.place(self.value, x=self.x + self.pad_x, y=self.y + self.pad_y)
return render
def event(self, ev, x, y, st):
self.x = x
self.y = y
if self.redraw:
renpy.redraw(self, 0)
# Pass the event to our child
return self.value.event(ev, x, y, st)
Code: Select all
screen guo_map():
tag menu
use TL_keyfocus
viewport:
xysize (config.screen_width, config.screen_height)
child_size (4040, 2230)
window:
style "gm_root"
add "maps/GUO_map.png"
if persistent._map_audio == True and persistent._map_ocean_SFX == True:
mousearea: # For dyanmic sounds
focus_mask "GUO_FOCUS_OP"
hovered [ Play("sound", "sounds/map/ambient_seaside.ogg", loop=True)]
unhovered [Stop("sound",fadeout=2.5)]
xinitial 2300
yinitial 500
draggable True
edgescroll (350, 350)
use tooltip
for q in TL_GUO_loc:
$ nx = q.x +5
$ ny = q.y -12
if q.IsActive:
for n in TL_GUO:
if n.ID == q.ID:
$ act = SetVariable('nation', n)
button:
xpos nx
ypos ny
sensitive GuoPlace.CitySensitive == True
keyboard_focus True
if persistent.romanized:
if persistent.romanization == "Modern-Standard":
text RomanizedMap.get(q.name) style "MapText" at ambient
elif persistent.romanization == "Modern-Pinyin":
text RomanizedPinyinMap.get(q.name) style "MapTextRomanized" at ambient
else:
text RomanizedMap.get(q.name) style "MapText" at ambient
else:
text q.name style "MapText" at ambient
action [act, Stop("sound", fadeout=4.5), Show('guo')]
if not q.Port and not q.Capital:
#add "gui/map_bullet.png" xpos q.x ypos q.y
imagebutton:
idle "gui/map_bullet.png"
hover "gui/map_bullet.png"
xpos q.x
ypos q.y
hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("City"))]
unhovered SetField(mtt, 'redraw', False)
action NullAction()
if q.Port and not q.Capital:
#add "gui/map_port.png" xpos q.x ypos q.y
imagebutton:
idle "gui/map_port.png"
hover "gui/map_port.png"
xpos q.x
ypos q.y
hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("Port City", color="#FFFFFF"))]
unhovered SetField(mtt, 'redraw', False)
action NullAction()
if q.Capital and not q.Port:
#add "gui/map_bullet_capital.png" xpos q.x ypos q.y
imagebutton:
idle "gui/map_bullet_capital.png"
hover "gui/map_bullet_capital.png"
xpos q.x
ypos q.y
hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("Capital City"))]
unhovered SetField(mtt, 'redraw', False)
action NullAction()
if q.Capital and q.Port:
#add "gui/map_bullet_capital.png" xpos q.x ypos q.y
imagebutton:
idle "gui/map_bullet_capital.png"
hover "gui/map_bullet_capital.png"
xpos q.x
ypos q.y
hovered [SetField(mtt, 'redraw', True), mtt.Action(Text("Capital Port City", size=40))]
unhovered SetField(mtt, 'redraw', False)
action NullAction()
on "show":
action Play("notify", "sounds/menu/select_flip.ogg", loop=False)
on "hide":
action Stop("music", fadeout=2.5)