示例#1
0
class LobbyFlashMarkerVisibility(CGFComponent):
    mainTankMarkerGO = ComponentProperty(type=CGFMetaTypes.LINK,
                                         value=CGF.GameObject,
                                         editorName='non-hero tank marker GO')
    heroTankMarkerGO = ComponentProperty(type=CGFMetaTypes.LINK,
                                         value=CGF.GameObject,
                                         editorName='hero tank marker GO')
示例#2
0
class TestStateMachineStatesActivator(CGFComponent):
    category = DEMO_CATEGORY
    statesList = ComponentProperty(type=CGFMetaTypes.STRING_LIST,
                                   editorName='States',
                                   value=('Click', 'BowlClick'))
    animator = ComponentProperty(type=CGFMetaTypes.LINK,
                                 editorName='Animator',
                                 value=GenericComponents.AnimatorComponent)
    trigger = ComponentProperty(type=CGFMetaTypes.LINK,
                                editorName='Time trigger',
                                value=Triggers.TimeTriggerComponent)

    def __init__(self):
        super(TestStateMachineStatesActivator, self).__init__()
        self.__index = 0
        self.__callbackID = None
        return

    def switchState(self):
        statesSize = len(self.statesList)
        if statesSize == 0:
            return
        else:
            if self.animator is not None:
                if self.__index >= len(self.statesList):
                    self.__index = 0
                _logger.debug('TestStateMachineStatesActivator. Set State %s',
                              self.statesList[self.__index])
                self.animator().setTrigger(self.statesList[self.__index])
                self.__index += 1
            return
class TestEntranceNotifier(CGFComponent):
    category = DEMO_CATEGORY
    textComponent = ComponentProperty(type=CGFMetaTypes.LINK,
                                      editorName='Text component to output',
                                      value=GameplayDebug.DebugTextComponent)
    trigger = ComponentProperty(type=CGFMetaTypes.LINK,
                                editorName='AreaTrigger to subscribe',
                                value=Triggers.AreaTriggerComponent)
    title = ComponentProperty(type=CGFMetaTypes.STRING,
                              editorName='Title',
                              value='Area')

    def __init__(self):
        super(TestEntranceNotifier, self).__init__()
        self.__log = ''
        self.__messageCount = 0

    def addMessage(self, message):
        if self.__messageCount >= 10:
            self.__log = ''
            self.__messageCount = 0
        self.__messageCount += 1
        self.__log += message
        self.__flushText()

    def __flushText(self):
        text = self.textComponent()
        if text:
            text.setText(self.__log, (0, 0, 0), (1.0, 1.0, 1.0, 1.0))
class TestMaterialParamManipulator(CGFComponent):
    category = DEMO_CATEGORY
    model = ComponentProperty(type=CGFMetaTypes.LINK,
                              editorName='model',
                              value=GenericComponents.DynamicModelComponent)
    paramName = ComponentProperty(type=CGFMetaTypes.STRING,
                                  editorName='paramName',
                                  value='g_tintColor')
class TestComponentCreation(CGFComponent):
    category = DEMO_CATEGORY
    trigger = ComponentProperty(type=CGFMetaTypes.LINK,
                                editorName='AreaTrigger to subscribe',
                                value=Triggers.AreaTriggerComponent)
    rotationSpeed = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                      editorName='rotation speed',
                                      value=0.0)
示例#6
0
class LobbyFlashMarker(CGFComponent):
    icon = ComponentProperty(type=CGFMetaTypes.STRING,
                             editorName='marker icon',
                             value='gui/maps/icons/marathon/marker/video.png',
                             annotations={'path': '*.png'})
    textKey = ComponentProperty(type=CGFMetaTypes.STRING,
                                editorName='marker text key',
                                value='#marathon:3dObject/showVideo')
