• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python CatalogItemList.CatalogItemList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getItems

    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,代码行数:7,代码来源:DistributedFurnitureManagerAI.py


示例2: loadFromHouse

 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())
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:10,代码来源:DistributedFurnitureManagerAI.py


示例3: __init__

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,代码行数:54,代码来源:DNAFurnitureReaderAI.py


示例4: setItems

    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,代码行数:48,代码来源:DistributedFurnitureManagerAI.py


示例5: buildList

    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

            x, y, z = child.getPos()
            h, p, r = child.getHpr()
            self.itemList.append(CatalogFurnitureItem(itemId,
                                                      posHpr=(x, y, z, h, p, r)))
开发者ID:Teku16,项目名称:Toontown-Crystal-Master,代码行数:31,代码来源:DNAFurnitureReaderAI.py


示例6: __init__

 def __init__(self, air):
     DistributedObjectAI.__init__(self, air)
     self.houseType = 0
     self.gardenPos = 0
     self.avatarId = 0
     self.name = ''
     self.color = 0
     self.housePos = 0
     self.gender = 1
     self.isInteriorInitialized = 1
     self.atticItems = CatalogItemList(store=Customization)
     self.interiorItems = CatalogItemList(store=Customization)
     self.interiorWallpaper = CatalogItemList(store=Customization)
     self.atticWallpaper = CatalogItemList(store=Customization)
     self.interiorWindows = CatalogItemList(store=Customization)
     self.atticWindows = CatalogItemList(store=Customization)
     self.deletedItems = CatalogItemList(store=Customization)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:17,代码来源:DistributedHouseAI.py


示例7: __init__

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

        self.houseType = 0
        self.gardenPos = 0
        self.avatarId = 0
        self.name = ""
        self.color = 0
        self.housePos = 0
        self.gender = 1
        self.isInteriorInitialized = 1  # Only fresh DB houses are not inited.

        # FIXME: Now I think I did this wrong...
        self.atticItems = CatalogItemList(store=Customization)
        self.interiorItems = CatalogItemList(store=Customization)
        self.interiorWallpaper = CatalogItemList(store=Customization)
        self.atticWallpaper = CatalogItemList(store=Customization)
        self.interiorWindows = CatalogItemList(store=Customization)
        self.atticWindows = CatalogItemList(store=Customization)
        self.deletedItems = CatalogItemList(store=Customization)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leaked-Source,代码行数:20,代码来源:DistributedHouseAI.py


示例8: setInteriorWindows

 def setInteriorWindows(self, interiorWindows):
     self.interiorWindows = CatalogItemList(interiorWindows, store=Customization | WindowPlacement)
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:2,代码来源:DistributedHouseAI.py


示例9: setAtticWindows

 def setAtticWindows(self, atticWindows):
     self.atticWindows = CatalogItemList(atticWindows, store=Customization)
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:2,代码来源:DistributedHouseAI.py


示例10: setInteriorWallpaper

 def setInteriorWallpaper(self, interiorWallpaper):
     self.interiorWallpaper = CatalogItemList(interiorWallpaper, store=Customization)
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:2,代码来源:DistributedHouseAI.py


示例11: setAtticWallpaper

 def setAtticWallpaper(self, atticWallpaper):
     self.atticWallpaper = CatalogItemList(atticWallpaper, store=Customization)
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:2,代码来源:DistributedHouseAI.py


示例12: setInteriorItems

 def setInteriorItems(self, interiorItems):
     self.interiorItems = CatalogItemList(interiorItems, store=Customization | Location)
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:2,代码来源:DistributedHouseAI.py


示例13: DistributedFurnitureManagerAI

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,代码行数:101,代码来源:DistributedFurnitureManagerAI.py


示例14: setDeletedItems

 def setDeletedItems(self, items):
     self.deletedItems = CatalogItemList(items, store=CatalogItem.Customization)
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:2,代码来源:DistributedFurnitureManagerAI.py


示例15: setAtticWallpaper

 def setAtticWallpaper(self, items):
     self.atticWallpaper = CatalogItemList(items, store=CatalogItem.Customization)
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:2,代码来源:DistributedFurnitureManagerAI.py


示例16: DistributedFurnitureManagerAI

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,代码行数:101,代码来源:DistributedFurnitureManagerAI.py


示例17: DistributedHouseAI

