本文整理汇总了Python中uthread.new函数的典型用法代码示例。如果您正苦于以下问题:Python new函数的具体用法?Python new怎么用?Python new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RandomizeCharacter
def RandomizeCharacter(self, randomizingPart = None, *args):
info = self.GetInfo()
doll = self.charSvc.GetSingleCharactersDoll(info.charID)
if doll.busyUpdating:
return
uicore.layer.charactercreation.LockNavigation()
uicore.layer.charactercreation.ToggleClothes(forcedValue=0)
uthread.new(self.RandomizeRotation_thread, self.sr.randomButton)
itemList = []
if info.genderID == ccConst.GENDERID_FEMALE:
itemList = ccConst.femaleRandomizeItems.keys()
else:
itemList = ccConst.maleRandomizeItems.keys()
canChangeBaseAppearance = uicore.layer.charactercreation.CanChangeBaseAppearance()
blacklist = ccConst.randomizerCategoryBlacklist[:]
if not canChangeBaseAppearance:
blacklist += ccConst.recustomizationRandomizerBlacklist
if info.genderID == ccConst.GENDERID_FEMALE:
blacklist.append(ccConst.scarring)
categoryList = []
for item in itemList:
if item not in blacklist:
categoryList.append(item)
self.charSvc.RandomizeCharacterGroups(info.charID, categoryList, doUpdate=False, fullRandomization=True)
if canChangeBaseAppearance:
self.charSvc.RandomizeCharacterSculpting(info.charID, doUpdate=False)
decalModifiers = doll.buildDataManager.GetModifiersByCategory(ccConst.tattoo)
for modifier in decalModifiers:
modifier.IsDirty = True
self.charSvc.UpdateDoll(info.charID, 'RandomizeCharacter')
示例2: AddExplosion
def AddExplosion(self, uniqueName, explosionGfxID, spreadOut):
if uniqueName not in self.districts:
self.LogError('Could not find district ' + str(uniqueName) + ' for planet with id ' + str(self.itemID))
graphics = cfg.graphics.GetIfExists(explosionGfxID)
if graphics is None:
self.LogError('Explosion graphicsID ' + str(explosionGfxID) + " doesn't exist!")
return
fx = trinity.Load(graphics.graphicFile)
if fx is None:
self.LogError('Explosion ' + str(graphics.graphicFile) + " doesn't exist!")
return
if len(fx.curveSets) == 0:
self.LogError('Explosion ' + str(graphics.graphicFile) + ' has no curveSets! This is useless...')
return
direction = self.districts[uniqueName].centerNormal
rotMatrix1 = geo2.MatrixRotationAxis((direction[1], direction[2], direction[0]), random.random() * spreadOut * self.districts[uniqueName].pinRadius)
rotMatrix2 = geo2.MatrixRotationAxis(direction, random.uniform(0, 2.0 * math.pi))
direction = geo2.Vec3TransformNormal(direction, rotMatrix1)
direction = geo2.Vec3TransformNormal(direction, rotMatrix2)
fx.translation = direction
fx.scaling = (5000.0 / PLANET_SIZE_SCALE, 5000.0 / PLANET_SIZE_SCALE, 5000.0 / PLANET_SIZE_SCALE)
v1 = geo2.Vec3Cross(geo2.Vec3Normalize(direction), (0.0, 1.0, 0.0))
alpha = -math.acos(geo2.Vec3Dot(geo2.Vec3Normalize(direction), (0.0, 1.0, 0.0)))
fx.rotation = geo2.QuaternionRotationAxis(v1, alpha)
duration = fx.curveSets[0].GetMaxCurveDuration()
self.districtExplosions.children.append(fx)
uthread.new(self._RemoveExplosionFromDistrict, fx, duration)
示例3: ApplyAttributes
def ApplyAttributes(self, attributes):
uicls.Transform.ApplyAttributes(self, attributes)
sprite = uicls.Sprite(parent=self, texturePath='res:/UI/Texture/loadingWheel.dds', pos=(0, 0, 0, 0), align=uiconst.TOALL, state=uiconst.UI_DISABLED)
loopParams = attributes.get('loopParams', self.default_loopParams)
if loopParams:
direction, time = loopParams
uthread.new(self.StartRotationCycle, direction, time)
示例4: LogColorModeUsage
def LogColorModeUsage(useCase = ''):
colorMode = settings.char.ui.Get('%s_%s' % (VIEWMODE_COLOR_SETTINGS, mapViewConst.MAPVIEW_PRIMARY_ID), mapViewConst.DEFAULT_MAPVIEW_SETTINGS[VIEWMODE_COLOR_SETTINGS])
if isinstance(colorMode, tuple):
colorMode, _colorModeArgs = colorMode
if colorMode in colorModeLogName:
logValue = '%s (%s)' % (colorModeLogName[colorMode], useCase)
uthread.new(sm.GetService('experimentClientSvc').LogMapColorModeLoadedCounter, logValue)
示例5: Damage
def Damage(self, items, *args):
btnSetup = {self.sr.selBtn: uiconst.UI_HIDDEN,
self.sr.pickBtn: uiconst.UI_DISABLED}
temp = uix.QtyPopup(100, 1, 50, hint=localization.GetByLabel('UI/Station/Repair/ApplyDamage'))
percentage = temp and temp['qty']
if percentage == 0 or percentage is None:
self.sr.pickBtn.state = uiconst.UI_NORMAL
return
itemIDAndAmountOfDamageList = []
try:
for item in items:
if self.invCache.IsItemLocked(item.itemID):
continue
if not self.invCache.TryLockItem(item.itemID, 'lockRepairingItem', {}, 1):
continue
amount = int(math.ceil(float(percentage) / 100.0 * float(item.maxHealth - item.damage)))
itemIDAndAmountOfDamageList.append((item.itemID, amount))
if len(itemIDAndAmountOfDamageList):
self.repairSvc.DamageModules(itemIDAndAmountOfDamageList)
finally:
for itemID, amount in itemIDAndAmountOfDamageList:
self.invCache.UnlockItem(itemID)
uthread.new(self.DisplayRepairQuote, self.GetAll())
btnSetup[self.sr.pickBtn] = uiconst.UI_NORMAL
self.DisplayButtons(btnSetup)
示例6: OnFleetJoin_Local
def OnFleetJoin_Local(self, memberInfo, state = 'Active'):
if self.destroyed:
return
myID = util.GetAttrs(self, 'sr', 'node', 'charID')
charID = memberInfo.charID
if myID is not None and charID == myID:
uthread.new(self.SetRelationship, self.sr.node)
示例7: StartScale
def StartScale(self, sender, btn, *args):
if self.align == uiconst.TOALL:
return
self.scaleData = (self.left,
self.top,
self.width,
self.height)
scalerName = sender.name
if 'Left' in scalerName and self.align != uiconst.TOLEFT:
modX = -1
elif 'Right' in scalerName and self.align != uiconst.TORIGHT:
modX = 1
else:
modX = 0
if 'Top' in scalerName:
modY = -1
elif 'Bottom' in scalerName:
modY = 1
else:
modY = 0
if not (modX or modY):
return
self.scaleModifiers = (modX, modY)
self._scaling = True
uthread.new(self.OnScale, uicore.uilib.x, uicore.uilib.y)
示例8: ProcessEntityVisibility
def ProcessEntityVisibility(self, eventList):
charid = session.charid
playerEntityCreateIdx = None
charactersCreated = []
for i, event in enumerate(eventList):
if event[0] == 'OnEntityCreate' and event[2] == charid:
eventList[i] = eventList[0]
eventList[0] = event
break
callsToMake = []
for t in eventList:
if t[0] == 'OnEntityCreate':
eventName, sceneID, entityID, initialState = t
callsToMake.append((self._CreateEntity, (sceneID, entityID, initialState)))
if util.IsCharacter(entityID):
charactersCreated.append(entityID)
elif t[0] == 'OnEntityDestroy':
eventName, entityID = t
callsToMake.append((self._RemoveEntity, (entityID,)))
else:
self.LogError('Aperture Client received a unknown event type %s', str(t[0]))
if charactersCreated:
uthread.new(cfg.eveowners.Prime, charactersCreated)
uthread.parallel(callsToMake)
示例9: UpdateSessionTimer
def UpdateSessionTimer(self):
if settings.user.ui.Get('showSessionTimer', 0):
if self.sessionTimer:
uthread.new(self.sessionTimer.AnimSessionChange)
self.sessionTimerUpdatePending = False
else:
self.sessionTimerUpdatePending = True
示例10: GetDamageStateForDrone
def GetDamageStateForDrone(self, droneID):
if self.IsDroneDamageReady(droneID):
return self.droneDamageStatesByDroneIDs.get(droneID, None)
droneIDsMissingDamage = self.FindDronesMissingDamageState([droneID])
if droneIDsMissingDamage:
uthread.new(self.FetchInBayDroneDamageToServer, droneIDsMissingDamage)
return -1
示例11: Run
def Run(self, memStream = None):
self.LogInfo('Starting War')
self.state = SERVICE_START_PENDING
self.__warMoniker = None
self.__warMonikerOwnerID = None
items = warObject.__dict__.items()
for objectName in self.__functionalobjects__:
if objectName == 'base':
continue
object = None
classType = 'warObject.%s' % objectName
for i in range(0, len(warObject.__dict__)):
self.LogInfo('Processing', items[i])
if len(items[i][0]) > 1:
if items[i][0][:2] == '__':
continue
if items[i][1].__guid__ == classType:
object = CreateInstance(classType, (self,))
break
if object is None:
raise RuntimeError('FunctionalObject not found %s' % classType)
setattr(self, objectName, object)
for objectName in self.__functionalobjects__:
object = getattr(self, objectName)
object.DoObjectWeakRefConnections()
self.state = SERVICE_RUNNING
uthread.new(self.CheckForStartOrEndOfWar)
示例12: OnOrbitalStrikeTargets
def OnOrbitalStrikeTargets(self, targets):
self.targets = targets
for targetID, target in self.targets.iteritems():
target['targetID'] = targetID
sm.ScatterEvent('OnDistrictTargets', targets)
uthread.new(self._LoadTargetBalls)
示例13: OnFKeyOverload
def OnFKeyOverload(self, sidx, gidx):
slot = self.slotsByOrder.get((gidx, sidx), None)
if slot and slot.sr.module and slot.sr.module.state == uiconst.UI_NORMAL:
if hasattr(slot.sr.module, 'ToggleOverload'):
uthread.new(slot.sr.module.ToggleOverload)
else:
uthread.new(eve.Message, 'Disabled')
示例14: OnViewStateChanged
def OnViewStateChanged(self, oldState, newState):
if newState == 'charactercreation':
uthread.new(self.GatherStats, self.lastClientState, session.locationid)
if oldState in ('station', 'hangar'):
self.lastClientState = 'charCustomization'
else:
self.lastClientState = newState
示例15: SwitchBloodline
def SwitchBloodline(self, newBloodlineID, *args):
uicore.layer.charactercreation.FadeToBlack(why=localization.GetByLabel('UI/Common/Loading'))
sm.GetService('character').StopEditing()
self.bloodlineID = newBloodlineID
self.sr.bloodlineCont.Flush()
self.RearrangeInfo(self.bloodlineID, 'bloodlineID', self.currentBloodlineInfo)
self.CreateBloodlineHex()
self.SelectHex(self.bloodlineConts.get(self.bloodlineID), [])
info = uicore.layer.charactercreation.GetInfo()
sm.GetService('character').RemoveCharacter(info.charID)
uicore.layer.charactercreation.AddCharacter(info.charID, newBloodlineID, info.genderID)
uicore.layer.charactercreation.SelectBloodline(self.bloodlineID, check=0)
doll = sm.GetService('character').GetSingleCharactersDoll(info.charID)
while doll.busyUpdating:
blue.synchro.Yield()
step = uicore.layer.charactercreation.sr.step
if hasattr(step, 'GoToAssetMode'):
uthread.new(step.GoToAssetMode, 0, 1)
if step.sr.tattooMenu and not step.sr.tattooMenu.destroyed:
step.sr.tattooMenu.Close()
else:
uicore.layer.charactercreation.StartEditMode(mode='sculpt', resetAll=True)
if hasattr(step, 'LoadFaceMode'):
uthread.new(step.LoadFaceMode)
uicore.layer.charactercreation.FadeFromBlack()