代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。