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


Python CatalogItemList.append方法代码示例

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


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

示例1: getItems

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]
    def getItems(self):
        items = CatalogItemList(store=CatalogItem.Customization|CatalogItem.Location)

        for item in self.items:
            items.append(item.catalogItem)

        return items.getBlob()
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:9,代码来源:DistributedFurnitureManagerAI.py

示例2: __init__

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]
class DNAFurnitureReaderAI:
    # This object processes the house_interior*.dna files and produces a
    # CatalogItemList representing the furniture in the DNA file. The resulting
    # list is passed to the FurnitureManager in order to initialize a blank
    # house to the default furniture arrangement.
    notify = directNotify.newCategory("DNAFurnitureReaderAI")

    def __init__(self, dnaData, gender, phonePos):
        self.dnaData = dnaData
        self.gender = gender
        self.phonePos = phonePos
        self.itemList = None

    def buildList(self):
        self.itemList = CatalogItemList(store=(CatalogItem.Customization |
                                               CatalogItem.Location))

        # Find the interior node:
        for i in xrange(self.dnaData.getNumChildren()):
            child = self.dnaData.at(i)
            if child.getName() == 'interior':
                interior = child
                break
        else:
            self.notify.error('Could not find "interior" in DNA!')

        self.itemList.append(CatalogFurnitureItem(1399, posHpr=self.phonePos))
        # Every child in the interior node is a prop, thus:
        for i in xrange(interior.getNumChildren()):
            child = interior.at(i)
            code = child.getCode()

            if code not in DNA2Furniture:
                self.notify.warning('Unrecognized furniture code %r!' % code)
                continue

            itemId = DNA2Furniture[code]
            if itemId is None:
                continue
            if hasattr(itemId, '__getitem__'):
                itemId = itemId[self.gender]

            x, y, z = child.getPos()
            h, p, r = child.getHpr()
            self.itemList.append(CatalogFurnitureItem(itemId,
                                                      posHpr=(x, y, z, h, p, r)))

    def getList(self):
        if not self.itemList:
            self.buildList()
        return self.itemList

    def getBlob(self):
        return self.getList().getBlob()
开发者ID:BmanGames,项目名称:ToontownStride,代码行数:56,代码来源:DNAFurnitureReaderAI.py

示例3: setItems

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]
    def setItems(self, items):
        # Decode the blob:
        items = CatalogItemList(items, store=CatalogItem.Customization|CatalogItem.Location)

        # Throw out our old items:
        for item in self.items:
            item.destroy()
        self.items = []

        items.removeDuplicates(FLCloset)

        # Due to a bug, some people are missing their closets...
        hasCloset = False
        for item in items:
            if item.getFlags() & FLCloset:
                hasCloset = True
                break

        if not hasCloset and self.ownerId != 0:
            item = CatalogFurnitureItem(500)  # the basic closet...
            item.posHpr = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
            items.append(item)
            # Since we have modified the items list, should we save it back to the house?

        for item in items:
            if item.getFlags() & FLTrunk:
                if self.house.gender is 0:
                    if item.furnitureType - 4000 < 10:
                        item.furnitureType += 10
                elif item.furnitureType - 4000 > 10:
                    item.furnitureType -= 10
                do = DistributedTrunkAI(self.air, self, item)
            elif item.getFlags() & FLCloset:
                if self.house.gender is 0:
                    if item.furnitureType - 500 < 10:
                        item.furnitureType += 10
                elif item.furnitureType - 500 > 10:
                    item.furnitureType -= 10
                do = DistributedClosetAI(self.air, self, item)
            elif item.getFlags() & FLBank:
                continue # We dont want banks in the estates.
            elif item.getFlags() & FLPhone:
                do = DistributedPhoneAI(self.air, self, item)
            else:
                do = DistributedFurnitureItemAI(self.air, self, item)
            if self.isGenerated():
                do.generateWithRequired(self.zoneId)
            self.items.append(do)
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:50,代码来源:DistributedFurnitureManagerAI.py

