shrpnl 1
shrpnl
Fethi Polat 1
Fethi Polat
kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
Best Studio 1
Best Studio
Agora Metin2 1
Agora Metin2
raderde 1
raderde
Cannn6161 1
Cannn6161
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Mt2Hizmet 1
Mt2Hizmet
melankolıa18 1
melankolıa18
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com
Kaynak ikonu

new battlepass system 2025-08-09

indirmek için izniniz yok
  • Konuyu başlatan Konuyu başlatan mistikaptal
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 42
  • Görüntüleme Görüntüleme 4K
5.00 yıldız(lar) 1 Değerlendirme Değerlendirenler
author: cream

Ekli dosyayı görüntüle 151376



eksik ui.py
[CODE lang="python" title="ui"]if app.ENABLE_BATTLEPASS:
from operator import truediv
[/CODE]


[CODE lang="python" title="ui"]if app.ENABLE_BATTLEPASS:
class BoxedBoard(Window):
BORDER_TOP = 0
BORDER_RIGHT = 1
BORDER_BOTTOM = 2
BORDER_LEFT = 3

DEFAULT_BORDER_COLOR = grp.GenerateColor(0.3, 0.3, 0.3, 0.8)
DEFAULT_BASE_COLOR = grp.GenerateColor(0, 0, 0, 0.5)

def __init__(self):
Window.__init__(self)

self.borderSize = 1

# Create Borders
self.borders = [
Bar(),
Bar(),
Bar(),
Bar()
]

for border in self.borders:
border.SetParent(self)
border.AddFlag("not_pick")
border.Show()

# Create Base
self.base = Bar()
self.base.SetParent(self)
self.base.AddFlag("not_pick")
self.base.Show()

# Set Default Colors
self.SetBorderColor(self.DEFAULT_BORDER_COLOR)
self.SetBaseColor(self.DEFAULT_BASE_COLOR)

def __del__(self):
self.Destroy()
Window.__del__(self)

def Destroy(self):
del self.borders[:]
self.base = None

Window.Destroy(self)

def SetBorderColor(self, color):
for border in self.borders:
border.SetColor(color)

def SetBorderSize(self, borderSize):
self.borderSize = borderSize
self.SetSize(self.GetWidth(), self.GetHeight())

def SetBaseColor(self, color):
self.base.SetColor(color)

def SetSize(self, width, height):
width = max(width, (2 * self.borderSize) + 1)
height = max(height, (2 * self.borderSize) + 1)

Window.SetSize(self, width, height)
self.UpdateBoard()

def UpdateBoard(self):
width = self.GetWidth()
height = self.GetHeight()

top, right, bottom, left = self.borders

# Top Border
top.SetSize(width - self.borderSize, self.borderSize)

# Right Border
right.SetSize(self.borderSize, height - self.borderSize)
right.SetPosition(width - self.borderSize, 0)

# Bottom Border
bottom.SetSize(width - self.borderSize, self.borderSize)
bottom.SetPosition(self.borderSize, height - self.borderSize)

# Left Border
left.SetSize(self.borderSize, height - self.borderSize)
left.SetPosition(0, self.borderSize)

# Base
self.base.SetSize(width - (2 * self.borderSize), height - (2 * self.borderSize))
self.base.SetPosition(self.borderSize, self.borderSize)

class ExpandedImageBoxButton(ImageBox):
def __init__(self, layer = "UI"):
ImageBox.__init__(self, layer)
self.ButtonText = None

def __del__(self):
ImageBox.__del__(self)

def RegisterWindow(self, layer):
self.hWnd = wndMgr.RegisterExpandedImageBox(self, layer)

def SetScale(self, xScale, yScale):
wndMgr.SetScale(self.hWnd, xScale, yScale)

def SetOrigin(self, x, y):
wndMgr.SetOrigin(self.hWnd, x, y)

def SetRotation(self, rotation):
wndMgr.SetRotation(self.hWnd, rotation)

def SetRenderingMode(self, mode):
wndMgr.SetRenderingMode(self.hWnd, mode)

def SetRenderingRect(self, left, top, right, bottom):
wndMgr.SetRenderingRect(self.hWnd, left, top, right, bottom)

def SetClipRect(self, left, top, right, bottom, isVertical = False):
wndMgr.SetClipRect(self.hWnd, left, top, right, bottom, isVertical)

