本文整理汇总了Python中Item类的典型用法代码示例。如果您正苦于以下问题:Python Item类的具体用法?Python Item怎么用?Python Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: newlevel
def newlevel(level):
background.blit(backimg, (0,0))
nums.empty()
ops.empty()
doors.empty()
global player
count = 0
try:
levfile = open(os.path.join("levels", "level%d.txt"%(level)))
data = [line.strip() for line in levfile]
Item.setlevel(data, charset)
for y, row in enumerate(data[:12]):
for x, cell in enumerate(row):
if cell != 'w':
cell = '.'
background.blit(images[cell], (32*x+48, 32*y+64))
for y, row in enumerate(data[:12]):
for x, cell in enumerate(row):
if cell == '-' or cell == '*' or cell == '/' or cell == '2' or cell == 's':
ops.add(Item.Op((x, y), cell, images[cell]))
elif cell == 'p':
player = Player.Player((x, y), data, images['p'])
elif cell == 'd':
doors.add(Item.Door((x, y), images['d']))
elif cell == '#':
nums.add(Item.Num((x, y), int(data[12+count]), images['#']))
count += 1
return 1
except IOError:
return 0
示例2: _createRootList
def _createRootList(self):
"""
Create and return the root list (all type available)
Returns list and name of the list
"""
list = []
listTitle = _( 10 )
# List the main categorie at the root level
for cat in self.racineDisplayList:
item = {}
#item['id'] = ""
item['name'] = Item.get_type_title( cat )
#item['parent'] = self.type
item['downloadurl'] = None
item['type'] = 'CAT'
item['xbmc_type'] = cat
item['cattype'] = cat
item['previewpictureurl'] = None
item['description'] = Item.get_type_title( cat )
item['language'] = ""
item['version'] = ""
item['author'] = ""
item['date'] = ""
item['added'] = ""
item['thumbnail'] = Item.get_thumb( cat )
item['previewpicture'] = ""#Item.get_thumb( cat )
item['image2retrieve'] = False # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)
list.append(item)
print item
return listTitle, list
示例3: _createScraperList
def _createScraperList(self):
"""
Create and return the list of scraper types
Returns list and name of the list
"""
list = []
listTitle = Item.get_type_title(Item.TYPE_SCRAPER)
# List all the type of plugins
for cat in self.scraperDisplayList:
item = {}
item["name"] = Item.get_type_title(cat)
item["downloadurl"] = None
item["type"] = "CAT"
item["xbmc_type"] = cat
item["previewpictureurl"] = None
item["description"] = Item.get_type_title(cat)
item["language"] = ""
item["version"] = ""
item["author"] = ""
item["date"] = ""
item["added"] = ""
item["thumbnail"] = Item.get_thumb(cat)
item["previewpicture"] = "" # Item.get_thumb( cat )
item[
"image2retrieve"
] = (
False
) # Temporary patch for reseting the flag after download (would be better in the thread in charge of the download)
list.append(item)
print item
return listTitle, list
示例4: huirCueva
def huirCueva():
events.addEvent('cuerda')
addItem(world, 'cuerda')
events.addEvent('madera')
addItem(world, 'madera')
Item.addNextFood(world)
Item.addNextFood(world)
示例5: add_armor
def add_armor(self, Item, Hero):
if not self.armory:
self.armory.append(Item)
# self.remove_item(Item)
Item.use(Hero)
else:
return False
示例6: ropeYes
def ropeYes():
log.add_event("Es una cuerda! Que suerte tengo")
c = Item.create("cuerda")
inv.addItem(c)
removeItem(world, "cuerda")
if not (inv.getItem(Item.getItemId("madera")) is None):
Story.addItem(self.world, "balsa")
示例7: woodYes
def woodYes():
log.add_event("Esto me servira para muchas cosas...")
c = Item.create("madera")
inv.addItem(c)
removeItem(world, "madera")
if not (inv.getItem(Item.getItemId("cuerda")) is None):
Story.addItem(self.world, "balsa")
示例8: balsaFunY
def balsaFunY():
log.add_event("No tengo nada mejor que hacer con estos recursos, mejor los uso")
events.addEvent('final_balsa')
c = Item.create('balsa')
inv.addItem(c)
inv.deleteItem(Item.create('madera'))
inv.deleteItem(Item.create('cuerda'))
inv.clean()
removeItem(world, 'balsa')
示例9: generate_items
def generate_items(self):
global ITEMS
global NUM_ITEMS
ind = randint(0, NUM_ITEMS-1)
newitem = Item(self, ITEMS[ind])
initial_y = randint(0, 240)
initial_y -= 120
newitem.move_pos(y = initial_y)
self.item_list.append(newitem)
示例10: jabali2FunY
def jabali2FunY():
log.add_event("Mas alimento me ayudara a sobrevivir")
c = Item.create('comida')
inv.addItem(c)
inv.addItem(c)
inv.clean()
events.addEvent('dead_man')
addItem(world, 'dead_man')
addItem(world, 'm_jabali')
removeItem(world, 'b_jabali')
Item.removeItem('b_jabali')
示例11: getChildren
def getChildren(self):
sublist=[]
for n in self.node.getSetOfInputPort():
sublist.append(Item.adapt(n))
for n in self.node.getSetOfOutputPort():
sublist.append(Item.adapt(n))
for n in self.node.getSetOfInputDataStreamPort():
sublist.append(Item.adapt(n))
for n in self.node.getSetOfOutputDataStreamPort():
sublist.append(Item.adapt(n))
return sublist
示例12: jabaliFunY
def jabaliFunY():
log.add_event("Su alimento me ayudara a sobrevivir")
c = Item.create('comida')
inv.addItem(c)
inv.addItem(c)
inv.clean()
removeItem(world, 'b_jabali')
Item.removeItem('b_jabali')
Item.addItem('b_jabali', 78, 154, '/')
addItem(world, 'b_jabali')
示例13: boarYes
def boarYes():
if inv.getItem(Item.getItemId("cuchillo")) is None:
# TODO Killed
log.add_event("Esto fue demasiado para mi....", 197)
self.info.gameOver()
else:
log.add_event("Por fin murio...")
c = Item.create("comida")
inv.addItem(c)
inv.addItem(c)
inv.addItem(c)
removeItem(world, "m_jabali")
示例14: jabaliMFunY
def jabaliMFunY():
if(inv.getItem(Item.getItemId('cuchillo')) is None):
log.add_event("Esto fue demasiado para mi....", 197)
info.gameOver()
else:
log.add_event("Eso fue facil... creo")
c = Item.create('comida')
inv.addItem(c)
inv.addItem(c)
inv.clean()
removeItem(world, 'm_jabali')
Item.removeItem('m_jabali')
示例15: addNode
def addNode(self,service):
new_node=service.clone(None)
ItemComposedNode.n=ItemComposedNode.n+1
name=service.getName()+"_%d" % ItemComposedNode.n
new_node.setName(name)
#replace the old node (if it exists) with the new one
nodes=self.node.edGetDirectDescendants()
if nodes:
old_item=Item.adapt(nodes[0])
CONNECTOR.Emit(old_item,"remove")
self.node.edSetNode(new_node)
item=Item.adapt(new_node)
CONNECTOR.Emit(self,"add",item)
CONNECTOR.Emit(self,"changed")