本文整理汇总了Python中otp.nametag.NametagGroup.NametagGroup.setObjectCode方法的典型用法代码示例。如果您正苦于以下问题:Python NametagGroup.setObjectCode方法的具体用法?Python NametagGroup.setObjectCode怎么用?Python NametagGroup.setObjectCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类otp.nametag.NametagGroup.NametagGroup
的用法示例。
在下文中一共展示了NametagGroup.setObjectCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DistributedDoor
# 需要导入模块: from otp.nametag.NametagGroup import NametagGroup [as 别名]
# 或者: from otp.nametag.NametagGroup.NametagGroup import setObjectCode [as 别名]
class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable):
deferFor = 1
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
self.openSfx = base.loadSfx('phase_3.5/audio/sfx/Door_Open_1.ogg')
self.closeSfx = base.loadSfx('phase_3.5/audio/sfx/Door_Close_1.ogg')
self.nametag = None
self.fsm = ClassicFSM.ClassicFSM('DistributedDoor_right', [State.State('off', self.enterOff, self.exitOff, ['closing',
'closed',
'opening',
'open']),
State.State('closing', self.enterClosing, self.exitClosing, ['closed', 'opening']),
State.State('closed', self.enterClosed, self.exitClosed, ['opening']),
State.State('opening', self.enterOpening, self.exitOpening, ['open']),
State.State('open', self.enterOpen, self.exitOpen, ['closing', 'open'])], 'off', 'off')
self.fsm.enterInitialState()
self.exitDoorFSM = ClassicFSM.ClassicFSM('DistributedDoor_left', [State.State('off', self.exitDoorEnterOff, self.exitDoorExitOff, ['closing',
'closed',
'opening',
'open']),
State.State('closing', self.exitDoorEnterClosing, self.exitDoorExitClosing, ['closed', 'opening']),
State.State('closed', self.exitDoorEnterClosed, self.exitDoorExitClosed, ['opening']),
State.State('opening', self.exitDoorEnterOpening, self.exitDoorExitOpening, ['open']),
State.State('open', self.exitDoorEnterOpen, self.exitDoorExitOpen, ['closing', 'open'])], 'off', 'off')
self.exitDoorFSM.enterInitialState()
self.specialDoorTypes = {DoorTypes.EXT_HQ: 0,
DoorTypes.EXT_COGHQ: 0,
DoorTypes.INT_COGHQ: 0,
DoorTypes.EXT_KS: 0,
DoorTypes.INT_KS: 0}
self.doorX = 1.5
return
def generate(self):
DistributedObject.DistributedObject.generate(self)
self.avatarTracks = []
self.avatarExitTracks = []
self.avatarIDList = []
self.avatarExitIDList = []
self.doorTrack = None
self.doorExitTrack = None
return
def disable(self):
self.clearNametag()
taskMgr.remove(self.checkIsDoorHitTaskName())
self.ignore(self.getEnterTriggerEvent())
self.ignore(self.getExitTriggerEvent())
self.ignore('clearOutToonInterior')
self.fsm.request('off')
self.exitDoorFSM.request('off')
if self.__dict__.has_key('building'):
del self.building
self.finishAllTracks()
self.avatarIDList = []
self.avatarExitIDList = []
if hasattr(self, 'tempDoorNodePath'):
self.tempDoorNodePath.removeNode()
del self.tempDoorNodePath
DistributedObject.DistributedObject.disable(self)
def delete(self):
del self.fsm
del self.exitDoorFSM
del self.openSfx
del self.closeSfx
DistributedObject.DistributedObject.delete(self)
def wantsNametag(self):
return not ZoneUtil.isInterior(self.zoneId)
def setupNametag(self):
if not self.wantsNametag():
return
if self.doorIndex != 0:
# Avoid duplicated nametags (eg hq doors)
return
if self.nametag == None:
self.nametag = NametagGroup()
self.nametag.setFont(ToontownGlobals.getBuildingNametagFont())
if TTLocalizer.BuildingNametagShadow:
self.nametag.setShadow(*TTLocalizer.BuildingNametagShadow)
self.nametag.setContents(Nametag.CName)
self.nametag.setColorCode(NametagGroup.CCToonBuilding)
self.nametag.setActive(0)
self.nametag.setAvatar(self.getDoorNodePath())
self.nametag.setObjectCode(self.block)
name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(self.block)
self.nametag.setName(name)
self.nametag.manage(base.marginManager)
def clearNametag(self):
if self.nametag != None:
#.........这里部分代码省略.........
示例2: DistributedHouse
# 需要导入模块: from otp.nametag.NametagGroup import NametagGroup [as 别名]
# 或者: from otp.nametag.NametagGroup.NametagGroup import setObjectCode [as 别名]
#.........这里部分代码省略.........
else:
houseName = TTLocalizer.AvatarsHouse % TTLocalizer.GetPossesive(self.name)
matText.setText(houseName)
self.matText = matText
textHeight = matText.getHeight() - 2
textWidth = matText.getWidth()
xScale = 1.0
if textWidth > 8:
xScale = 8.0 / textWidth
mat_origin = self.house.find('**/mat_origin')
pos = mat_origin.getPos()
mat_origin.setPosHpr(pos[0] - 0.15 * textHeight, pos[1], pos[2], 90, -90, 0)
self.floorMat = mat_origin.attachNewNode(self.matText)
self.floorMat.setDepthWrite(0)
self.floorMat.setPos(0, -.025, 0)
self.floorMat.setScale(0.45 * xScale)
return
def __setupNametag(self):
if self.nametag:
self.clearNametag()
if self.name == '':
houseName = ''
else:
houseName = TTLocalizer.AvatarsHouse % TTLocalizer.GetPossesive(self.name)
self.nametag = NametagGroup()
self.nametag.setFont(ToontownGlobals.getBuildingNametagFont())
if TTLocalizer.BuildingNametagShadow:
self.nametag.setShadow(*TTLocalizer.BuildingNametagShadow)
self.nametag.setContents(Nametag.CName)
self.nametag.setColorCode(NametagGroup.CCHouseBuilding)
self.nametag.setActive(0)
self.nametag.setAvatar(self.house)
self.nametag.setObjectCode(self.doId)
self.nametag.setName(houseName)
self.nametag.manage(base.marginManager)
def unload(self):
self.notify.debug('unload')
self.ignoreAll()
def setHouseReady(self):
self.notify.debug('setHouseReady')
try:
self.House_initialized
except:
self.House_initialized = 1
self.load()
def setHousePos(self, index):
self.notify.debug('setHousePos')
self.housePosInd = index
self.__setHouseColor()
def setHouseType(self, index):
self.notify.debug('setHouseType')
self.houseType = index
def setFavoriteNum(self, index):
self.notify.debug('setFavoriteNum')
self.favoriteNum = index
def __setHouseColor(self):
if self.house:
bwall = self.house.find('**/*back')
rwall = self.house.find('**/*right')