class HighlightComponent(CGFComponent):
    editorTitle = 'Highlight'
    category = 'Common'
    color = ComponentProperty(type=CGFMetaTypes.VECTOR4,
                              editorName='Color',
                              value=(0, 0, 0, 1))
    groupName = ComponentProperty(type=CGFMetaTypes.STRING,
                                  editorName='Group name')
示例#8
0
class TestScriptAxisRotator(CGFComponent):
    category = DEMO_CATEGORY
    rotationSpeedYaw = ComponentProperty(type=CGFMetaTypes.FLOAT, editorName='rotation speed yaw', value=1.0)
    rotationSpeedPitch = ComponentProperty(type=CGFMetaTypes.FLOAT, editorName='rotation speed pitch', value=1.0)
    rotationSpeedRoll = ComponentProperty(type=CGFMetaTypes.FLOAT, editorName='rotation speed roll', value=1.0)
    transform = ComponentProperty(type=CGFMetaTypes.LINK, editorName='transform', value=GenericComponents.TransformComponent)

    def __init__(self):
        super(TestScriptAxisRotator, self).__init__()
class InfluenceZoneMultiVisualizer(CGFComponent):
    editorTitle = 'Influence Zone Multi Visualizer'
    category = 'Abilities'
    influencePrefab = ComponentProperty(type=CGFMetaTypes.STRING,
                                        value='',
                                        editorName='Influence prefab',
                                        annotations={'path': '*.prefab'})
    rotateFromCenter = ComponentProperty(type=CGFMetaTypes.BOOL,
                                         value=False,
                                         editorName='Rotate from center')
示例#10
0
class TestScriptMover(CGFComponent):
    category = DEMO_CATEGORY
    finalPoint = ComponentProperty(type=CGFMetaTypes.LINK, editorName='finalPoint', value=GenericComponents.TransformComponent)
    period = ComponentProperty(type=CGFMetaTypes.FLOAT, editorName='period', value=1.0)
    transform = ComponentProperty(type=CGFMetaTypes.LINK, editorName='transform', value=GenericComponents.TransformComponent)

    def __init__(self):
        self.simTime = 0.0
        self.startTransform = Matrix()

    def prepare(self, transform):
        self.startMatrix = transform.transform
        self.simTime = 0.0
示例#11
0
class SerialNumberComponent(CGFComponent):
    counterValue = ComponentProperty(type=CGFMetaTypes.STRING,
                                     editorName='Counter Value',
                                     value='00000')
    splitNumber = ComponentProperty(type=CGFMetaTypes.BOOL,
                                    editorName='Split number',
                                    value=False)
    decalComponent = ComponentProperty(type=CGFMetaTypes.LINK,
                                       editorName='DecalLink',
                                       value=DecalComponent)
    decalCount = ComponentProperty(type=CGFMetaTypes.INT,
                                   editorName='Decal count',
                                   value=1)
class TestModelSwapper(CGFComponent):
    category = DEMO_CATEGORY
    model1 = ComponentProperty(type=CGFMetaTypes.STRING,
                               value='',
                               editorName='model1',
                               annotations={'path': '*.model'})
    model2 = ComponentProperty(type=CGFMetaTypes.STRING,
                               value='',
                               editorName='model2',
                               annotations={'path': '*.model'})

    def __init__(self):
        super(TestModelSwapper, self).__init__()
        self.currentModel = self.model1
class InfluenceZoneTerrainArea(CGFComponent):
    editorTitle = 'Influence Zone Terrain Area'
    category = 'Abilities'
    fullZoneVisual = ComponentProperty(type=CGFMetaTypes.STRING,
                                       value='',
                                       editorName='Full Zone Visual',
                                       annotations={'path': '*.visual'})
    dropOffset = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                   value=1000.0,
                                   editorName='Drop Offset')

    def __init__(self):
        super(InfluenceZoneTerrainArea, self).__init__()
        self.fullZoneArea = None
        return
