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


Python PyDatagram.addServerHeader方法代码示例

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


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

示例1: getActivated

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def getActivated(self, doId, callback):
        ctx = self.getContext()
        self.__callbacks[ctx] = callback

        dg = PyDatagram()
        dg.addServerHeader(doId, self.ourChannel, DBSS_OBJECT_GET_ACTIVATED)
        dg.addUint32(ctx)
        dg.addUint32(doId)
        self.send(dg)
开发者ID:ToonTownInfiniteRepo,项目名称:ToontownInfinite,代码行数:11,代码来源:AstronInternalRepository.py

示例2: setClientState

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def setClientState(self, clientChannel, state):
        """
        Sets the state of the client on the CA.
        Useful for logging in and logging out, and for little else.
        """

        dg = PyDatagram()
        dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_SET_STATE)
        dg.add_uint16(state)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:12,代码来源:AstronInternalRepository.py

示例3: eject

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def eject(self, clientChannel, reasonCode, reason):
        """
        Kicks the client residing at the specified clientChannel, using the specifed reasoning.
        """

        dg = PyDatagram()
        dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_EJECT)
        dg.add_uint16(reasonCode)
        dg.addString(reason)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:12,代码来源:AstronInternalRepository.py

示例4: setOwner

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def setOwner(self, doId, newOwner):
        """
        Sets the owner of a DistributedObject. This will enable the new owner to send "ownsend" fields,
        and will generate an OwnerView.
        """

        dg = PyDatagram()
        dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_OWNER)
        dg.add_uint64(newOwner)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:12,代码来源:AstronInternalRepository.py

示例5: setAI

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def setAI(self, doId, aiChannel):
        """
        Sets the AI of the specified DistributedObjectAI to be the specified channel.
        Generally, you should not call this method, and instead call DistributedObjectAI.setAI.
        """

        dg = PyDatagram()
        dg.addServerHeader(doId, aiChannel, STATESERVER_OBJECT_SET_AI)
        dg.add_uint64(aiChannel)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:12,代码来源:AstronInternalRepository.py

示例6: requestDelete

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def requestDelete(self, do):
        """
        Request the deletion of an object that already exists on the State Server.

        You should probably use do.requestDelete() instead.
        """

        dg = PyDatagram()
        dg.addServerHeader(do.doId, self.ourChannel, STATESERVER_OBJECT_DELETE_RAM)
        dg.addUint32(do.doId)
        self.send(dg)
开发者ID:ToonTownInfiniteRepo,项目名称:ToontownInfinite,代码行数:13,代码来源:AstronInternalRepository.py

示例7: clientAddSessionObject

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def clientAddSessionObject(self, clientChannel, doId):
        """
        Declares the specified DistributedObject to be a "session object",
        meaning that it is destroyed when the client disconnects.
        Generally used for avatars owned by the client.
        """

        dg = PyDatagram()
        dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_ADD_SESSION_OBJECT)
        dg.add_uint32(doId)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:13,代码来源:AstronInternalRepository.py

示例8: requestDelete

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def requestDelete(self, do):
        """
        Request the deletion of an object that already exists on the State Server.

        You should use do.requestDelete() instead. This is not meant to be
        called directly unless you really know what you are doing.
        """

        dg = PyDatagram()
        dg.addServerHeader(do.doId, self.ourChannel, STATESERVER_OBJECT_DELETE_RAM)
        dg.addUint32(do.doId)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:14,代码来源:AstronInternalRepository.py

示例9: clientAddInterest

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def clientAddInterest(self, clientChannel, interestId, parentId, zoneId):
        """
        Opens an interest on the behalf of the client. This, used in conjunction
        with add_interest: visible (or preferably, disabled altogether), will mitigate
        possible security risks.
        """

        dg = PyDatagram()
        dg.addServerHeader(clientChannel, self.ourChannel, CLIENTAGENT_ADD_INTEREST)
        dg.add_uint16(interestId)
        dg.add_uint32(parentId)
        dg.add_uint32(zoneId)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:15,代码来源:AstronInternalRepository.py

示例10: getNetworkAddress

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def getNetworkAddress(self, clientId, callback):
        """
        Get the endpoints of a client connection.

        You should already be sure the client actually exists, otherwise the
        callback will never be called.

        Callback is called as: callback(remoteIp, remotePort, localIp, localPort)
        """

        ctx = self.getContext()
        self.__callbacks[ctx] = callback
        dg = PyDatagram()
        dg.addServerHeader(clientId, self.ourChannel, CLIENTAGENT_GET_NETWORK_ADDRESS)
        dg.addUint32(ctx)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:18,代码来源:AstronInternalRepository.py