class DistributedHouseAI(DistributedObjectAI):
    notify = directNotify.newCategory('DistributedHouseAI')

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

        self.houseType = 0
        self.gardenPos = 0
        self.avatarId = 0
        self.name = ''
        self.color = 0
        self.housePos = 0
        self.gender = 1
        self.isInteriorInitialized = 1
        self.gardenManager = None
        self.gardenData = ''

        self.atticItems = CatalogItemList(store=Customization)
        self.interiorItems = CatalogItemList(store=Customization)
        self.interiorWallpaper = CatalogItemList(store=Customization)
        self.atticWallpaper = CatalogItemList(store=Customization)
        self.interiorWindows = CatalogItemList(store=Customization)
        self.atticWindows = CatalogItemList(store=Customization)
        self.deletedItems = CatalogItemList(store=Customization)

    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)
        self.interiorZone = self.air.allocateZone()

        self.door = DistributedHouseDoorAI(self.air, self.getDoId(), DoorTypes.EXT_STANDARD)
        self.door.setSwing(3)
        self.door.generateWithRequired(self.zoneId)

        self.interiorDoor = DistributedHouseDoorAI(self.air, self.getDoId(), DoorTypes.INT_STANDARD)
        self.interiorDoor.setSwing(3)
        self.interiorDoor.setOtherDoor(self.door)
        self.interiorDoor.generateWithRequired(self.interiorZone)

        self.door.setOtherDoor(self.interiorDoor)

        self.interior = DistributedHouseInteriorAI(self.air, self)
        self.interior.setHouseIndex(self.housePos)
        self.interior.setHouseId(self.getDoId())
        self.interior.generateWithRequired(self.interiorZone)

        if self.avatarId:
            self.mailbox = DistributedMailboxAI(self.air, self)
            self.mailbox.generateWithRequired(self.zoneId)

        if config.GetBool('want-gardening', False):
            self.createGardenManager()

        if not self.isInteriorInitialized:
            self.notify.info('Initializing interior...')
            self.interior.initialize()
            self.b_setInteriorInitialized(1)

        self.sendUpdate('setHouseReady', [])

    def delete(self):
        self.door.requestDelete()
        self.interiorDoor.requestDelete()
        self.interior.requestDelete()

        if self.avatarId:
            self.mailbox.requestDelete()

        if self.gardenManager is not None:
            self.gardenManager.delete()

        self.air.deallocateZone(self.interiorZone)
        DistributedObjectAI.delete(self)

    def setHousePos(self, pos):
        self.housePos = pos

    def d_setHousePos(self, pos):
        self.sendUpdate('setHousePos', [pos])

    def b_setHousePos(self, pos):
        self.setHousePos(pos)
        self.d_setHousePos(pos)

    def getHousePos(self):
        return self.housePos

    def setHouseType(self, type):
        self.houseType = type

    def d_setHouseType(self, type):
        self.sendUpdate('setHouseType', [type])

    def b_setHouseType(self, type):
        self.setHouseType(type)
        self.d_setHouseType(type)

    def getHouseType(self):
        return self.houseType

    def setGardenPos(self, pos):
#.........这里部分代码省略.........
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:101,代码来源:DistributedHouseAI.py


示例18: setAtticWindows

 def setAtticWindows(self, items):
     self.atticWindows = CatalogItemList(items, store=CatalogItem.Customization)
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:2,代码来源:DistributedFurnitureManagerAI.py


示例19: DistributedHouseAI

class DistributedHouseAI(DistributedObjectAI):
    notify = directNotify.newCategory("DistributedHouseAI")

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

        self.houseType = 0
        self.gardenPos = 0
        self.avatarId = 0
        self.name = ''
        self.color = 0
        self.housePos = 0
        self.gender = 1
        self.isInteriorInitialized = 1

        self.atticItems = CatalogItemList(store=Customization)
        self.interiorItems = CatalogItemList(store=Customization)
        self.interiorWallpaper = CatalogItemList(store=Customization)
        self.atticWallpaper = CatalogItemList(store=Customization)
        self.interiorWindows = CatalogItemList(store=Customization)
        self.atticWindows = CatalogItemList(store=Customization)
        self.deletedItems = CatalogItemList(store=Customization)

    def announceGenerate(self):
        DistributedObjectAI.announceGenerate(self)
        self.interiorZone = self.air.allocateZone()

        self.door = DistributedHouseDoorAI(self.air, self.getDoId(), DoorTypes.EXT_STANDARD)
        self.door.setSwing(3)
        self.door.generateWithRequired(self.zoneId)

        self.interiorDoor = DistributedHouseDoorAI(self.air, self.getDoId(), DoorTypes.INT_STANDARD)
        self.interiorDoor.setSwing(3)
        self.interiorDoor.setOtherDoor(self.door)
        self.interiorDoor.generateWithRequired(self.interiorZone)

        self.door.setOtherDoor(self.interiorDoor)

        self.interior = DistributedHouseInteriorAI(self.air, self)
        self.interior.setHouseIndex(self.housePos)
        self.interior.setHouseId(self.getDoId())
        self.interior.generateWithRequired(self.interiorZone)

        if self.avatarId:
            self.mailbox = DistributedMailboxAI(self.air, self)
            self.mailbox.generateWithRequired(self.zoneId)

        if not self.isInteriorInitialized:
            self.notify.info('Initializing interior...')
            self.interior.initialize()
            self.b_setInteriorInitialized(1)

        self.sendUpdate('setHouseReady', [])


    def delete(self):
        self.door.requestDelete()
        self.interiorDoor.requestDelete()
        self.interior.requestDelete()
        if self.avatarId:
            self.mailbox.requestDelete()
        self.air.deallocateZone(self.interiorZone)
        DistributedObjectAI.delete(self)

    def setHousePos(self, pos):
        self.housePos = pos

    def d_setHousePos(self, pos):
        self.sendUpdate('setHousePos', [pos])

    def b_setHousePos(self, pos):
        self.setHousePos(pos)
        self.d_setHousePos(pos)

    def getHousePos(self):
        return self.housePos

    def setHouseType(self, type):
        self.houseType = type

    def d_setHouseType(self, type):
        self.sendUpdate('setHouseType', [type])

    def b_setHouseType(self, type):
        self.setHouseType(type)
        self.d_setHouseType(type)

    def getHouseType(self):
        return self.houseType

    def setGardenPos(self, pos):
        self.gardenPos = pos

    def d_setGardenPos(self, pos):
        self.sendUpdate('setGardenPos', [pos])

    def b_setGardenPos(self, pos):
        self.setGardenPow(pos)
        self.d_setGardenPos(pos)

#.........这里部分代码省略.........
开发者ID:CalmBit,项目名称:ToonboxSource,代码行数:101,代码来源:DistributedHouseAI.py


示例20: DistributedFurnitureManagerAI

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,代码行数:101,代码来源:DistributedFurnitureManagerAI.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python chat.ResistanceChat类代码示例发布时间:2022-05-27
下一篇:
Python building.ElevatorUtils类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap