接着整

This commit is contained in:
沈瑗杰 2021-01-25 17:01:54 +08:00
parent 4656f8062c
commit 8509c1a725
4 changed files with 39 additions and 15 deletions

View File

@ -3,10 +3,9 @@ writen by shenjackyuanjie
mail: 3695888@qq.com mail: 3695888@qq.com
""" """
import pyglet import os
import bin import bin
import sys import sys
import os
def main(): def main():
@ -17,6 +16,7 @@ def main():
if py_v_info[0] == 2: if py_v_info[0] == 2:
raise Exception("Simple Rocket need python vision 3+") raise Exception("Simple Rocket need python vision 3+")
# start games # start games
game = bin.main.Game()
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -14,21 +14,20 @@ import logging
import server import server
import client import client
# get time when the program to start the logging
start_time = time.time()
start_time_date = time.strftime("%Y-%m-%d %H-%M-%S", time.gmtime(start_time))
# ---------- option start ----------
log_level = logging.DEBUG # log level
class Game(): class Game():
def __init__(self): def __init__(self):
self.start_time = time.strftime("%Y-%m-%d %H-%M-%S", time.gmtime(start_time)) # basic config
self.start_time = time.strftime("%Y-%m-%d %H-%M-%S", time.gmtime(time.time()))
self.configs = ''
# share memory
self.dics = share().dict() self.dics = share().dict()
self.lists = share().list() self.lists = share().list()
# logger
self.server_logger = logging.getLogger('server') self.server_logger = logging.getLogger('server')
self.client_logger = logging.getLogger('client') self.client_logger = logging.getLogger('client')
self.log_file_hander = logging.FileHandler('')
# client and server
self.client = client.RenderThread(self.lists, self.dics, self.client_logger, net_mode='local') self.client = client.RenderThread(self.lists, self.dics, self.client_logger, net_mode='local')
self.server = server.server(self.lists, self.dics, self.server_logger, net_mode='local') self.server = server.server(self.lists, self.dics, self.server_logger, net_mode='local')

View File

@ -3,7 +3,8 @@ writen by shenjackyuanjie
mail: 3695888@qq.com mail: 3695888@qq.com
""" """
import libs import bin
import json5
""" """
some tools some tools
@ -78,7 +79,7 @@ def __S_N_M(A, B):
Unit1, Unit2 = A[2] + B[2], A[3] + B[3] Unit1, Unit2 = A[2] + B[2], A[3] + B[3]
if Unit1 == None: if Unit1 == None:
Unit1 = [] Unit1 = []
libs.tools.D_C(Unit1, Unit2) D_C(Unit1, Unit2)
R += [Unit1, Unit2] R += [Unit1, Unit2]
return R return R
@ -92,7 +93,7 @@ def S_N_D(A, B): # stand for Scientific notation divided
Unit1, Unit2 = A[2] + B[3], A[3] + B[2] Unit1, Unit2 = A[2] + B[3], A[3] + B[2]
if Unit1 == None: if Unit1 == None:
Unit1 = [] Unit1 = []
libs.tools.D_C(Unit1, Unit2) D_C(Unit1, Unit2)
R += [Unit1, Unit2] R += [Unit1, Unit2]
return R return R
@ -106,7 +107,7 @@ def G_C(M, m, R, G): # stand for gravity calculation
G : Gravitational constant G : Gravitational constant
M & m & R format: docs.basic_config:basic_number M & m & R format: docs.basic_config:basic_number
""" """
g = libs.config.basic_number() g = bin.config.basic_number()
A = S_N_M(M, m, G) A = S_N_M(M, m, G)
g = S_N_D(A, S_N_M(R, R)) g = S_N_D(A, S_N_M(R, R))
return g return g
@ -117,7 +118,7 @@ def distance(A, B):
formats: formats:
A & B format: docs.basic_config:basic_poi A & B format: docs.basic_config:basic_poi
""" """
D = libs D = bin
pass pass

24
configs/logging.json5 Normal file
View File

@ -0,0 +1,24 @@
{
'server': {
'level': 'DEBUG',
// option: CRITICAL ERROR WARNING INFO DEBUG
'date_fmt': '%Y-%m-%d %H-%M-%S'
// format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime
},
'client': {
'level': 'DEBUG',
// option: CRITICAL ERROR WARNING INFO DEBUG
'date_fmt': '%Y-%m-%d %H-%M-%S'
// format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime
},
'file': {
'level': 'DEBUG',
// option: CRITICAL ERROR WARNING INFO DEBUG
'filename': {
'main': '{date} SR.log',
// {date} -> date
'{date}': '%Y-%m-%d %H-%M-%S',
// format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime
}
}
}