Advertisement
deadx2

Untitled

Aug 15th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.83 KB | None | 0 0
  1. import app
  2. import constInfo
  3. import uimg
  4. import uiToolTip
  5. import item
  6. import localemg
  7. import player
  8. import grp
  9. import time
  10. import event
  11. import chat
  12. import chr
  13. import net
  14.  
  15. import wndMgr
  16.  
  17. COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, 0.0)
  18.  
  19. class NagrodaBoss(uimg.ThinBoard):
  20.     Schowaj1 = 0
  21.     Schowaj2 = 0
  22.     Schowaj3 = 0
  23.  
  24.     Sloty = []
  25.     NagrodyBG = []
  26.     Przyciski = []
  27.     Pytajniki = []
  28.    
  29.     a1 = 1.0
  30.     a2 = 1.0
  31.     a3 = 1.0
  32.    
  33.     Animacja = 0
  34.     Alpha = 0.00
  35.     Alpha2 = 0.00
  36.     Nagroda = 0
  37.     Pozostale = 0
  38.     Zamknij = 0
  39.     def __init__(self):
  40.         uimg.ThinBoard.__init__(self, "TOP_MOST")
  41.         self.ZbudujOkno()
  42.     def SetColor(self,color):
  43.         wndMgr.SetColor(self.hWnd, color)
  44.         self.color = color
  45.  
  46.     def __del__(self):
  47.         uimg.ThinBoard.__del__(self)
  48.  
  49.     def Destroy(self):
  50.         self.Hide()
  51.         return TRUE
  52.  
  53.     def ZbudujOkno(self):
  54.         self.SetPosition(0, 0)
  55.         self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  56.         self.SetColor(COLOR_BG)
  57.         self.Show()
  58.        
  59.         self.CancelButton2 = uimg.Button()
  60.         self.CancelButton2.SetParent(self)
  61.         self.CancelButton2.SetPosition(self.GetWidth()/2-54, self.GetHeight()/2+190)
  62.         self.CancelButton2.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  63.         self.CancelButton2.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  64.         self.CancelButton2.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  65.         self.CancelButton2.SetText("Start")
  66.         self.CancelButton2.SetEvent(self.Open)
  67.         self.CancelButton2.Show()
  68.        
  69.         self.CancelButton3 = uimg.Button()
  70.         self.CancelButton3.SetParent(self)
  71.         self.CancelButton3.SetPosition(self.GetWidth()/2-95, self.GetHeight()/2+130)
  72.         self.CancelButton3.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  73.         self.CancelButton3.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  74.         self.CancelButton3.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  75.         self.CancelButton3.SetText("Pozostałe")
  76.         self.CancelButton3.SetEvent(self.Reszta)
  77.         self.CancelButton3.Hide()
  78.        
  79.         self.CancelButton4 = uimg.Button()
  80.         self.CancelButton4.SetParent(self)
  81.         self.CancelButton4.SetPosition(self.GetWidth()/2, self.GetHeight()/2+130)
  82.         self.CancelButton4.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  83.         self.CancelButton4.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  84.         self.CancelButton4.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  85.         self.CancelButton4.SetText("Zamknij")
  86.         self.CancelButton4.SetEvent(self.Close)
  87.         self.CancelButton4.Hide()
  88.        
  89.         for i in xrange(0,3):
  90.             Obrazek = uimg.ExpandedImageBox()
  91.             Obrazek.SetParent(self)
  92.             Obrazek.SetPosition((self.GetWidth()/2-172)+120*i, self.GetHeight()/2+20)
  93.             Obrazek.LoadImage("illumina/nagroda_boss/tlo.tga")
  94.             Obrazek.SetAlpha(0.0)
  95.             Obrazek.Show()
  96.             self.NagrodyBG.append(Obrazek)
  97.  
  98.             Slot = uimg.SlotWindow()
  99.             Slot.SetParent(Obrazek)
  100.             Slot.SetPosition(39, 39)
  101.             Slot.AppendSlot(i, 0, 0, 32, 32)
  102.             Slot.Hide()
  103.             self.Sloty.append(Slot)
  104.  
  105.             Pyt1 = uimg.ExpandedImageBox()
  106.             Pyt1.LoadImage("illumina/nagroda_boss/btn_01.tga")
  107.             Pyt1.SetParent(self)
  108.             Pyt1.SetPosition((self.GetWidth()/2-172)+120*i, self.GetHeight()/2+20)
  109.             Pyt1.SetAlpha(0.0)
  110.             Pyt1.Show()
  111.             self.Pytajniki.append(Pyt1)
  112.  
  113.             Btn = uimg.Button()
  114.             Btn.SetParent(self)
  115.             Btn.SetPosition((self.GetWidth()/2-172)+120*i, self.GetHeight()/2+20)
  116.             Btn.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  117.             Btn.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  118.             Btn.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  119.             Btn.SetEvent(uimg.__mem_func__(self.Schowaj), i+1)
  120.             Btn.Hide()
  121.             self.Przyciski.append(Btn)
  122.        
  123.         self.Tlo = uimg.ExpandedImageBox()
  124.         self.Tlo.LoadImage("illumina/nagroda_boss/info.tga")
  125.         self.Tlo.SetParent(self)
  126.         self.Tlo.SetPosition(self.GetWidth()/2-150, self.GetHeight()/2-200)
  127.         self.Tlo.SetAlpha(0.0)
  128.         self.Tlo.Show()
  129.  
  130.     def Schowaj(self, nr):
  131.         for i in xrange(0,3):
  132.             self.Przyciski[i].Hide()
  133.         if nr == 1:
  134.             self.Schowaj1 = 1
  135.             self.Nagroda = 1
  136.         elif nr == 2:
  137.             self.Schowaj2 = 1
  138.             self.Nagroda = 2
  139.         elif nr == 3:
  140.             self.Schowaj3 = 1
  141.             self.Nagroda = 3
  142.         self.CancelButton3.Show()
  143.         self.CancelButton4.Show()
  144.  
  145.     def Teleportacja(self, id):
  146.         net.SendChatPacket("/teleport " + str(id))
  147.  
  148.     def Reszta(self):
  149.         self.Pozostale = 1
  150.         self.CancelButton3.Hide()
  151.  
  152.     def PokazReszte(self):
  153.         if self.Pozostale == 1:
  154.             self.Schowaj1 = 1
  155.             self.Schowaj2 = 1
  156.             self.Schowaj3 = 1
  157.  
  158.     def Open(self):
  159.         self.Alpha = 0.0
  160.         self.Animacja = 1
  161.        
  162.     def OnPressEscapeKey(self):
  163.         self.Hide()
  164.         return TRUE
  165.  
  166.     def PrzyciskiShow(self):
  167.         if self.Animacja == 1:
  168.             for i in xrange(0,3):
  169.                 self.Przyciski[i].Show()
  170.  
  171.     def WyborNagrody(self, nr):
  172.         if self.Schowaj1 == 1 and self.a1 > 0:
  173.             self.Przyciski[0].Hide()
  174.             self.a1 -= 0.05
  175.             self.Pytajniki[0].SetAlpha(self.a1)
  176.        
  177.         if self.Schowaj2 == 1 and self.a2 > 0:
  178.             self.Przyciski[1].Hide()
  179.             self.a2 -= 0.05
  180.             self.Pytajniki[1].SetAlpha(self.a2)
  181.        
  182.         if self.Schowaj3 == 1 and self.a3 > 0:
  183.             self.Przyciski[2].Hide()
  184.             self.a3 -= 0.05
  185.             self.Pytajniki[2].SetAlpha(self.a3)
  186.  
  187.     def WyswietlOkno(self):
  188.         global COLOR_BG
  189.  
  190.         if self.Animacja == 1 and self.Alpha < 0.49:
  191.             self.Alpha += 0.01
  192.             COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, self.Alpha)
  193.             self.SetColor(COLOR_BG)
  194.  
  195.             self.Tlo.SetAlpha(self.Alpha*2)
  196.            
  197.             for i in xrange(0,3):
  198.                 self.NagrodyBG[i].SetAlpha(self.Alpha*2)
  199.                 self.Pytajniki[i].SetAlpha(self.Alpha*2)
  200.  
  201.         else:
  202.             self.PrzyciskiShow()
  203.             self.Animacja = 0
  204.  
  205.     def Close(self):
  206.         self.Zamknij = 1
  207.         self.CancelButton4.Hide()
  208.  
  209.     def ZamknijCalosc(self):
  210.         global COLOR_BG
  211.  
  212.         if self.Zamknij == 1 and self.Alpha > 0.1:
  213.             self.Alpha -= 0.01
  214.             COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, self.Alpha)
  215.             self.SetColor(COLOR_BG)
  216.  
  217.             self.Tlo.SetAlpha(self.Alpha*2)
  218.            
  219.             for i in xrange(0,3):
  220.                 self.NagrodyBG[i].SetAlpha(self.Alpha*2)
  221.         else:
  222.             self.Hide()
  223.             self.Zamknij = 0
  224.  
  225.     def OnUpdate(self):
  226.         self.WyswietlOkno()
  227.  
  228.         self.WyborNagrody(self.Nagroda)
  229.        
  230.         self.PokazReszte()
  231.        
  232.         if self.Zamknij == 1:
  233.             self.ZamknijCalosc()
  234.  
  235. NagrodaBoss().Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement