Guest User

Panel by DevBolt aka Cady

a guest
Oct 19th, 2014
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 9.55 KB | None | 0 0
  1. ###################################
  2. ############Dla MPCFORUM###########
  3. #####Zakaz dodawaia na inne fora###
  4. ########By DevBolt aka Cady########
  5. ###################################
  6. #IMPORT START
  7. import player, chat, constInfo, consoleModule, playerSettingModule, interfaceModule, event, game, uichat, uirunwindow, ui, dbg, app, time, uiwiki, tombola, item, locale, grp, uibonus, uiToolTip, ime, constInfo, net, stringCommander, background, snd
  8. #IMPORT END
  9. #CODE START
  10. class panelgracza(ui.BoardWithTitleBar):
  11.     def __init__(self):
  12.         ui.BoardWithTitleBar.__init__(self)
  13.         self.BuildWindow()
  14.     def __del__(self):
  15.         ui.BoardWithTitleBar.__del__(self)
  16.     def BuildWindow(self):
  17.         self.SetSize(400, 180)
  18.         self.SetCenterPosition()
  19.         self.AddFlag('movable')
  20.         self.AddFlag('float')
  21.         self.SetTitleName('Panel Gracza: ' + player.GetName())
  22.         self.comp = Component()
  23.         self.teleporacja = self.comp.Button(self, '', 'Teleportacja', 10, 35, self.teleporacja, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  24.         self.polimorfia = self.comp.Button(self, '', 'Polimorfia', 10, 76, self.polimorfia, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  25.         self.radio = self.comp.Button(self, '', 'Radio', 10, 117, self.radio, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  26.         self.magazyn = self.comp.Button(self, '', 'Magazyn', 50, 35, self.magazyn, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  27.         self.itemshop = self.comp.Button(self, '', 'ItemShop', 50, 76, self.itemshop, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  28.         self.bonusy = self.comp.Button(self, '', 'Bonusy', 50, 117, self.bonusy, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  29.         self.bonusshitcher = self.comp.Button(self, '', 'Bonus Swither', 356, 35, self.bonusshitcher, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  30.         self.cos = self.comp.Button(self, '', 'COS', 356, 76, self.cos, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  31.         self.cos1 = self.comp.Button(self, '', 'COS1', 356, 117, self.cos1, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  32.         self.cos2 = self.comp.Button(self, '', 'COS2', 316, 35, self.cos2, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  33.         self.cos3 = self.comp.Button(self, '', 'COS2', 316, 76, self.cos3, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  34.         self.cos4 = self.comp.Button(self, '', 'COS', 316, 117, self.cos4, 'd:/ymir work/ui/game/TaskBar/Mall_Button_01.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_02.tga', 'd:/ymir work/ui/game/TaskBar/Mall_Button_03.tga')
  35.         self.info = self.comp.Button(self, 'Informacje', '', 103, 65, self.info, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
  36.         self.eventy = self.comp.Button(self, 'Eventy', '', 210, 65, self.eventy, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
  37.         self.czas = self.comp.TextLine(self, 'Godzina:', 90, 26, self.comp.RGB(255, 255, 255))
  38.         self.data = self.comp.TextLine(self, 'Data:', 270, 26, self.comp.RGB(255, 255, 255))
  39. ############Można było za pomocą pętli "try" ale to jest jeden z pierwszych paneli###############
  40.         self.czasLine = ui.TextLine()
  41.         self.czasLine.SetParent(self)
  42.         self.czasLine.SetPackedFontColor(0xffffff00)
  43.         self.czasLine.SetText(time.strftime("%H:%M:%S"))
  44.         self.czasLine.SetPosition(90, 43)
  45.         self.czasLine.Show()
  46.         self.dataLine = ui.TextLine()
  47.         self.dataLine.SetParent(self)
  48.         self.dataLine.SetPackedFontColor(0xffffff00)
  49.         self.dataLine.SetText(str(time.strftime("%Y-%m-%d")))
  50.         self.dataLine.SetPosition(259, 43)
  51.         self.dataLine.Show()
  52.         self.informacje = ui.TextLine()
  53.         self.informacje.SetParent(self)
  54.         self.informacje.SetPackedFontColor(0xffffff00)
  55.         self.informacje.SetText("Cady to mistrz nad mistrzami.Jakieś info dalej") ##Informacja
  56.         self.informacje.SetPosition(100, 110)
  57.         self.informacje.Hide()
  58.         self.eve = ui.TextLine()
  59.         self.eve.SetParent(self)
  60.         self.eve.SetPackedFontColor(0xffffff00)
  61.         self.eve.SetText("Dnia 28.09.2014 odbedzie się event OX.") #Jakieś info o eventach
  62.         self.eve.SetPosition(100, 110)
  63.         self.eve.Hide()
  64.         self.prawa = ui.TextLine()
  65.         self.prawa.SetParent(self)
  66.         self.prawa.SetPackedFontColor(0xffffff00)
  67.         self.prawa.SetText("By SerwerMt2") ##Prawa autorskie
  68.         self.prawa.SetPosition(333, 160)
  69.         self.prawa.Show()
  70.     def teleporacja(self):
  71.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  72.     def polimorfia(self):
  73.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  74.     def radio(self):
  75.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  76.     def magazyn(self):
  77.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  78.     def itemshop(self):
  79.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  80.     def bonusy(self):
  81.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  82.     def bonusshitcher(self):
  83.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  84.     def cos(self):
  85.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  86.     def cos1(self):
  87.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  88.     def cos2(self):
  89.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  90.     def cos3(self):
  91.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  92.     def cos4(self):
  93.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  94.     def cos5(self):
  95.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  96.     def cos6(self):
  97.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  98.     def cos7(self):
  99.         event.QuestButtonClick(constInfo.cos) # Jeśli ktoś sie zna to sobie ustawi :P
  100.     def info(self):
  101.         self.informacje.Show()
  102.         self.eve.Hide()
  103.     def eventy(self):
  104.         self.eve.Show()
  105.         self.informacje.Hide()
  106.     def OnUpdate(self):
  107.         self.czasLine.SetText(time.strftime("%H:%M:%S"))
  108. #CODE END
  109. class Component:
  110.     def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
  111.         button = ui.Button()
  112.         button.SetParent(parent)
  113.         button.SetPosition(x, y)
  114.         button.SetUpVisual(UpVisual)
  115.         button.SetOverVisual(OverVisual)
  116.         button.SetDownVisual(DownVisual)
  117.         button.SetText(buttonName)
  118.         button.SetToolTipText(tooltipText)
  119.         button.Show()
  120.         button.SetEvent(func)
  121.         return button
  122.     def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
  123.         button = ui.ToggleButton()
  124.         button.SetParent(parent)
  125.         button.SetPosition(x, y)
  126.         button.SetUpVisual(UpVisual)
  127.         button.SetOverVisual(OverVisual)
  128.         button.SetDownVisual(DownVisual)
  129.         button.SetText(buttonName)
  130.         button.SetToolTipText(tooltipText)
  131.         button.Show()
  132.         button.SetToggleUpEvent(funcUp)
  133.         button.SetToggleDownEvent(funcDown)
  134.         return button
  135.     def EditLine(self, parent, editlineText, x, y, width, heigh, max):
  136.         SlotBar = ui.SlotBar()
  137.         SlotBar.SetParent(parent)
  138.         SlotBar.SetSize(width, heigh)
  139.         SlotBar.SetPosition(x, y)
  140.         SlotBar.Show()
  141.         Value = ui.EditLine()
  142.         Value.SetParent(SlotBar)
  143.         Value.SetSize(width, heigh)
  144.         Value.SetPosition(5, 1)
  145.         Value.SetMax(max)
  146.         Value.SetText(editlineText)
  147.         Value.Show()
  148.         return SlotBar, Value
  149.     def TextLine(self, parent, textlineText, x, y, color):
  150.         textline = ui.TextLine()
  151.         textline.SetParent(parent)
  152.         textline.SetPosition(x, y)
  153.         if color != None:
  154.             textline.SetFontColor(color[0], color[1], color[2])
  155.         textline.SetText(textlineText)
  156.         textline.Show()
  157.         return textline
  158.     def RGB(self, r, g, b):
  159.         return (r*255, g*255, b*255)
  160.     def SliderBar(self, parent, sliderPos, func, x, y):
  161.         Slider = ui.SliderBar()
  162.         Slider.SetParent(parent)
  163.         Slider.SetPosition(x, y)
  164.         Slider.SetSliderPos(sliderPos / 100)
  165.         Slider.Show()
  166.         Slider.SetEvent(func)
  167.         return Slider
  168.     def ExpandedImage(self, parent, x, y, img):
  169.         image = ui.ExpandedImageBox()
  170.         image.SetParent(parent)
  171.         image.SetPosition(x, y)
  172.         image.LoadImage(img)
  173.         image.Show()
  174.         return image
  175.     def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
  176.         thin = ui.ThinBoard()
  177.         if parent != None:
  178.             thin.SetParent(parent)
  179.         if moveable == TRUE:
  180.             thin.AddFlag('movable')
  181.             thin.AddFlag('float')
  182.         thin.SetSize(width, heigh)
  183.         thin.SetPosition(x, y)
  184.         if center == TRUE:
  185.             thin.SetCenterPosition()
  186.         thin.Show()
  187.         return thin
  188. panelgracza().Show()
Advertisement
Add Comment
Please, Sign In to add comment