diff --git a/dist/ba_data/python/ba/_map.py b/dist/ba_data/python/ba/_map.py index 376f3a2..0a70585 100644 --- a/dist/ba_data/python/ba/_map.py +++ b/dist/ba_data/python/ba/_map.py @@ -210,6 +210,8 @@ class Map(Actor): # Set various globals. gnode = _ba.getactivity().globalsnode import ba + from tools import textonmap + textonmap.textonmap() diff --git a/dist/ba_root/mods/custom_hooks.py b/dist/ba_root/mods/custom_hooks.py index 5dc17f1..8e91fbe 100644 --- a/dist/ba_root/mods/custom_hooks.py +++ b/dist/ba_root/mods/custom_hooks.py @@ -2,8 +2,9 @@ def filter_chat_message(msg,client_id): + from chatHandle import handlechat - return msg + return handlechat.filter_chat_message(msg,client_id) def on_app_launch(): #something @@ -13,4 +14,4 @@ def score_screen_on_begin(_stats): def playerspaz_init(player): #add tag,rank,effect - \ No newline at end of file + diff --git a/dist/ba_root/mods/setting.json b/dist/ba_root/mods/setting.json index e69de29..32bfb05 100644 --- a/dist/ba_root/mods/setting.json +++ b/dist/ba_root/mods/setting.json @@ -0,0 +1,8 @@ +{ + "textonmap": + { + "top watermark":"Welcome to server \n ip 192.168.0.1", + "bottom left watermark":"join discord for fun", + "center highlights":["message 1","message 2","message 3"] + } +} \ No newline at end of file diff --git a/dist/ba_root/mods/setting.py b/dist/ba_root/mods/setting.py index 9b46f9f..70c0a75 100644 --- a/dist/ba_root/mods/setting.py +++ b/dist/ba_root/mods/setting.py @@ -1 +1,19 @@ -# Released under the MIT License. See LICENSE for details. \ No newline at end of file +# Released under the MIT License. See LICENSE for details. + + +settings={} + +def get_setting(): + global settings + if settings=={}: + f=open("setting.json","r") + dat=json.loads(f.read()) + settings=dat + f.close() + return settings + +def commit(): + global settings + f=open("setting.json",'w') + json.dump(setting,f,indent=4) + f.close() \ No newline at end of file diff --git a/dist/ba_root/mods/tools/__pycache__/__init__.cpython-38.pyc b/dist/ba_root/mods/tools/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index 62683cf..0000000 Binary files a/dist/ba_root/mods/tools/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/dist/ba_root/mods/tools/__pycache__/whitelist.cpython-38.pyc b/dist/ba_root/mods/tools/__pycache__/whitelist.cpython-38.pyc deleted file mode 100644 index 776e704..0000000 Binary files a/dist/ba_root/mods/tools/__pycache__/whitelist.cpython-38.pyc and /dev/null differ diff --git a/dist/ba_root/mods/tools/textonmap.py b/dist/ba_root/mods/tools/textonmap.py index 9b46f9f..8269e9c 100644 --- a/dist/ba_root/mods/tools/textonmap.py +++ b/dist/ba_root/mods/tools/textonmap.py @@ -1 +1,59 @@ -# Released under the MIT License. See LICENSE for details. \ No newline at end of file +# Released under the MIT License. See LICENSE for details. + +#TODO need to set coordinates of text node , move timer values to settings.json +from ba._enums import TimeType +import ba +import setting +class textonmap: + def __init__(self): + self.index=0; + _textonmap=setting.get_setting()['textonmap'] + self.highlights=_textonmap['center highlights'] + left=_textonmap['bottom left watermark'] + top=_textonmap['top watermark'] + + self.timerr=ba.Timer(8,self.highlights,repeat=True) + + self.left_watermark(left) + self.top_message(top) + + + def highlights(self): + hg=_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,hg.delete) + self.index=int((self.index+1)%len(self.highlights)) + + def left_watermark(self,text): + hg=_ba.newnode('text', + attrs={ + 'text': text, + + 'flatness': 1.0, + 'h_align': 'left', + 'v_attach':'bottom', + 'scale':1, + 'position':(0,138), + 'color':(1,1,1) + }) + def top_message(self,text): + txt=_ba.newnode('text', + attrs={ + 'text': text, + + 'flatness': 1.0, + 'h_align': 'center', + 'v_attach':'top', + 'scale':1, + 'position':(0,138), + 'color':(1,1,1) + }) \ No newline at end of file