import ui import constInfo class HealthBoard(ui.ThinBoard): def __init__(self): ui.ThinBoard.__init__(self) self.Config() def __del__(self): ui.ThinBoard.__del__(self) def Config(self): self.SetSize(200, 120) self.SetPosition(wndMgr.GetScreenWidth()/2 - self.GetWidth()/2+6-3, 10+30+30+20+10+10-46-12) self.hp_bar = ui.Gauge() self.hp_bar.SetParent(self) self.hp_bar.SetPosition(80, 30+20-15-10) self.hp_bar.MakeGauge(130, "red") self.hp_bar.Show() self.sp_bar = ui.Gauge() self.sp_bar.SetParent(self) self.sp_bar.SetPosition(80, 60+20-15-10) self.sp_bar.MakeGauge(130, "blue") self.sp_bar.Show() self.name = ui.TextLine() self.name.SetParent(self) self.name.SetDefaultFontName() self.name.SetPosition(120-30, 80+7-15-65) self.name.SetText("") self.name.Show() self.hp_show = ui.TextLine() self.hp_show.SetParent(self) self.hp_show.SetDefaultFontName() self.hp_show.SetPosition(120-30, 57-15-10) self.hp_show.SetText("") self.hp_show.Show() self.sp_show = ui.TextLine() self.sp_show.SetParent(self) self.sp_show.SetDefaultFontName() self.sp_show.SetPosition(120-30, 80+7-15-10) self.sp_show.SetText("") self.sp_show.Show() def OnUpdate(self): if (constInfo.PLAYER_HP+constInfo.PLAYER_MAX_HP+constInfo.PLAYER_SP+constInfo.PLAYER_MAX_SP) == 0: self.Hide() self.hp_bar.SetPercentage(constInfo.PLAYER_HP, constInfo.PLAYER_MAX_HP) self.sp_bar.SetPercentage(constInfo.PLAYER_SP, constInfo.PLAYER_MAX_SP) self.name.SetText(constInfo.PLAYER_NAME) self.hp_show.SetText("HP Miktari: %s / %s" % (constInfo.PLAYER_HP, constInfo.PLAYER_MAX_HP)) self.sp_show.SetText("SP Miktari: %s / %s" % (constInfo.PLAYER_SP, constInfo.PLAYER_MAX_SP)) self.name.SetText("Karakter: %s" % (constInfo.PLAYER_NAME))