diff --git a/bin/client.py b/bin/client.py index fb1da31..520f1cc 100644 --- a/bin/client.py +++ b/bin/client.py @@ -8,7 +8,7 @@ import multiprocessing as mp import re import pyglet import pyglet.app -from pyglet.resource import image +from pyglet import image from pyglet.window import Window try: @@ -16,7 +16,7 @@ try: import configs import tools except ModuleNotFoundError: - # ben import use + # been import use from bin import configs from bin import tools @@ -47,19 +47,21 @@ class RenderThread(mp.Process, pyglet.window.Window): # image self.b_g = image("back_ground_space.png") # configs - self.window_config = tools.config('sys_value/window.json5') - self.part_list = tools.config('sys_value/parts.json5') + self.view = tools.config('configs/view.json5') self.map_view = [configs.basic_poi(poi_type='chunk')] + self.part_list = tools.config('sys_value/parts.json5') + self.window_config = tools.config('sys_value/window.json5') # dic self.ships = {} # all ship(part) self.planet_system = {} # hole planet system # list # re stuff - self.ipv4_re = re.compile("""^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$""") + 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'])) # setup @@ -73,10 +75,19 @@ class RenderThread(mp.Process, pyglet.window.Window): # net_mode if self.net_mode == 'local': pass - elif re.match(self.ipv4_re, self.net_mode): # net_mode != 'local' and ,can is a ipv4 ip + # net_mode != 'local' and ,can is a ipv4 ip + elif re.match(self.ipv4_re, self.net_mode): pass # textures - + self.textures = {} + # parts + self.textures['part'] = {} + parts = tools.configs('sys_value/parts.json5') + for part in parts: + name = parts[part] + path = part[2][0] + part_image = image.load(path) + self.textures['part'][name] = part_image """ draws """ diff --git a/bin/configs.py b/bin/configs.py index 8f80e4d..f43bfc7 100644 --- a/bin/configs.py +++ b/bin/configs.py @@ -96,6 +96,7 @@ class BasicNumberClass: self.float = check[0] self.int = check[1] elif o_type == type(decimal.Decimal('1.0')) and not self.units(): + pass def __radd__(self, other): self.__add__(self) diff --git a/configs/view.json5 b/configs/view.json5 index cf0d088..6465e31 100644 --- a/configs/view.json5 +++ b/configs/view.json5 @@ -1,3 +1,4 @@ { - 'map far': 100 + 'map far': 100 // float + // 大概是“渲染距离”的选项 } \ No newline at end of file diff --git a/docs/configes sample/in_file_config.json5 b/docs/configes sample/in_file_config.json5 index 25a779c..443f88e 100644 --- a/docs/configes sample/in_file_config.json5 +++ b/docs/configes sample/in_file_config.json5 @@ -1,31 +1,35 @@ { - 'Game_threads': { - 'orbit_demo': { - 'ship_info': { - 'mass': 'basic_config:basic_number', - 'force': 'basic_config:basic_force' + Game_threads: { + orbit_demo: { + ship_info: { + mass: 'basic_config:basic_number', + force: 'basic_config:basic_force' } } }, - 'client': { - 'self.view': [ - 'space', - 'map', - 'menu' - ], + client: { + 'self.view': ['space', 'map', 'menu'], + 'self.textures': { + 'first name of textures(defaut: difficult_rocket)': { + 'name of image or name of list': 'pyglet.image class or dict', + /* + 这里说明一下,你即可以直接主列表下直接放image,也可以再细分 + 会直接检测是列表还是image + 另外 可 在文件夹同级放image文件 + */ + 'nothing': 'nothing' + } + }, 'self.parts': { 'ship name': { - 'brain': [ + brain: [ 'part type', // part type 'turn', // type:float 'is mirror', // type:bool - [ - 'basic_config.basic_poi', - 'basic_config.basic_poi' - ] + ['basic_config.basic_poi', 'basic_config.basic_poi'] /*brain的坐标记录由两部分组成 第一部分是brain所在区块的区块坐标(区块的大小暂定2^64m大小,从恒星中心开始算,普通的平面直角坐标系) 第二部分是brain所在区块内的相对坐标(左上角00)*/ @@ -44,12 +48,10 @@ // type:float 0 is up clockwise 'is mirror', // type:bool - [ - 'basic_config.basic_poi' - ], + ['basic_config.basic_poi'], { 'special value 1': 'xxx', - 'special value 2': 'xxx' + 'special value 2': 'xxx', /*继续继续 这里的“特殊值”指的是 除去上面写的类型、角度、镜像、位置之外的其他属性 @@ -58,9 +60,10 @@ 比如对接之后传输燃料、渲染太阳能板 的时候可以用到 */ + 'nothing': 'nothing' } ] } } } -} \ No newline at end of file +}