def SetHP(self, hpPercentage, iMinHP, iMaxHP): if not self.hpGauge.IsShow(): if app.ENABLE_VIEW_TARGET_PLAYER_HP: showingButtonCount = len(self.showingButtonList) if showingButtonCount > 0: if chr.GetInstanceType( self.vid) == chr.INSTANCE_TYPE_PLAYER: self.SetSize( max(150 + 75 * 3, showingButtonCount * 75), self.GetHeight()) else: self.SetSize(200 + 7 * self.nameLength, self.GetHeight()) else: self.SetSize(200 + 7 * self.nameLength, self.GetHeight()) else: self.SetSize(200 + 7 * self.nameLength, self.GetHeight()) if localeInfo.IsARABIC(): self.name.SetPosition(self.GetWidth() - 23, 13) else: self.name.SetPosition(23, 13) self.name.SetWindowHorizontalAlignLeft() self.name.SetHorizontalAlignLeft() self.hpGauge.Show() self.UpdatePosition() self.hpGauge.SetPercentage(hpPercentage, 100) if app.ENABLE_VIEW_TARGET_DECIMAL_HP: iMinHPText = '.'.join([ i - 3 < 0 and str(iMinHP)[:i] or str(iMinHP)[i - 3:i] for i in range( len(str(iMinHP)) % 3, len(str(iMinHP)) + 1, 3) if i ]) iMaxHPText = '.'.join([ i - 3 < 0 and str(iMaxHP)[:i] or str(iMaxHP)[i - 3:i] for i in range( len(str(iMaxHP)) % 3, len(str(iMaxHP)) + 1, 3) if i ]) self.hpDecimal.SetText(str(iMinHPText) + "/" + str(iMaxHPText)) (textWidth, textHeight) = self.hpDecimal.GetTextSize() if localeInfo.IsARABIC(): self.hpDecimal.SetPosition(120 / 2 + textWidth / 2, -13) else: self.hpDecimal.SetPosition(130 / 2 - textWidth / 2, -13) self.hpDecimal.Show()
def OnSelectEmpire(self, arg): for key in self.empireArea.keys(): self.empireAreaDestAlpha[key] = 0.0 self.empireAreaFlagDestAlpha[key] = 0.0 self.empireFlagDestAlpha[key] = 0.0 self.empireAreaDestAlpha[arg] = 1.0 self.empireAreaFlagDestAlpha[arg] = 1.0 self.empireFlagDestAlpha[arg] = 1.0 self.empireID = arg self.empireName.SetText(self.EMPIRE_NAME.get(self.empireID, "")) rgb = self.EMPIRE_NAME_COLOR[self.empireID] self.empireName.SetFontColor(rgb[0], rgb[1], rgb[2]) snd.PlaySound("sound/ui/click.wav") event.ClearEventSet(self.descIndex) if self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME.has_key(arg): self.descIndex = event.RegisterEventSet( self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME[arg]) #event.SetFontColor(self.descIndex, 0.7843, 0.7843, 0.7843) if localeInfo.IsARABIC(): event.SetEventSetWidth(self.descIndex, 170) else: event.SetRestrictedCount(self.descIndex, 35) if event.BOX_VISIBLE_LINE_COUNT >= event.GetTotalLineCount( self.descIndex): self.btnPrev.Hide() self.btnNext.Hide() else: self.btnPrev.Show() self.btnNext.Show()
def SetHP(self, hpPercentage): if not self.hpGauge.IsShow(): if app.ENABLE_VIEW_TARGET_PLAYER_HP: showingButtonCount = len(self.showingButtonList) if showingButtonCount > 0: if chr.GetInstanceType(self.GetTargetVID) != chr.INSTANCE_TYPE_PLAYER: if showingButtonCount != 1: self.SetSize(max(150, showingButtonCount * 75), self.GetHeight()) else: self.SetSize(max(150, 2 * 75), self.GetHeight()) else: self.SetSize(200 + 7*self.nameLength, self.GetHeight()) else: self.SetSize(200 + 7*self.nameLength, self.GetHeight()) else: self.SetSize(200 + 7*self.nameLength, self.GetHeight()) if localeInfo.IsARABIC(): self.name.SetPosition( self.GetWidth()-23, 13) else: self.name.SetPosition(23, 13) self.name.SetWindowHorizontalAlignLeft() self.name.SetHorizontalAlignLeft() self.hpGauge.Show() self.UpdatePosition() self.hpPercenttxt.SetPosition(200 + 7*self.nameLength-205, 13) self.hpPercenttxt.Show()
def __ArrangeQuestButton(self): screenWidth = wndMgr.GetScreenWidth() screenHeight = wndMgr.GetScreenHeight() ##!! 20061026.levites.퀘스트_위치_보정 if self.wndParty.IsShow(): xPos = 100 + 30 else: xPos = 20 if localeInfo.IsARABIC(): xPos = xPos + 15 yPos = 170 * screenHeight / 600 yCount = (screenHeight - 330) / 63 count = 0 for btn in self.questButtonList: btn.SetPosition(xPos + (int(count/yCount) * 100), yPos + (count%yCount * 63)) count += 1 global IsQBHide if IsQBHide: btn.Hide() else: btn.Show()
def OnResize(self): x, y = self.btnSizing.GetLocalPosition() width = self.btnSizing.GetWidth() height = self.btnSizing.GetHeight() if x < self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width: self.btnSizing.SetPosition( self.CHAT_LOG_WINDOW_MINIMUM_WIDTH - width, y) return if y < self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height: self.btnSizing.SetPosition( x, self.CHAT_LOG_WINDOW_MINIMUM_HEIGHT - height) return self.scrollBar.LockScroll() self.SetSize(x + width, y + height) self.scrollBar.UnlockScroll() if localeInfo.IsARABIC(): self.chatInputSet.SetPosition(20, 25) else: self.chatInputSet.SetPosition(0, 25) self.chatInputSet.SetSize(self.GetWidth() - 20, 20) self.chatInputSet.RefreshPosition() self.chatInputSet.SetChatMax(self.GetWidth() / 8)
def AppendMaterial(self, vnum, count): slot = self.__MakeSlot() slot.SetParent(self) slot.SetPosition(15, self.dialogHeight) itemImage = self.__MakeItemImage() itemImage.SetParent(slot) item.SelectItem(vnum) itemImage.LoadImage(item.GetIconImageFileName()) thinBoard = self.__MakeThinBoard() thinBoard.SetPosition(50, self.dialogHeight) thinBoard.SetSize(191, 20) textLine = ui.TextLine() textLine.SetParent(thinBoard) textLine.SetFontName(localeInfo.UI_DEF_FONT) textLine.SetPackedFontColor(0xffdddddd) textLine.SetText("%s x %02d" % (item.GetItemName(), count)) textLine.SetOutline() textLine.SetFeather(False) textLine.SetWindowVerticalAlignCenter() textLine.SetVerticalAlignCenter() if localeInfo.IsARABIC(): (x, y) = textLine.GetTextSize() textLine.SetPosition(x, 0) else: textLine.SetPosition(15, 0) textLine.Show() self.children.append(textLine) self.dialogHeight += 34 self.UpdateDialog()
def OpenChat(self): self.SetSize(self.CHAT_WINDOW_WIDTH, 25) chat.SetBoardState(self.chatID, chat.BOARD_STATE_EDIT) self.boardState = chat.BOARD_STATE_EDIT (x, y, width, height) = self.GetRect() (btnX, btnY) = self.btnChatSizing.GetGlobalPosition() if localeInfo.IsARABIC(): chat.SetPosition(self.chatID, x + width - 10, y) else: chat.SetPosition(self.chatID, x + 10, y) chat.SetHeight(self.chatID, y - btnY - self.EDIT_LINE_HEIGHT + 100) if self.IsShow(): self.btnChatSizing.Show() self.Refresh() self.btnSendWhisper.SetPosition(self.GetWidth() - 50, 2) self.btnSendWhisper.Show() self.btnChatLog.SetPosition(self.GetWidth() - 25, 2) self.btnChatLog.Show() self.chatInputSet.Open() self.chatInputSet.SetTop() self.SetTop()
def __init__(self): ui.ScriptWindow.__init__(self) self.isLoaded = 0 self.PositionOut = 0 self.PositionStartX = 0 self.PositionStartY = 0 self.titleBar = None self.scrollBar = None self.rankLine = None self.rankDataBackground = None self.rankData = None if localeInfo.IsARABIC(): self.LeftTop = None self.RightTop = None self.LeftBottom = None self.RightBottom = None self.leftcenterImg = None self.rightcenterImg = None self.topcenterImg = None self.bottomcenterImg = None self.centerImg = None self.LeftTopSelf = None self.RightTopSelf = None self.LeftBottomSelf = None self.RightBottomSelf = None self.topcenterImgSelf = None self.bottomcenterImgSelf = None
def Open(self, maxValue, unitValue=1): if localeInfo.IsYMIR() or localeInfo.IsCHEONMA( ) or localeInfo.IsHONGKONG(): unitValue = "" width = self.GetWidth() (mouseX, mouseY) = wndMgr.GetMousePosition() if mouseX + width / 2 > wndMgr.GetScreenWidth(): xPos = wndMgr.GetScreenWidth() - width elif mouseX - width / 2 < 0: xPos = 0 else: xPos = mouseX - width / 2 self.SetPosition(xPos, mouseY - self.GetHeight() - 20) if localeInfo.IsARABIC(): self.maxValueTextLine.SetText("/" + str(maxValue)) else: self.maxValueTextLine.SetText(" / " + str(maxValue)) self.pickValueEditLine.SetText(str(unitValue)) self.pickValueEditLine.SetFocus() ime.SetCursorPosition(1) self.unitValue = unitValue self.maxValue = maxValue self.Show() self.SetTop()
def Destroy(self): self.ClearDictionary() self.PositionOut = 0 self.PositionStartX = 0 self.PositionStartY = 0 self.titleBar = None self.scrollBar = None self.rankLine = None self.rankDataBackground = None self.rankData = None if localeInfo.IsARABIC(): self.LeftTop = None self.RightTop = None self.LeftBottom = None self.RightBottom = None self.leftcenterImg = None self.rightcenterImg = None self.topcenterImg = None self.bottomcenterImg = None self.centerImg = None self.LeftTopSelf = None self.RightTopSelf = None self.LeftBottomSelf = None self.RightBottomSelf = None self.topcenterImgSelf = None self.bottomcenterImgSelf = None
def InitDataSet(self, slot, name, level, real_slot): width = self.CharacterButtonList[slot].GetWidth() height = self.CharacterButtonList[slot].GetHeight() if localeInfo.IsARABIC(): self.CharacterButtonList[slot].LeftRightReverse() self.CharacterButtonList[slot].AppendTextLine( name, localeInfo.UI_DEF_FONT, self.Name_FontColor_Def, "right", 12, height / 4 + 2) self.CharacterButtonList[slot].AppendTextLine( "Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor, "right", 7, height * 3 / 4) else: self.CharacterButtonList[slot].AppendTextLine( name, localeInfo.UI_DEF_FONT, self.Name_FontColor_Def, "right", width - 12, height / 4 + 2) self.CharacterButtonList[slot].AppendTextLine( "Lv." + str(level), localeInfo.UI_DEF_FONT, self.Level_FontColor, "left", width - 42, height * 3 / 4) self.CharacterButtonList[slot].Show() self.FaceImage[slot].LoadImage( self.RACE_FACE_PATH[self.mycharacters.GetRace(slot)] + "2.sub") self.FaceImage[slot].Show() self.RealSlot.append(real_slot) ## 진짜 슬롯 ID ##
def SetName(self, name): self.name = name if name: self.text.SetText(name) self.SetSize(20 + 6 * len(name) + 4, 16) if localeInfo.IsARABIC(): self.text.SetPosition(20 + 6 * len(name) + 4, 2)
def OnRender(self): (x, y, width, height) = self.GetRect() if localeInfo.IsARABIC(): grp.SetColor(0x77000000) grp.RenderBar(x + 2, y + 45, 13, height - 45) grp.SetColor(0x77000000) grp.RenderBar(x, y, width, height) grp.SetColor(0x77000000) grp.RenderBox(x, y, width - 2, height) grp.SetColor(0x77000000) grp.RenderBox(x + 1, y + 1, width - 2, height) grp.SetColor(0xff989898) grp.RenderLine(x + width - 13, y + height - 1, 11, -11) grp.RenderLine(x + width - 9, y + height - 1, 7, -7) grp.RenderLine(x + width - 5, y + height - 1, 3, -3) else: grp.SetColor(0x77000000) grp.RenderBar(x + width - 15, y + 45, 13, height - 45) grp.SetColor(0x77000000) grp.RenderBar(x, y, width, height) grp.SetColor(0x77000000) grp.RenderBox(x, y, width - 2, height) grp.SetColor(0x77000000) grp.RenderBox(x + 1, y + 1, width - 2, height) grp.SetColor(0xff989898) grp.RenderLine(x + width - 13, y + height - 1, 11, -11) grp.RenderLine(x + width - 9, y + height - 1, 7, -7) grp.RenderLine(x + width - 5, y + height - 1, 3, -3) ##### chat.ArrangeShowingChat(self.chatID) if localeInfo.IsARABIC(): chat.SetPosition(self.chatID, x + width - 10, y + height - 25) else: chat.SetPosition(self.chatID, x + 10, y + height - 25) chat.SetHeight(self.chatID, height - 45 - 25) chat.Update(self.chatID) chat.Render(self.chatID)
def RefreshPosition(self): if localeInfo.IsARABIC(): self.chatLine.SetSize(self.GetWidth() - 93, 18) else: self.chatLine.SetSize(self.GetWidth() - 93, 13) self.btnSend.SetPosition(self.GetWidth() - 25, 2) (self.chatLine.x, self.chatLine.y, self.chatLine.width, self.chatLine.height) = self.chatLine.GetRect()
def __LoadWindow(self): if self.isLoaded == 1: return self.isLoaded = 1 try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py") except: import exception exception.Abort("CostumeWindow.LoadWindow.LoadObject") try: self.ORIGINAL_WIDTH = self.GetWidth() wndBeltInventorySlot = self.GetChild("BeltInventorySlot") self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer") self.expandBtn = self.GetChild("ExpandBtn") self.minBtn = self.GetChild("MinimizeBtn") self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory)) self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory)) if localeInfo.IsARABIC(): self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15) self.wndBeltInventoryLayer.SetPosition( self.wndBeltInventoryLayer.GetWidth() - 5, 0) self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15) for i in xrange(item.BELT_INVENTORY_SLOT_COUNT): slotNumber = item.BELT_INVENTORY_SLOT_START + i wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\ "d:/ymir work/ui/game/quest/slot_button_01.sub",\ "d:/ymir work/ui/game/quest/slot_button_01.sub",\ "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE) except: import exception exception.Abort("CostumeWindow.LoadWindow.BindObject") ## Equipment wndBeltInventorySlot.SetOverInItemEvent( ui.__mem_func__(self.wndInventory.OverInItem)) wndBeltInventorySlot.SetOverOutItemEvent( ui.__mem_func__(self.wndInventory.OverOutItem)) wndBeltInventorySlot.SetUnselectItemSlotEvent( ui.__mem_func__(self.wndInventory.UseItemSlot)) wndBeltInventorySlot.SetUseSlotEvent( ui.__mem_func__(self.wndInventory.UseItemSlot)) wndBeltInventorySlot.SetSelectEmptySlotEvent( ui.__mem_func__(self.wndInventory.SelectEmptySlot)) wndBeltInventorySlot.SetSelectItemSlotEvent( ui.__mem_func__(self.wndInventory.SelectItemSlot)) self.wndBeltInventorySlot = wndBeltInventorySlot
def __SelectSlot(self, slot): if slot < 0: return if slot >= SLOT_COUNT: return if self.slot == slot: return self.slot = slot constInfo.SLOTCH = slot self.ResetStat() for i in xrange(SLOT_COUNT): self.destNameAlpha[i] = 0.0 self.destNameAlpha[slot] = 1.0 for i in xrange(SLOT_COUNT): self.destRotation[(i+self.slot)%SLOT_COUNT] = self.SLOT_ROTATION[i] if self.IsShow(): snd.PlaySound("sound/ui/click.wav") event.ClearEventSet(self.descIndex) self.descIndex = event.RegisterEventSet(self.DESCRIPTION_FILE_NAME[self.slot]) if localeInfo.IsARABIC(): event.SetEventSetWidth(self.descIndex, 170) chr.SelectInstance(self.__GetSlotChrID(0, 0)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(0, 1)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(0, 2)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(0, 3)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 0)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 1)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 2)) chr.Hide() chr.SelectInstance(self.__GetSlotChrID(1, 3)) chr.Hide() chr_id = self.__GetSlotChrID(self.gender, slot) if chr.HasInstance(chr_id): chr.SelectInstance(chr_id) self.__SelectShape(self.shapeList[self.gender][slot]) chr.Show()
def __CreateFileListBox(self): fileListBox=ui.ListBoxEx() fileListBox.SetParent(self) if localeInfo.IsARABIC(): fileListBox.SetPosition( self.GetWidth() - fileListBox.GetWidth() - 10, 50) else: fileListBox.SetPosition(15, 50) fileListBox.Show() return fileListBox
def __CreateTextLine(self, fileName): textLine = ui.TextLine() textLine.SetParent(self) if localeInfo.IsARABIC(): textLine.SetPosition(6 * len(fileName) + 6, 0) else: textLine.SetPosition(0, 0) textLine.SetText(fileName) textLine.Show() return textLine
def AppendMaterial(self, vnum, count): slot = self.__MakeSlot() slot.SetParent(self) slot.SetPosition(22, self.dialogHeight+20) itemImage = self.__MakeItemImage() itemImage.SetParent(slot) item.SelectItem(vnum) itemImage.LoadImage(item.GetIconImageFileName()) thinBoard = self.__MakeThinBoard() thinBoard.SetPosition(58, self.dialogHeight+20) thinBoard.SetSize(191, 20) textLine = ui.TextLine() textLine.SetParent(thinBoard) textLine.SetFontName(localeInfo.UI_DEF_FONT) itemMaterialCount = fgGHGjjFHJghjfFG1545gGG.GetItemCountByVnum(vnum) if itemMaterialCount < count: if settinginfo.GetUppItemCountByItemVnum_NEW(vnum) < count: textLine.SetPackedFontColor(0xffFF0033) if itemMaterialCount == 0: itemMaterialCount = settinginfo.GetUppItemCountByItemVnum_NEW(vnum) else: itemMaterialCount = settinginfo.GetUppItemCountByItemVnum_NEW(vnum) textLine.SetPackedFontColor(0xff40EF37) else: itemMaterialCount = fgGHGjjFHJghjfFG1545gGG.GetItemCountByVnum(vnum) textLine.SetPackedFontColor(0xff40EF37) textLine.SetText("%s x%d|h|r (%d)" % (item.GetItemName(), count, itemMaterialCount)) textLine.SetOutline() textLine.SetFeather(False) textLine.SetWindowVerticalAlignCenter() textLine.SetVerticalAlignCenter() if localeInfo.IsARABIC(): (x,y) = textLine.GetTextSize() textLine.SetPosition(x, 0) else: textLine.SetPosition(15, 0) textLine.Show() self.children.append(textLine) self.dialogHeight += 34 self.UpdateDialog()
def Show(self): if self.AtlasMainWindow: (bGet, iSizeX, iSizeY) = miniMap.GetAtlasSize() if bGet: self.SetSize(iSizeX + 15, iSizeY + 38) if localeInfo.IsARABIC(): self.board.SetPosition(iSizeX + 15, 0) self.board.SetSize(iSizeX + 15, iSizeY + 38) #self.AtlasMainWindow.SetSize(iSizeX, iSizeY) self.AtlasMainWindow.ShowAtlas() self.AtlasMainWindow.Show() ui.ScriptWindow.Show(self)
def BINARY_RecvQuest(self, index, name, iconType, iconName): btn = self.__FindQuestButton(index) if 0 != btn: self.__DestroyQuestButton(btn) btn = uiWhisper.WhisperButton() # QUEST_LETTER_IMAGE ##!! 20061026.levites.퀘스트_이미지_교체 import item if "item"==iconType: item.SelectItem(int(iconName)) buttonImageFileName=item.GetIconImageFileName() else: buttonImageFileName=iconName if localeInfo.IsEUROPE(): if "highlight" == iconType: btn.SetUpVisual("locale/ymir_ui/highlighted_quest.tga") btn.SetOverVisual("locale/ymir_ui/highlighted_quest_r.tga") btn.SetDownVisual("locale/ymir_ui/highlighted_quest_r.tga") else: btn.SetUpVisual(localeInfo.GetLetterCloseImageName()) btn.SetOverVisual(localeInfo.GetLetterOpenImageName()) btn.SetDownVisual(localeInfo.GetLetterOpenImageName()) else: btn.SetUpVisual(buttonImageFileName) btn.SetOverVisual(buttonImageFileName) btn.SetDownVisual(buttonImageFileName) btn.Flash() # END_OF_QUEST_LETTER_IMAGE if localeInfo.IsARABIC(): btn.SetToolTipText(name, 0, 35) btn.ToolTipText.SetHorizontalAlignCenter() else: btn.SetToolTipText(name, -20, 35) btn.ToolTipText.SetHorizontalAlignLeft() btn.SetEvent(ui.__mem_func__(self.__StartQuest), btn) btn.Show() btn.index = index btn.name = name self.questButtonList.insert(0, btn) self.__ArrangeQuestButton()
def LoadWindow(self): if self.isLoaded == 1: return self.isLoaded = 1 try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/acce_combinewindow.py") except: import exception exception.Abort("AcceWindow.LoadDialog.LoadScript") try: GetObject = self.GetChild if localeInfo.IsARABIC(): self.board = GetObject("board") self.board.SetScale(-1.0, 1.0) self.board.SetRenderingRect(-1.0, 0.0, 1.0, 0.0) self.titleBar = GetObject("TitleBar") self.btnAccept = GetObject("AcceptButton") self.btnCancel = GetObject("CancelButton") self.acceSlot = GetObject("AcceSlot") self.needMoney = GetObject("NeedMoney") self.Result = GetObject("Result") except: import exception exception.Abort("AcceWindow.LoadDialog.BindObject") self.acceSlot.SetSelectEmptySlotEvent( ui.__mem_func__(self.__OnSelectEmptySlot)) self.acceSlot.SetSelectItemSlotEvent( ui.__mem_func__(self.__OnSelectItemSlot)) self.acceSlot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem)) self.acceSlot.SetOverOutItemEvent(ui.__mem_func__( self.__OnOverOutItem)) self.titleBar.SetCloseEvent(ui.__mem_func__(self.__OnCloseButtonClick)) self.btnCancel.SetEvent(ui.__mem_func__(self.__OnCloseButtonClick)) self.btnAccept.SetEvent(ui.__mem_func__(self.__OnAcceptButtonClick)) self.needMoney.SetText(localeInfo.ACCE_ABSORB_COST % (0)) self.acceItemInfo = {} self.tooltipItem = None self.firstSlotIndex = 0 self.SLOT_SIZEX = 32 self.SLOT_SIZEY = 32
def SetToolTipText(self, text, x = 0, y = -19): if not self.toolTipText: textLine = ui.TextLine() textLine.SetParent(self) textLine.SetSize(0, 0) textLine.SetOutline() textLine.Hide() self.toolTipText = textLine self.toolTipText.SetText(text) w, h = self.toolTipText.GetTextSize() if localeInfo.IsARABIC(): self.toolTipText.SetPosition(w+20, y) else: self.toolTipText.SetPosition(max(0, x + self.GetWidth()/2 - w/2), y)
def UpdateDialog(self): newWidth = self.newToolTip.GetWidth() + 230 + 15 + 20 newHeight = self.newToolTip.GetHeight() + 98 if localeInfo.IsARABIC(): self.board.SetPosition( newWidth, 0 ) (x,y) = self.titleBar.GetLocalPosition() self.titleBar.SetPosition( newWidth - 15, y ) self.board.SetSize(newWidth, newHeight) self.titleBar.SetWidth(newWidth-15) self.SetSize(newWidth, newHeight) (x, y) = self.GetLocalPosition() self.SetPosition(x, y)
def SetHP(self, hpPercentage): if not self.hpGauge.IsShow(): self.SetSize(200 + 7 * self.nameLength, self.GetHeight()) if localeInfo.IsARABIC(): self.name.SetPosition(self.GetWidth() - 23, 13) else: self.name.SetPosition(23, 13) self.name.SetWindowHorizontalAlignLeft() self.name.SetHorizontalAlignLeft() self.hpGauge.Show() self.UpdatePosition() self.hpGauge.SetPercentage(hpPercentage, 100)
def LoadWindow(self): if self.isLoaded == 1: return self.isLoaded = 1 try: pyScrLoader = ui.PythonScriptLoader() if localeInfo.IsARABIC() : pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "itemcombinationwindow.py") else: pyScrLoader.LoadScriptFile(self, "UIScript/itemcombinationwindow.py") except: import exception exception.Abort("AcceWindow.LoadDialog.LoadScript") try: GetObject = self.GetChild self.titleBar = GetObject("TitleBar") self.ItemCombBackgroundImage = self.GetChild("Item_Comb_Background_Image") self.btnAccept = GetObject("AcceptButton") self.btnCancel = GetObject("CancelButton") self.mediumSlot = GetObject("MediumSlot") self.combSlot = GetObject("CombSlot") except: import exception exception.Abort("AcceWindow.LoadDialog.BindObject") self.titleBar.SetCloseEvent(ui.__mem_func__(self.__OnCloseButtonClick)) self.btnCancel.SetEvent(ui.__mem_func__(self.__OnCloseButtonClick)) self.btnAccept.SetEvent(ui.__mem_func__(self.__OnAcceptButtonClick)) self.combSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__OnSelectEmptySlot)) self.combSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__OnSelectItemSlot)) self.combSlot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem)) self.combSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem)) self.mediumSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__OnSelectEmptySlot)) self.mediumSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__OnSelectItemSlot)) self.mediumSlot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem)) self.mediumSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem)) self.ItemCombBackgroundImage.Hide() self.combSlot.Hide() self.tooltipItem = None self.SLOT_SIZEX = 32 self.SLOT_SIZEY = 32 self.itemInfo = {}
def SetWhisperDialogSize(self, width, height): try: max = int((width - 90) / 6) * 3 - 6 self.board.SetSize(width, height) self.scrollBar.SetPosition(width - 25, 35) self.scrollBar.SetScrollBarSize(height - 100) self.scrollBar.SetPos(1.0) self.editBar.SetSize(width - 18, 50) self.chatLine.SetSize(width - 90, 40) self.chatLine.SetLimitWidth(width - 90) self.SetSize(width, height) if 0 != self.targetName: chat.SetWhisperBoxSize(self.targetName, width - 50, height - 90) if localeInfo.IsARABIC(): self.textRenderer.SetPosition(width - 20, 28) self.scrollBar.SetPosition( width - 25 + self.scrollBar.GetWidth(), 35) self.editBar.SetPosition(10 + self.editBar.GetWidth(), height - 60) self.sendButton.SetPosition( width - 80 + self.sendButton.GetWidth(), 10) self.minimizeButton.SetPosition( width - 42 + self.minimizeButton.GetWidth(), 12) self.closeButton.SetPosition( width - 24 + self.closeButton.GetWidth(), 12) self.chatLine.SetPosition(5 + self.chatLine.GetWidth(), 5) self.board.SetPosition(self.board.GetWidth(), 0) else: self.textRenderer.SetPosition(20, 28) self.scrollBar.SetPosition(width - 25, 35) self.editBar.SetPosition(10, height - 60) self.sendButton.SetPosition(width - 80, 10) self.minimizeButton.SetPosition(width - 42, 12) self.closeButton.SetPosition(width - 24, 12) self.SetChatLineMax(max) except: import exception exception.Abort("WhisperDialog.SetWhisperDialogSize.BindObject")
def OnSelectEmpire(self, arg): for key in self.empireArea.keys(): self.empireAreaDestAlpha[key] = 0.0 self.empireAreaFlagDestAlpha[key] = 0.0 self.empireFlagDestAlpha[key] = 0.0 self.empireAreaDestAlpha[arg] = 1.0 self.empireAreaFlagDestAlpha[arg] = 1.0 self.empireFlagDestAlpha[arg] = 1.0 self.empireID = arg event.ClearEventSet(self.descIndex) if self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME.has_key(arg): self.descIndex = event.RegisterEventSet(self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME[arg]) if localeInfo.IsARABIC(): event.SetEventSetWidth(self.descIndex, 170) else: event.SetRestrictedCount(self.descIndex, 35)
def __Load(self): self.popupDialog = PopupDialog(self) if localeInfo.IsARABIC(): self.__Load_LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "MusicListWindow.py") else: self.__Load_LoadScript("UIScript/MusicListWindow.py") self.__Load_BindObject() self.refreshButton.SAFE_SetEvent(self.__OnRefresh) self.cancelButton.SAFE_SetEvent(self.__OnCancel) self.okButton.SAFE_SetEvent(self.__OnOK) self.board.SetCloseEvent(ui.__mem_func__(self.__OnCancel)) self.UpdateRect() self.__RefreshFileList()
def SetSize(self, width, height): self.imgCenter.SetRenderingRect( 0.0, 0.0, float((width - self.BLOCK_WIDTH * 2) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0) self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0) self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0) if localeInfo.IsARABIC(): self.titleName.SetPosition(self.GetWidth() - 20, 3) self.btnClose.SetPosition(3, 3) self.scrollBar.SetPosition(1, 45) else: self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 5, 5) self.scrollBar.SetPosition(width - 15, 45) self.scrollBar.SetScrollBarSize(height - 45 - 12) self.scrollBar.SetPos(self.scrollBarPos) ui.Window.SetSize(self, width, height)