本文整理汇总了Python中Client.Client.s方法的典型用法代码示例。如果您正苦于以下问题:Python Client.s方法的具体用法?Python Client.s怎么用?Python Client.s使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client.Client
的用法示例。
在下文中一共展示了Client.s方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: serviceJoiningPlayer
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import s [as 别名]
def serviceJoiningPlayer(self, cl):
if cl[2] == 0:
fn = False
try:
ubt = ord(cl[0].recv(1))
fn = True
except: pass
if not fn:
return
if fn:
fn = False
try:
exb = ord(cl[0].recv(1))
fn = True
except: pass
if fn:
if ubt == PLAYER_JOIN:
cl[2] = 1
cl[3] = exb
else:
kickTempClient(self, cl)
return
if cl[2] == 1:
"""if len(self.clients) >= c.maxPlayers:
cl[0].send(chr(SERVER_FULL))
kickTempClient(self, cl)
return"""
fn = False
try:
nam = str(cl[0].recv(cl[3]))
fn = True
except: pass
if fn:
if len(self.clients) >= c.maxPlayers and cl[1][0] != "127.0.0.1":
cl[0].send(chr(SERVER_FULL))
cl.append(nam)
kickTempClient(self, cl)
return
serverJoinUpdate(self, cl[0])
p = Client()
p.s = cl[0]
p.ip = cl[1][0]
p.rport = cl[1][1]
p.name = nam
p.name = p.name[0:MAX_PLAYERNAME_LENGTH-1]
p.name = p.name.replace("#", " ")
print p.name, "connected (IP: " + p.ip + ")."
self.clients.append(p)
serverPlayerJoin(self, p.name)
del self.tempClients[self.tempClients.index(cl)]
del cl