Neler yeni
XenForo Bannerlar
Modern AdBlock Uyarısı

Foruma hoş geldin, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.

Kod Lonca SKOR Board New

Fatih Bulut

Süper Üye
Katılım
6 Kas 2021
Mesajlar
3,271
Tepkime puanı
4,783
Puanları
113
Yaş
31
Konum
Türkiye
Dc
fatihbulut
263162_401b3fa53a608b1ae2ff9cd054a219b8.png

download.jpg
Kod:
# ROOT: AT      guild_skor_board.png


uiguild.py

# Arat       class GuildWarScoreBoard(ui.ScriptWindow):

# Değiştir       Komple Değiştir




class GuildWarScoreBoard(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.Initialize()

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

    def Initialize(self):
        self.allyGuildID = 0
        self.enemyGuildID = 0
        self.allyDataDict = {}
        self.enemyDataDict = {}
      
        self.allyImageBox = ui.MakeImageBox(self, "guild_skor_board.png", -5, 5)
        self.allyImageBox.AddFlag("not_pick")
      
        self.FarkText = ui.TextLine()
        self.FarkText.SetParent(self)
        self.FarkText.SetFontName("Tahoma:15")
        self.FarkText.SetPosition(130, 20)
        self.FarkText.SetText("FARK")
        self.FarkText.SetHorizontalAlignLeft()
        self.FarkText.Show()

        self.bScoreText = ui.TextLine()
        self.bScoreText.SetParent(self)
        self.bScoreText.SetFontName("Tahoma:35")
        self.bScoreText.SetPosition(143, 40)
        self.bScoreText.SetHorizontalAlignLeft()
        self.bScoreText.Show()
      
        self.AddFlag('movable')
  
    def Open(self, allyGuildID, enemyGuildID):
        self.allyGuildID = allyGuildID
        self.enemyGuildID = enemyGuildID
        self.SetPosition(10, wndMgr.GetScreenHeight() - 200)

        nameText = ui.TextLine()
        nameText.SetParent(self)
        nameText.SetFontName("Tahoma:16")
        nameText.SetPosition(-25 + (48 - int(nameText.GetTextSize()[0])/2), 97)
        nameText.Show()
      
        mark = ui.MarkBox()
        mark.SetParent(self)
        mark.SetIndex(allyGuildID)
        mark.SetPosition(60, 15)
        mark.Show()
      
        scoreText = ui.TextLine()
        scoreText.SetParent(self)
        scoreText.SetFontName("Tahoma:35")
        scoreText.SetPosition(10 + (48 - int(scoreText.GetTextSize()[0])/2), 45)
        scoreText.Show()
      
        self.allyDataDict = {
            "NAME": guild.GetGuildName(allyGuildID),
            "SCORE": 0,
            "MEMBER_COUNT": 0,
            "MARK": mark,
            "NAMETEXT": nameText,
            "SCORETEXT": scoreText
        }
      
        nameText2 = ui.TextLine()
        nameText2.SetParent(self)
        nameText2.SetFontName("Tahoma:16")
        nameText2.SetPosition(160 + (48 - int(nameText2.GetTextSize()[0])/2), 97)
        nameText2.Show()
      
        mark2 = ui.MarkBox()
        mark2.SetParent(self)
        mark2.SetIndex(enemyGuildID)
        mark2.SetPosition(226, 15)
        mark2.Show()
      
        scoreText2 = ui.TextLine()
        scoreText2.SetParent(self)
        scoreText2.SetFontName("Tahoma:35")
        scoreText2.SetPosition(177 + (48 - int(scoreText2.GetTextSize()[0])/2), 45)
        scoreText2.Show()
      
        self.enemyDataDict = {
            "NAME": guild.GetGuildName(enemyGuildID),
            "SCORE": 0,
            "MEMBER_COUNT": 0,
            "MARK": mark2,
            "NAMETEXT": nameText2,
            "SCORETEXT": scoreText2
        }
      
        self.__RefreshName()
        self.Show()
      
    def __GetDataDict(self, ID):
        if self.allyGuildID == ID:
            return self.allyDataDict
        if self.enemyGuildID == ID:
            return self.enemyDataDict
        return None
  
    def SetScore(self, gainGuildID, opponetGuildID, point):
        dataDict = self.__GetDataDict(gainGuildID)
        if not dataDict:
            return
        dataDict["SCORE"] = point
        self.__RefreshName()
  
    def UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2):
        dataDict1 = self.__GetDataDict(guildID1)
        dataDict2 = self.__GetDataDict(guildID2)
        if dataDict1:
            dataDict1["MEMBER_COUNT"] = memberCount1
        if dataDict2:
            dataDict2["MEMBER_COUNT"] = memberCount2
        self.__RefreshName()
        self.OnUpdate()
      
    def OnUpdate(self):
        aScore = self.allyDataDict["SCORE"]
        bScore = self.enemyDataDict["SCORE"]
        diff = abs(aScore - bScore)
        self.bScoreText.SetText("%d" % diff)
        if aScore > bScore:
            self.bScoreText.SetPackedFontColor(0xff2e8b57)
        elif bScore > aScore:
            self.bScoreText.SetPackedFontColor(0xffcd5c5c)
        else:
            self.bScoreText.SetPackedFontColor(0xffa9a9a9)
  
    def __RefreshName(self):
        self.SetSize(330, 85)
      
        self.allyDataDict["NAMETEXT"].SetText("%s (%d)" % (self.allyDataDict["NAME"], self.allyDataDict["MEMBER_COUNT"]))
        self.enemyDataDict["NAMETEXT"].SetText("%s (%d)" % (self.enemyDataDict["NAME"], self.enemyDataDict["MEMBER_COUNT"]))
        self.allyDataDict["SCORETEXT"].SetText("%d" % self.allyDataDict["SCORE"])
        self.enemyDataDict["SCORETEXT"].SetText("%d" % self.enemyDataDict["SCORE"])
      
        if self.allyDataDict["SCORE"] > self.enemyDataDict["SCORE"]:
            self.allyDataDict["NAMETEXT"].SetPackedFontColor(0xff2e8b57)
            self.enemyDataDict["NAMETEXT"].SetPackedFontColor(0xffcd5c5c)
            self.allyDataDict["SCORETEXT"].SetPackedFontColor(0xff2e8b57)
            self.enemyDataDict["SCORETEXT"].SetPackedFontColor(0xffcd5c5c)
        elif self.enemyDataDict["SCORE"] > self.allyDataDict["SCORE"]:
            self.allyDataDict["NAMETEXT"].SetPackedFontColor(0xffcd5c5c)
            self.enemyDataDict["NAMETEXT"].SetPackedFontColor(0xff2e8b57)
            self.allyDataDict["SCORETEXT"].SetPackedFontColor(0xffcd5c5c)
            self.enemyDataDict["SCORETEXT"].SetPackedFontColor(0xff2e8b57)
        else:
            self.allyDataDict["NAMETEXT"].SetPackedFontColor(0xffa9a9a9)
            self.enemyDataDict["NAMETEXT"].SetPackedFontColor(0xffa9a9a9)
            self.allyDataDict["SCORETEXT"].SetPackedFontColor(0xffa9a9a9)
            self.enemyDataDict["SCORETEXT"].SetPackedFontColor(0xffa9a9a9)
 

Benzer konular

Forumdan daha fazla yararlanmak için giriş yapın yada üye olun!

Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!

Kayıt ol

Forumda bir hesap oluşturmak tamamen ücretsizdir.

Şimdi kayıt ol
Giriş yap

Eğer bir hesabınız var ise lütfen giriş yapın

Giriş yap

Tema düzenleyici

Tema özelletirmeleri

Grafik arka planlar

Granit arka planlar