示例#14
0
class SerialNumberSwitcher(CGFComponent):
    lamp3digits = ComponentProperty(type=CGFMetaTypes.STRING,
                                    editorName='3 digits',
                                    annotations={'path': '*.prefab'})
    lamp4digits = ComponentProperty(type=CGFMetaTypes.STRING,
                                    editorName='4 digits',
                                    annotations={'path': '*.prefab'})
    lamp5digits = ComponentProperty(type=CGFMetaTypes.STRING,
                                    editorName='5 digits',
                                    annotations={'path': '*.prefab'})

    def getPrefabPath(self, counterValue):
        length = len(counterValue)
        if length > 4:
            return self.lamp5digits
        return self.lamp4digits if length > 3 else self.lamp3digits
class TriggerVSEComponent(CGFComponent):
    eventName = ComponentProperty(type=CGFMetaTypes.STRING,
                                  editorName='event name',
                                  value='event')

    def __init__(self):
        super(TriggerVSEComponent, self).__init__()
        self.triggerEvent = Event.Event()
示例#16
0
class ClientTestComponent(CGFComponent):
    category = DEMO_CATEGORY
    stringList = ComponentProperty(type=CGFMetaTypes.STRING_LIST,
                                   editorName='String List',
                                   value=('Test1', 'Test2'))
    intList = ComponentProperty(type=CGFMetaTypes.INT_LIST,
                                editorName='Int List',
                                value=(1, 2, 3))
    floatList = ComponentProperty(type=CGFMetaTypes.FLOAT_LIST,
                                  editorName='Float List',
                                  value=(4.0, 5.0, 6.0, 7.0))
    double = ComponentProperty(type=CGFMetaTypes.FLOAT,
                               editorName='Double',
                               value=55.0)
    integer = ComponentProperty(type=CGFMetaTypes.INT,
                                editorName='Integer',
                                value=777)
    string = ComponentProperty(type=CGFMetaTypes.STRING,
                               editorName='String',
                               value='Tiger')
    transformLink = ComponentProperty(
        type=CGFMetaTypes.LINK,
        editorName='Link to Transform',
        value=GenericComponents.TransformComponent)

    def __init__(self):
        super(ClientTestComponent, self).__init__()
        _logger.debug('ClientTestComponent stringList = %s', self.stringList)
        _logger.debug('ClientTestComponent double = %f', self.double)
        _logger.debug('ClientTestComponent integer = %d', self.integer)
        _logger.debug('ClientTestComponent string = %s', self.string)
        if self.transformLink is not None:
            _logger.debug('ClientTestComponent transform from link =\n%s',
                          self.transformLink().worldTransform)
        return
class ColorComponent(CGFComponent):
    category = 'UI'
    editorTitle = 'Color Component'
    model = ComponentProperty(type=CGFMetaTypes.LINK,
                              editorName='model',
                              value=GenericComponents.DynamicModelComponent)
    colorParamName = ComponentProperty(type=CGFMetaTypes.STRING,
                                       editorName='colorParamName',
                                       value='g_color')
    color = ComponentProperty(type=CGFMetaTypes.VECTOR4,
                              value=Math.Vector4(1, 0, 0, 0),
                              editorName='color')

    def __init__(self):
        super(ColorComponent, self).__init__()
        self.currentColor = self.color
        self.currentColorParamName = self.colorParamName
        self.currentModel = self.model
class DamageStickerComponent(CGFComponent):
    category = 'Render'
    damageSticker = ComponentProperty(type=CGFMetaTypes.STRING,
                                      editorName='Damage sticker',
                                      value='')
    lodDistance = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                    editorName='Lod Distance',
                                    value=100)
    fadeoutTime = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                    editorName='Fadeout time',
                                    value=0)
    offset = ComponentProperty(type=CGFMetaTypes.FLOAT,
                               editorName='Offset',
                               value=1.0)

    def __init__(self):
        super(DamageStickerComponent, self).__init__()
        self.stickerModel = BigWorld.WGStickerModel()
