re write some function
This commit is contained in:
parent
ab8d2b5860
commit
dd12b45115
@ -27,11 +27,12 @@ class RenderThread(mp.Process, pyglet.window.Window):
|
|||||||
self.dev_list = dev_list
|
self.dev_list = dev_list
|
||||||
self.dev_dic = dev_dic
|
self.dev_dic = dev_dic
|
||||||
# dic
|
# dic
|
||||||
self.parts = {} # this ship parts
|
self.ships = {} # this ship parts
|
||||||
self.o_parts = {} # stand for other parts
|
self.o_parts = {} # stand for other parts
|
||||||
self.b_g_e = {} # stand for back ground element
|
self.b_g_e = {} # stand for back ground element
|
||||||
self.planet_system = {} # hole planet system
|
self.planet_system = {} # hole planet system
|
||||||
# list
|
# list
|
||||||
|
self.map_view = [bin.config]
|
||||||
|
|
||||||
def start_game(self):
|
def start_game(self):
|
||||||
pyglet.app.run()
|
pyglet.app.run()
|
||||||
@ -57,11 +58,16 @@ class RenderThread(mp.Process, pyglet.window.Window):
|
|||||||
|
|
||||||
def part_draw(self):
|
def part_draw(self):
|
||||||
# render parts
|
# render parts
|
||||||
for ship in self.parts:
|
for ship in self.ships:
|
||||||
ship_poi = ship['brain'][3]
|
ship_poi = ship['brain'][3]
|
||||||
for part in ship:
|
for part in ship:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def check_in_view(self):
|
||||||
|
for ship in self.ships:
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
"""
|
"""
|
||||||
keyboard and mouse input
|
keyboard and mouse input
|
||||||
"""
|
"""
|
||||||
|
@ -3,14 +3,14 @@ writen by shenjackyuanjie
|
|||||||
mail: 3695888@qq.com
|
mail: 3695888@qq.com
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
# import re
|
||||||
import bin
|
import bin
|
||||||
import time
|
import time
|
||||||
import json5
|
import json5
|
||||||
import decimal
|
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:
|
if unit1 is None:
|
||||||
unit1 = []
|
unit1 = []
|
||||||
if unit2 is None:
|
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
|
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:
|
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:
|
def configs(name, option=None) -> dict:
|
||||||
@ -34,6 +53,7 @@ def configs(name, option=None) -> dict:
|
|||||||
except:
|
except:
|
||||||
print(Exception)
|
print(Exception)
|
||||||
raise Exception
|
raise Exception
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
def name_handler(name: str, configs: dict = None) -> str:
|
def name_handler(name: str, configs: dict = None) -> str:
|
||||||
|
@ -18,11 +18,15 @@
|
|||||||
'is mirror',
|
'is mirror',
|
||||||
// type:bool
|
// type:bool
|
||||||
[
|
[
|
||||||
|
'basic_config.basic_poi',
|
||||||
'basic_config.basic_poi'
|
'basic_config.basic_poi'
|
||||||
]
|
]
|
||||||
|
/*brain的坐标记录由两部分组成
|
||||||
|
第一部分是brain所在区块的区块坐标(区块的大小暂定2^64m大小,从恒星中心开始算,普通的平面直角坐标系)
|
||||||
|
第二部分是brain所在区块内的相对坐标(左上角00)*/
|
||||||
/*rua! 我用中文了!
|
/*rua! 我用中文了!
|
||||||
飞船的"大脑"(直译)没有"特殊值"
|
飞船的"大脑"(直译)没有"特殊值"
|
||||||
也就是说"大脑"只是一个"壳"(服务端同理)
|
也就是说"大脑"只是一个"壳"(服务端同理)
|
||||||
只会计算位置、方向之类的统一数据
|
只会计算位置、方向之类的统一数据
|
||||||
需要改的话发issue 嘿嘿
|
需要改的话发issue 嘿嘿
|
||||||
*/
|
*/
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
# pyglet相关
|
# pyglet相关
|
||||||
|
|
||||||
pyglet 坐标轴原点是左上角
|
pyglet 坐标轴原点是左上角
|
||||||
|
|
||||||
|
# 坐标记录相关
|
||||||
|
|
||||||
|
记录的是部件碰撞箱左上角的相对于控制仓左上角的相对坐标
|
||||||
|
|
||||||
|
然后控制仓是单独记录的
|
||||||
|
|
||||||
|
记录的是区块坐标+区块内坐标
|
@ -1,20 +1,44 @@
|
|||||||
{
|
{
|
||||||
|
// /*
|
||||||
'part id': [
|
'part id': [
|
||||||
[
|
[
|
||||||
'float',
|
'part name',
|
||||||
'float'
|
// 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',
|
||||||
'float'
|
'float'
|
||||||
],
|
],
|
||||||
/* 碰撞箱大小 (暂时只支持方形碰撞箱)
|
// 贴图偏移量
|
||||||
坐标轴也是从左上开始*/
|
// 指的是部件的碰撞箱左上角到贴图左上角的距离
|
||||||
'xxx.png'
|
|
||||||
/* 贴图文件名
|
|
||||||
可以为包含文件夹的 比如:./engine/xxx.png*/
|
|
||||||
],
|
],
|
||||||
|
// about texture
|
||||||
|
[
|
||||||
|
'float',
|
||||||
|
'float'
|
||||||
|
],
|
||||||
|
// 碰撞箱大小 (暂时只支持方形碰撞箱)
|
||||||
|
//坐标轴也是从左上开始
|
||||||
|
//可以为包含文件夹的 比如:./engine/xxx.png
|
||||||
|
[
|
||||||
|
'特殊值(懒得写)'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
// */
|
||||||
'': []
|
'': []
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user