示例4: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]
class DistributedFurnitureManagerAI(DistributedObjectAI):
    notify = DirectNotifyGlobal.directNotify.newCategory("DistributedFurnitureManagerAI")

    def __init__(self, air, house, interior):
        DistributedObjectAI.__init__(self, air)

        self.house = house
        self.interior = interior

        self.director = None

        self.ownerId = house.avatarId
        self.ownerName = house.name

        self.atticItems = None
        self.atticWallpaper = None
        self.wallpaper = None
        self.atticWindows = None
        self.windows = None
        self.deletedItems = None

        self.items = []

        # Initialize the above variables:
        self.loadFromHouse()

    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)
        for item in self.items:
            item.generateWithRequired(self.zoneId)

    def loadFromHouse(self):
        self.b_setAtticItems(self.house.getAtticItems())
        self.b_setAtticWallpaper(self.house.getAtticWallpaper())
        self.b_setAtticWindows(self.house.getAtticWindows())
        self.b_setDeletedItems(self.house.getDeletedItems())

        self.wallpaper = CatalogItemList(self.house.getInteriorWallpaper(),
                                         store=CatalogItem.Customization)
        self.applyWallpaper()
        self.windows = CatalogItemList(self.house.getInteriorWindows(),
                                       store=CatalogItem.Customization |
                                             CatalogItem.WindowPlacement)
        self.applyWindows()

        self.setItems(self.house.getInteriorItems())

    def saveToHouse(self):
        self.house.b_setAtticItems(self.getAtticItems())
        self.house.b_setAtticWallpaper(self.getAtticWallpaper())
        self.house.b_setAtticWindows(self.getAtticWindows())
        self.house.b_setDeletedItems(self.getDeletedItems())

        self.house.b_setInteriorWallpaper(self.wallpaper.getBlob())
        self.house.b_setInteriorWindows(self.windows.getBlob())

        self.house.b_setInteriorItems(self.getItems())

    def applyWallpaper(self):
        self.interior.b_setWallpaper(self.wallpaper.getBlob())

    def applyWindows(self):
        self.interior.b_setWindows(self.windows.getBlob())

    def setItems(self, items):
        # Decode the blob:
        items = CatalogItemList(items, store=CatalogItem.Customization|CatalogItem.Location)

        # Throw out our old items:
        for item in self.items:
            item.destroy()
        self.items = []

        for item in items:
            if item.furnitureType in furnitureId2Do:
                do = furnitureId2Do[item.furnitureType](self.air, self, item, self.ownerId)
                if self.isGenerated():
                    do.generateWithRequired(self.zoneId)
                self.items.append(do)
            else:
                do = DistributedFurnitureItemAI(self.air, self, item)
                if self.isGenerated():
                    do.generateWithRequired(self.zoneId)
                self.items.append(do)

    def getItems(self):
        items = CatalogItemList(store=CatalogItem.Customization|CatalogItem.Location)

        for item in self.items:
            items.append(item.catalogItem)

        return items.getBlob()

    def setOwnerId(self, ownerId):
        self.ownerId = ownerId

    def d_setOwnerId(self, ownerId):
        self.sendUpdate('setOwnerId', [ownerId])

    def b_setOwnerId(self, ownerId):
#.........这里部分代码省略.........
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:103,代码来源:DistributedFurnitureManagerAI.py

示例5: DistributedHouseAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]

