cehua_hzl
2018-08-22 af4a1f8d277bdb9e5bbd7e388bdc0c8ea901b380
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
W[c@s¡ddlZddlmZddlZddlZddlmZddlZddl    Z    defd„ƒYZ
dd
d„ƒYZ da d„Zd    „ZdS( iÿÿÿÿN(t ProjectRobot(tThreadtAIThreadcBs#eZd„Zd„Zd„ZRS(cCsTtj|ddd|ƒ||_g|_d|_d|_d|_d|_dS(Ns AIThreadPy_%sii(    Rt__init__tNonetrobotMgrtAIListtlastTimet badRobotCnttProcessFindTJGTimet lastLoginTime(tselfRtindex((s.\\Tool\Robot\Robot\RobotMgr.pyRs                    c
Cstjd|jƒƒxùtry«tjƒ}|jr2||j|jkr2||_|jjƒ}|jj    j
ƒ}g}xxt t |ƒƒD]d}|j ƒ}|d|krÆdG|dGHq‘n|jj|ƒ}|j|ƒ|dkr‘Pq‘q‘Wx6|D]+}|sqn|jƒs|jƒqqWnxdt |jjƒƒD]M}||jjƒkrgPn|jj|ƒ}|s…qHn|jƒjƒqHW|js®||_ntjdƒx¨t |jjƒƒD]‘}|jj|ƒ}|sdGH|jj|ƒ|jd7_Pn|jƒrÑdGHtjd|jƒƒ|jj|ƒ|jd7_PqÑqÑWtjƒ}||jd    krÊd
|jjƒ|jjƒfGH||_|jrÊd |jGHqÊnWqtk
r}    tjd t |    ƒƒtjd t!j"ƒƒqXqWdS( Nsthread %s startisÕýÔڵǼÖÐ------i
g{®Gáz”?s====ûÓлúÆ÷ÈËs ++++++±»´Ý»ÙsGetNeedDestroy __peer:0x%08X i sÍÑ»ú¹ÒÍæ¼ÒÊýÁ¿: %s - %ss²Î¿¼-ÀúÊ·Òì³£ÍÑ»ú¹Ò´ÎÊý£º%ss AIThread: %s(#tloggingtinfotgetNametTruettimeR
R    RtGetRobotAccIDListtdbRobott GetTokenListtxrangetlentpoptAddRobottappendt IsConnectedt ReCreateRobott GetRobotCounttGetRobottGetAIMgrt    ProcessAItsleeptRemoveRtGetNeedDestroytdebugt GetPeerValueRtGetLoginOKRobotCountt    Exceptionterrortstrt    tracebackt    print_exc(
R tnowTimet logoningListt    tokenListt    robotListtit    tokenInfotrobotR te((s.\\Tool\Robot\Robot\RobotMgr.pyt    runThreadsn                       !        cCs|j}|ƒdS(N(R3(R trunM((s.\\Tool\Robot\Robot\RobotMgr.pytrunls    (t__name__t
__module__RR3R5(((s.\\Tool\Robot\Robot\RobotMgr.pyRs         OtRobotMgrcBskeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z RS( cCsS||_d|_g|_g|_||_i|_t|dƒ}|jƒdS(Ni(t_RobotMgr__asioMgrt_RobotMgr__robotNumt_RobotMgr__robotst_RobotMgr__robotAccIDsRtTeamMgrRtstart(R tasioMgrRtth((s.\\Tool\Robot\Robot\RobotMgr.pyRus                        cCs>g|_x+|jD] }|jj|jƒdƒqW|jS(Ni(R<R;RtGetRobotConfig(R R1((s.\\Tool\Robot\Robot\RobotMgr.pyR„s    cCs:tjd|fƒt|j|ƒ}|jj|ƒ|S(NsCreate Robot index:%s.....(R R#RR9R;R(R R0R1((s.\\Tool\Robot\Robot\RobotMgr.pyRŠscCs t|jƒS(N(RR;(R ((s.\\Tool\Robot\Robot\RobotMgr.pyR”scCs7d}x*|jD]}|jƒr|d7}qqW|S(Nii(R;R(R tnR1((s.\\Tool\Robot\Robot\RobotMgr.pytGetConnectedRobotCount˜s
 cCsMd}x@|jD]5}|jƒr/|d7}qtjd|jƒƒqW|S(Niis!!!not login :0x%08X(R;t GetIsLoginOKR R#R$(R RBR1((s.\\Tool\Robot\Robot\RobotMgr.pyR% s   cCs |j|S(N(R;(R R ((s.\\Tool\Robot\Robot\RobotMgr.pyR·scCs|jj|ƒdS(N(R;tremove(R R1((s.\\Tool\Robot\Robot\RobotMgr.pyR!¼scCsP|jƒjƒ}tjd|ƒ|jƒ||jkrL|j|ƒndS(NsDisconnectServer for %s(t GetPlayerInfotGetAccIDR R#t DestroyRobotR;R!(R R1taccID((s.\\Tool\Robot\Robot\RobotMgr.pytDisconnectServerÀs
 
cCs.tjd|ƒ|j|ƒ}|s*tSdS(NsStartAI for %d(R R#RtFalse(R R R1((s.\\Tool\Robot\Robot\RobotMgr.pytStartAIÊscCs.tjd|ƒ|j|ƒ}|s*tSdS(Ns StopAI for %d(R R#RRK(R R R1((s.\\Tool\Robot\Robot\RobotMgr.pytStopAIÖs( R6R7RRRRRCR%RR!RJRLRM(((s.\\Tool\Robot\Robot\RobotMgr.pyR8ss            
                        
     cCstst||ƒandS(N(t __gRobotMgrR8(R?R((s.\\Tool\Robot\Robot\RobotMgr.pytCreateRobotMgrscCstS(N(RN(((s.\\Tool\Robot\Robot\RobotMgr.pyt GetRobotMgrs((R tProjectBinding.ProjectRobotRt&ConfigurationReader.RobotsConfigReadertConfigurationReadert#ConfigurationReader.ConfigIniReadert    threadingRR)RRR8RRNRORP(((s.\\Tool\Robot\Robot\RobotMgr.pyt<module>s     cŒ