示例11: getLocation

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def getLocation(self, doId, callback):
        """
        Ask a DistributedObject where it is.

        You should already be sure the object actually exists, otherwise the
        callback will never be called.

        Callback is called as: callback(doId, parentId, zoneId)
        """

        ctx = self.getContext()
        self.__callbacks[ctx] = callback
        dg = PyDatagram()
        dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_GET_LOCATION)
        dg.addUint32(ctx)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:18,代码来源:AstronInternalRepository.py

示例12: getObject

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def getObject(self, doId, callback):
        """
        Get the entire state of an object.

        You should already be sure the object actually exists, otherwise the
        callback will never be called.

        Callback is called as: callback(doId, parentId, zoneId, dclass, fields)
        """

        ctx = self.getContext()
        self.__callbacks[ctx] = callback
        dg = PyDatagram()
        dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_GET_ALL)
        dg.addUint32(ctx)
        dg.addUint32(doId)
        self.send(dg)
开发者ID:jwcotejr,项目名称:panda3d,代码行数:19,代码来源:AstronInternalRepository.py

示例13: __connected

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def __connected(self):
        self.notify.info('Connected successfully.')

        # Listen to our channel...
        self.registerForChannel(self.ourChannel)

        # If we're configured with a State Server, register a post-remove to
        # clean up whatever objects we own on this server should we unexpectedly
        # fall over and die.
        if self.serverId:
            dg = PyDatagram()
            dg.addServerHeader(self.serverId, self.ourChannel, STATESERVER_DELETE_AI_OBJECTS)
            dg.addChannel(self.ourChannel)
            self.addPostRemove(dg)

        messenger.send('airConnected')
        self.handleConnected()
开发者ID:ToonTownInfiniteRepo,项目名称:ToontownInfinite,代码行数:19,代码来源:AstronInternalRepository.py

示例14: queryObject

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def queryObject(self, databaseId, doId, callback):
        """
        Query object `doId` out of the database.

        On success, the callback will be invoked as callback(dclass, fields)
        where dclass is a DCClass instance and fields is a dict.
        On failure, the callback will be invoked as callback(None, None).
        """

        # Save the callback:
        ctx = self.air.getContext()
        self._callbacks[ctx] = callback

        # Generate and send the datagram:
        dg = PyDatagram()
        dg.addServerHeader(databaseId, self.air.ourChannel, DBSERVER_OBJECT_GET_ALL)
        dg.addUint32(ctx)
        dg.addUint32(doId)
        self.air.send(dg)
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:21,代码来源:AstronDatabaseInterface.py

示例15: sendActivate

# 需要导入模块: from PyDatagram import PyDatagram [as 别名]
# 或者: from PyDatagram.PyDatagram import addServerHeader [as 别名]
    def sendActivate(self, doId, parentId, zoneId, dclass=None, fields=None):
        """
        Activate a DBSS object, given its doId, into the specified parentId/zoneId.

        If both dclass and fields are specified, an ACTIVATE_WITH_DEFAULTS_OTHER
        will be sent instead. In other words, the specified fields will be
        auto-applied during the activation.
        """

        fieldPacker = DCPacker()
        fieldCount = 0
        if dclass and fields:
            for k, v in fields.items():
                field = dclass.getFieldByName(k)
                if not field:
                    self.notify.error(
                        "Activation request for %s object contains " "invalid field named %s" % (dclass.getName(), k)
                    )

                fieldPacker.rawPackUint16(field.getNumber())
                fieldPacker.beginPack(field)
                field.packArgs(fieldPacker, v)
                fieldPacker.endPack()
                fieldCount += 1

            dg = PyDatagram()
            dg.addServerHeader(doId, self.ourChannel, DBSS_OBJECT_ACTIVATE_WITH_DEFAULTS)
            dg.addUint32(doId)
            dg.addUint32(0)
            dg.addUint32(0)
            self.send(dg)
            # DEFAULTS_OTHER isn't implemented yet, so we chase it with a SET_FIELDS
            dg = PyDatagram()
            dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_FIELDS)
            dg.addUint32(doId)
            dg.addUint16(fieldCount)
            dg.appendData(fieldPacker.getString())
            self.send(dg)
            # Now slide it into the zone we expect to see it in (so it
            # generates onto us with all of the fields in place)
            dg = PyDatagram()
            dg.addServerHeader(doId, self.ourChannel, STATESERVER_OBJECT_SET_LOCATION)
            dg.addUint32(parentId)
            dg.addUint32(zoneId)
            self.send(dg)
        else:
            dg = PyDatagram()
            dg.addServerHeader(doId, self.ourChannel, DBSS_OBJECT_ACTIVATE_WITH_DEFAULTS)
            dg.addUint32(doId)
            dg.addUint32(parentId)
            dg.addUint32(zoneId)
            self.send(dg)
开发者ID:Wilee999,项目名称:ToontownFritzServer,代码行数:54,代码来源:AstronInternalRepository.py


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