0.6.1 developing
This commit is contained in:
parent
e0ee62334e
commit
26d0a1e821
@ -46,8 +46,11 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
from Difficult_Rocket import main
|
from Difficult_Rocket import main
|
||||||
game = main.Game()
|
game = main.Game()
|
||||||
|
cprofile = False
|
||||||
|
if cprofile:
|
||||||
cProfile.run('game.start()', sort='calls')
|
cProfile.run('game.start()', sort='calls')
|
||||||
# game.start()
|
else:
|
||||||
|
game.start()
|
||||||
if DEBUGGING:
|
if DEBUGGING:
|
||||||
raise TestError('debugging')
|
raise TestError('debugging')
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
|
@ -45,7 +45,7 @@ file_error = {'FileNotFoundError': 'no {filetype} file was founded!:\n file name
|
|||||||
def load_file(file_name: str, stack=None) -> dict:
|
def load_file(file_name: str, stack=None) -> dict:
|
||||||
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
|
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
|
||||||
try:
|
try:
|
||||||
rd = ''
|
rd = NotImplementedError('解析失败,请检查文件类型/文件内容/文件是否存在!')
|
||||||
if (f_type == 'json5') or (f_type == 'json'):
|
if (f_type == 'json5') or (f_type == 'json'):
|
||||||
try:
|
try:
|
||||||
with open(file_name, 'r', encoding='utf-8') as jf: # jf -> json file
|
with open(file_name, 'r', encoding='utf-8') as jf: # jf -> json file
|
||||||
|
@ -38,6 +38,7 @@ from Difficult_Rocket.api import tools, new_thread
|
|||||||
local_lib = True
|
local_lib = True
|
||||||
if local_lib:
|
if local_lib:
|
||||||
from libs import pyglet
|
from libs import pyglet
|
||||||
|
from libs.pyglet.window import Window
|
||||||
from libs.pyglet.window import key, mouse
|
from libs.pyglet.window import key, mouse
|
||||||
else:
|
else:
|
||||||
import pyglet
|
import pyglet
|
||||||
@ -75,7 +76,7 @@ class Client:
|
|||||||
# TODO 写一下服务端启动相关,还是需要服务端啊
|
# TODO 写一下服务端启动相关,还是需要服务端啊
|
||||||
|
|
||||||
|
|
||||||
class ClientWindow(pyglet.window.Window):
|
class ClientWindow(Window):
|
||||||
|
|
||||||
def __init__(self, net_mode='local', *args, **kwargs):
|
def __init__(self, net_mode='local', *args, **kwargs):
|
||||||
start_time = time.time_ns()
|
start_time = time.time_ns()
|
||||||
@ -258,10 +259,6 @@ class ClientWindow(pyglet.window.Window):
|
|||||||
key.MOD_CAPSLOCK |
|
key.MOD_CAPSLOCK |
|
||||||
key.MOD_SCROLLLOCK)):
|
key.MOD_SCROLLLOCK)):
|
||||||
self.dispatch_event('on_close')
|
self.dispatch_event('on_close')
|
||||||
if symbol == key.C and modifiers & key.MOD_CTRL:
|
|
||||||
self.dispatch_event('on_text_motion', key.MOTION_COPY)
|
|
||||||
if symbol == key.V and modifiers & key.MOD_CTRL:
|
|
||||||
self.dispatch_event('on_text_motion', key.MOTION_PASTE)
|
|
||||||
self.logger.debug(tr.lang('window', 'key.press').format(key.symbol_string(symbol), key.modifiers_string(modifiers)))
|
self.logger.debug(tr.lang('window', 'key.press').format(key.symbol_string(symbol), key.modifiers_string(modifiers)))
|
||||||
|
|
||||||
def on_key_release(self, symbol, modifiers) -> None:
|
def on_key_release(self, symbol, modifiers) -> None:
|
||||||
|
@ -239,6 +239,8 @@ class CommandLine(widgets.WidgetBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def on_text(self, text):
|
def on_text(self, text):
|
||||||
|
# 这里的大部分东西都会在最近被重写
|
||||||
|
# TODO 重写成基于新的 InputBox 的解析
|
||||||
if self.editing:
|
if self.editing:
|
||||||
if text in ('\r', '\n'): # goto a new line
|
if text in ('\r', '\n'): # goto a new line
|
||||||
if not self.text:
|
if not self.text:
|
||||||
|
@ -189,6 +189,7 @@ class InputBox(widgets.WidgetBase):
|
|||||||
def on_key_press(self, symbol, modifiers):
|
def on_key_press(self, symbol, modifiers):
|
||||||
# 在这加一个on_key_press纯属为了处理剪贴板操作
|
# 在这加一个on_key_press纯属为了处理剪贴板操作
|
||||||
# (pyglet没有把ctrl+c和ctrl+v的事件绑定到on_text_motion上)
|
# (pyglet没有把ctrl+c和ctrl+v的事件绑定到on_text_motion上)
|
||||||
|
# TODO 正在给pyglet发PR
|
||||||
if symbol == key.C and modifiers & key.MOD_CTRL:
|
if symbol == key.C and modifiers & key.MOD_CTRL:
|
||||||
self.on_text_motion(key.MOTION_COPY)
|
self.on_text_motion(key.MOTION_COPY)
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](README-cn.md)
|
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](README-cn.md)
|
||||||
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
||||||
|
|
||||||
## 202111 V 0.6.1
|
## 202112 V 0.6.1
|
||||||
|
|
||||||
|
争取12月内发一个release
|
||||||
|
|
||||||
### Change
|
### Change
|
||||||
|
|
||||||
@ -26,7 +28,15 @@
|
|||||||
- 重写了一遍` client.load_fonts()`
|
- 重写了一遍` client.load_fonts()`
|
||||||
- rewrite `client.load_fonts()`
|
- rewrite `client.load_fonts()`
|
||||||
- 重写了 `tools.load_file()` 的错误处理和 `.config` 文件的解析方式
|
- 重写了 `tools.load_file()` 的错误处理和 `.config` 文件的解析方式
|
||||||
- rewrite `tools.load_file()` error handling and `.config` file parsing mode
|
- 现在 `.config` 文件解析后会直接返回一个 `ConfigParser` 对象
|
||||||
|
- 也就意味着不能再直接遍历 `.config` 文件返回的解析 ~~谁遍历.config文件啊~~
|
||||||
|
- 同时也意味着可以直接用解析好的 `.config` 文件来修改 `.config` 文件
|
||||||
|
- rewrite `tools.load_file()` error handling and `.config` file parsing method
|
||||||
|
- now `.config` file parsing after return `ConfigParser` object
|
||||||
|
- that means you can not directly traverse `.config` file return parsing ~~who traverse .config file~~
|
||||||
|
- also means you can directly use parsed `.config` file to modify `.config` file
|
||||||
|
- 为 `pyglet` 添加 `Ctrl+C` 和 `Ctrl+V` 的快捷键解析
|
||||||
|
- add `Ctrl+C` and `Ctrl+V` shortcut for `pyglet`
|
||||||
|
|
||||||
### Command
|
### Command
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user