当前位置: 首页>>代码示例>>Python>>正文


Python Game.name方法代码示例

本文整理汇总了Python中models.Game.name方法的典型用法代码示例。如果您正苦于以下问题:Python Game.name方法的具体用法?Python Game.name怎么用?Python Game.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Game的用法示例。


在下文中一共展示了Game.name方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
	def get( self ):
		alias = self.request.get( 'alias' )
		name = self.request.get( 'name' )
                platforms = self.request.get( 'platforms' ).split( ',' )
                category = self.request.get( 'category' )

                download_link_linux = self.request.get( 'download_link_linux' )
                download_link_osx = self.request.get( 'download_link_osx' )
                download_link_windows = self.request.get( 'download_link_windows' )
                download_link_java = self.request.get( 'download_link_java' )

                store_link_chrome = self.request.get( 'store_link_chrome' )
                store_link_android = self.request.get( 'store_link_android' )
                store_link_ios = self.request.get( 'store_link_ios' )

		model = Game()
                model.alias = alias
                model.name = name
                model.platforms = platforms
                model.category = category

                model.download_link_linux = download_link_linux
                model.download_link_osx = download_link_osx
                model.download_link_windows = download_link_windows
                model.download_link_java = download_link_java

                model.store_link_chrome = store_link_chrome
                model.store_link_android = store_link_android
                model.store_link_ios = store_link_ios
		model.put()
	
                self.send_json_response( True )
开发者ID:Ponup,项目名称:api-server,代码行数:34,代码来源:game.py

示例2: handlefbrequestcallback

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
def handlefbrequestcallback(request):
    fp = open( 'tmp.3.log', 'w' ) 
    print >> fp, request
    request_str   = ( request.GET.get('request') )
    request_to    = ( request.GET.get('to') )
    #request_from  = ( request.GET.get('from') )
    request_id    = ( request.GET.get('id') )
    request_from  = request.session['fb_id']
 
    #if request_to:
    #   request_to = int(request_to.encode('ascii'))

    #if request_from:
    #   request_from = int(request_from.encode('ascii'))

    #if request_id:
    #   request_id = int(request_id.encode('ascii'))

    print >> fp, "request id", request_id
    print >> fp, "request string", request_str
    print >> fp, "request to", request_to
    print >> fp, "request from", request_from
    print >> fp, "request fb id", request.session['fb_id']

    try:
    	m_to   = Member.objects.get(fb_id=request_to)
    except: 
	# need to make member    	
        m_to   = Member(fb_id=request_to)
  
    try: 
        m_from = Member.objects.get(fb_id=request_from)
    except:
	# need to make member    	
        m_from = Member(fb_id=request_from)

    # name is set
    gamename = "%s_%s_%s" % ( request_from, request_to, time.asctime(time.gmtime()) ) 
    r = Room(name=gamename)
    r.fb_request_id = request_id
    r.save()

    g = Game(room=r)
    # game name and room name duplicated 
    g.name = gamename
    g.save()

    p = Player(game=g,turn=0)
    p.member = m_from
    p.save()

    # TODO assumes two player game - generalize
    p = Player(game=g,turn=1)
    p.member = m_to
    p.save()

    #return HttpResponseRedirect('requestpage.html')
    return HttpResponseRedirect( reverse('lupalo.views.lupalo') ) # Redirect after POST
开发者ID:JanetGuo,项目名称:lupalo,代码行数:60,代码来源:views.old.py

示例3: makerobogame

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
def makerobogame(request):
  
    fb_id = ROBOT1
    request.session['fb_id'] = fb_id
 
    # make robot player 1
    try:
        m_from = Member.objects.get( fb_id=ROBOT1 )
    except Member.DoesNotExist:
        m_from   = Member(fb_id=ROBOT1)
        m_from.user_name     =  'Robo1'
        m_from.fb_first_name =  'Robo1'
        m_from.fb_last_name  =  'Robo1'
        m_from.save()
    # make robot player 2
    try:
        m_to = Member.objects.get( fb_id=ROBOT2 )
    except Member.DoesNotExist:
        m_to   = Member(fb_id=ROBOT2)
        m_to.user_name     =  'Robo2'
        m_to.fb_first_name =  'Robo2'
        m_to.fb_last_name  =  'Robo2'
        m_to.save()

    # name is set
    request_from = 'Robo1'
    request_to   = 'Robo2'
    gamename = "%s_%s_%s" % ( request_from, request_to, time.asctime(time.gmtime()) ) 
    r = Room(name=gamename)
    r.fb_request_id = ROBOREQUEST
    r.save()

    g = Game(room=r)
    # game name and room name duplicated 
    g.name = gamename
    g.save()

    p = Player(member=m_from)  # player in game, link to member 
    p.game=g		       # game 
    p.turn=0                   # static order of player in game
    p.save()

    request.session['player_id'] = p.turn

    # TODO assumes two player game - generalize
    p = Player( member = m_to )
    p.game=g
    p.turn=1
    p.save()

    return HttpResponse( simplejson.dumps( { "gamename": gamename } ), mimetype='application/javascript' )
