From 60f120862aa62dae121052c022f4dab35d67a28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E7=91=97=E6=9D=B0?= <3695888@qq.com> Date: Fri, 24 Sep 2021 00:04:56 +0800 Subject: [PATCH] =?UTF-8?q?release=20coming=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Difficult_Rocket/api/tools.py | 10 +++++----- Difficult_Rocket/client.py | 15 +++++---------- configs/lang/zh-CN.json5 | 3 ++- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Difficult_Rocket/api/tools.py b/Difficult_Rocket/api/tools.py index a286c54..677e26f 100644 --- a/Difficult_Rocket/api/tools.py +++ b/Difficult_Rocket/api/tools.py @@ -19,9 +19,9 @@ import decimal import logging import traceback import configparser -from xml.dom.minidom import parse -import semver +from typing import List +from xml.dom.minidom import parse if __name__ == '__main__': # been start will not run this sys.path.append('/bin/libs') @@ -221,7 +221,7 @@ Physics calculation def is_decimal(A: any) -> bool: - if isinstance(A, decimal): + if isinstance(A, decimal.Decimal): return False else: return True @@ -334,7 +334,7 @@ def G_C(M, m, R, G): # stand for gravity calculation return g -def distance(A: List[float, float], B: List[float, float]): +def distance(A, B): """ formats: A & B format: docs.basic_config:basic_poi @@ -353,4 +353,4 @@ def distance(A: List[float, float], B: List[float, float]): poi_dis[2] **= 0.5 return poi_dis[2] -def +# def diff --git a/Difficult_Rocket/client.py b/Difficult_Rocket/client.py index 6807a1e..2dcac83 100644 --- a/Difficult_Rocket/client.py +++ b/Difficult_Rocket/client.py @@ -21,6 +21,7 @@ import threading import configparser import multiprocessing +from decimal import Decimal from multiprocessing import Pipe from multiprocessing.connection import Connection @@ -85,9 +86,6 @@ class ClientWindow(pyglet.window.Window): """ # logging self.logger = logging.getLogger('client') - # share memory - # self.dev_list = dev_list - # self.dev_dic = dev_dic # value self.net_mode = net_mode self.run_input = False @@ -95,15 +93,14 @@ class ClientWindow(pyglet.window.Window): pyglet.resource.path = ['textures'] pyglet.resource.reindex() self.config_file = tools.config('configs/main.config') - self.FPS = int(self.config_file['runtime']['fps']) - self.SPF = 1.0 / self.FPS + self.FPS = Decimal(int(self.config_file['runtime']['fps'])) + self.SPF = Decimal('1') / self.FPS # lang self.lang = tools.config('configs/lang/%s.json5' % self.config_file['runtime']['language'], 'client') # dic self.environment = {} self.textures = {} # all textures self.runtime = {} - # list # FPS self.max_fps = [self.FPS, time.time()] self.min_fps = [self.FPS, time.time()] @@ -113,15 +110,13 @@ class ClientWindow(pyglet.window.Window): self.label_batch = pyglet.graphics.Batch() # frame self.frame = pyglet.gui.Frame(self) + self.M_frame = pyglet.gui.MovableFrame(self) # setup self.setup() self.info_label = pyglet.text.Label(x=10, y=self.height - 10, anchor_x='left', anchor_y='top', batch=self.label_batch) - pyglet.clock.schedule_interval(self.update, self.SPF) - self.times.append(time.time()) - self.times.append(self.times[1] - self.times[0]) - self.logger.debug(self.times[2]) + pyglet.clock.schedule_interval(self.update, float(self.SPF)) self.logger.info(self.lang['setup.done']) @new_thread('client_load_environment') diff --git a/configs/lang/zh-CN.json5 b/configs/lang/zh-CN.json5 index 3222186..328c68b 100644 --- a/configs/lang/zh-CN.json5 +++ b/configs/lang/zh-CN.json5 @@ -16,6 +16,7 @@ }, 'client': { 'setup.done': '客户端载入完成', + 'setup.use_time': '客户端载入消耗时间: {} 秒', 'os.pid_is': '客户端 PID: {} PPID: {}', 'button.been_press': '按钮被按下,目前状态为:', 'mouse.press': '鼠标在 {} 被按下,按键为:{}', @@ -23,7 +24,7 @@ 'mouse.right': '右键', 'mouse.left': '左键', 'libs.local': '正在使用本地 pyglet 库 版本为: {}', - 'libs.outer': '正在使用全局 pyglet 库 版本为: {}\n(可能会造成bug,因为本地库版本为2.0dev)' + 'libs.outer': '正在使用全局 pyglet 库 版本为: {}\n(可能会造成bug,因为本地库版本为2.0dev9)' }, 'server': { 'setup.done': '服务端载入完成',