def SetPercentage(self, curValue, maxValue):
if maxValue:
self.SetRenderingRect(0.0, 0.0, -1.0 + float(curValue) / float(maxValue), 0.0)
else:
self.SetRenderingRect(0.0, 0.0, 0.0, 0.0)

def GetWidth(self):
return wndMgr.GetWindowWidth(self.hWnd)

def GetHeight(self):
return wndMgr.GetWindowHeight(self.hWnd)

def SetUpVisual(self, path):
self.normal_visual = path
self.LoadImage(self.normal_visual)

def SetOverVisual(self, path):
self.over_visual = path

def SetDownVisual(self, path):
self.down_visual = path

def SetText(self, text, height = 4):
if not self.ButtonText:
textLine = TextLine()
textLine.SetParent(self)
textLine.SetPosition(self.GetWidth()/2, self.GetHeight()/2)
textLine.SetVerticalAlignCenter()
textLine.SetHorizontalAlignCenter()
textLine.Show()
self.ButtonText = textLine

self.ButtonText.SetText(text)

def OnMouseLeftButtonDown(self):
self.LoadImage(self.down_visual)

try:
if self.eventDict.__contains__("MOUSE_LEFT_DOWN"):
self.eventDict["MOUSE_LEFT_DOWN"](* self.argDict["MOUSE_LEFT_DOWN"])
except Exception:
pass

def OnMouseLeftButtonUp(self) :
self.LoadImage(self.normal_visual)

try:
if self.eventFunc["mouse_click"]:
apply(self.eventFunc["mouse_click"], self.eventArgs["mouse_click"])
Window.OnMouseLeftButtonUp(self)
except Exception:
pass

def OnMouseOverIn(self):
self.LoadImage(self.over_visual)

try:
if self.eventFunc["mouse_over_in"]:
apply(self.eventFunc["mouse_over_in"], self.eventArgs["mouse_over_in"])

if self.eventDict.has_key("mouse_over_in"):
if self.eventArgs["mouse_over_in"]:
apply(self.eventDict["mouse_over_in"], self.eventArgs["mouse_over_in"])
else:
self.eventDict["mouse_over_in"]()
except Exception:
pass

def OnMouseOverOut(self):
self.LoadImage(self.normal_visual)

try:
if self.eventFunc["MOUSE_OVER_OUT"]:
apply(self.eventFunc["MOUSE_OVER_OUT"], self.eventArgs["MOUSE_OVER_OUT"])

if self.eventDict.has_key("MOUSE_OVER_OUT"):
if self.eventArgs["MOUSE_OVER_OUT"]:
apply(self.eventDict["MOUSE_OVER_OUT"], self.eventArgs["MOUSE_OVER_OUT"])
else:
self.eventDict["MOUSE_OVER_OUT"]()
except Exception:
pass

class WikiScrollBar(Window):
BASE_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 1.0)
CORNERS_AND_LINES_COLOR = grp.GenerateColor(0.3411, 0.3411, 0.3411, 1.0)
#SELECT_COLOR_WIKI

BAR_NUMB = 9 #This is static value! Please dont touch in him.

class MiddleBar(DragButton):
MIDDLE_BAR_COLOR = grp.GenerateColor(0.6470, 0.6470, 0.6470, 1.0)
# MIDDLE_BAR_COLOR = grp.GenerateColor(219.0 / 66.0, 0.0 / 255.0, 0.0 / 255.0, 1.0)

def __init__(self, horizontal_scroll):
DragButton.__init__(self)
self.AddFlag("movable")

self.horizontal_scroll = horizontal_scroll

self.middle = Bar()
self.middle.SetParent(self)
self.middle.AddFlag("attach")
self.middle.AddFlag("not_pick")
self.middle.SetColor(self.MIDDLE_BAR_COLOR)
self.middle.SetSize(1, 1)
self.middle.Show()

def SetStaticScale(self, size):
(base_width, base_height) = (self.middle.GetWidth(), self.middle.GetHeight())

if not self.horizontal_scroll:
DragButton.SetSize(self, base_width, size)
self.middle.SetSize(base_width, size)
else:
DragButton.SetSize(self, size, base_height)
self.middle.SetSize(size, base_height)

def SetSize(self, selfSize, fullSize):
(base_width, base_height) = (self.middle.GetWidth(), self.middle.GetHeight())