#.........这里部分代码省略.........
    def getInteriorWallpaper(self):
        return self.interiorWallpaper.getBlob()

    def setAtticWindows(self, atticWindows):
        self.atticWindows = CatalogItemList(atticWindows, store=Customization)

    def d_setAtticWindows(self, atticWindows):
        self.sendUpdate('setAtticWindows', [atticWindows])

    def b_setAtticWindows(self, atticWindows):
        self.setAtticWindows(atticWindows)
        self.d_setAtticWindows(atticWindows)

    def getAtticWindows(self):
        return self.atticWindows.getBlob()

    def setInteriorWindows(self, interiorWindows):
        self.interiorWindows = CatalogItemList(interiorWindows, store=Customization | WindowPlacement)

    def d_setInteriorWindows(self, interiorWindows):
        self.sendUpdate('setInteriorWindows', [interiorWindows])

    def b_setInteriorWindows(self, interiorWindows):
        self.setInteriorWindows(interiorWindows)
        self.d_setInteriorWindows(interiorWindows)

    def getInteriorWindows(self):
        return self.interiorWindows.getBlob()

    def setDeletedItems(self, deletedItems):
        self.deletedItems = CatalogItemList(deletedItems, store=Customization)

    def d_setDeletedItems(self, deletedItems):
        self.sendUpdate('setDeletedItems', [deletedItems])

    def b_setDeletedItems(self, deletedItems):
        self.setDeletedItems(deletedItems)
        self.d_setDeletedItems(deletedItems)

    def getDeletedItems(self):
        return self.deletedItems.getBlob()

    def setInteriorInitialized(self, initialized):
        self.isInteriorInitialized = initialized

    def d_setInteriorInitialized(self, initialized):
        self.sendUpdate('setInteriorInitialized', [initialized])

    def b_setInteriorInitialized(self, initialized):
        self.setInteriorInitialized(initialized)
        self.d_setInteriorInitialized(initialized)

    def getInteriorInitialized(self):
        return self.isInteriorInitialized

    def setCannonEnabled(self, todo0):
        pass

    def getCannonEnabled(self):
        return 0

    def setHouseReady(self):
        pass

    def addAtticItem(self, item):
        self.interior.furnitureManager.saveToHouse()
        if item.getFlags() & FLTrunk:
            self.atticItems.append(item)
        elif item.replacesExisting() and item.hasExisting():
            if item.getFlags() & FLCloset:
                closets = ClosetToClothes.keys()
                for itItem in self.interiorItems:
                    if itItem.furnitureType in closets:
                        posHpr = itItem.posHpr
                        self.interiorItems.remove(itItem)
                        item.posHpr = posHpr
                        self.interiorItems.append(item)
                        break
                for itItem in self.atticItems:
                    if itItem.furnitureType in closets:
                        self.atticItems.remove(itItem)
                        self.atticItems.append(item)
                        break
        else:
            self.atticItems.append(item)
        self.d_setAtticItems(self.atticItems.getBlob())
        self.d_setInteriorItems(self.interiorItems.getBlob())
        self.interior.furnitureManager.loadFromHouse()

    def addWindow(self, item):
        self.interior.furnitureManager.saveToHouse()
        self.atticWindows.append(item)
        self.d_setAtticWindows(self.atticWindows.getBlob())
        self.interior.furnitureManager.loadFromHouse()

    def addWallpaper(self, item):
        self.interior.furnitureManager.saveToHouse()
        self.atticWallpaper.append(item)
        self.d_setAtticWallpaper(self.atticWallpaper.getBlob())
        self.interior.furnitureManager.loadFromHouse()
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:104,代码来源:DistributedHouseAI.py