开发者ID:cliffmeyer,项目名称:lupalo,代码行数:53,代码来源:views.py

示例4: post

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
    def post(self):
        logging.debug("CreateGame: ")
        user = auth()
        if user == None:
            logging.debug("CreateGame: Entered unauthenticated user!!")
            self.response.out.write(json.dumps({'error': 'Unauthenticated User'}))
            return

        #sendMessage(user, "HELLO");
        logging.debug("CreateGame: Before creating Game Object")
        #Create Game
        game = Game()
        game.name = self.request.get("name")
        game.players = []
        game.messages = []
        game.creator = user.key().id()
        game.location = user.location
        game.range = float(self.request.get('range'))
        game.startTime = datetime.datetime.now()
        logging.debug("CreateGame: Before creating Clue Object")
        
        clue = MyMessage()
        clue.text = self.request.get('clue')
        clue.time = datetime.datetime.now() 
        clue.put()
        logging.debug("CreateGame: Clue Object Created")
        game.clue = clue.key().id()
        game.active = True
        game.put()
        logging.debug("Game object created")
        clue.gameid = game.key().id()
        clue.user = user
        clue.put()
        user.activeGame = game
        user.put()
        #Notify users in the location
        #Return Game ID to UI
        logging.debug(game.key().id())
        self.response.out.write(json.dumps({'gameid': game.key().id()}))
开发者ID:clholgat,项目名称:iSpy,代码行数:41,代码来源:iSpyServer.py

示例5: post

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
 def post(self):
 	  
     self.response.headers['Content-Type'] = 'application/json';
     game_entity = Game()
     
    # print float(self.request.get("latitude"))
     game_entity.location = db.GeoPt(float(self.request.get("latitude")),float(self.request.get("longitude")))
     game_entity.name = unicode_str(self.request.get("name"))
     game_entity.game_type = int(self.request.get('type'))
    # game_entity.address = unicode_str(self.request.get('address'))
   #  print self.request.get('address')
   #  game_entity.game_id = self.request.get('id')
     game_entity.update_location()
     game_entity.put()
     
     self.response.out.write(simplejson.dumps({
     "status": "success",
     "name": self.request.get("name"),
     "type": int(self.request.get('type')),
     "latitude":game_entity.location.lat,
     "longitude": game_entity.location.lon,	
     #"address": game_entity.address,
     "savedSuccess":game_entity.is_saved(),
   }))
开发者ID:westinedu,项目名称:handsupmain,代码行数:26,代码来源:service.py

示例6: int

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
#!/usr/bin/env python2

import base64
import sys

import rkit
from django.utils import crypto

from models import Game, Entity, ItemDefinition, Item, Class, Power, Character, Credential, Account, Subscription

rkit.connect("localhost", int(sys.argv[1]) if len(sys.argv) > 1 else 8081)
print "Making test models..."

precursors = Game()
precursors.pk = "precursors"
precursors.name = "Requiem for Innocence: Precursors"
precursors.save()

print "Finished Game."


soldier = Class()
soldier.game = precursors
soldier.name = "Soldier"
soldier.primary_stat = "strength"
soldier.save()

operative = Class()
operative.game = precursors
operative.name = "Operative"
operative.primary_stat = "dexterity"
开发者ID:SkewedAspect,项目名称:precursors-server,代码行数:33,代码来源:load_initial_db.py

