Add network objects dirtying api
This commit is contained in:
@@ -466,6 +466,18 @@ void NetworkReplicator::SetObjectOwnership(ScriptingObject* obj, uint32 ownerCli
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkReplicator::DirtyObject(ScriptingObject* obj)
|
||||
{
|
||||
ScopeLock lock(ObjectsLock);
|
||||
const auto it = Objects.Find(obj->GetID());
|
||||
if (it == Objects.End())
|
||||
return;
|
||||
auto& item = it->Item;
|
||||
if (item.Object != obj || item.Role != NetworkObjectRole::OwnedAuthoritative)
|
||||
return;
|
||||
// TODO: implement objects state replication frequency and dirtying
|
||||
}
|
||||
|
||||
void NetworkInternal::NetworkReplicatorClientConnected(NetworkClient* client)
|
||||
{
|
||||
ScopeLock lock(ObjectsLock);
|
||||
|
||||
@@ -95,6 +95,12 @@ public:
|
||||
/// <param name="localRole">The local role to assign for the object.</param>
|
||||
API_FUNCTION() static void SetObjectOwnership(ScriptingObject* obj, uint32 ownerClientId, NetworkObjectRole localRole = NetworkObjectRole::Replicated);
|
||||
|
||||
/// <summary>
|
||||
/// Marks the object dirty to perform immediate replication to the other clients.
|
||||
/// </summary>
|
||||
/// <param name="obj">The network object.</param>
|
||||
API_FUNCTION() static void DirtyObject(ScriptingObject* obj);
|
||||
|
||||
private:
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
API_FUNCTION(NoProxy) static void AddSerializer(const ScriptingTypeHandle& type, const Function<void(void*, void*)>& serialize, const Function<void(void*, void*)>& deserialize);
|
||||
|
||||
Reference in New Issue
Block a user