示例6: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]
class DistributedFurnitureManagerAI(DistributedObjectAI):
    notify = DirectNotifyGlobal.directNotify.newCategory('DistributedFurnitureManagerAI')

    def __init__(self, air, house, interior):
        DistributedObjectAI.__init__(self, air)
        self.house = house
        self.interior = interior
        self.director = None
        self.ownerId = house.avatarId
        self.ownerName = house.name
        self.avId = None
        self.atticItems = None
        self.atticWallpaper = None
        self.wallpaper = None
        self.atticWindows = None
        self.windows = None
        self.deletedItems = None
        self.items = []
        self.loadFromHouse()

    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)
        for item in self.items:
            item.generateWithRequired(self.zoneId)

    def delete(self):
        for item in self.items:
            item.destroy()

        DistributedObjectAI.delete(self)

    def loadFromHouse(self):
        self.b_setAtticItems(self.house.getAtticItems())
        self.b_setAtticWallpaper(self.house.getAtticWallpaper())
        self.b_setAtticWindows(self.house.getAtticWindows())
        self.b_setDeletedItems(self.house.getDeletedItems())
        self.wallpaper = CatalogItemList(self.house.getInteriorWallpaper(), store=CatalogItem.Customization)
        self.applyWallpaper()
        self.windows = CatalogItemList(self.house.getInteriorWindows(), store=CatalogItem.Customization | CatalogItem.WindowPlacement)
        self.applyWindows()
        self.setItems(self.house.getInteriorItems())

    def saveToHouse(self):
        self.house.b_setAtticItems(self.getAtticItems())
        self.house.b_setAtticWallpaper(self.getAtticWallpaper())
        self.house.b_setAtticWindows(self.getAtticWindows())
        self.house.b_setDeletedItems(self.getDeletedItems())
        self.house.b_setInteriorWallpaper(self.wallpaper.getBlob())
        self.house.b_setInteriorWindows(self.windows.getBlob())
        self.house.b_setInteriorItems(self.getItems())

    def applyWallpaper(self):
        self.interior.b_setWallpaper(self.wallpaper.getBlob())

    def applyWindows(self):
        self.interior.b_setWindows(self.windows.getBlob())

    def setItems(self, items):
        items = CatalogItemList(items, store=CatalogItem.Customization | CatalogItem.Location)
        for item in self.items:
            item.destroy()

        self.items = []
        for item in items:
            if item.getHashContents() in (1300, 1310, 1320, 1330, 1340, 1350):
                do = DistributedBankAI(self.air, self, item)
            elif 500 <= item.getHashContents() <= 518:
                do = DistributedClosetAI(self.air, self, item)
                do.setOwnerId(self.avId)
            elif item.getHashContents() == 1399:
                do = DistributedPhoneAI(self.air, self, item)
            elif item.getHashContents() in (4000, 4010):
                do = DistributedTrunkAI(self.air, self, item)
                do.setOwnerId(self.avId)
            else:
                do = DistributedFurnitureItemAI(self.air, self, item)
            if self.isGenerated():
                do.generateWithRequired(self.zoneId)
            self.items.append(do)

    def getItems(self):
        items = CatalogItemList(store=CatalogItem.Customization | CatalogItem.Location)
        for item in self.items:
            items.append(item.catalogItem)

        return items.getBlob()

    def setOwnerId(self, ownerId):
        self.ownerId = ownerId

    def d_setOwnerId(self, ownerId):
        self.sendUpdate('setOwnerId', [ownerId])

    def b_setOwnerId(self, ownerId):
        self.setOwnerId(ownerId)
        self.d_setOwnerId(ownerId)

    def getOwnerId(self):
        return self.ownerId

#.........这里部分代码省略.........
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:103,代码来源:DistributedFurnitureManagerAI.py

示例7: DistributedHouseAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]

#.........这里部分代码省略.........

    def b_setDeletedItems(self, deletedItems):
        self.setDeletedItems(deletedItems)
        self.d_setDeletedItems(deletedItems)

    def getDeletedItems(self):
        return self.deletedItems.getBlob()

    def setInteriorInitialized(self, initialized):
        self.isInteriorInitialized = initialized

    def d_setInteriorInitialized(self, initialized):
        self.sendUpdate('setInteriorInitialized', [initialized])

    def b_setInteriorInitialized(self, initialized):
        self.setInteriorInitialized(initialized)
        self.d_setInteriorInitialized(initialized)

    def getInteriorInitialized(self):
        return self.isInteriorInitialized

    def setCannonEnabled(self, todo0):
        pass

    def getCannonEnabled(self):
        return 0

    def setHouseReady(self):
        pass

    def addAtticItem(self, item):
        self.interior.furnitureManager.saveToHouse()
        if item.getFlags() & FLTrunk:
            self.atticItems.append(item)
        elif item.replacesExisting() and item.hasExisting():
            if item.getFlags() & FLCloset:
                closets = ClosetToClothes.keys()
                for itItem in self.interiorItems:
                    if itItem.furnitureType in closets:
                        posHpr = itItem.posHpr
                        self.interiorItems.remove(itItem)
                        item.posHpr = posHpr
                        self.interiorItems.append(item)
                        break
                for itItem in self.atticItems:
                    if itItem.furnitureType in closets:
                        self.atticItems.remove(itItem)
                        self.atticItems.append(item)
                        break
        else:
            self.atticItems.append(item)
        self.d_setAtticItems(self.atticItems.getBlob())
        self.d_setInteriorItems(self.interiorItems.getBlob())
        self.interior.furnitureManager.loadFromHouse()

    def addWindow(self, item):
        self.interior.furnitureManager.saveToHouse()
        self.atticWindows.append(item)
        self.d_setAtticWindows(self.atticWindows.getBlob())
        self.interior.furnitureManager.loadFromHouse()

    def addWallpaper(self, item):
        self.interior.furnitureManager.saveToHouse()
        self.atticWallpaper.append(item)
        self.d_setAtticWallpaper(self.atticWallpaper.getBlob())
        self.interior.furnitureManager.loadFromHouse()
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:70,代码来源:DistributedHouseAI.py

