Yardım Official Render Target

  • Konuyu açan Konuyu açan xplarges
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 6
  • Gösterim Gösterim 141
Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

xplarges

Üye
Üye
Mesaj
134
Çözümler
9
Beğeni
39
Puan
119
Ticaret Puanı
0
Kendimce bir gui yapmaya çalıştım 6 tane npc yi göstermesi gerekirken 1 tane gösteriyor sorun ne olabilir?

Belirli kod parçacığı:
Genişlet Daralt Kopyala
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.NPCModelList = [
            ["Silah", 9001],
            ["Zirh", 9002],
            ["Satici", 9003],
            ["Olay", 9004],
            ["Depocu", 9005],
            ["Yasli", 9006]
        ]

    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def PlaceNPCModels(self):
        for i in range(6):
            npcName, npcVnum = self.NPCModelList[i]
            renderTarget = getattr(self, "RenderTarget{}".format(i + 1))

            modelNameWidget = getattr(self, "ModelName{}".format(i + 1))
            modelNameWidget.SetText(npcName)
        
            player.SelectShopModel(npcVnum)

    def Open(self):
        self.__LoadScript("rangenpcwindow.py")

        self.TitleBar = self.GetChild("TitleName")

        for i in range(1, 7):
            setattr(self, "Board{}".format(i), self.GetChild("Board{}".format(i)))
            setattr(self, "ModelView{}".format(i), self.GetChild("ModelView{}".format(i)))
            setattr(self, "ModelName{}".format(i), self.GetChild("ModelName{}".format(i)))
            setattr(self, "RenderTarget{}".format(i), self.GetChild("RenderTarget{}".format(i)))

        self.PlaceNPCModels()

        player.MyShopDecoShow( True )
        ui.ScriptWindow.Show(self)

1728925675741.webp
 
Merhaba,
Aslında istediğini yapmışsın ama eksiğin renderleri modelleri vs yapıyor ancak hepsini üst üste bindiriyor. her model için ayrı konumlandırma yapmamışsın.

Python:
Genişlet Daralt Kopyala
def __init__(self):
    ui.ScriptWindow.__init__(self)
    self.NPCModelList = [
        ["Silah", 9001],
        ["Zirh", 9002],
        ["Satici", 9003],
        ["Olay", 9004],
        ["Depocu", 9005],
        ["Yasli", 9006]
    ]

def __del__(self):
    ui.ScriptWindow.__del__(self)

def PlaceNPCModels(self):
    for i in range(len(self.NPCModelList)):
        npcName, npcVnum = self.NPCModelList[i]
        renderTarget = getattr(self, "RenderTarget{}".format(i + 1))

        modelNameWidget = getattr(self, "ModelName{}".format(i + 1))
        modelNameWidget.SetText(npcName)

        # NPC modelini seç
        player.SelectShopModel(npcVnum)

        # Her render target konumunu ayarla
        x_position = (i % 3) * 200  # 3 sütun için
        y_position = (i // 3) * 150  # 2 satır için
        renderTarget.SetPosition(x_position, y_position)

def Open(self):
    self.__LoadScript("rangenpcwindow.py")

    self.TitleBar = self.GetChild("TitleName")

    for i in range(1, 7):
        setattr(self, "Board{}".format(i), self.GetChild("Board{}".format(i)))
        setattr(self, "ModelView{}".format(i), self.GetChild("ModelView{}".format(i)))
        setattr(self, "ModelName{}".format(i), self.GetChild("ModelName{}".format(i)))
        setattr(self, "RenderTarget{}".format(i), self.GetChild("RenderTarget{}".format(i)))

    self.PlaceNPCModels()

    player.MyShopDecoShow(True)
    ui.ScriptWindow.Show(self)

Öncekini yedek alıp şöyle bir denermisin rastgele konumlar ekledim dinamik olarakta npcliste uydurdum. tam nereye oturacaklar bilmiyorum dene bakalım sonuç ne olacak
 
Merhaba,
Aslında istediğini yapmışsın ama eksiğin renderleri modelleri vs yapıyor ancak hepsini üst üste bindiriyor. her model için ayrı konumlandırma yapmamışsın.

Python:
Genişlet Daralt Kopyala
def __init__(self):
    ui.ScriptWindow.__init__(self)
    self.NPCModelList = [
        ["Silah", 9001],
        ["Zirh", 9002],
        ["Satici", 9003],
        ["Olay", 9004],
        ["Depocu", 9005],
        ["Yasli", 9006]
    ]

def __del__(self):
    ui.ScriptWindow.__del__(self)

def PlaceNPCModels(self):
    for i in range(len(self.NPCModelList)):
        npcName, npcVnum = self.NPCModelList[i]
        renderTarget = getattr(self, "RenderTarget{}".format(i + 1))

        modelNameWidget = getattr(self, "ModelName{}".format(i + 1))
        modelNameWidget.SetText(npcName)

        # NPC modelini seç
        player.SelectShopModel(npcVnum)

        # Her render target konumunu ayarla
        x_position = (i % 3) * 200  # 3 sütun için
        y_position = (i // 3) * 150  # 2 satır için
        renderTarget.SetPosition(x_position, y_position)

def Open(self):
    self.__LoadScript("rangenpcwindow.py")

    self.TitleBar = self.GetChild("TitleName")

    for i in range(1, 7):
        setattr(self, "Board{}".format(i), self.GetChild("Board{}".format(i)))
        setattr(self, "ModelView{}".format(i), self.GetChild("ModelView{}".format(i)))
        setattr(self, "ModelName{}".format(i), self.GetChild("ModelName{}".format(i)))
        setattr(self, "RenderTarget{}".format(i), self.GetChild("RenderTarget{}".format(i)))

    self.PlaceNPCModels()

    player.MyShopDecoShow(True)
    ui.ScriptWindow.Show(self)

Öncekini yedek alıp şöyle bir denermisin rastgele konumlar ekledim dinamik olarakta npcliste uydurdum. tam nereye oturacaklar bilmiyorum dene bakalım sonuç ne olacak
1728928114485.webp
 
rangenpcwindow.py:
Genişlet Daralt Kopyala
                {
                    "name": "Board1",
                    "type": "thinboard_circle",
                    "x": 13, "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView1",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName1", "type": "text", "x": 0, "y": 0, "text": "Model 1", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget1",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 1,
                        },
                    ),
                },
                {
                    "name": "Board2",
                    "type": "thinboard_circle",
                    "x": 13 + BOARD_WIDTH + BOARD_X_GAP, "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView2",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName2", "type": "text", "x": 0, "y": 0, "text": "Model 2", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget2",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 2,
                        },
                    ),
                },

