farkmt2official 1
farkmt2official
Bvural41 1
Bvural41
noisiv 1
noisiv
Manwe Work 1
Manwe Work
kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
Hikaye Ekle

Remote Shop Sistemi

  • Konuyu başlatan Konuyu başlatan dertbaz63
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 51
  • Görüntüleme Görüntüleme 8K
5.00 yıldız(lar) 2 Değerlendirme Değerlendirenler
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!

add scrollbar

Kod:
import player
import player
import net
import background
import app

import ui, renderTarget, constInfo

ROOT_YENI = "d:/ymir work/ui/remoteshop_2022/"

#######################################################

RENDER_TARGET_INDEX = 62

MOB_VNUM_1 = 9001
MOB_VNUM_2 = 9002
MOB_VNUM_3 = 9003
MOB_VNUM_4 = 9006
MOB_VNUM_5 = 9009
MOB_VNUM_6 = 9005
MOB_VNUM_7 = 20016
MOB_VNUM_8 = 20022

SHOP_VNUM_1 = 1
SHOP_VNUM_2 = 4
SHOP_VNUM_3 = 3
SHOP_VNUM_4 = 9
SHOP_VNUM_5 = 2
SHOP_VNUM_6 = 7
SHOP_VNUM_7 = 53
SHOP_VNUM_8 = 20022

#######################################################

