This commit is contained in:
沈瑗杰 2021-02-15 21:45:20 +08:00
parent 496ccb0580
commit dfeb573d4c
5 changed files with 29 additions and 21 deletions

View File

@ -4,7 +4,7 @@
0.0 (developing)
中文请移步[这里](https://github.com/shenjackyuanjie/DR/blob/main/docs/README-cn.md)。
中文README请移步[这里](https://github.com/shenjackyuanjie/Difficult-Rocket/blob/main/docs/README-cn.md)。
> It's a Simple Rocket liked game build with Python

View File

@ -54,16 +54,13 @@ class RenderThread(mp.Process, pyglet.window.Window):
self.planet_system = tools.config('sys_value/planet.json5') # hole planet system
# list
# re stuff
self.ipv4_re = re.compile(
u'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$')
# window
self.window = Window(width=int(self.window_config['width']),
height=int(self.window_config['height']),
fullscreen=tools.c_b(
self.window_config['full_screen']),
fullscreen=tools.c_b(self.window_config['full_screen']),
caption=str(self.window_config['caption']),
visible=tools.c_b(self.window_config['visible']))
self.logger.info('setup done')
self.logger.info('client setup done!')
# setup
self.setup()
@ -76,8 +73,8 @@ class RenderThread(mp.Process, pyglet.window.Window):
if self.net_mode == 'local':
pass
# net_mode != 'local' and ,can is a ipv4 ip
elif re.match(self.ipv4_re, self.net_mode):
pass
# elif re.match(self.ipv4_re, self.net_mode):
# pass
# textures
self.textures = {}
# parts

View File

@ -33,16 +33,26 @@ class Game:
self.lists = share().list()
# logger
self.log_config = tools.config('configs/logging.json5', 'file')
self.log_filename = 'logs/' + configs.name_handler(
self.log_config['filename']['main'], self.log_config['filename']['formats'])
logging.basicConfig(filename=self.log_filename, level=logging.DEBUG)
self.root_logger_stream_hander = logging.StreamHandler()
self.root_logger_stream_hander.setLevel(
self.log_config['level'])
logging.getLogger().addHandler(self.root_logger_stream_hander)
self.log_filename = 'logs/' + configs.name_handler(self.log_config['filename']['main'],
self.log_config['filename']['formats'])
logging.basicConfig(level=logging.DEBUG,
format=self.log_config['fmt'],
datefmt=self.log_config['date_fmt'])
self.root_logger_stream_handler = logging.StreamHandler()
self.root_logger_stream_handler.setLevel(self.log_config['level'])
logging.info('logger done')
self.server_logger = logging.getLogger()
self.client_logger = logging.getLogger()
self.root_logger_fmt = logging.Formatter(self.log_config['fmt'], self.log_config['date_fmt'])
self.root_logger_stream_handler.setFormatter(self.root_logger_fmt)
self.root_logger_stream_handler.setLevel(self.log_config['level'])
self.root_logger_file_handler = logging.FileHandler(self.log_filename)
self.root_logger_file_handler.setFormatter(self.root_logger_fmt)
logging.getLogger().addHandler(self.root_logger_stream_handler)
logging.getLogger().addHandler(self.root_logger_file_handler)
self.server_logger = logging.getLogger().getChild('server')
self.client_logger = logging.getLogger().getChild('client')
self.client_logger.info('client logger and server logger done')
# client and server
self.client = client.RenderThread(

View File

@ -18,6 +18,7 @@ class server(mp.Process):
# share memory
self.dev_list = dev_list
self.dev_dic = dev_dic
self.logger.info('server setup done!')
def run(self):
pass

View File

@ -23,10 +23,10 @@
'date_fmt': '%Y-%m-%d %H-%M-%S',
// format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime
'filename': {
'main': '{date} SR.log',
'main': '{date} DR.log',
// {date} -> date
'formats': {
'{date}': '%Y-%m-%d %H-%M-%S',
'{date}': '%Y-%m-%d %H-%M-%S'
// format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime
// can and more {xx} by adding more obj EZ
}