示例#1
0
文件: Game.py 项目: rlugojr/dope_wars
 def getTradeOptions(self):
     code = 0
     options = []
     location = self.getLocation()
     for product in location.market:
         option = {
             'code': str(code),
             'description': 'buy {0}'.format(product['name']),
             'callback': self.getPurchaseClosure(product)
         }
         options.append(option)
         code += 1
     for product in self.inventory.items:
         option = {
             'code': str(code),
             'description': 'sell {0}'.format(product['name']),
             'callback': self.getSaleClosure(product)
         }
         options.append(option)
         code += 1
     options.append({
         'code': 'm',
         'description': 'check out a different area',
         'callback': self.travel
     })
     options.append({
         'code': 'q',
         'description': 'quit',
         'callback': self.exit
     })
     ask('Would you like to trade?', options)
示例#2
0
文件: Game.py 项目: rlugojr/dope_wars
	def travel(self):
		code = 0
		options = []
		for location in self.locations:
			if location is self.getLocation():
				continue
			option = {'code': str(code), 'description':location.name, 'callback':self.getMovementClosure(location)}
			options.append(option)
			code += 1
		options.append({'code':'q', 'description':'quit', 'callback':self.exit})
		ask('Where would you like to go?', options)
示例#3
0
文件: Game.py 项目: rlugojr/dope_wars
	def getTradeOptions(self):
		code = 0
		options = []
		location = self.getLocation()
		for product in location.market:
			option = {'code': str(code), 'description':'buy {0}'.format(product['name']), 'callback':self.getPurchaseClosure(product)}
			options.append(option)
			code += 1
		for product in self.inventory.items:
			option = {'code': str(code), 'description':'sell {0}'.format(product['name']), 'callback':self.getSaleClosure(product)}
			options.append(option)
			code += 1
		options.append({'code':'m', 'description':'check out a different area', 'callback':self.travel})
		options.append({'code':'q', 'description':'quit', 'callback':self.exit})
		ask('Would you like to trade?', options)
示例#4
0
文件: Game.py 项目: rlugojr/dope_wars
 def travel(self):
     code = 0
     options = []
     for location in self.locations:
         if location is self.getLocation():
             continue
         option = {
             'code': str(code),
             'description': location.name,
             'callback': self.getMovementClosure(location)
         }
         options.append(option)
         code += 1
     options.append({
         'code': 'q',
         'description': 'quit',
         'callback': self.exit
     })
     ask('Where would you like to go?', options)