This commit is contained in:
沈瑗杰 2021-02-13 22:41:44 +08:00
parent 277448a63d
commit f02bf605a7
4 changed files with 46 additions and 30 deletions

View File

@ -8,7 +8,7 @@ import multiprocessing as mp
import re import re
import pyglet import pyglet
import pyglet.app import pyglet.app
from pyglet.resource import image from pyglet import image
from pyglet.window import Window from pyglet.window import Window
try: try:
@ -16,7 +16,7 @@ try:
import configs import configs
import tools import tools
except ModuleNotFoundError: except ModuleNotFoundError:
# ben import use # been import use
from bin import configs from bin import configs
from bin import tools from bin import tools
@ -47,19 +47,21 @@ class RenderThread(mp.Process, pyglet.window.Window):
# image # image
self.b_g = image("back_ground_space.png") self.b_g = image("back_ground_space.png")
# configs # configs
self.window_config = tools.config('sys_value/window.json5') self.view = tools.config('configs/view.json5')
self.part_list = tools.config('sys_value/parts.json5')
self.map_view = [configs.basic_poi(poi_type='chunk')] 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 # dic
self.ships = {} # all ship(part) self.ships = {} # all ship(part)
self.planet_system = {} # hole planet system self.planet_system = {} # hole planet system
# list # list
# re stuff # 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 # window
self.window = Window(width=int(self.window_config['width']), self.window = Window(width=int(self.window_config['width']),
height=int(self.window_config['height']), 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']), caption=str(self.window_config['caption']),
visible=tools.c_b(self.window_config['visible'])) visible=tools.c_b(self.window_config['visible']))
# setup # setup
@ -73,10 +75,19 @@ class RenderThread(mp.Process, pyglet.window.Window):
# net_mode # net_mode
if self.net_mode == 'local': if self.net_mode == 'local':
pass 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 pass
# textures # 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 draws
""" """

View File

@ -96,6 +96,7 @@ class BasicNumberClass:
self.float = check[0] self.float = check[0]
self.int = check[1] self.int = check[1]
elif o_type == type(decimal.Decimal('1.0')) and not self.units(): elif o_type == type(decimal.Decimal('1.0')) and not self.units():
pass
def __radd__(self, other): def __radd__(self, other):
self.__add__(self) self.__add__(self)

View File

@ -1,3 +1,4 @@
{ {
'map far': 100 'map far': 100 // float
// 大概是“渲染距离”的选项
} }

View File

@ -1,31 +1,35 @@
{ {
'Game_threads': { Game_threads: {
'orbit_demo': { orbit_demo: {
'ship_info': { ship_info: {
'mass': 'basic_config:basic_number', mass: 'basic_config:basic_number',
'force': 'basic_config:basic_force' force: 'basic_config:basic_force'
} }
} }
}, },
'client': { client: {
'self.view': [ 'self.view': ['space', 'map', 'menu'],
'space', 'self.textures': {
'map', 'first name of textures(defaut: difficult_rocket)': {
'menu' 'name of image or name of list': 'pyglet.image class or dict',
], /*
这里说明一下你即可以直接主列表下直接放image也可以再细分
会直接检测是列表还是image
另外 可 在文件夹同级放image文件
*/
'nothing': 'nothing'
}
},
'self.parts': { 'self.parts': {
'ship name': { 'ship name': {
'brain': [ brain: [
'part type', 'part type',
// part type // part type
'turn', 'turn',
// type:float // type:float
'is mirror', 'is mirror',
// type:bool // type:bool
[ ['basic_config.basic_poi', 'basic_config.basic_poi']
'basic_config.basic_poi',
'basic_config.basic_poi'
]
/*brain的坐标记录由两部分组成 /*brain的坐标记录由两部分组成
第一部分是brain所在区块的区块坐标(区块的大小暂定2^64m大小从恒星中心开始算普通的平面直角坐标系) 第一部分是brain所在区块的区块坐标(区块的大小暂定2^64m大小从恒星中心开始算普通的平面直角坐标系)
第二部分是brain所在区块内的相对坐标(左上角00)*/ 第二部分是brain所在区块内的相对坐标(左上角00)*/
@ -44,12 +48,10 @@
// type:float 0 is up clockwise // type:float 0 is up clockwise
'is mirror', 'is mirror',
// type:bool // type:bool
[ ['basic_config.basic_poi'],
'basic_config.basic_poi'
],
{ {
'special value 1': 'xxx', 'special value 1': 'xxx',
'special value 2': 'xxx' 'special value 2': 'xxx',
/*继续继续 /*继续继续
这里的“特殊值”指的是 这里的“特殊值”指的是
除去上面写的类型、角度、镜像、位置之外的其他属性 除去上面写的类型、角度、镜像、位置之外的其他属性
@ -58,6 +60,7 @@
比如对接之后传输燃料、渲染太阳能板 比如对接之后传输燃料、渲染太阳能板
的时候可以用到 的时候可以用到
*/ */
'nothing': 'nothing'
} }
] ]
} }