class RemoteShop(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.__Initialize()
        self.__Load()
#        if app.ENABLE_WINDOW_SLIDE_EFFECT:
#            self.EnableSlidingEffect()

    def __del__(self):
        ui.ScriptWindow.__del__(self)
    
    def __Initialize(self):
        self.titleBar = 0
        self.ibrahimbutton = [
            [["Silah Satýcýsý",MOB_VNUM_1,SHOP_VNUM_1]],
            [["Zýrh Satýcýsý",MOB_VNUM_2,SHOP_VNUM_2]],
            [["Satýcý",MOB_VNUM_3,SHOP_VNUM_3]],
            [["Yaþlý Kadýn",MOB_VNUM_4,SHOP_VNUM_4]],
            [["Balýkçý",MOB_VNUM_5,SHOP_VNUM_5]],
            [["Depocu",MOB_VNUM_6,SHOP_VNUM_6]],
            [["Demirci",MOB_VNUM_7,SHOP_VNUM_7]],
            [["Huahn-So",MOB_VNUM_8,SHOP_VNUM_8]],
        ]
        self.ibonunresmi = [
            [["",MOB_VNUM_1]],
            [["",MOB_VNUM_2]],
            [["",MOB_VNUM_3]],
            [["",MOB_VNUM_4]],
            [["",MOB_VNUM_5]],
            [["",MOB_VNUM_6]],
            [["",MOB_VNUM_7]],
            [["",MOB_VNUM_8]],
        ]
        self.gokalp = {}
        self.NpcIconImage = {}
        self.model = 0
        self.index = 0
    
    def Destroy(self):
        self.ClearDictionary()
        self.gokalp = {}
        self.NpcIconImage = {}
        self.model = 0
        self.index = 0
        self.__Initialize()
        print " -------------------------------------- DESTROY SYSTEM HIDRAGAME DIALOG"
    
    def __Load_LoadScript(self, fileName):
        try:
            pyScriptLoader = ui.PythonScriptLoader()
            pyScriptLoader.LoadScriptFile(self, fileName)
        except:
            import exception
            exception.Abort("System.ibrahimDialog.__Load_LoadScript")
    
    def __Load_BindObject(self):
        try:
    
            self.titleBar = self.GetChild("titlebar")
            self.Board = self.GetChild("board")
            self.name = self.GetChild("test")
            self.OpenButton = self.GetChild("OpenButton")
            self.CancelButton = self.GetChild("OpenButton")
            self.BlackBoard2 = self.GetChild("BlackBoard2")
            self.BlackBoard1 = self.GetChild("BlackBoard1")
            self.CancelButton = self.GetChild("cancel")
        except:
            import exception
            exception.Abort("ibrahimDialog.__Load_BindObject")
    
    def __Load(self):
        self.__Load_LoadScript("uiscript/npcekran.py")
        self.__Load_BindObject()
    
        self.renderTarget = ui.RenderTarget()
        self.renderTarget.SetParent(self.BlackBoard2)
        self.renderTarget.SetSize(230,350)
        self.renderTarget.SetPosition(10,40)
        self.renderTarget.SetRenderTarget(RENDER_TARGET_INDEX)
        self.renderTarget.Show()

        # ????? ScrollBar
        self.scrollBar = self.GetChild("ScrollBar")
        self.scrollBar.SetParent(self)
        self.scrollBar.SetPosition(285, 40)
        self.scrollBar.SetScrollBarSize(420)
        self.scrollBar.Show()
        self.scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScroll))

        self.UpdateButtonList()
    
        renderTarget.SetBackground(RENDER_TARGET_INDEX, "d:/ymir work/ui/game/myshop_deco/model_view_bg.sub")
        renderTarget.SetVisibility(RENDER_TARGET_INDEX, True)
    
        butonsayisi = 0
        for market in self.ibrahimbutton:
            self.gokalp[butonsayisi] = ui.RadioButton()
            self.gokalp[butonsayisi].SetParent(self.BlackBoard1)
            self.gokalp[butonsayisi].SetPosition(7,9+ butonsayisi*51)
            self.gokalp[butonsayisi].SetUpVisual(ROOT_YENI + "butonlar/selectbutton1.png")
            self.gokalp[butonsayisi].SetOverVisual(ROOT_YENI + "butonlar/selectbutton1.png")
            self.gokalp[butonsayisi].SetDownVisual(ROOT_YENI + "butonlar/selectbutton2.png")
            self.gokalp[butonsayisi].SetText(market[0][0])
            self.gokalp[butonsayisi].SetEvent(self.__Fonksiyon,butonsayisi,market[0][1], market[0][2])
            self.gokalp[butonsayisi].Show()
            butonsayisi +=1
    
        self.ibobuttonlar = (
            self.gokalp[0],
            self.gokalp[1],
            self.gokalp[2],
            self.gokalp[3],
            self.gokalp[4],
            self.gokalp[5],
            self.gokalp[6],
            self.gokalp[7],
        )
    
        self.__Fonksiyon(0, self.ibrahimbutton[0][0][1], self.ibrahimbutton[0][0][2])
    
        resimsayisi = 0
        for resimler in self.ibonunresmi:
            self.NpcIconImage[resimsayisi] = ui.ImageBox()
            self.NpcIconImage[resimsayisi].SetParent(self.gokalp[resimsayisi])
            self.NpcIconImage[resimsayisi].LoadImage(ROOT_YENI + "face/%d.png" % resimler[0][1])
            self.NpcIconImage[resimsayisi].SetPosition(0, 0)
            self.NpcIconImage[resimsayisi].Show()
            resimsayisi += 1
    
        self.SetCenterPosition()
        self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
        self.CancelButton.SAFE_SetEvent(self.Close)

    def OnScroll(self):
        self.Close()
        self.Open()
    
        start_index = int(self.scrollBar.GetPos())
    
        for a in range(start_index, len(self.visible_buttons)):
            if start_index + a < len(self.ibrahimbutton):
                mob_vnum = self.ibrahimbutton[start_index + a][0][1]
                shop_vnum = self.ibrahimbutton[start_index + a][0][2]
    
                if mob_vnum > MOB_VNUM_8:
                    self.visible_buttons[a].Hide()
                else:
                    self.visible_buttons[a].Show()
            else:
                self.visible_buttons[a].Hide()
    
        self.SetScrollPosition(start_index)
    
    def SetScrollPosition(self, i):
        for a in range(len(self.ibrahimbutton)):
            b = a - i
            if a < len(self.visible_buttons):
                mob_vnum = self.ibrahimbutton[a][0][1]
                shop_vnum = self.ibrahimbutton[a][0][2]
    
                if mob_vnum > MOB_VNUM_8:
                    self.visible_buttons[a].Hide()
                else:
                    self.visible_buttons[a].Show()
    
                self.visible_buttons[a].SetPosition(self.gokalp[a].GetX(), self.gokalp[a].GetY() + b * 51)


    def UpdateButtonList(self):
        butonsayisi = 0
        self.gokalp = {}
        self.visible_buttons = []
    
        for market in self.ibrahimbutton:
            self.gokalp[butonsayisi] = ui.RadioButton()
            self.gokalp[butonsayisi].SetParent(self.BlackBoard1)
            self.gokalp[butonsayisi].SetPosition(7, 9 + butonsayisi * 51)
            self.gokalp[butonsayisi].SetUpVisual(ROOT_YENI + "butonlar/selectbutton1.png")
            self.gokalp[butonsayisi].SetOverVisual(ROOT_YENI + "butonlar/selectbutton1.png")
            self.gokalp[butonsayisi].SetDownVisual(ROOT_YENI + "butonlar/selectbutton2.png")
            self.gokalp[butonsayisi].SetText(market[0][0])
            self.gokalp[butonsayisi].SetEvent(self.__Fonksiyon, butonsayisi, market[0][1], market[0][2])
            self.gokalp[butonsayisi].Show()
            self.visible_buttons.append(self.gokalp[butonsayisi])
            butonsayisi += 1
    
        self.ibobuttonlar = tuple(self.visible_buttons)
        self.__Fonksiyon(0, self.ibrahimbutton[0][0][1], self.ibrahimbutton[0][0][2])
    
    def UpdateScrollBarVisibility(self):
        start_index = int(self.scrollBar.GetPos() * (len(self.ibrahimbutton) - len(self.visible_buttons)))
    
        for i, button in enumerate(self.visible_buttons):
            if i + start_index < len(self.ibrahimbutton):
                mob_vnum = self.ibrahimbutton[i + start_index][0][1]
                shop_vnum = self.ibrahimbutton[i + start_index][0][2]
            else:
                button.Hide()

    def OnUpdate(self):
        self.UpdateScrollBar()
    
    def UpdateScrollBar(self):
        start_index = int(self.scrollBar.GetPos() * (len(self.ibrahimbutton) - len(self.ibobuttonlar)))
        for i, button in enumerate(self.ibobuttonlar):
            button.SetText(self.ibrahimbutton[start_index + i][0][0])
            button.SetEvent(self.__Fonksiyon, i, self.ibrahimbutton[start_index + i][0][1], self.ibrahimbutton[start_index + i][0][2])
            if start_index + i < len(self.ibonunresmi):
                self.NpcIconImage[i].LoadImage(ROOT_YENI + "face/%d.png" % self.ibonunresmi[start_index + i][0][1])
    
        # Check for scroll bar thumb dragging
        if hasattr(self.scrollBar, "OnUpdate"):
            self.scrollBar.OnUpdate()

    def __Fonksiyon(self, index, model,shop):
        self.model = model
        self.index = index
        self.shop = shop
    
        for btn in self.ibobuttonlar:
            btn.SetUp()
        self.ibobuttonlar[index].Down()
    
        self.name.SetText(self.ibrahimbutton[self.index][0][0])
    
        renderTarget.SelectModel(RENDER_TARGET_INDEX, self.ibrahimbutton[self.index][0][1])
        self.OpenButton.SAFE_SetEvent(self.__openbutton,self.shop)
    
    def __openbutton(self,model):
        constInfo.RANGE_SHOP_NOT_VIEW = 1
        net.SendChatPacket("/open_range_npc %d " % int(model))
        self.Close()
    
    def Show(self):
        ui.ScriptWindow.Show(self)
        renderTarget.SelectModel(RENDER_TARGET_INDEX, self.ibrahimbutton[self.index][0][1])
    
    def Open(self):
        self.Show()
    
    def Close(self):
        self.Hide()
    
    def OnPressEscapeKey(self):
        self.Close()

