[PY] Error Notice Box - Elveron

XxZeMaHSeRxX

Kıdemli Yönetici
Katılım
2 Ara 2024
Konular
186
Mesajlar
1,946
Online süresi
5ay 13g
Reaksiyon Skoru
1,478
Altın Konu
1
Başarım Puanı
206
TM Yaşı
1 Yıl 4 Ay 18 Gün
MmoLira
12,094
DevLira
36

Metin2 EP, Valorant VP dahil tüm oyun ürünlerini en uygun fiyatlarla bulabilir, Item ve Karakterlerinizi hızlıca satabilirsiniz. HEMEN TIKLA!

Oyundaki hataları burda balık tutamazsınız vesaire gibi şeyleri yeni bir notice kutusu tarzında size gösterir.



Video link





ANLATIM,

ui.py:
Aratılır

class ImageBox(Window):
   
Bloğun altına eklenir

class NoticeBoxBoard(Window):
    CORNER_WIDTH = 11
    CORNER_HEIGHT = 11
    LINE_WIDTH = 11
    LINE_HEIGHT = 11
    BOARD_COLOR = grp.GenerateColor(0.165, 0.133, 0.098, 1.0)

    LT = 0
    LB = 1
    RT = 2
    RB = 3
    L = 0
    R = 1
    T = 2
    B = 3

    def __init__(self, msg, lifeTime= 2.0, layer="UI"):
        Window.__init__(self, layer)

        CornerFileNames = [
            "d:/ymir work/ui/pattern/notice_box/noti_box_left_top.png",
            "d:/ymir work/ui/pattern/notice_box/noti_box_left_bot.png",
            "d:/ymir work/ui/pattern/notice_box/noti_box_right_top.png",
            "d:/ymir work/ui/pattern/notice_box/noti_box_right_bot.png"
        ]
        LineFileNames = [
            "d:/ymir work/ui/pattern/notice_box/noti_box_left.png",
            "d:/ymir work/ui/pattern/notice_box/noti_box_right.png",
            "d:/ymir work/ui/pattern/notice_box/noti_box_top.png",
            "d:/ymir work/ui/pattern/notice_box/noti_box_bot.png"
        ]

        self.Corners = []
        for fn in CornerFileNames:
            corner = ExpandedImageBox()
            corner.AddFlag("attach")
            corner.AddFlag("not_pick")
            corner.LoadImage(fn)
            corner.SetParent(self)
            corner.Show()
            self.Corners.append(corner)

        self.Lines = []
        for fn in LineFileNames:
            line = ExpandedImageBox()
            line.AddFlag("attach")
            line.AddFlag("not_pick")
            line.LoadImage(fn)
            line.SetParent(self)
            line.Show()
            self.Lines.append(line)

        self.Base = Bar()
        self.Base.SetParent(self)
        self.Base.AddFlag("attach")
        self.Base.AddFlag("not_pick")
        self.Base.SetColor(self.BOARD_COLOR)
        self.Base.Show()

        self.SetSize(200, 32)
        self.SetCenterPosition()
        x, y = self.GetGlobalPosition()
        self.SetPosition(x, y + 255)
        self.AddFlag("float")
        self.Show()

        self.textLine = TextLine()
        self.textLine.SetParent(self)
        self.textLine.SetHorizontalAlignCenter()
        self.textLine.SetVerticalAlignCenter()
        self.textLine.SetPosition(self.GetWidth() / 2, self.GetHeight() / 2 -5 )
        self.textLine.SetText(msg)
        self.textLine.SetPackedFontColor(0xFFF5F5DC)
        self.textLine.Show()

        self.lifeTime = lifeTime
        self.startTime = app.GetTime()

    def SetSize(self, width, height):
        width = max(self.CORNER_WIDTH*2, width)
        height = max(self.CORNER_HEIGHT*2, height)
        Window.SetSize(self, width, height)

        self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
        self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
        self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)

        self.Lines[self.L].SetPosition(0, self.CORNER_HEIGHT)
        self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
        self.Lines[self.T].SetPosition(self.CORNER_WIDTH, 0)
        self.Lines[self.B].SetPosition(self.CORNER_HEIGHT, height - self.CORNER_HEIGHT)

        verticalShowingPercentage = float((height - self.CORNER_HEIGHT*2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
        horizontalShowingPercentage = float((width - self.CORNER_WIDTH*2) - self.LINE_WIDTH) / self.LINE_WIDTH
        self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
        self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
        self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
        self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
        self.Base.SetPosition(self.CORNER_WIDTH, self.CORNER_HEIGHT)
        self.Base.SetSize(width - self.CORNER_WIDTH*2, height - self.CORNER_HEIGHT*2)

    def OnUpdate(self):
        if self.lifeTime > 0 and (app.GetTime() - self.startTime > self.lifeTime):
            self.Hide()

game.py:
Aratılıp değiştirilir

    # ADD_FISHING_MESSAGE
    def OnFishingNotifyUnknown(self):
        # chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_UNKNOWN)
        self.noticeBox = ui.NoticeBoxBoard(localeInfo.FISHING_UNKNOWN)
    def OnFishingWrongPlace(self):
        # chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_WRONG_PLACE)
        self.noticeBox = ui.NoticeBoxBoard(localeInfo.FISHING_WRONG_PLACE)
    # END_OF_ADD_FISHING_MESSAGE

    def OnFishingNotify(self, isFish, fishName):
        chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.FISHING_NOTIFY(isFish, fishName))

    def OnFishingFailure(self):
        chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, localeInfo.FISHING_FAILURE, 2000)

    def OnCannotPickItem(self):
        # chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_PICK_ITEM)
        self.noticeBox = ui.NoticeBoxBoard(localeInfo.GAME_CANNOT_PICK_ITEM)
    # MINING
    def OnCannotMining(self):
        # chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GAME_CANNOT_MINING)
        self.noticeBox = ui.NoticeBoxBoard(localeInfo.GAME_CANNOT_MINING)
    # END_OF_MINING

    def OnCannotUseSkill(self, vid, type):
        if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
            # textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
            self.noticeBox = ui.NoticeBoxBoard(localeInfo.USE_SKILL_ERROR_TAIL_DICT[type])
        if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
            chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
            self.noticeBox = ui.NoticeBoxBoard(localeInfo.USE_SKILL_ERROR_CHAT_DICT[type])
    def    OnCannotShotError(self, vid, type):
        # textTail.RegisterInfoTail(vid, localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type)))
        msg = localeInfo.SHOT_ERROR_TAIL_DICT.get(type, localeInfo.SHOT_ERROR_UNKNOWN % (type))
        self.noticeBox = ui.NoticeBoxBoard(msg)

Son olarak ekte verdiğim notice_box.rar içindeki klasörünü etc/ymir work/ui/pattern içine atarsanız olay biter.​
 

Ekli dosyalar

  • notice_box.rar
    8.6 KB · Görüntüleme: 0
Moderatör tarafında düzenlendi:

En Çok Reaksiyon Alan Mesajlar

Paylaşım için Teşekkürler


Öğeyi görmek için üye olmalısınız.
paylaşım için teşekkürler
 
Lütfen konuya 24 saat içerisinde virüstotal ekleyiniz.
 

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