示例8: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import append [as 别名]
class DistributedFurnitureManagerAI(DistributedObjectAI):
    notify = directNotify.newCategory("DistributedFurnitureManagerAI")

    def __init__(self, air, house, interior):
        DistributedObjectAI.__init__(self, air)

        self.house = house
        self.interior = interior

        self.director = None

        self.ownerId = house.avatarId
        self.ownerName = house.name

        self.atticItems = None
        self.atticWallpaper = None
        self.wallpaper = None
        self.atticWindows = None
        self.windows = None
        self.deletedItems = None

        self.items = []

        # Initialize the above variables:
        self.loadFromHouse()

    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)

        for item in self.items:
            item.generateWithRequired(self.zoneId)

    def delete(self):
        for item in self.items:
            item.destroy()

        DistributedObjectAI.delete(self)

    def loadFromHouse(self):
        self.b_setAtticItems(self.house.getAtticItems())
        self.b_setAtticWallpaper(self.house.getAtticWallpaper())
        self.b_setAtticWindows(self.house.getAtticWindows())
        self.b_setDeletedItems(self.house.getDeletedItems())

        self.wallpaper = CatalogItemList(self.house.getInteriorWallpaper(),
                                         store=CatalogItem.Customization)
        self.applyWallpaper()
        self.windows = CatalogItemList(self.house.getInteriorWindows(),
                                       store=CatalogItem.Customization |
                                             CatalogItem.WindowPlacement)
        self.applyWindows()

        self.setItems(self.house.getInteriorItems())

    def saveToHouse(self):
        self.house.b_setAtticItems(self.getAtticItems())
        self.house.b_setAtticWallpaper(self.getAtticWallpaper())
        self.house.b_setAtticWindows(self.getAtticWindows())
        self.house.b_setDeletedItems(self.getDeletedItems())

        self.house.b_setInteriorWallpaper(self.wallpaper.getBlob())
        self.house.b_setInteriorWindows(self.windows.getBlob())

        self.house.b_setInteriorItems(self.getItems())

    def applyWallpaper(self):
        self.interior.b_setWallpaper(self.wallpaper.getBlob())

    def applyWindows(self):
        self.interior.b_setWindows(self.windows.getBlob())

    def setItems(self, items):
        # Decode the blob:
        items = CatalogItemList(items, store=CatalogItem.Customization|CatalogItem.Location)

        # Throw out our old items:
        for item in self.items:
            item.destroy()
        self.items = []

        items.removeDuplicates(FLCloset)

        # Due to a bug, some people are missing their closets...
        hasCloset = False
        for item in items:
            if item.getFlags() & FLCloset:
                hasCloset = True
                break

        if not hasCloset:
            item = CatalogFurnitureItem(500)  # the basic closet...
            item.posHpr = (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
            items.append(item)
            # Since we have modified the items list, should we save it back to the house?

        for item in items:
            if item.getFlags() & FLTrunk:
                if self.house.gender is 0:
                    if item.furnitureType - 4000 < 10:
                        item.furnitureType += 10
#.........这里部分代码省略.........
开发者ID:swingmaster66,项目名称:LimitNetworkTT-1.4.6,代码行数:103,代码来源:DistributedFurnitureManagerAI.py


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