if not self.horizontal_scroll:
DragButton.SetSize(self, base_width, truediv(int(selfSize), int(fullSize)) * selfSize)
self.middle.SetSize(base_width, truediv(int(selfSize), int(fullSize)) * selfSize)
else:
DragButton.SetSize(self, truediv(int(selfSize), int(fullSize)) * selfSize, base_height)
self.middle.SetSize(truediv(int(selfSize), int(fullSize)) * selfSize, base_height)

def SetStaticSize(self, size):
size = max(2, size)

if not self.horizontal_scroll:
DragButton.SetSize(self, size, self.middle.GetHeight())
self.middle.SetSize(size, self.middle.GetHeight())
else:
DragButton.SetSize(self, self.middle.GetWidth(), size)
self.middle.SetSize(self.middle.GetWidth(), size)

def __init__(self, horizontal_scroll = False):
Window.__init__(self)

self.horizontal_scroll = horizontal_scroll

self.scrollEvent = None
self.scrollSpeed = 1
self.sizeScale = 1.0

self.bars = []
for i in xrange(self.BAR_NUMB):
br = Bar()
br.SetParent(self)
br.AddFlag("attach")
br.AddFlag("not_pick")
br.SetColor([self.CORNERS_AND_LINES_COLOR, self.BASE_COLOR][i == (self.BAR_NUMB-1)])
if not (i % 2 == 0): br.SetSize(1, 1)
br.Show()

self.bars.append(br)

self.middleBar = self.MiddleBar(self.horizontal_scroll)
self.middleBar.SetParent(self)
self.middleBar.SetMoveEvent(__mem_func__(self.OnScrollMove))
self.middleBar.Show()

def OnScrollMove(self):
if not self.scrollEvent:
return

arg = float(self.middleBar.GetLocalPosition()[1] - 1) / float(self.GetHeight() - 2 - self.middleBar.GetHeight()) if not self.horizontal_scroll else\
float(self.middleBar.GetLocalPosition()[0] - 1) / float(self.GetWidth() - 2 - self.middleBar.GetWidth())

self.scrollEvent(arg)

def SetScrollEvent(self, func):
self.scrollEvent = __mem_func__(func)

def SetScrollSpeed(self, speed):
self.scrollSpeed = speed

def OnRunMouseWheel(self, length):
if self.IsInPosition():
if not self.horizontal_scroll:
val = min(max(1, self.middleBar.GetLocalPosition()[1] - (length * 0.01) * self.scrollSpeed * self.sizeScale), self.GetHeight() - self.middleBar.GetHeight() - 1)
self.middleBar.SetPosition(2, val)
else:
val = min(max(1, self.middleBar.GetLocalPosition()[0] - (length * 0.01) * self.scrollSpeed * self.sizeScale), self.GetWidth() - self.middleBar.GetWidth() - 1)
self.middleBar.SetPosition(val, 1)

self.OnScrollMove()
return True

return False

def OnMouseLeftButtonDown(self):
(xMouseLocalPosition, yMouseLocalPosition) = self.GetMouseLocalPosition()

if not self.horizontal_scroll:
if xMouseLocalPosition == 0 or xMouseLocalPosition == self.GetWidth():
return

y_pos = (yMouseLocalPosition - self.middleBar.GetHeight() / 2)
self.middleBar.SetPosition(2, y_pos)
else:
if yMouseLocalPosition == 0 or yMouseLocalPosition == self.GetHeight():
return

x_pos = (xMouseLocalPosition - self.middleBar.GetWidth() / 2)
self.middleBar.SetPosition(x_pos, 1)

self.OnScrollMove()

def SetSize(self, w, h):
(width, height) = (max(3, w), max(3, h))

Window.SetSize(self, width, height)

self.bars[0].SetSize(1, (height - 2))
self.bars[0].SetPosition(0, 1)
self.bars[2].SetSize((width - 2), 1)
self.bars[2].SetPosition(1, 0)
self.bars[4].SetSize(1, (height - 2))
self.bars[4].SetPosition((width - 1), 1)
self.bars[6].SetSize((width - 2), 1)
self.bars[6].SetPosition(1, (height - 1))
self.bars[8].SetSize((width - 2), (height - 2))
self.bars[8].SetPosition(1, 1)

self.bars[1].SetPosition(0, 0)
self.bars[3].SetPosition((width - 1), 0)
self.bars[5].SetPosition((width - 1), (height - 1))
self.bars[7].SetPosition(0, (height - 1))