Böyle bir yapı kullanıyorum
 
rangenpcwindow.py:
Genişlet Daralt Kopyala
                {
                    "name": "Board1",
                    "type": "thinboard_circle",
                    "x": 13, "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView1",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName1", "type": "text", "x": 0, "y": 0, "text": "Model 1", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget1",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 1,
                        },
                    ),
                },
                {
                    "name": "Board2",
                    "type": "thinboard_circle",
                    "x": 13 + BOARD_WIDTH + BOARD_X_GAP, "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView2",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName2", "type": "text", "x": 0, "y": 0, "text": "Model 2", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget2",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 2,
                        },
                    ),
                },

Böyle bir yapı kullanıyorum
Bu dosyanın tamamını atarmısın
 
Bu dosyanın tamamını atarmısın
Python:
Genişlet Daralt Kopyala
import uiScriptLocale

MAINBOARD_WIDTH = 634
MAINBOARD_HEIGHT = 600
MAINBOARD_X = (SCREEN_WIDTH / 2) - (MAINBOARD_WIDTH / 2)
MAINBOARD_Y = (SCREEN_HEIGHT / 2) - (MAINBOARD_HEIGHT / 2)

BOARD_WIDTH = 196
BOARD_HEIGHT = 269
BOARD_X_GAP = 10
BOARD_Y_GAP = 10

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

    "x": MAINBOARD_X,
    "y": MAINBOARD_Y,

    "width": MAINBOARD_WIDTH,
    "height": MAINBOARD_HEIGHT,

    "children":
    (
        ## MainBoard
        {
            "name": "MyShopDecoBoard",
            "type": "board",
            "style": ("attach", "ltr"),

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

            "width": MAINBOARD_WIDTH,
            "height": MAINBOARD_HEIGHT,

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

                    "x": 6, "y": 7, "width": MAINBOARD_WIDTH - 13,

                    "children":
                    (
                        {"name": "TitleName", "type": "text", "x": 0, "y": 0, "text": "Uzaktan Market", "all_align": "center"},
                    ),
                },

                # Board satırları
                # 1. satır (üstte)
                {
                    "name": "Board1",
                    "type": "thinboard_circle",
                    "x": 13, "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView1",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName1", "type": "text", "x": 0, "y": 0, "text": "Model 1", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget1",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 1,
                        },
                    ),
                },
                {
                    "name": "Board2",
                    "type": "thinboard_circle",
                    "x": 13 + BOARD_WIDTH + BOARD_X_GAP, "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView2",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName2", "type": "text", "x": 0, "y": 0, "text": "Model 2", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget2",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 2,
                        },
                    ),
                },
                {
                    "name": "Board3",
                    "type": "thinboard_circle",
                    "x": 13 + 2 * (BOARD_WIDTH + BOARD_X_GAP), "y": 36, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView3",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName3", "type": "text", "x": 0, "y": 0, "text": "Model 3", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget3",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 3,
                        },
                    ),
                },

                # 2. satır (altta)
                {
                    "name": "Board4",
                    "type": "thinboard_circle",
                    "x": 13, "y": 36 + BOARD_HEIGHT + BOARD_Y_GAP, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView4",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName4", "type": "text", "x": 0, "y": 0, "text": "Model 4", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget4",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 4,
                        },
                    ),
                },
                {
                    "name": "Board5",
                    "type": "thinboard_circle",
                    "x": 13 + BOARD_WIDTH + BOARD_X_GAP, "y": 36 + BOARD_HEIGHT + BOARD_Y_GAP, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView5",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName5", "type": "text", "x": 0, "y": 0, "text": "Model 5", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget5",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 5,
                        },
                    ),
                },
                {
                    "name": "Board6",
                    "type": "thinboard_circle",
                    "x": 13 + 2 * (BOARD_WIDTH + BOARD_X_GAP), "y": 36 + BOARD_HEIGHT + BOARD_Y_GAP, "width": BOARD_WIDTH, "height": BOARD_HEIGHT,
                    "children":
                    (
                        {
                            "name": "ModelView6",
                            "type": "image",
                            "x": 0, "y": 0,
                            "image": "d:/ymir work/ui/game/myshop_deco/model_view_title.sub",
                            "children":
                            (
                                { "name": "ModelName6", "type": "text", "x": 0, "y": 0, "text": "Model 6", "all_align": "center" },
                            ),
                        },
                        {
                            "name": "RenderTarget6",
                            "type": "render_target",
                            "x": 3,
                            "y": 26,
                            "width": 190,
                            "height": 210,
                            "index": 6,
                        },
                    ),
                },
            ),
        },
    ),
}
 
Üst