class GuildWarScoreBoard(ui.ThinBoard): def __init__(self): ui.ThinBoard.__init__(self) self.Initialize() def __del__(self): ui.ThinBoard.__del__(self) def Initialize(self): self.allyGuildID = 0 self.enemyGuildID = 0 self.allyDataDict = {} self.enemyDataDict = {} def Open(self, allyGuildID, enemyGuildID): self.allyGuildID = allyGuildID self.enemyGuildID = enemyGuildID self.SetPosition(10, wndMgr.GetScreenHeight() - 200) self.AddFlag('movable') mark = ui.MarkBox() mark.SetParent(self) mark.SetIndex(allyGuildID) mark.SetPosition(15, 10 + 14*0) mark.Show() scoreText = ui.TextLine() scoreText.SetParent(self) scoreText.SetPosition(45, 10 + 16*0+25) scoreText.SetFontName("Arial:35") scoreText.SetHorizontalAlignLeft() scoreText.Show() NameText = ui.TextLine() NameText.SetParent(self) NameText.SetPosition(35,5 + 18*0) NameText.SetFontName("Arial:18") NameText.SetHorizontalAlignLeft() NameText.Show() # skillSlot = ui.GridSlotWindow() # skillSlot.SetParent(self) # skillSlot.ArrangeSlot(0, 3, 2, 32, 32, 0, 0) # skillSlot.SetPosition(15, 10 + 68) # skillSlot.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0) # skillSlot.SetSkillSlot(0, 151, 1) # skillSlot.SetSkillSlot(1, 152, 1) # skillSlot.SetSkillSlot(2, 153, 1) # skillSlot.SetSkillSlot(3, 154, 1) # skillSlot.SetSkillSlot(4, 155, 1) # skillSlot.SetSkillSlot(5, 156, 1) # skillSlot.Show() self.allyDataDict["NAME"] = guild.GetGuildName(allyGuildID) self.allyDataDict["SCORE"] = 0 self.allyDataDict["MEMBER_COUNT"] = -1 self.allyDataDict["MARK"] = mark self.allyDataDict["TEXT"] = scoreText self.allyDataDict["TEXT_NAME"] = NameText # self.allyDataDict["SKILL"] = skillSlot mark = ui.MarkBox() mark.SetParent(self) mark.SetIndex(enemyGuildID) mark.SetPosition(30+120, 10 + 14*0) mark.Show() scoreText = ui.TextLine() scoreText.SetParent(self) scoreText.SetPosition(60+130, 10 + 16*0+25) scoreText.SetFontName("Arial:35") scoreText.SetHorizontalAlignLeft() scoreText.Show() NameText = ui.TextLine() NameText.SetParent(self) NameText.SetPosition(50+120,5 + 18*0) NameText.SetFontName("Arial:18") NameText.SetHorizontalAlignLeft() NameText.Show() # skillSlot = ui.GridSlotWindow() # skillSlot.SetParent(self) # skillSlot.ArrangeSlot(0, 3, 2, 32, 32, 0, 0) # skillSlot.SetPosition(50+120, 10 + 68) # skillSlot.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0) # skillSlot.SetSkillSlot(0, 151, 1) # skillSlot.SetSkillSlot(1, 152, 1) # skillSlot.SetSkillSlot(2, 153, 1) # skillSlot.SetSkillSlot(3, 154, 1) # skillSlot.SetSkillSlot(4, 155, 1) # skillSlot.SetSkillSlot(5, 156, 1) # skillSlot.Show() self.enemyDataDict["NAME"] = guild.GetGuildName(enemyGuildID) self.enemyDataDict["SCORE"] = 0 self.enemyDataDict["MEMBER_COUNT"] = -1 self.enemyDataDict["MARK"] = mark self.enemyDataDict["TEXT"] = scoreText self.enemyDataDict["TEXT_NAME"] = NameText # self.enemyDataDict["SKILL"] = skillSlot self.imgCenter = ui.ExpandedImageBox() self.imgCenter.SetParent(self) self.imgCenter.SetPosition(122, 10 + 16*0+35) self.imgCenter.LoadImage("d:/ymir work/ui/sold_icon/guild_vs.tga") self.imgCenter.Show() self.__RefreshName() self.SetSize(290, 90) self.Show() def __GetDataDict(self, ID): if self.allyGuildID == ID: return self.allyDataDict if self.enemyGuildID == ID: return self.enemyDataDict return None def SetScore(self, gainGuildID, opponetGuildID, point): dataDict = self.__GetDataDict(gainGuildID) if not dataDict: return dataDict["SCORE"] = point self.__RefreshName() def UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2): dataDict1 = self.__GetDataDict(guildID1) dataDict2 = self.__GetDataDict(guildID2) if dataDict1: dataDict1["MEMBER_COUNT"] = memberCount1 if dataDict2: dataDict2["MEMBER_COUNT"] = memberCount2 self.__RefreshName() def __RefreshName(self): nameMaxLen = max(len(self.allyDataDict["NAME"]), len(self.enemyDataDict["NAME"])) if -1 == self.allyDataDict["MEMBER_COUNT"] or -1 == self.enemyDataDict["MEMBER_COUNT"]: self.allyDataDict["TEXT_NAME"].SetText("%s" % (self.allyDataDict["NAME"])) self.enemyDataDict["TEXT_NAME"].SetText("%s" % (self.enemyDataDict["NAME"])) else: self.allyDataDict["TEXT_NAME"].SetText("%s(%d)" % (self.allyDataDict["NAME"], self.allyDataDict["MEMBER_COUNT"])) self.enemyDataDict["TEXT_NAME"].SetText("%s(%d)" % (self.enemyDataDict["NAME"], self.enemyDataDict["MEMBER_COUNT"])) self.allyDataDict["TEXT"].SetText("%s" % (self.allyDataDict["SCORE"])) self.enemyDataDict["TEXT"].SetText("%s" % (self.enemyDataDict["SCORE"]))