if not self.horizontal_scroll:
self.middleBar.SetStaticSize(width - 4)
self.middleBar.SetSize(10, self.GetHeight())
else:
self.middleBar.SetStaticSize(height - 2)
self.middleBar.SetSize(12, self.GetWidth())

if not self.horizontal_scroll:
self.middleBar.SetRestrictMovementArea(2, 1, width - 4, height - 2)
else:
self.middleBar.SetRestrictMovementArea(1, 1, width - 2, height - 2)

def SetScale(self, selfSize, fullSize):
self.sizeScale = float(selfSize/fullSize)
self.middleBar.SetSize(selfSize, fullSize)

def SetStaticScale(self, r_size):
self.middleBar.SetStaticScale(r_size)

def SetPosScale(self, fScale):
pos = (math.ceil((self.GetHeight() - 2 - self.middleBar.GetHeight()) * fScale) + 1) if not self.horizontal_scroll else\
(math.ceil((self.GetWidth() - 2 - self.middleBar.GetWidth()) * fScale) + 1)

self.SetPos(pos)

def SetPos(self, pos):
wPos = (2, pos) if not self.horizontal_scroll else (pos, 1)
self.middleBar.SetPosition(*wPos)

class ScrollBarNew(Window):

SCROLLBAR_WIDTH = 13
SCROLLBAR_MIDDLE_HEIGHT = 1
SCROLLBAR_BUTTON_WIDTH = 17
SCROLLBAR_BUTTON_HEIGHT = 17
SCROLL_BTN_XDIST = 2
SCROLL_BTN_YDIST = 2

class MiddleBar(DragButton):
def __init__(self):
DragButton.__init__(self)
self.AddFlag("movable")
self.SetWindowName("scrollbar_middlebar")

def MakeImage(self):
top = ExpandedImageBox()
top.SetParent(self)
top.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scrollbar.tga")
top.AddFlag("not_pick")
top.Show()
topScale = ExpandedImageBox()
topScale.SetParent(self)
topScale.SetPosition(0, top.GetHeight())
topScale.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scroll_top.tga")
topScale.AddFlag("not_pick")
topScale.Show()

bottom = ExpandedImageBox()
bottom.SetParent(self)
bottom.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scrollbar.tga")
bottom.AddFlag("not_pick")
bottom.Show()
bottomScale = ExpandedImageBox()
bottomScale.SetParent(self)
bottomScale.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scroll_bottom.tga")
bottomScale.AddFlag("not_pick")
bottomScale.Show()

middle = ExpandedImageBox()
middle.SetParent(self)
middle.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scrollbar.tga")
middle.AddFlag("not_pick")
middle.Show()

self.top = top
self.topScale = topScale
self.bottom = bottom
self.bottomScale = bottomScale
self.middle = middle

def Resize(self, height):
height = max(12, height)
DragButton.SetSize(self, 10, height)
self.bottom.SetPosition(0, height-4)

height -= 4*3
self.middle.SetRenderingRect(0, 0, 0, float(height)/4.0)

def SetSize(self, height):
minHeight = self.top.GetHeight() + self.bottom.GetHeight() + self.middle.GetHeight()
height = max(minHeight, height)
DragButton.SetSize(self, 10, height)

scale = (height - minHeight) / 2
extraScale = 0
if (height - minHeight) % 2 == 1:
extraScale = 1

self.topScale.SetRenderingRect(0, 0, 0, scale - 1)
self.middle.SetPosition(0, self.top.GetHeight() + scale)
self.bottomScale.SetPosition(0, self.middle.GetBottom())
self.bottomScale.SetRenderingRect(0, 0, 0, scale - 1 + extraScale)
self.bottom.SetPosition(0, height - self.bottom.GetHeight())

def __init__(self):
Window.__init__(self)

self.pageSize = 1
self.curPos = 0.0
self.eventScroll = None
self.eventArgs = None
self.lockFlag = False

self.CreateScrollBar()
self.SetScrollBarSize(0)

self.scrollStep = 0.20
self.SetWindowName("NONAME_ScrollBar")

def __del__(self):
Window.__del__(self)

def CreateScrollBar(self):
topImage = ExpandedImageBox()
topImage.SetParent(self)
topImage.AddFlag("not_pick")
topImage.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scroll_top.tga")
topImage.Show()

middleImage = ExpandedImageBox()
middleImage.SetParent(self)
middleImage.AddFlag("not_pick")
middleImage.SetPosition(0, topImage.GetHeight())
middleImage.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scroll_center.tga")
middleImage.Show()

bottomImage = ExpandedImageBox()
bottomImage.SetParent(self)
bottomImage.AddFlag("not_pick")
bottomImage.LoadImage("d:/ymir work/ui/game/battle_pass_reworked/lightwork/searchshop/scroll_bottom.tga")
bottomImage.Show()

self.topImage = topImage
self.bottomImage = bottomImage
self.middleImage = middleImage

middleBar = self.MiddleBar()
middleBar.SetParent(self)
middleBar.SetMoveEvent(__mem_func__(self.OnMove))
middleBar.Show()
middleBar.MakeImage()
middleBar.SetSize(0) # set min height
self.middleBar = middleBar

def Destroy(self):
self.eventScroll = None
self.eventArgs = None

def SetScrollEvent(self, event, *args):
self.eventScroll = event
self.eventArgs = args

def SetMiddleBarSize(self, pageScale):
self.middleBar.Resize(int(pageScale * float(self.GetHeight() - self.SCROLL_BTN_YDIST*2)))
realHeight = self.GetHeight() - self.SCROLL_BTN_YDIST*2 - self.middleBar.GetHeight()
self.pageSize = realHeight

def SetScrollBarSize(self, height):
self.SetSize(self.SCROLLBAR_WIDTH, height)

self.pageSize = height - self.SCROLL_BTN_YDIST*2 - self.middleBar.GetHeight()

middleImageScale = float((height-3 - self.SCROLL_BTN_YDIST*2) - self.middleImage.GetHeight()) / float(self.middleImage.GetHeight())
self.middleImage.SetRenderingRect(0, 0, 0, middleImageScale)
self.bottomImage.SetPosition(0, height-6)

self.middleBar.SetRestrictMovementArea(self.SCROLL_BTN_XDIST, self.SCROLL_BTN_YDIST, \
self.middleBar.GetWidth(), height - self.SCROLL_BTN_YDIST * 2)
self.middleBar.SetPosition(self.SCROLL_BTN_XDIST, self.SCROLL_BTN_YDIST)

def SetScrollStep(self, step):
self.scrollStep = step

def GetScrollStep(self):
return self.scrollStep

def GetPos(self):
return self.curPos

def OnUp(self):
self.SetPos(self.curPos-self.scrollStep)

def OnDown(self):
self.SetPos(self.curPos+self.scrollStep)

def SetPos(self, pos, moveEvent = True):
pos = max(0.0, pos)
pos = min(1.0, pos)

newPos = float(self.pageSize) * pos
self.middleBar.SetPosition(self.SCROLL_BTN_XDIST, int(newPos) + self.SCROLL_BTN_YDIST)
if moveEvent == True:
self.OnMove()

def OnMove(self):

if self.lockFlag:
return

if 0 == self.pageSize:
return

(xLocal, yLocal) = self.middleBar.GetLocalPosition()
self.curPos = float(yLocal - self.SCROLL_BTN_YDIST) / float(self.pageSize)

if self.eventScroll:
apply(self.eventScroll, self.eventArgs)

def OnMouseLeftButtonDown(self):
(xMouseLocalPosition, yMouseLocalPosition) = self.GetMouseLocalPosition()
newPos = float(yMouseLocalPosition) / float(self.GetHeight())
self.SetPos(newPos)

def LockScroll(self):
self.lockFlag = True

def UnlockScroll(self):
self.lockFlag = False
[/CODE]


[CODE lang="python" title="ui"]if app.ENABLE_BATTLEPASS:
def MakeTextLineNew(parent, x, y, text):
textLine = TextLine()
textLine.SetParent(parent)
textLine.SetPosition(x, y)
textLine.SetText(text)
textLine.Show()
return textLine

def MakeRadioButton(parent, x, y, path, up, over, down):
button = RadioButton()
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(path + up)
button.SetOverVisual(path + over)
button.SetDownVisual(path + down)
button.Show()
return button[/CODE]



yeni scrollbar'ın görselleri de burada

 

Ekli dosyalar

Son düzenleme:
bizlerle sistemin eksiklerini paylaştığı için forum80'e tekrardan teşekkürler :)
 

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

Geri
Üst