def __LoadQuestionDialog(self): self.UI["board"] = ui.BoardWithTitleBar() self.UI["board"].SetCenterPosition() self.UI["board"].AddFlag("movable") if POSITION_FIX: self.UI["board"].SetSize(240, 170) else: self.UI["board"].SetSize(240, 180) self.UI["board"].SetCenterPosition() self.UI["board"].SetTop() self.UI["board"].SetTitleName(uiScriptLocale.SHOP_WINDOW_CREATE) self.UI["board"].Hide() self.UI["nameText"] = ui.MakeText(self.UI["board"], uiScriptLocale.SHOP_NAME, 95, 30, None) self.UI["nameEdit"] = Edit2(self.UI["board"], "", 10, 45, 150, 25, FALSE, 6, 30) self.UI["selectText"] = ui.TextLine() self.UI["selectText"].SetParent(self.UI["board"]) self.UI["selectText"].SetPosition(15, 70) self.UI["selectText"].SetFeather() self.UI["selectText"].SetDefaultFontName() self.UI["selectText"].SetOutline() self.UI["selectText"].SetText(uiScriptLocale.SHOP_TIMEOUT) self.UI["selectText"].Show() self.UI["create"] = ui.MakeButton(self.UI["board"], 30, 110, "", "d:/ymir work/ui/public/", "xlarge_button_01.sub", "xlarge_button_02.sub", "xlarge_button_03.sub") self.UI["create"].SetText(uiScriptLocale.SHOP_CREATE) self.UI["create"].SetEvent(ui.__mem_func__(self.CreateShop)) self.UI["create"].Show() self.UI["cancel"] = ui.MakeButton(self.UI["board"], 30, 140, "", "d:/ymir work/ui/public/", "xlarge_button_01.sub", "xlarge_button_02.sub", "xlarge_button_03.sub") self.UI["cancel"].SetText(uiScriptLocale.CANCEL) self.UI["cancel"].SetEvent(ui.__mem_func__(self.Close)) self.UI["cancel"].Show() self.UI["price"] = ui.MakeText(self.UI["board"], "", 15, 90, None) self.UI["price"].SetFeather() self.UI["price"].SetDefaultFontName() self.UI["price"].SetOutline() self.UI["price"].Show() self.CreateList()
def __LoadDialog(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/RemoteShopDialog.py") except: import exception exception.Abort("RemoteShopDialog.__LoadDialog") self.ParentBoard = self.GetChild("RemoteShopBoard") self.ChildBoard = self.GetChild("BlackBoard") self.GetChild("RemoteShopTitle").SetCloseEvent( ui.__mem_func__(self.Close)) self.ShopList = [] ShopData = net.GetRemoteShopData() cnt = len(ShopData) self.DlgWidht = 190 self.BlackBoardHeight = 23 * cnt + 5 * (cnt - 1) + 13 self.DlgHeight = self.BlackBoardHeight + 75 self.AcceptBtn = ui.MakeButton(self.ParentBoard, 13, self.DlgHeight - 33, "", "d:/ymir work/ui/public/", "middle_button_01.sub", "middle_button_02.sub", "middle_button_03.sub") self.AcceptBtn.SetText(localeInfo.UI_ACCEPT) self.AcceptBtn.SetEvent(ui.__mem_func__(self.AcceptButton)) self.CloseBtn = ui.MakeButton(self.ParentBoard, self.DlgWidht - 73, self.DlgHeight - 33, "", "d:/ymir work/ui/public/", "middle_button_01.sub", "middle_button_02.sub", "middle_button_03.sub") self.CloseBtn.SetText(localeInfo.UI_CLOSE) self.CloseBtn.SetEvent(ui.__mem_func__(self.Close)) for i in xrange(cnt): btn = ui.MakeButton(self.ChildBoard, 8, 6 + i * 28, "", "d:/ymir work/ui/game/myshop_deco/", "select_btn_01.sub", "select_btn_02.sub", "select_btn_03.sub") btn.SetText(ShopData[i]) btn.SetEvent(ui.__mem_func__(self.__SelectShop), i) self.ShopList.append(btn) self.ParentBoard.SetSize(self.DlgWidht, self.DlgHeight) self.ChildBoard.SetSize(self.DlgWidht - 26, self.BlackBoardHeight) self.SetSize(self.DlgWidht, self.DlgHeight) self.UpdateRect()
def __LoadDialog(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/RemoteShopDialog.py") except: import exception exception.Abort("RemoteShopDialog.__LoadDialog") REMOTE_FILE_NAME = "{}/remote_shop_names.txt".format( app.GetLocalePath()) try: ShopData = pack_open(REMOTE_FILE_NAME, "r").readlines() except IOError: import dbg dbg.LogBox("Can not read: ({})".format(REMOTE_FILE_NAME)) app.Abort() cnt = len(ShopData) self.ParentBoard = self.GetChild("RemoteShopBoard") self.ChildBoard = self.GetChild("BlackBoard") self.GetChild("RemoteShopTitle").SetCloseEvent( ui.__mem_func__(self.Close)) DlgWidht = 190 BlackBoardHeight = 23*cnt + 5*(cnt-1) + 13 DlgHeight = BlackBoardHeight + 75 self.AcceptBtn = ui.MakeButton(self.ParentBoard, 13, DlgHeight - 33, "", "d:/ymir work/ui/public/", "middle_button_01.sub", "middle_button_02.sub", "middle_button_03.sub") self.AcceptBtn.SetText(localeInfo.UI_ACCEPT) self.AcceptBtn.SetEvent(ui.__mem_func__(self.AcceptButton)) self.CloseBtn = ui.MakeButton(self.ParentBoard, DlgWidht - 73, DlgHeight - 33, "", "d:/ymir work/ui/public/", "middle_button_01.sub", "middle_button_02.sub", "middle_button_03.sub") self.CloseBtn.SetText(localeInfo.UI_CLOSE) self.CloseBtn.SetEvent(ui.__mem_func__(self.Close)) self.ShopList = [] for i in range(cnt): btn = ui.MakeButton(self.ChildBoard, 8, 6 + i*28, "", "d:/ymir work/ui/game/myshop_deco/", "select_btn_01.sub", "select_btn_02.sub", "select_btn_03.sub") btn.SetText(ShopData[i]) btn.SetEvent(ui.__mem_func__(self.__SelectShop), i) self.ShopList.append(btn) self.ParentBoard.SetSize(DlgWidht, DlgHeight) self.ChildBoard.SetSize(DlgWidht - 26, BlackBoardHeight) self.SetSize(DlgWidht, DlgHeight) self.UpdateRect()
def LoadWindow(self): self.UI["board"]=ui.BoardWithTitleBar() self.UI["board"].SetSize(500, 320) self.UI["board"].SetTitleName(uiScriptLocale.GIFT_WINDOW_NAME) self.UI["board"].SetCloseEvent(ui.__mem_func__(self.Close)) self.UI["board"].AddFlag("movable") self.UI["board"].Hide() self.UI["slots"] = ui.GridSlotWindow() self.UI["slots"].SetParent(self.UI["board"]) self.UI["slots"].SetPosition(10,30) self.UI["slots"].SetSize(480, 280) self.UI["slots"].ArrangeSlot(0, 15,8, 32, 32, 0, 0) self.UI["slots"].RefreshSlot() self.UI["slots"].SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0) self.UI["slots"].SAFE_SetButtonEvent("LEFT", "EXIST", self.OnSelectItemSlot) self.UI["slots"].SAFE_SetButtonEvent("RIGHT", "EXIST", self.UnselectItemSlot) self.UI["slots"].SetOverInItemEvent(ui.__mem_func__(self.OverInItem)) self.UI["slots"].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) self.UI["slots"].Show() Y=self.UI["board"].GetHeight()-30 if POSITION_FIX: Y=self.UI["board"].GetHeight()-43 self.UI["get_button"] = ui.MakeButton(self.UI["board"],250, Y,"","d:/ymir work/ui/public/","large_Button_01.sub","large_Button_02.sub","large_Button_03.sub") self.UI["get_button"].SetText(uiScriptLocale.GIFT_GET_ALL) self.UI["get_button"].SetEvent(lambda : self.GetAll()) self.UI["get_button"].Show() self.UI["pageSlotImage"] = ui.MakeImageBox(self.UI["board"], "d:/ymir work/ui/public/Parameter_Slot_00.sub", self.UI["board"].GetWidth()-110, Y) self.UI["pageSlot"]= ui.MakeTextLine(self.UI["pageSlotImage"]) self.UI["pageSlot"].SetWindowHorizontalAlignCenter() self.UI["pageSlot"].SetHorizontalAlignCenter() self.UI["pageSlot"].SetText(str(self.pageCur)+" - "+str(self.pageNum+1)) self.UI["pageSlot"].Show() ## Prev Button self.UI["prevButton"] = ui.MakeButton(self.UI["board"], self.UI["board"].GetWidth()-160, Y ,uiScriptLocale.GIFT_PREV_PAGE, "d:/ymir work/ui/public/", "small_button_01.sub", "small_button_02.sub", "small_button_03.sub") self.UI["prevButton"].SetText("<<") self.UI["prevButton"].SetEvent(ui.__mem_func__(self.PrepPage), -1) ## Next Button self.UI["nextButton"] = ui.MakeButton(self.UI["board"], self.UI["board"].GetWidth()-65, Y , uiScriptLocale.GIFT_NEXT_PAGE, "d:/ymir work/ui/public/", "small_button_01.sub", "small_button_02.sub", "small_button_03.sub") self.UI["nextButton"].SetText(">>") self.UI["nextButton"].SetEvent(ui.__mem_func__(self.PrepPage), 1) self.AddFlag("movable") self.AddFlag("float") self.SetCenterPosition() self.Show()
def MakeUiBoard(self): yPos = 0 for i in range(0, self.MAX_LINE_COUNT + 1): yPos = 60 + i * 24 if i == 10: yPos += 10 RankingSlotImage = ui.MakeImageBox( self, "d:/ymir work/ui/public/parameter_slot_00.sub", 23, yPos) RankingSlotImage.SetAlpha(0) RankingSlot = ui.MakeTextLine(RankingSlotImage) self.Children.append(RankingSlotImage) self.Children.append(RankingSlot) NameImage = ui.MakeImageBox( self, "d:/ymir work/ui/public/parameter_slot_04.sub", 77, yPos) NameImage.SetAlpha(0) NameSlot = ui.MakeTextLine(NameImage) self.Children.append(NameImage) self.Children.append(NameSlot) LevelImage = ui.MakeImageBox( self, "d:/ymir work/ui/public/parameter_slot_00.sub", 205, yPos) LevelImage.SetAlpha(0) LevelSlot = ui.MakeTextLine(LevelImage) self.Children.append(LevelImage) self.Children.append(LevelSlot) GuildImage = ui.MakeImageBox( self, "d:/ymir work/ui/public/parameter_slot_00.sub", 270, yPos) GuildImage.SetAlpha(0) GuildSlot = ui.MakeTextLine(GuildImage) self.Children.append(GuildImage) self.Children.append(GuildSlot) if i < self.MAX_LINE_COUNT: temprankingslotlist = [] temprankingslotlist.append(RankingSlot) temprankingslotlist.append(NameSlot) temprankingslotlist.append(LevelSlot) temprankingslotlist.append(GuildSlot) self.ResultSlotList[i] = temprankingslotlist else: self.MyResultSlotList.append(RankingSlot) self.MyResultSlotList.append(NameSlot) self.MyResultSlotList.append(LevelSlot) self.MyResultSlotList.append(GuildSlot) itemSlotButtonImage = ui.MakeButton( self, 21, yPos, "", "d:/ymir work/ui/game/guild/dragonlairranking/", "ranking_list_button01.sub", "ranking_list_button02.sub", "ranking_list_button02.sub") itemSlotButtonImage.Show() itemSlotButtonImage.Disable() self.Children.append(itemSlotButtonImage) if i < self.MAX_LINE_COUNT: self.ResultButtonList.append(itemSlotButtonImage)
def MakeButton(self, index, parent, x, y): self.tab[index] = ui.MakeButton(parent, x, y, False, "d:/ymir work/battle_pass/", "tab_normal.tga", "tab_select.tga", "tab_normal.tga") self.gauge[index] = ui.MakeGauge(self.tab[index], 41, 23, 130) self.gauge_f = ui.MakeGauge(parent, 326, 235, 92) self.text[index] = ui.TextLine() self.text[index].SetParent(self.tab[index]) self.text[index].SetPosition(50, 8) self.text[index].SetText(str(constInfo.info_missions_bp[int(index)]["Name"])) self.text[index].Show() self.reward1[index] = ui.MakeGridSlot(self.tab[index], 180+7, 2+4, self.Get3(index, "iVnum1"), self.Get3(index, "iCount1")) self.reward1[index].SetOverInItemEvent(lambda slotindex = 0, ivnumz = index: self.OverInItem(slotindex, ivnumz, "iVnum1")) self.reward1[index].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) self.reward2[index] = ui.MakeGridSlot(self.tab[index], 180+32+7, 2+4, self.Get3(index, "iVnum2"), self.Get3(index, "iCount2")) self.reward2[index].SetOverInItemEvent(lambda slotindex = 0, ivnumz = index: self.OverInItem(slotindex, ivnumz, "iVnum2")) self.reward2[index].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) self.reward3[index] = ui.MakeGridSlot(self.tab[index], 217+28+7, 2+4, self.Get3(index, "iVnum3"), self.Get3(index, "iCount3")) self.reward3[index].SetOverInItemEvent(lambda slotindex = 0, ivnumz = index: self.OverInItem(slotindex, ivnumz, "iVnum3")) self.reward3[index].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem)) self.icon[index] = ui.MakeImageBoxNoImg(self.tab[index], 1, 2) if self.Get(index, "iType") == 1: # Category: Use Items item.SelectItem(self.Get(index, "iVnum")) self.icon[index].LoadImage(item.GetIconImageFileName()) if self.Get(index, "iType") > 2: self.icon[index].LoadImage(self.Type_Images[self.Get(index, "iType")])
def Load(self, data): title = data["name"] if len(title) > 22: title = title[:19] + "..." gui = {} gui["nameTextImage"] = ui.MakeImageBox( self.UI["board"], "d:/ymir work/ui/public/Parameter_Slot_04.sub", 10, self.BoardHeight) gui["nameTextImage"].SAFE_SetStringEvent( "MOUSE_OVER_IN", lambda arg=data: self.__ShowToolTip(arg), TRUE) gui["nameTextImage"].SAFE_SetStringEvent("MOUSE_OVER_OUT", self.__HideItemToolTip) gui["name"] = ui.MakeTextLine(gui["nameTextImage"]) gui["name"].SetWindowHorizontalAlignCenter() gui["name"].SetHorizontalAlignCenter() gui["name"].SetText(title) gui["manage"] = ui.MakeButton(self.UI["board"], 130, self.BoardHeight, "", "d:/ymir work/ui/public/", "middle_Button_01.sub", "middle_Button_02.sub", "middle_Button_03.sub") gui["manage"].SetText(uiScriptLocale.SHOP_MANAGE) gui["manage"].SetEvent(ui.__mem_func__(self.ManageShop), data) gui["manage"].Show() if self.CurrentEdit == data["id"]: self.ManageShop(data, 1) gui["data"] = data self.UI["shops"][str(data["id"])] = gui self.BoardHeight += 30 self.UpdateSize()
def UpdateSize(self): Y = 25 if POSITION_FIX: Y = 45 self.UI["create_button"] = ui.MakeButton( self.UI["board"], 10, self.UI["board"].GetHeight() - Y, "", "d:/ymir work/ui/public/", "Xlarge_Button_01.sub", "Xlarge_Button_02.sub", "Xlarge_Button_03.sub") self.UI["create_button"].SetText(uiScriptLocale.SHOP_OPEN) self.UI["create_button"].SetEvent(lambda: self.CreateShop()) self.UI["create_button"].Show() if POSITION_FIX: self.UI["board"].SetSize(200, self.BoardHeight + 55) else: self.UI["board"].SetSize(200, self.BoardHeight + 35) if self.BoardHeight < self.EditBoardY: self.SetSize(400, self.EditBoardY + 50) else: self.SetSize(400, self.BoardHeight + 60)
def __LoadScript(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "uiscript/GuildStorageAdmin.py") except: import exception exception.Abort("test.__LoadScript.LoadObject") try: self.board = self.GetChild("Board") self.titleBar = self.GetChild("TitleBar") self.AddMemberButton = self.GetChild("GS_AddMember") self.MemberInput = self.GetChild("GS_MemberInputLine") self.scrollbar = self.GetChild("scrollbar") self.scrollbar.SetScrollEvent(ui.__mem_func__(self.__OnScroll)) self.MemberPage = {} for i in range(12): event = lambda argSelf=proxy( self), argIndex=i, argAuthority=0: apply( argSelf.OnCheckAuthority, (argIndex, argAuthority)) self.MemberPage['stock' + str(i)] = (CheckBox( self.board, 130, 60 + (20 * i), event)) event = lambda argSelf=proxy( self), argIndex=i, argAuthority=1: apply( argSelf.OnCheckAuthority, (argIndex, argAuthority)) self.MemberPage['transfer' + str(i)] = (CheckBox( self.board, 190, 60 + (20 * i), event)) event = lambda argSelf=proxy( self), argIndex=i, argAuthority=2: apply( argSelf.OnCheckAuthority, (argIndex, argAuthority)) self.MemberPage['payin' + str(i)] = (CheckBox( self.board, 250, 60 + (20 * i), event)) event = lambda argSelf=proxy( self), argIndex=i, argAuthority=3: apply( argSelf.OnCheckAuthority, (argIndex, argAuthority)) self.MemberPage['payout' + str(i)] = (CheckBox( self.board, 310, 60 + (20 * i), event)) self.MemberPage['membername_slotbar' + str(i)] = ui.MakeSlotBar( self.board, 20, 61 + (20 * i), 100, 16) self.MemberPage['membername_text' + str(i)] = ui.MakeTextLine( self.MemberPage['membername_slotbar' + str(i)]) self.MemberPage['deleteBTN' + str(i)] = ui.MakeButton( self.board, 365, 61 + (20 * i), "loeschen", "d:/ymir work/ui/public/", "close_button_01.sub", "close_button_02.sub", "close_button_03.sub") self.MemberPage['deleteBTN' + str(i)].SetEvent( ui.__mem_func__(self.DeleteMember), i) except: import exception exception.Abort("test.__LoadScript.BindObject") self.AddMemberButton.SetEvent(self.AddMember) self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close)) self.isLoaded = TRUE