本文整理汇总了Python中Client.login方法的典型用法代码示例。如果您正苦于以下问题:Python Client.login方法的具体用法?Python Client.login怎么用?Python Client.login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.login方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: actionPerformed
# 需要导入模块: import Client [as 别名]
# 或者: from Client import login [as 别名]
def actionPerformed(self,e):
print e.getActionCommand()
comm=e.getActionCommand()
if comm=='Connect':
rsp=Client.login(frame.getServerAddress(),frame.getUserName(),'9999')
frame.addMsg(rsp)
if rsp=='success':
e.getSource().setEnabled(False)
Client.requestUserList(frame.getServerAddress())
for u in Client.userlist.keys():
frame.addUser(u)
elif comm=='Send':
print frame.getSelectedUser()
Client.sendmsg(frame.getMessage(),frame.getSelectedUser())
elif comm=='Exit':
frame.dispose()
示例2: start
# 需要导入模块: import Client [as 别名]
# 或者: from Client import login [as 别名]
def start(canvas,multiplayer=False,runServer=False,AI=False,nAI=1,diff=4) :
global screen, player, height, width, size, level,hud,basicFont,isMultiplayer,hasAI,numAI,difficulty,timer,endLevel
screen = canvas
pygame.init()
pygame.font.init()
if runServer:#true if you want to run a server localy
t = threading.Thread(target=startServer,args=('3',False))
t.start()
time.sleep(1)#bad, but oh well
print "Server starting"
basicFont = pygame.font.SysFont(None, 32)
x = 32*16
y = 32*16
hud = GuiHUD.GuiHUD(screen)
level = Level.Level(32,32)
endLevel = None
#endLevel = Level.Level(32,32)
username = Config.config["name"]
player = Player.Player(level,username,x,y)
#level.player = player
isMultiplayer = multiplayer
hasAI = AI
numAI = nAI
difficulty = diff
if isMultiplayer == True:
Client.login(username,x,y)
size = width, height = 800, 600
while Client.isWaiting == True and isMultiplayer == True:#wait for Client to sync
pass
level.loadLevelFromFile("levels/Arena.txt")
#endLevel.loadLevelFromFile("levels/sort.txt")
#endLevel.entities.append(SorterRobot.SorterRobot(endLevel,6<<5,5<<5))
#if isMultiplayer == False:
#populateLevel()
# if Client.isHost == True and isMultiplayer == True:
# populateLevel()
lastTime = time.time()
lastTimer = time.time()
delta = 0.0
FPS = 60.0
timepertick = 1./FPS
frames = 0
ticks = 0
timer = 0
clock = pygame.time.Clock()
while Keyboard.running:
#doesn't work on pi, but better on pc
now = time.time()
delta += (now - lastTime) / timepertick
lastTime = now
while delta >= 1:
ticks+=1
timer+=1
tick()
delta -= 1
frames+=1
render()
if time.time() - lastTimer >= 0:
lastTimer+=1
#print frames
pygame.display.set_caption("Frames:"+ str(frames) +" ticks:"+str(ticks))
frames=0
ticks=0
## tick()
## render()
## pygame.display.set_caption("FPS:"+str(clock.get_fps()))
## clock.tick(60)
quitGame()
pygame.quit()