Kod:
import uiScriptLocale
import localeInfo

ROOT_PATH = "d:/ymir work/ui/public/"
ROOT_YENI = "d:/ymir work/ui/remoteshop_2022/"
TEMPORARY_X = +13
TEXT_TEMPORARY_X = -10
BUTTON_TEMPORARY_X = 5
PVP_X = -10

window = {
    "name" : "GameOptionDialog",
    "style" : ("movable", "float",),

    "x" : 0,
    "y" : 0,

    "width" : 537,
    "height" : 467,

    "children" :
    (
        {
            "name" : "board",
            "type" : "board",

            "x" : 0,
            "y" : 0,

            "width" : 537,
            "height" : 467,

            "children" :
            (
                ## Title
                {
                    "name" : "titlebar",
                    "type" : "titlebar",
                    "style" : ("attach",),

                    "x" : 8,
                    "y" : 8,

                    "width" : 537 - 15,
                    "color" : "gray",

                    "children" :
                    (
                        { 
                        "name":"titlename", "type":"text", "x":0, "y":3, 
                        "horizontal_align":"center", "text_horizontal_align":"center",
                        "text": localeInfo.Market,
                         },
                    ),
                },
                {
                    "name" : "BlackBoard1",
                    "type" : "thinboard_circle",
                    "x" : 10, "y" : 36, "width" : 267, "height" : 422,
                },
                {
                    "name" : "BlackBoard2",
                    "type" : "thinboard_circle",
                    "x" : 280, "y" : 36, "width" :196 + 30 + 23, "height" : 422,
                    "children":
                    (
                        {
                            "name" : "ModelView",
                            "type" : "image",
                            
                            "x" : 3, "y" : 2,
                            "image" : ROOT_YENI + "butonlar/title.png",
                            
                            "children" :
                            (
                                { "name" : "test", "type" : "text", "x" : 0, "y" : 0, "text" : "", "all_align":"center" },
                            ),
                        },
                        {
                            "name" : "OpenButton", "type" : "button",
                            "x" : 12, "y" : 9+(30*6)+33 + 170,
                            "text": localeInfo.UI_OK,
                            "text_height" : 6,

                            "default_image" : ROOT_YENI + "butonlar/button_1.png",
                            "over_image" : ROOT_YENI + "butonlar/button_2.png",
                            "down_image" : ROOT_YENI + "butonlar/button_2.png",
                        },
                        {
                            "name" : "cancel", "type" : "button",
                            "x" : 130, "y" : 9+(30*6)+33 + 170,
                            "text": localeInfo.UI_CLOSE,
                            "text_height" : 6,
                            "default_image" : ROOT_YENI + "butonlar/button_1.png",
                            "over_image" : ROOT_YENI + "butonlar/button_2.png",
                            "down_image" : ROOT_YENI + "butonlar/button_2.png",
                        },
                        {
                            "name" : "ScrollBar",
                            "type" : "scrollbar",
                            "x" : 510,
                            "y" : 40,
                            "size" : 10,
                        },
                    ),
                },
            ),
        },
    ),
}
 
Son düzenleme:
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