bikral 1
bikral
ShadowFon 1
ShadowFon
D 1
delimuratt
PrimeAC 1
PrimeAC
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Best Studio 1
Best Studio
kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

New class for drop/buy/sell dialog

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

xRooT

Level 2
Üye
Katılım
20 Mar 2015
Konular
10
Mesajlar
88
Online süresi
4h 8m
Reaksiyon Skoru
13
Altın Konu
0
TM Yaşı
11 Yıl 2 Ay 25 Gün
Başarım Puanı
82
MmoLira
258
DevLira
0
Ticaret - 0%
0   0   0

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!

Hi Turkmmo

Illustrative video:




add new class in root/uiCommon.py

PHP:
class ItemQuestionDialog(ui.ScriptWindow):

    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.__CreateDialog()
       
        self.tooltipItem = uiToolTip.ItemToolTip()
        self.window_type = 0 # "inv" or "shop"
        self.count = 0
        self.height = 0 # 30 for buy & sell
       
    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def __CreateDialog(self):
        pyScrLoader = ui.PythonScriptLoader()
        pyScrLoader.LoadScriptFile(self, "uiscript/questiondialog.py")

        self.board = self.GetChild("board")
        self.textLine = self.GetChild("message")
        self.acceptButton = self.GetChild("accept")
        self.cancelButton = self.GetChild("cancel")

        self.titleBar = ui.TitleBar()
        self.titleBar.SetParent(self.board)
        self.titleBar.MakeTitleBar(244, "yellow")
        self.titleBar.SetPosition(8, 7)
        self.titleBar.Show()

        self.titleName = ui.TextLine()
        self.titleName.SetParent(self.titleBar)
        self.titleName.SetPosition(0, 4)
        self.titleName.SetWindowHorizontalAlignCenter()
        self.titleName.SetHorizontalAlignCenter()
        self.titleName.Show()

        self.slotList = []
        for i in xrange(3):
            slot = ui.ImageBox()
            slot.LoadImage("d:/ymir work/ui/public/slot_base.sub")
            slot.SetParent(self)
            slot.SetWindowHorizontalAlignCenter()
            self.slotList.append(slot)

    def Open(self, vnum, slot, text=""):
        item.SelectItem(vnum)
        xSlotCount, ySlotCount = item.GetItemSize()

        try:
            if self.window_type == "inv":
                metinSlot = [player.GetItemMetinSocket(player.INVENTORY, slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
            elif self.window_type == "shop":
                metinSlot = [shop.GetItemMetinSocket(slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
        except:
            pass

        if vnum in (50300, 70037):
            self.titleName.SetText("%s %s" % (skill.GetSkillName(metinSlot[0]), item.GetItemName()))
        elif vnum == 70104:
            self.titleName.SetText("%s %s" % (nonplayer.GetMonsterName(metinSlot[0]), item.GetItemName()))
        else:
            self.titleName.SetText(item.GetItemName())

        if text:
            textLine2 = ui.TextLine()
            textLine2.SetPosition(0, 80 + 32*ySlotCount)
            textLine2.SetWindowHorizontalAlignCenter()
            textLine2.SetHorizontalAlignCenter()
            textLine2.SetVerticalAlignCenter()
            textLine2.SetParent(self.board)
            textLine2.SetText(text)
            textLine2.Show()
            self.textLine2 = textLine2

        slotGrid = ui.SlotWindow()
        slotGrid.SetParent(self)
        slotGrid.SetPosition(-16, 64)
        slotGrid.SetWindowHorizontalAlignCenter()
        slotGrid.AppendSlot(0, 0, 0, 32*xSlotCount, 32*ySlotCount)
        slotGrid.AddFlag("not_pick")
        slotGrid.Show()
        self.slotGrid = slotGrid

        if self.count > 1:
            self.slotGrid.SetItemSlot(0, vnum, self.count)
        else:
            self.slotGrid.SetItemSlot(0, vnum)

        if text:
            self.height -= 10
               
        self.SetSize(260, 110 + 32*ySlotCount + self.height)
        self.board.SetSize(260, 110 + 32*ySlotCount + self.height)
        self.textLine.SetPosition(0, 44)

        for i in xrange(min(3, ySlotCount)):
            self.slotList[i].SetPosition(0, 32 + ySlotCount*32 - i*32)
            self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(arg)
            self.slotList[i].OnMouseOverOut = lambda arg = self.tooltipItem: self.OverOutItem(arg)
            self.slotList[i].Show()

        self.GetChild("accept").SetPosition(-40, 74 + 32*ySlotCount + self.height)
        self.GetChild("cancel").SetPosition(40, 74 + 32*ySlotCount + self.height)

        self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
       
        self.SetCenterPosition()
        self.SetTop()
        self.Show()

    def SetCloseEvent(self, event):
        self.titleBar.SetCloseEvent(event)
       
    def SetMessage(self, text):
        self.textLine.SetText(text)

    def OverInItem(self, slot):
        if self.window_type == "shop":
            self.tooltipItem.SetShopItem(slot)
        elif self.window_type == "inv":
            self.tooltipItem.SetInventoryItem(slot)
       
    def OverOutItem(self, tooltipItem):
        if 0 != tooltipItem:
            self.tooltipItem.HideToolTip()
            self.tooltipItem.ClearToolTip()
   
    def Close(self):
        self.ClearDictionary()
        self.slotList = []
        self.titleBar = None
        self.titleName = None
        self.textLine2 = None
        self.slotGrid = None
       
        self.tooltipItem = 0
        self.Hide()
       
        constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
       
    def SetWidth(self, width):
        height = self.GetHeight()
        self.SetSize(width, height)
        self.board.SetSize(width, height)
        self.SetCenterPosition()
        self.UpdateRect()

    def SAFE_SetAcceptEvent(self, event):
        self.acceptButton.SAFE_SetEvent(event)

    def SAFE_SetCancelEvent(self, event):
        self.cancelButton.SAFE_SetEvent(event)

    def SetAcceptEvent(self, event):
        self.acceptButton.SetEvent(event)

    def SetCancelEvent(self, event):
        self.cancelButton.SetEvent(event)

    def SetText(self, text):
        self.textLine.SetText(text)

    def SetAcceptText(self, text):
        self.acceptButton.SetText(text)

    def SetCancelText(self, text):
        self.cancelButton.SetText(text)

    def OnPressEscapeKey(self):
        self.Close()

        return True
    # End

The topic is moved and I think one of the members will benefit from this class


I ask the brothers who have a problem and solve it by bringing the solution to everyone and I love the people what you love for yourself

Thank you,
 

En Çok Reaksiyon Alan Mesajlar

Thank you brother
 
Hi Turkmmo

Illustrative video:




add new class in root/uiCommon.py

PHP:
class ItemQuestionDialog(ui.ScriptWindow):

    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.__CreateDialog()
      
        self.tooltipItem = uiToolTip.ItemToolTip()
        self.window_type = 0 # "inv" or "shop"
        self.count = 0
        self.height = 0 # 30 for buy & sell
      
    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def __CreateDialog(self):
        pyScrLoader = ui.PythonScriptLoader()
        pyScrLoader.LoadScriptFile(self, "uiscript/questiondialog.py")

        self.board = self.GetChild("board")
        self.textLine = self.GetChild("message")
        self.acceptButton = self.GetChild("accept")
        self.cancelButton = self.GetChild("cancel")

        self.titleBar = ui.TitleBar()
        self.titleBar.SetParent(self.board)
        self.titleBar.MakeTitleBar(244, "yellow")
        self.titleBar.SetPosition(8, 7)
        self.titleBar.Show()

        self.titleName = ui.TextLine()
        self.titleName.SetParent(self.titleBar)
        self.titleName.SetPosition(0, 4)
        self.titleName.SetWindowHorizontalAlignCenter()
        self.titleName.SetHorizontalAlignCenter()
        self.titleName.Show()

        self.slotList = []
        for i in xrange(3):
            slot = ui.ImageBox()
            slot.LoadImage("d:/ymir work/ui/public/slot_base.sub")
            slot.SetParent(self)
            slot.SetWindowHorizontalAlignCenter()
            self.slotList.append(slot)

    def Open(self, vnum, slot, text=""):
        item.SelectItem(vnum)
        xSlotCount, ySlotCount = item.GetItemSize()

        try:
            if self.window_type == "inv":
                metinSlot = [player.GetItemMetinSocket(player.INVENTORY, slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
            elif self.window_type == "shop":
                metinSlot = [shop.GetItemMetinSocket(slot, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
        except:
            pass

        if vnum in (50300, 70037):
            self.titleName.SetText("%s %s" % (skill.GetSkillName(metinSlot[0]), item.GetItemName()))
        elif vnum == 70104:
            self.titleName.SetText("%s %s" % (nonplayer.GetMonsterName(metinSlot[0]), item.GetItemName()))
        else:
            self.titleName.SetText(item.GetItemName())

        if text:
            textLine2 = ui.TextLine()
            textLine2.SetPosition(0, 80 + 32*ySlotCount)
            textLine2.SetWindowHorizontalAlignCenter()
            textLine2.SetHorizontalAlignCenter()
            textLine2.SetVerticalAlignCenter()
            textLine2.SetParent(self.board)
            textLine2.SetText(text)
            textLine2.Show()
            self.textLine2 = textLine2

        slotGrid = ui.SlotWindow()
        slotGrid.SetParent(self)
        slotGrid.SetPosition(-16, 64)
        slotGrid.SetWindowHorizontalAlignCenter()
        slotGrid.AppendSlot(0, 0, 0, 32*xSlotCount, 32*ySlotCount)
        slotGrid.AddFlag("not_pick")
        slotGrid.Show()
        self.slotGrid = slotGrid

        if self.count > 1:
            self.slotGrid.SetItemSlot(0, vnum, self.count)
        else:
            self.slotGrid.SetItemSlot(0, vnum)

        if text:
            self.height -= 10
              
        self.SetSize(260, 110 + 32*ySlotCount + self.height)
        self.board.SetSize(260, 110 + 32*ySlotCount + self.height)
        self.textLine.SetPosition(0, 44)

        for i in xrange(min(3, ySlotCount)):
            self.slotList[i].SetPosition(0, 32 + ySlotCount*32 - i*32)
            self.slotList[i].OnMouseOverIn = lambda arg = slot: self.OverInItem(arg)
            self.slotList[i].OnMouseOverOut = lambda arg = self.tooltipItem: self.OverOutItem(arg)
            self.slotList[i].Show()

        self.GetChild("accept").SetPosition(-40, 74 + 32*ySlotCount + self.height)
        self.GetChild("cancel").SetPosition(40, 74 + 32*ySlotCount + self.height)

        self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
      
        self.SetCenterPosition()
        self.SetTop()
        self.Show()

    def SetCloseEvent(self, event):
        self.titleBar.SetCloseEvent(event)
      
    def SetMessage(self, text):
        self.textLine.SetText(text)

    def OverInItem(self, slot):
        if self.window_type == "shop":
            self.tooltipItem.SetShopItem(slot)
        elif self.window_type == "inv":
            self.tooltipItem.SetInventoryItem(slot)
      
    def OverOutItem(self, tooltipItem):
        if 0 != tooltipItem:
            self.tooltipItem.HideToolTip()
            self.tooltipItem.ClearToolTip()
  
    def Close(self):
        self.ClearDictionary()
        self.slotList = []
        self.titleBar = None
        self.titleName = None
        self.textLine2 = None
        self.slotGrid = None
      
        self.tooltipItem = 0
        self.Hide()
      
        constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
      
    def SetWidth(self, width):
        height = self.GetHeight()
        self.SetSize(width, height)
        self.board.SetSize(width, height)
        self.SetCenterPosition()
        self.UpdateRect()

    def SAFE_SetAcceptEvent(self, event):
        self.acceptButton.SAFE_SetEvent(event)

    def SAFE_SetCancelEvent(self, event):
        self.cancelButton.SAFE_SetEvent(event)

    def SetAcceptEvent(self, event):
        self.acceptButton.SetEvent(event)

    def SetCancelEvent(self, event):
        self.cancelButton.SetEvent(event)

    def SetText(self, text):
        self.textLine.SetText(text)

    def SetAcceptText(self, text):
        self.acceptButton.SetText(text)

    def SetCancelText(self, text):
        self.cancelButton.SetText(text)

    def OnPressEscapeKey(self):
        self.Close()

        return True
    # End

The topic is moved and I think one of the members will benefit from this class


I ask the brothers who have a problem and solve it by bringing the solution to everyone and I love the people what you love for yourself

Thank you,
Çalışır halde kanıt kendinden atarmısın.
 
thank you bro
 
Çalışır halde kanıt kendinden atarmısın.
I have moved the subject and I think that any one of the members benefit from the code and that one of the installation adds solutions for everyone to benefit more, and I think it is necessary to add other codes but I do not have enough experience
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst