Beispiel #1
0
    def send_method_call(self, method_index, future_id, *args, **kwargs):
        if not self:
            WARN_MSG("Call to invalid mailbox %s" % self, depth=1)
            return

        method_info = self.entity_info.get_method(self.context_name,
                                                  method_index)
        params, _ = method_info.signature
        name = method_info.name

        serialized_params = BinarySerialization()

        for param_index, (param_name, param_type) in enumerate(params):
            param = param_type.instantiate(args[param_index])
            serialized_params << param.serialize()

        serialized_call = BinarySerialization()
        serialized_call << self.remote_id
        serialized_call << Globals.generator_signature
        serialized_call << method_index
        serialized_call << future_id
        serialized_call << Globals.access_token
        serialized_call << serialized_params

        message = BinarySerialization()
        message << ConnectionMessageTypes.rmi_call
        message << serialized_call

        self.send_data(message.get_archive())
Beispiel #2
0
 def serialize(self):
     sr = BinarySerialization()
     sr << str(self.get_endpoint()[0])
     sr << self.get_endpoint()[1]
     sr << self.get_id()
     sr << self.get_context()
     sr << self.get_class_name()
     return sr.get_archive()
Beispiel #3
0
 def serialize(self):
     serialized = BinarySerialization()
     count = len(self)
     serialized << count
     for index, item in enumerate(self):
         if not isinstance(item, self.base):
             item = self.base.instantiate(item)
         serialized << item.serialize()
     return serialized.get_archive()
Beispiel #4
0
async def _async_UnrealEngine4_go_to(asset_path):
    global EditorTCPClient

    from Core.TCP.TestProtocolClient import create_connection
    if EditorTCPClient is None or not is_valid(EditorTCPClient):
        _, EditorTCPClient = await create_connection(("127.0.0.1", 6666), None)
    bs = BinarySerialization()
    bs << "open_asset"
    bs << asset_path
    EditorTCPClient.send(bs.get_archive())
Beispiel #5
0
 def serialize(self):
     sr = BinarySerialization()
     sr << self
     sr << self.key
     sr << self.namespace
     sr << len(self.format_values)
     for value in self.format_values:
         if isinstance(value, FText):
             sr << TextFormatValueType.Simple
             sr << str(value)
         else:
             sr << TextFormatValueType.Text
             sr << value.serialize()
     return sr.get_archive()
Beispiel #6
0
 def serialize(self):
     serialized = BinarySerialization()
     count = len(self)
     serialized << count
     for key in self.keys():
         if not isinstance(key, self.base_key):
             key = self.base_key.instantiate(key)
         serialized << key.serialize()
     for value in self.values():
         if not isinstance(value, self.base_value):
             try:
                 value = self.base_value.instantiate(value)
             except TypeError:
                 print(self.base_value, value)
                 raise
         serialized << value.serialize()
     return serialized.get_archive()
Beispiel #7
0
    def serialize(self):
        serialized = BinarySerialization()
        for field_name, field_type in self.fields:
            # if field_name.lower() in self:
            #     value = self.get(field_name.lower(), None)
            # else:
            #     value = self.get(field_name, None)

            if field_name in self:
                value = self[field_name]
                if not isinstance(value, field_type):
                    value = field_type.instantiate(value)
            else:
                value = field_type.instantiate() if field_name not in self.defaults else field_type.instantiate(self.defaults[field_name])

            serialized << value.serialize()
        return serialized.get_archive()
Beispiel #8
0
    async def GetEntityData(self, entity_dbid: int32, entity_class: FString) -> FBytes:
        """
        Получение бинарных данных о сущности
        @param entity_dbid: ДБИД сущности
        @param entity_class: класс сущности
        @return: сериализованные байты (по классу)
        """
        properties = ConfigurationGenerator().generated_entities_info.get_by_name(entity_class).get_properties('base', only_persistent=True)

        props_templ = ", ".join([f'"{key}"' for key in properties.keys()])

        res = await self.driver.exec_raw(""" SELECT {0} 
                                             FROM "class_{1}"
                                             WHERE db_id={2}; """.format(props_templ, entity_class, entity_dbid))
        sr = BinarySerialization()
        for data in res:
            values = tuple(data.values())
            for index, (prop_name, prop_data) in enumerate(properties.items()):
                print(prop_name, prop_data)
                T = self.find_type(prop_data.typename, BaseEntity)
                value = values[index]
                value = T.pg_null(value)
                sr << T.serializable_value(value).serialize()
            return sr.get_archive()
Beispiel #9
0
 def serialize(self):
     serialized = BinarySerialization()
     serialized << json.dumps(self)
     return serialized.get_archive()
Beispiel #10
0
 def serialize(self):
     sr = BinarySerialization()
     sr << self._names[int(self)]
     return sr.get_archive()
Beispiel #11
0
    def replicate_value(self, value):
        if not self.with_partial_replication or not value.replication_buffer:
            serialized = value.serialize()
            self.client.UpdateClientEntityVariable(self.entity_id, self.owner_property_name, serialized)
        else:
            sr = BinarySerialization()
            sr << SliceReplicationDataType.Map
            for rep_kind, rep_data in value.replication_buffer:
                if rep_kind == SliceReplicationKind.Nop:
                    continue

                sr << rep_kind
                if rep_kind == SliceReplicationKind.Full:
                    sr << value.serialize()
                elif rep_kind == SliceReplicationKind.Clear:
                    pass
                elif rep_kind == SliceReplicationKind.EditEntry:
                    sr << value.serialize_entry(rep_data)
                elif rep_kind == SliceReplicationKind.RemoveEntry:
                    sr << value.serialize_key(rep_data[0])
            self.client.UpdateClientEntityVariableSlice(self.entity_id, self.owner_property_name, sr.get_archive())