1 Star 0 Fork 0

AUST_RM_HongLie/RoboHero-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
front.py 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
import thread_socket
import user_class
from myoutput import *
#主进程执行
def Front():
Application_start()
while(True):
illegalFlag:bool=False
str_input=input()
words:list[str]=str_input.split(" ")
if(words[0]=="q" or words[0]=="quit"):
Application_quit()
break
elif(words[0]=="h" or words[0]=="help"):
Application_help()
elif(words[0]=="s" or words[0]=="show"):
illegalFlag=Application_show(words)
else:
illegalFlag=True
if(illegalFlag):
print("\033[91mIllegal import!\033[0m")
#开始应用,启动socket线程
def Application_start():
Application_showLogo()
print("\033[37mRoboHero Server\033[0m")
print("\033[92minput 'h' or 'help' can watch help document\033[0m")
print("\033[92minput 'q' or 'quit' can quit\033[0m")
thread_socket.thread_socket_start()
#退出应用
def Application_quit():
for uid in user_class.User_Dict:
user_class.User_Dict[uid].thread_flag=False
while(len(user_class.User_Dict)!=0):
pass
thread_socket.thread_socket_end()
thread_socket.Mysocket.close()
print("\033[92mPlease wait...\033[0m")
#exit()
#展示字符画LOGO
def Application_showLogo():
with open('doc/temp','r') as f:
for line in f:
print(line,end="")
f.close()
#展示帮助文档
def Application_help():
with open('doc/helpdoc','r') as f:
for line in f:
print(line,end="")
f.close()
#show命令
def Application_show(words:list[str])->bool:
illegalFlag:bool=False
if(len(words)==1):
print("show all players name")#补全
else:
if(words[1]=="player"):
print("show all players message")#补全
elif(words[1]=="socket"):
print("show all sockets message")#补全
else:
illegalFlag=True
return illegalFlag
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/aust_-rm_-hong-lie/RoboHero-server.git
git@gitee.com:aust_-rm_-hong-lie/RoboHero-server.git
aust_-rm_-hong-lie
RoboHero-server
RoboHero-server
main

搜索帮助