示例#19
0
class VehicleCustomEffectsSettings(CGFComponent):
    category = 'Vehicle'
    editorTitle = 'Vehicle Custom Effects Settings'
    disableDefaultChassis = ComponentProperty(
        type=CGFMetaTypes.BOOL,
        value=False,
        editorName='Disable Default Chassis Effects')
    disableDefaultHull = ComponentProperty(
        type=CGFMetaTypes.BOOL,
        value=False,
        editorName='Disable Default Hull Effects')
    additionalEngineSoundPC = ComponentProperty(
        type=CGFMetaTypes.STRING,
        value='',
        editorName='Additional Engine Sound PC')
    additionalEngineSoundNPC = ComponentProperty(
        type=CGFMetaTypes.STRING,
        value='',
        editorName='Additional Engine Sound NPC')
class SingleCollisionComponent(CGFComponent):
    editorTitle = 'Single Collision'
    category = 'Common'
    asset = ComponentProperty(type=CGFMetaTypes.STRING,
                              editorName='Asset',
                              annotations={'path': '*.model'})
    matrix = Math.Matrix()

    def __init__(self):
        super(SingleCollisionComponent, self).__init__()
        self.matrix = Math.Matrix()
        self.matrix.setIdentity()
示例#21
0
class AreaAbilityVisualizer(CGFComponent):
    editorTitle = 'Area Ability Visualizer'
    category = 'Abilities'
    areaTransform = ComponentProperty(
        type=CGFMetaTypes.LINK,
        value=GenericComponents.TransformComponent,
        editorName='Area object')

    def __init__(self):
        super(AreaAbilityVisualizer, self).__init__()
        self.manualRadius = None
        return
class CombatMarker(CGFComponent):
    category = 'UI'
    editorTitle = 'Combat Marker'
    shape = ComponentProperty(type=CGFMetaTypes.STRING,
                              value='',
                              editorName='Shape')
    offset = ComponentProperty(type=CGFMetaTypes.VECTOR3,
                               value=Math.Vector3(0, 0, 0),
                               editorName='offset')
    areaRadius = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                   value=0.0,
                                   editorName='areaRadius')
    disappearanceRadius = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                            value=1.0,
                                            editorName='Disappearance Radius')
    reverseDisappearing = ComponentProperty(type=CGFMetaTypes.BOOL,
                                            value=False,
                                            editorName='Reverse disappearing')
    distanceFieldColor = ComponentProperty(type=CGFMetaTypes.STRING,
                                           value='white',
                                           editorName='Distance Field Color')

    def __init__(self):
        super(CombatMarker, self).__init__()
        self.marker = None
        self.markerID = None
        return
class InfluenceZoneEquipmentComponent(CGFComponent):
    editorTitle = 'Influence Zone Equipment'
    userVisible = False
    radius = ComponentProperty(type=CGFMetaTypes.FLOAT,
                               value=0,
                               editorName='Radius')
    zonesCount = ComponentProperty(type=CGFMetaTypes.INT,
                                   value=0,
                                   editorName='Zones Count')
    zoneRadius = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                   value=0,
                                   editorName='Zone Radius')

    def __int__(self):
        self.equipment = None
        return

    def setupEquipment(self, equipment):
        self.equipment = equipment
        self.radius = equipment.radius
        self.zonesCount = equipment.zonesCount
        self.zoneRadius = equipment.influenceZone.radius