示例7: handlefbrequestcallback

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
def handlefbrequestcallback(request):
    fp = open( 'tmp.3.log', 'w' ) 
    print >> fp, request
    request_str   = ( request.GET.get('request') )
    request_to    = ( request.GET.get('to') )
    request_id    = ( request.GET.get('id') )
    request_from  = request.session['fb_id']

    print >> fp, "request id",     request_id
    print >> fp, "request string", request_str
    print >> fp, "request to",     request_to
    print >> fp, "request from",   request_from
    print >> fp, "request fb id",  request.session['fb_id']

    instance = UserSocialAuth.objects.filter(provider='facebook',user=request.user.id).order_by('-id')[0]
    graph   = facebook.GraphAPI(instance.tokens["access_token"])

    try:
        profile = graph.get_object("me")
    except:
        logout(request)
        return HttpResponseRedirect( reverse('lupalo.views.lupalo') ) # Redirect after POST

    try:
    	m_to   = Member.objects.get(fb_id=request_to)
    except: 
	# need to make member    	
        m_to   = Member(fb_id=request_to)

        # play against robot
        if request_to == 'auto':
            m_to.fb_first_name = 'auto'
            m_to.fb_last_name  = 'auto'
	else: 
            profile = graph.get_object( str(request_to) )
            m_to.fb_first_name = profile['first_name']
            m_to.fb_last_name  = profile['last_name']
        m_to.save()

    if m_to.fb_first_name == None or m_to.fb_last_name == None:
        profile = graph.get_object( str(request_to) )
        m_to.fb_first_name = profile['first_name']
        m_to.fb_last_name  = profile['last_name']
        m_to.save()
  
    try: 
        m_from = Member.objects.get(fb_id=request_from)
    except:
	# need to make member    	
        m_from = Member(fb_id=request_from)
        profile = graph.get_object( str(request_from) )
        m_from.fb_first_name = profile['first_name']
        m_from.fb_last_name  = profile['last_name']
        m_from.save() 

    if m_from.fb_first_name == None or m_from.fb_last_name == None:
        profile = graph.get_object( str(request_from) )
        m_from.fb_first_name = profile['first_name']
        m_from.fb_last_name  = profile['last_name']
        m_from.save()

    # name is set
    gamename = "%s_%s_%s" % ( request_from, request_to, time.asctime(time.gmtime()) ) 
    print >> fp, "gamename", gamename
    r = Room(name=gamename)
    r.fb_request_id = request_id
    r.save()

    g = Game(room=r)
    # game name and room name duplicated 
    g.name = gamename
    g.save()

    p = Player(member=m_from)
    p.game=g
    p.turn=0
    p.save()

    # TODO assumes two player game - generalize
    p = Player( member = m_to )
    p.game=g
    p.turn=1
    p.save()

    #return HttpResponseRedirect('requestpage.html')
    return HttpResponseRedirect( reverse('lupalo.views.lupalo') ) # Redirect after POST
开发者ID:cliffmeyer,项目名称:lupalo,代码行数:88,代码来源:views.py

示例8: add_update_game_interact

# 需要导入模块: from models import Game [as 别名]
# 或者: from models.Game import name [as 别名]
def add_update_game_interact(request):
    
    game_id = request.POST.get('game_id')
    name = request.POST.get('name')
    rows = request.POST.get('rows')
    columns = request.POST.get('columns')
    groups_num = request.POST.get('groups_num')
    panels_per_group = request.POST.get('panels_per_group')
    wait_time = request.POST.get('wait_time')
    total_time = request.POST.get('total_time')
    warning_time = request.POST.get('warning_time')
    switch_cost = request.POST.get('switch_cost')
    
    #parse to int
    try:
        rows = int(rows)
        columns = int(columns)
        groups_num = int(groups_num)
        panels_per_group = int(panels_per_group)
        wait_time = int(wait_time)
    except:
        return HttpResponse('Error')

    try:
        game = Game.objects.get(pk = game_id)
    except:
        game = Game()
        game.create_time = datetime.now()
    
    needInitGroupsPanels = True
    if game.rows and game.columns and game.groups_num \
            and game.panels_per_group \
            and game.rows * game.columns==rows*columns \
            and game.groups_num==groups_num and game.panels_per_group==panels_per_group:
        needInitGroupsPanels = False

    game.name = name
    game.rows = rows
    game.columns = columns
    game.groups_num = groups_num
    game.panels_per_group = panels_per_group
    game.wait_time = wait_time
    game.total_time = total_time
    game.warning_time = warning_time
    game.switch_cost = switch_cost
    
    game.save()


    #initial Groups and Panels
    if needInitGroupsPanels:
        Group.objects.filter(game = game).delete()
        for i in range(groups_num):
            group = Group()
            group.game = game
            group.name = "Group %d" % (i+1) 
            group.save()
            for j in range(panels_per_group):
                panel = Panel()
                panel.group = group
                panel.game = game
                panel.name = "Panel %d" % (j+1)
                panel.progress = '0' * rows * columns
                panel.save()



    nextUrl = reverse('mine.views.mine_admin_view')
    return HttpResponseRedirect(nextUrl)
开发者ID:gamblegear,项目名称:djmatt,代码行数:71,代码来源:interact.py


注:本文中的models.Game.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。