Refresh private shop ad board on render
This commit is contained in:
@@ -94,24 +94,32 @@ class PrivateShopAdvertisementBoard(ui.ThinBoard):
|
||||
net.SendOnClickPacket(self.vid)
|
||||
|
||||
return True
|
||||
|
||||
def OnUpdate(self):
|
||||
|
||||
def __UpdateProjectedPosition(self):
|
||||
if not self.vid:
|
||||
return
|
||||
|
||||
projectVID = None
|
||||
if systemSetting.IsShowSalesText():
|
||||
self.Show()
|
||||
x, y = chr.GetProjectPosition(self.vid, 220)
|
||||
self.SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
|
||||
projectVID = self.vid
|
||||
elif player.GetMainCharacterIndex() == self.vid:
|
||||
projectVID = player.GetMainCharacterIndex()
|
||||
|
||||
if projectVID is None:
|
||||
self.Hide()
|
||||
return
|
||||
|
||||
self.Show()
|
||||
x, y = chr.GetProjectPosition(projectVID, 220)
|
||||
self.SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
|
||||
|
||||
else:
|
||||
for key in list(g_privateShopAdvertisementBoardDict.keys()):
|
||||
if player.GetMainCharacterIndex() == key: # When the private shop is visible and closed, the player's own shop ID changes.
|
||||
g_privateShopAdvertisementBoardDict[key].Show()
|
||||
x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220)
|
||||
g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
|
||||
else:
|
||||
g_privateShopAdvertisementBoardDict[key].Hide()
|
||||
def OnUpdate(self):
|
||||
self.__UpdateProjectedPosition()
|
||||
|
||||
def OnRender(self):
|
||||
# Keep the board anchored to the interpolated render position instead
|
||||
# of the legacy fixed update cadence.
|
||||
self.__UpdateProjectedPosition()
|
||||
|
||||
class PrivateShopBuilder(ui.ScriptWindow):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user