class HierarchyModifier2(CGFComponent):
    category = DEMO_CATEGORY
    top = ComponentProperty(type=CGFMetaTypes.LINK,
                            editorName='Top Object',
                            value=CGF.GameObject)
    bottom = ComponentProperty(type=CGFMetaTypes.LINK,
                               editorName='Bottom Object',
                               value=CGF.GameObject)
    box = ComponentProperty(type=CGFMetaTypes.LINK,
                            editorName='Box Object',
                            value=CGF.GameObject)
    cameraTransform = ComponentProperty(
        type=CGFMetaTypes.LINK,
        editorName='Camera Transform',
        value=GenericComponents.TransformComponent)
    areaTrigger = ComponentProperty(type=CGFMetaTypes.LINK,
                                    editorName='Area Trigger',
                                    value=Triggers.AreaTriggerComponent)

    def unwrapFigure(self, where):
        _logger.debug('HierarchyModifier2. Trigger entered')
        CGF.changeHierarchy(where, 'Head', self.top.name)
        CGF.changeHierarchy(where, 'Back', self.bottom.name)
        CGF.changeHierarchy(where, 'Camera', self.top.name)
        CGF.changeHierarchy(where, 'LH', 'TL')
        CGF.changeHierarchy(where, 'RH', 'TR')
        CGF.changeHierarchy(where, 'LL', 'BL')
        CGF.changeHierarchy(where, 'RL', 'BR')

    def wrapFigure(self, where):
        _logger.debug('HierarchyModifier2. Trigger exited')
        CGF.changeHierarchy(where, 'Head', self.box.name)
        CGF.changeHierarchy(where, 'Back', self.box.name)
        CGF.changeHierarchy(where, 'Camera', 'Bot')
        CGF.changeHierarchy(where, 'LH', self.box.name)
        CGF.changeHierarchy(where, 'RH', self.box.name)
        CGF.changeHierarchy(where, 'LL', self.box.name)
        CGF.changeHierarchy(where, 'RL', self.box.name)
示例#25
0
class DeathZonesRule(Rule):
    category = 'Steel Hunter'
    editorTitle = 'Death Zones Mechanics Rule'
    maxAlpha = ComponentProperty(type=CGFMetaTypes.FLOAT,
                                 value=0.5,
                                 editorName='Max Alpha')
    height = ComponentProperty(type=CGFMetaTypes.FLOAT,
                               value=16.0,
                               editorName='Height')
    activeColor = ComponentProperty(type=CGFMetaTypes.VECTOR4,
                                    value=Math.Vector4(0.8, 0.0, 0.0, 0.0),
                                    editorName='Active color')
    waitingColor = ComponentProperty(type=CGFMetaTypes.VECTOR4,
                                     value=Math.Vector4(1.0, 0.6, 0.0, 0.0),
                                     editorName='Waiting Color')

    @registerManager(DeathZoneDrawManager)
    def registerDeathZonesDrawManager(self):
        return (self.maxAlpha, self.height, self.activeColor,
                self.waitingColor)

    @registerManager(DeathZoneUpdaterManager)
    def registerDeathZoneUpdaterManager(self):
        return None
示例#26
0
class OpenBrowserOnClickComponent(CGFComponent):
    urlProvider = ComponentProperty(type=CGFMetaTypes.STRING,
                                    editorName='url provider',
                                    value='MARATHON_VIDEO_URL_PROVIDER')

    def __init__(self):
        super(OpenBrowserOnClickComponent, self).__init__()
        self.__urlParser = URLMacros()

    def doAction(self):
        self.__openBrowser()

    @process
    def __openBrowser(self):
        getterFunc = URL_PROVIDERS[self.urlProvider]
        unparsedUrl = getterFunc()
        url = yield self.__urlParser.parse(unparsedUrl)
        showBrowserOverlayView(url, alias=VIEW_ALIAS.BROWSER_OVERLAY)
class ArtilleryFortColorComponent(CGFComponent):
    category = 'Abilities'
    colorComponent = ComponentProperty(type=CGFMetaTypes.LINK,
                                       editorName='colorComponent',
                                       value=ColorComponent)

    def __init__(self):
        super(ArtilleryFortColorComponent, self).__init__()
        self.entityGO = None
        return

    def changeColor(self):
        if self.entityGO is not None and self.entityGO.isValid():
            goSyncComponent = self.entityGO.findComponentByType(EntityGOSync)
            if goSyncComponent is not None:
                self.colorComponent().color = hexARGBToRGBAFloatColor(
                    goSyncComponent.entity.areaColor)
        return

    def colorSettingsChanged(self, diff):
        if GRAPHICS.COLOR_BLIND in diff:
            self.changeColor()
