diff --git a/bin/client.py b/bin/client.py index f4c73d5..2c471ee 100644 --- a/bin/client.py +++ b/bin/client.py @@ -27,11 +27,12 @@ class RenderThread(mp.Process, pyglet.window.Window): self.dev_list = dev_list self.dev_dic = dev_dic # dic - self.parts = {} # this ship parts + self.ships = {} # this ship parts self.o_parts = {} # stand for other parts self.b_g_e = {} # stand for back ground element self.planet_system = {} # hole planet system # list + self.map_view = [bin.config] def start_game(self): pyglet.app.run() @@ -57,11 +58,16 @@ class RenderThread(mp.Process, pyglet.window.Window): def part_draw(self): # render parts - for ship in self.parts: + for ship in self.ships: ship_poi = ship['brain'][3] for part in ship: pass + def check_in_view(self): + for ship in self.ships: + pass + pass + """ keyboard and mouse input """ diff --git a/bin/configs.py b/bin/configs.py index 4c0943d..9947769 100644 --- a/bin/configs.py +++ b/bin/configs.py @@ -3,14 +3,14 @@ writen by shenjackyuanjie mail: 3695888@qq.com """ -import re +# import re import bin import time import json5 import decimal -def basic_number(int_num=0, float_num=1, unit1=None, unit2=None) -> list: +def __basic_number(int_num=0, float_num=1, unit1=None, unit2=None) -> list: if unit1 is None: unit1 = [] if unit2 is None: @@ -21,8 +21,27 @@ def basic_number(int_num=0, float_num=1, unit1=None, unit2=None) -> list: return [int_num, decimal.Decimal(str(float_num)), unit1, unit2] # no create a decimal class +def basic_number(int_num=0, float_num=1, unit1=None, unit2=None, num=1) -> list: + numbers = [] + if num > 1: + for x in range(0, num, 1): + numbers.append(__basic_number(int_num, float_num, unit1, unit2)) + elif num == 1: + return __basic_number(int_num, float_num, unit1, unit2) + else: # num < 1 + raise TypeError('you should give me a num with >= 1!') + return numbers + + +def basic_poi(type=None) -> list: + if type == None: + return basic_number(unit1='m', num=2) + if type == 'view': + return [basic_number(unit1='chunk', num=2), basic_number(unit1='m', num=2)] + + def basic_force() -> list: - return [basic_number(unit1=["N"]), basic_number(unit1=["N"])] + return basic_number(unit1='N', num=2) def configs(name, option=None) -> dict: @@ -34,6 +53,7 @@ def configs(name, option=None) -> dict: except: print(Exception) raise Exception + return data def name_handler(name: str, configs: dict = None) -> str: diff --git a/docs/configes sample/in_file_config.json5 b/docs/configes sample/in_file_config.json5 index f5b2cc4..ec8f901 100644 --- a/docs/configes sample/in_file_config.json5 +++ b/docs/configes sample/in_file_config.json5 @@ -18,11 +18,15 @@ 'is mirror', // type:bool [ + 'basic_config.basic_poi', 'basic_config.basic_poi' ] + /*brain的坐标记录由两部分组成 + 第一部分是brain所在区块的区块坐标(区块的大小暂定2^64m大小,从恒星中心开始算,普通的平面直角坐标系) + 第二部分是brain所在区块内的相对坐标(左上角00)*/ /*rua! 我用中文了! 飞船的"大脑"(直译)没有"特殊值" - 也就是说"大脑"只是一个"壳"(服务端同理) + 也就是说"大脑"只是一个"壳"(服务端同理) 只会计算位置、方向之类的统一数据 需要改的话发issue 嘿嘿 */ diff --git a/docs/rua!.md b/docs/rua!.md index c58372a..ecf77ce 100644 --- a/docs/rua!.md +++ b/docs/rua!.md @@ -1,3 +1,11 @@ # pyglet相关 pyglet 坐标轴原点是左上角 + +# 坐标记录相关 + +记录的是部件碰撞箱左上角的相对于控制仓左上角的相对坐标 + +然后控制仓是单独记录的 + +记录的是区块坐标+区块内坐标 \ No newline at end of file diff --git a/sys_value/parts.json5 b/sys_value/parts.json5 index fd129ac..3852de4 100644 --- a/sys_value/parts.json5 +++ b/sys_value/parts.json5 @@ -1,20 +1,44 @@ { + // /* 'part id': [ [ - 'float', - 'float' + 'part name', + // part name can be reuse + 'description', + // 描述 ], - /* 坐标轴偏移量 - 指的是部件的碰撞箱左上角到贴图左上角的距离*/ + // about names and other + [ + 'float', + // mass + 'bool', + // hidden in part list + 'float' + // buoyancy(浮力) in the water + ], + // about config + [ + 'xxx.png', + // texture file name + [ + 'float', + 'float' + ], + // 贴图偏移量 + // 指的是部件的碰撞箱左上角到贴图左上角的距离 + ], + // about texture [ 'float', 'float' ], - /* 碰撞箱大小 (暂时只支持方形碰撞箱) - 坐标轴也是从左上开始*/ - 'xxx.png' - /* 贴图文件名 - 可以为包含文件夹的 比如:./engine/xxx.png*/ + // 碰撞箱大小 (暂时只支持方形碰撞箱) + //坐标轴也是从左上开始 + //可以为包含文件夹的 比如:./engine/xxx.png + [ + '特殊值(懒得写)' + ] ], + // */ '': [] } \ No newline at end of file