first part for phy simluation #34

Merged
shenjackyuanjie merged 19 commits from dr_game/phy_simluation into main 2023-06-22 02:11:47 +08:00
3 changed files with 22 additions and 5 deletions
Showing only changes of commit 192e679c6d - Show all commits

View File

@ -308,7 +308,6 @@ class ClientWindow(Window):
@_call_screen_after
def on_command(self, command: line.CommandText):
print(command.find('/'))
self.logger.info(tr().window.command.text().format(command))
if command.find('stop'):
# self.dispatch_event('on_exit')

View File

@ -44,9 +44,12 @@ class CommandText:
i += 1
def find(self, text: str) -> bool:
print(f'text: {text} startswith: {self.text.startswith(text)} find: {self.text.find(text)}')
startswitch = self.text.startswith(text)
if startswitch:
find = self.text.find(text)
if find != -1:
self.text = self.text[find + len(text):]
self.text = self.text[find + len(text):] if not self.text[find+len(text)] == ' ' else self.text[find + len(text) + 1:]
return True
return False

View File

@ -11,6 +11,21 @@
- issue #33 (https://github.com/shenjackyuanjie/Difficult-Rocket/issues/33)
- 修复了实际上并不会加载 `.otf` 格式的字体文件的问题
### 修改
- 现在输入命令之后不会输出一个 `True`/`False` 了
- (实际上是用来检测命令是不是用 `/` 开头的)
- Now, the command will not output a `True`/`False`
- (Actually used to detect whether the command starts with `/`)
- `CommandText`
- `find`
- 现在会先用 `str.startswith` 检测是否以要求的字符串开头
- 实际上就是丐版 `re.match`
- 并且会在匹配上之后 如果匹配内容后面第一个字符是空格 则会截取掉空格
- Now, it will first use `str.startswith` to detect whether it starts with the required string
- Actually a poor version of `re.match`
- And after matching, if the first character after the matching content is a space, the space will be intercepted
## DR sdk 0.8.3.0
### 删除