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


Python CatalogItemList.remove方法代码示例

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


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

示例1: DistributedFurnitureManagerAI

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

#.........这里部分代码省略.........
        director = self.air.doId2do.get(directorId)
        if directorId and not director:
            self.air.writeServerEvent('suspicious', directorId,
                                      'Tried to move furniture without being on the shard!')
            return

        if self.director:
            self.director.b_setGhostMode(0)
        if director:
            director.b_setGhostMode(1)

        self.director = director
        self.sendUpdate('setDirector', [directorId])

        # Let's also save the furniture to the house (and thus to the DB) while
        # we're at it...
        self.saveToHouse()

    def avatarEnter(self):
        pass

    def avatarExit(self):
        pass


    # Furniture-manipulation:
    def moveItemToAttic(self, doId):
        item = self.getItemObject(doId)

        self.atticItems.append(item.catalogItem)
        self.d_setAtticItems(self.getAtticItems())

        item.destroy()
        self.items.remove(item)

        return ToontownGlobals.FM_MovedItem

    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)

        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())

        item.posHpr = (x, y, z, h, p, r)

        
        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)

        return (ToontownGlobals.FM_MovedItem, do.doId)

    def deleteItemFromAttic(self, blob, index):
        pass

    def deleteItemFromRoom(self, blob, doId):
        pass

    def moveWallpaperFromAttic(self, index, room):
开发者ID:frogtongue,项目名称:tonguefrog,代码行数:70,代码来源:DistributedFurnitureManagerAI.py

示例2: DistributedHouseAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import remove [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

示例3: DistributedHouseAI

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

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

    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()

    def setGardenData(self, gardenData):
        self.gardenData = gardenData

    def d_setGardenData(self, gardenData):
        self.sendUpdate('setGardenData', [gardenData])
开发者ID:NostalgicTTR,项目名称:Toontown-Infinite-2016-Leak,代码行数:69,代码来源:DistributedHouseAI.py

示例4: DistributedFurnitureManagerAI

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

#.........这里部分代码省略.........
        senderId = self.air.getAvatarIdFromSender()
        if self.ownerId != senderId:
            self.air.writeServerEvent('suspicious', avId=senderId, issue='Tried to move furniture, but not the house owner!')
            return
        if senderId != directorId and directorId != 0:
            self.air.writeServerEvent('suspicious', avId=senderId, issue='Tried to make someone else (%d) move their furniture!' % directorId)
            return
        director = self.air.doId2do.get(directorId)
        if directorId and not director:
            self.air.writeServerEvent('suspicious', avId=directorId, issue='Tried to move furniture without being on the shard!')
            return
        if self.director:
            self.director.b_setGhostMode(0)
        if director:
            if director.zoneId != self.zoneId:
                self.air.writeServerEvent('suspicious', avId=directorId, issue='Tried to become director from another zone!')
                return
            director.b_setGhostMode(1)
        self.director = director
        self.sendUpdate('setDirector', [directorId])
        self.saveToHouse()

    def avatarEnter(self):
        pass

    def avatarExit(self):
        pass

    def moveItemToAttic(self, doId):
        item = self.getItemObject(doId)
        self.atticItems.append(item.catalogItem)
        self.d_setAtticItems(self.getAtticItems())
        item.destroy()
        self.items.remove(item)
        return ToontownGlobals.FM_MovedItem

    def moveItemFromAttic(self, index, x, y, z, h, p, r):
        item = self.getAtticFurniture(self.atticItems, index)
        self.atticItems.remove(item)
        self.d_setAtticItems(self.getAtticItems())
        item.posHpr = (x,
         y,
         z,
         h,
         p,
         r)
        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:
            do = DistributedBankAI(self.air, self, item)
        elif item.getFlags() & FLPhone:
            do = DistributedPhoneAI(self.air, self, item)
        else:
            do = DistributedFurnitureItemAI(self.air, self, item)
开发者ID:Toonerz,项目名称:Toontown-World-Online-Leak,代码行数:70,代码来源:DistributedFurnitureManagerAI.py

示例5: DistributedFurnitureManagerAI

# 需要导入模块: from toontown.catalog.CatalogItemList import CatalogItemList [as 别名]
# 或者: from toontown.catalog.CatalogItemList.CatalogItemList import remove [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.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。