Bombsquad-Ballistica-Modded.../dist/ba_root/mods/tools/textonmap.py

97 lines
3.2 KiB
Python
Raw Normal View History

2021-04-02 20:53:19 +05:30
# Released under the MIT License. See LICENSE for details.
2021-04-17 13:22:30 +05:30
""" TODO need to set coordinates of text node , move timer values to settings.json """
from ba._generated.enums import TimeType
2021-04-17 13:22:30 +05:30
import ba, _ba
2021-04-02 20:53:19 +05:30
import setting
from stats import mystats
from datetime import datetime
2021-04-02 20:53:19 +05:30
class textonmap:
2021-04-02 20:53:19 +05:30
def __init__(self):
setti=setting.get_settings_data()
data = setti['textonmap']
2021-04-17 13:22:30 +05:30
left = data['bottom left watermark']
top = data['top watermark']
nextMap=_ba.get_foreground_host_session().get_next_game_description().evaluate()
2021-04-17 13:22:30 +05:30
self.index = 0
self.highlights = data['center highlights']
2021-04-02 20:53:19 +05:30
self.left_watermark(left)
self.top_message(top)
self.nextGame(nextMap)
self.leaderBoard()
2021-04-22 14:54:47 +05:30
self.timer = ba.timer(8, ba.Call(self.highlights_), repeat=True)
2021-04-02 20:53:19 +05:30
2021-04-17 13:22:30 +05:30
def highlights_(self):
node = _ba.newnode('text',
attrs={
'text': self.highlights[self.index],
'flatness': 1.0,
'h_align': 'center',
'v_attach':'bottom',
'scale':1,
'position':(0,138),
'color':(1,1,1)
})
2021-04-17 13:22:30 +05:30
self.delt = ba.timer(7,node.delete)
self.index = int((self.index+1)%len(self.highlights))
2021-04-17 13:22:30 +05:30
def left_watermark(self, text):
node = _ba.newnode('text',
attrs={
'text': text,
'flatness': 1.0,
'h_align': 'left',
'v_attach':'bottom',
'h_attach':'left',
'scale':0.7,
'position':(25,67),
'color':(0.7,0.7,0.7)
2021-04-17 13:22:30 +05:30
})
def nextGame(self,text):
node = _ba.newnode('text',
attrs={
'text':"Next : "+text,
'flatness':1.0,
'h_align':'right',
'v_attach':'bottom',
'h_attach':'right',
'scale':0.7,
'position':(-25,18),
'color':(0.5,0.5,0.5)
})
2021-04-17 13:22:30 +05:30
def top_message(self, text):
node = _ba.newnode('text',
attrs={
'text': text,
'flatness': 1.0,
'h_align': 'center',
'v_attach':'top',
'scale':1,
'position':(0,138),
'color':(1,1,1)
})
def leaderBoard(self):
if len(mystats.top3Name) >2:
self.ss1=ba.newnode('image',attrs={'scale':(300,30),'texture':ba.gettexture('bar'),'position':(0,-80),'attach':'topRight','opacity':0.5,'color':(0.7,0.1,0)})
self.ss1a=ba.newnode('text',attrs={'text':"#1 "+mystats.top3Name[0][:10]+"...",'flatness':1.0,'h_align':'left','h_attach':'right','v_attach':'top','v_align':'center','position':(-140,-80),'scale':0.7,'color':(0.7,0.4,0.3)})
self.ss1=ba.newnode('image',attrs={'scale':(300,30),'texture':ba.gettexture('bar'),'position':(0,-115),'attach':'topRight','opacity':0.5,'color':(0.6,0.6,0.6)})
self.ss1a=ba.newnode('text',attrs={'text':"#2 "+mystats.top3Name[1][:10]+"...",'flatness':1.0,'h_align':'left','h_attach':'right','v_attach':'top','v_align':'center','position':(-140,-115),'scale':0.7,'color':(0.8,0.8,0.8)})
self.ss1=ba.newnode('image',attrs={'scale':(300,30),'texture':ba.gettexture('bar'),'position':(0,-150),'attach':'topRight','opacity':0.5,'color':(0.1,0.3,0.1)})
self.ss1a=ba.newnode('text',attrs={'text':"#3 "+mystats.top3Name[2][:10]+"...",'flatness':1.0,'h_align':'left','h_attach':'right','v_attach':'top','v_align':'center','position':(-140,-150),'scale':0.7,'color':(0.2,0.6,0.2)})