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

61 lines
1.4 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 """
2021-04-02 20:53:19 +05:30
from ba._enums import TimeType
2021-04-17 13:22:30 +05:30
import ba, _ba
2021-04-02 20:53:19 +05:30
import setting
2021-04-17 13:22:30 +05:30
2021-04-02 20:53:19 +05:30
class textonmap:
2021-04-17 13:22:30 +05:30
2021-04-02 20:53:19 +05:30
def __init__(self):
2021-04-17 13:22:30 +05:30
data = setting.get_settings_data()['textonmap']
left = data['bottom left watermark']
top = data['top watermark']
self.index = 0
self.highlights = data['center highlights']
2021-04-02 20:53:19 +05:30
self.left_watermark(left)
self.top_message(top)
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)
})
self.delt = ba.timer(7,node.delete)
self.index = int((self.index+1)%len(self.highlights))
def left_watermark(self, text):
node = _ba.newnode('text',
attrs={
'text': text,
'flatness': 1.0,
'h_align': 'left',
'v_attach':'bottom',
'scale':1,
'position':(-480,20),
2021-04-17 13:22:30 +05:30
'color':(1,1,1)
})
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)
})