示例#28
0
class _SequenceAnimatorTimer(CGFComponent):
    parent = ComponentProperty(type=CGFMetaTypes.LINK, value=CGF.GameObject)

    def __init__(self, sequenceAnimator, parent):
        super(_SequenceAnimatorTimer, self).__init__()
        self.__sequenceAnimator = sequenceAnimator
        self.parent = parent

    def tick(self):
        if not self.__sequenceAnimator.isPlaying():
            self.__sequenceAnimator.stop()
            self.__sequenceAnimator.setEnabled(False)
            self.__sequenceAnimator = None
            CGF.removeGameObject(self.parent)
        return

    def destroy(self):
        if self.__sequenceAnimator is not None:
            self.__sequenceAnimator.stop()
            self.__sequenceAnimator.setEnabled(False)
        self.__sequenceAnimator = None
        self.parent = None
        return
示例#29
0
class TestBridge(CGFComponent):
    category = DEMO_CATEGORY
    moverTransform1 = ComponentProperty(
        type=CGFMetaTypes.LINK,
        editorName='Mover1',
        value=GenericComponents.TransformComponent)
    moverTransform2 = ComponentProperty(
        type=CGFMetaTypes.LINK,
        editorName='Mover2',
        value=GenericComponents.TransformComponent)
    trigger1 = ComponentProperty(type=CGFMetaTypes.LINK,
                                 editorName='Trigger1',
                                 value=Triggers.AreaTriggerComponent)
    trigger2 = ComponentProperty(type=CGFMetaTypes.LINK,
                                 editorName='Trigger2',
                                 value=Triggers.AreaTriggerComponent)
    limit = ComponentProperty(type=CGFMetaTypes.FLOAT,
                              editorName='Limit',
                              value=0.5)
    speed = ComponentProperty(type=CGFMetaTypes.FLOAT,
                              editorName='Speed',
                              value=1)

    def __init__(self):
        super(TestBridge, self).__init__()
        _logger.debug('Bridge Created')
        self.moveDirection1 = 0
        self.moveDirection2 = 0

    def activate(self):
        _logger.debug('Bridge Activated')

    def tr1In(self, who, where):
        _logger.debug('Bridge Trigger 1 Entered')
        self.moveDirection1 = 1

    def tr1Out(self, who, where):
        self.moveDirection1 = -1

    def tr2In(self, who, where):
        _logger.debug('Bridge Trigger 2 Entered')
        self.moveDirection2 = 1

    def tr2Out(self, who, where):
        self.moveDirection2 = -1
class TestPrefabSpawner(CGFComponent):
    category = DEMO_CATEGORY
    prefabPath = ComponentProperty(
        type=CGFMetaTypes.STRING,
        editorName='Prefab to spawn',
        value='content/Prefabs/1003_cgf_test/TestExplosion.prefab',
        annotations={'path': '*.prefab'})
    instancesCount = ComponentProperty(type=CGFMetaTypes.INT,
                                       editorName='Instances count',
                                       value=1)
    areaToSpawn = ComponentProperty(type=CGFMetaTypes.LINK,
                                    editorName='Area to spawn',
                                    value=Triggers.CylinderAreaComponent)
    triggerToMonitor = ComponentProperty(type=CGFMetaTypes.LINK,
                                         editorName='Trigger to monitor',
                                         value=Triggers.AreaTriggerComponent)
    transform = ComponentProperty(type=CGFMetaTypes.LINK,
                                  editorName='transform',
                                  value=GenericComponents.TransformComponent)
    attachToEntered = ComponentProperty(type=CGFMetaTypes.BOOL,
                                        editorName='attach to entered',
                                        value=False)