本文整理汇总了C#中IMyReplicable类的典型用法代码示例。如果您正苦于以下问题:C# IMyReplicable类的具体用法?C# IMyReplicable怎么用?C# IMyReplicable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMyReplicable类属于命名空间,在下文中一共展示了IMyReplicable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetChildren
public void GetChildren(IMyReplicable replicable, List<IMyReplicable> resultChildren)
{
foreach (var child in GetChildren(replicable))
{
resultChildren.Add(child);
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyReplicables.cs
示例2: MyStateDataEntry
public MyStateDataEntry(IMyReplicable owner, NetworkId groupId, IMyStateGroup group)
{
Priority = 0;
Owner = owner;
GroupId = groupId;
Group = group;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyStateDataEntry.cs
示例3: MyCharacterPhysicsStateGroup
public MyCharacterPhysicsStateGroup(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
// This is 9 bits per component which is more than enough (512 discrete values per-axis)
m_lowPrecisionOrientation = true;
FindSupportDelegate = () => MySupportHelper.FindSupportForCharacter(Entity);
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCharacterPhysicsStateGroup.cs
示例4: SetReplicableReady
/// <summary>
/// Marks replicable as successfully created, ready to receive events and state groups data.
/// </summary>
void SetReplicableReady(NetworkId networkId, IMyReplicable replicable)
{
MyPendingReplicable pendingReplicable;
if (m_pendingReplicables.TryGetValue(networkId, out pendingReplicable))
{
var ids = pendingReplicable.StateGroupIds;
AddNetworkObjectClient(networkId, replicable);
using (m_tmpGroups)
{
replicable.GetStateGroups(m_tmpGroups);
Debug.Assert(ids.Count == m_tmpGroups.Count, "Number of state groups on client and server for replicable does not match");
for (int i = 0; i < m_tmpGroups.Count; i++)
{
if (m_tmpGroups[i] != replicable)
AddNetworkObjectClient(ids[i], m_tmpGroups[i]);
}
}
m_pendingReplicables.Remove(networkId);
m_eventBuffer.ProcessEvents(networkId, m_eventHandler);
m_sendStream.ResetWrite();
m_sendStream.WriteNetworkId(networkId);
m_callback.SendReplicableReady(m_sendStream);
}
else
{
// Replicable was already destroyed on server, during it's load on client
m_eventBuffer.RemoveEvents(networkId);
replicable.OnDestroy();
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:37,代码来源:MyReplicationClient.cs
示例5: GetAllChildren
void GetAllChildren(IMyReplicable replicable, List<IMyReplicable> resultList)
{
foreach (var child in GetChildren(replicable))
{
resultList.Add(child);
GetAllChildren(child, resultList);
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:8,代码来源:MyReplicables.cs
示例6: MyEntityPhysicsStateGroupWithSupport
public MyEntityPhysicsStateGroupWithSupport(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
m_onSupportMove = OnSupportMove;
m_onSupportVelocityChanged = OnSupportVelocityChanged;
if (Sync.IsServer)
OnMoved += PhysicsStateGroup_OnMoved;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:8,代码来源:MyEntityPhysicsStateGroupWithSupport.cs
示例7: MyStateDataEntry
public MyStateDataEntry(IMyReplicable owner, NetworkId groupId, IMyStateGroup group, IMyReplicable parent)
{
Priority = 0;
Owner = owner;
GroupId = groupId;
Group = group;
GroupType = group.GroupType;
Parent = parent;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:9,代码来源:MyStateDataEntry.cs
示例8: MyFloatingObjectPhysicsStateGroup
public MyFloatingObjectPhysicsStateGroup(MyFloatingObject entity, IMyReplicable owner)
: base(entity, owner)
{
m_lowPrecisionOrientation = true;
m_prioritySettings.AcceleratingPriority /= 2;
m_prioritySettings.LinearMovingPriority /= 2;
m_prioritySettings.StoppedPriority /= 2;
m_prioritySettings.AcceleratingUpdateCount *= 2;
m_prioritySettings.LinearMovingUpdateCount *= 2;
m_prioritySettings.StoppedUpdateCount *= 2;
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:12,代码来源:MyFloatingObjectPhysicsStateGroup.cs
示例9: Add
/// <summary>
/// Sets or resets replicable (updates child status and parent).
/// Returns true if replicable is root, otherwise false.
/// </summary>
public void Add(IMyReplicable replicable, out IMyReplicable parent)
{
if (replicable.IsChild && TryGetDependency(replicable, out parent)) // Add as child
{
AddChild(replicable, parent);
}
else // Add as root
{
parent = null;
m_roots.Add(replicable);
m_updateQueue.Add(replicable);
}
}
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:17,代码来源:MyReplicables.cs
示例10: RemoveClientReplicable
private void RemoveClientReplicable(IMyReplicable replicable, ClientData clientData)
{
foreach (var g in m_replicableGroups[replicable])
{
g.DestroyClientData(clientData.State);
clientData.StateGroups.Remove(g);
}
clientData.Replicables.Remove(replicable);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyReplicationServer.cs
示例11: MySmallObjectPhysicsStateGroup
public MySmallObjectPhysicsStateGroup(MyEntity entity, IMyReplicable owner)
: base(entity, owner)
{
m_positionValidation = ValidatePosition;
FindSupportDelegate = () => MySupportHelper.FindSupportForCharacter(Entity);
}
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:6,代码来源:MySmallObjectPhysicsStateGroup.cs
示例12: RemoveStateGroups
public void RemoveStateGroups(IMyReplicable replicable)
{
// Remove from actively replicating state groups and replicable
foreach (var client in m_clientStates.Values)
{
RemoveClientReplicable(replicable, client);
}
// Remove groups
foreach (var group in m_replicableGroups[replicable])
{
if (group != replicable)
RemoveNetworkedObject(group);
}
m_replicableGroups.Remove(replicable);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:16,代码来源:MyReplicationServer.cs
示例13: AddClientReplicable
private void AddClientReplicable(IMyReplicable replicable, ClientData clientData)
{
// Add replicable
clientData.Replicables.Add(replicable, new MyReplicableClientData());
// Add state groups
foreach (var group in m_replicableGroups[replicable])
{
var netId = GetNetworkIdByObject(group);
clientData.StateGroups.Add(group, new MyStateDataEntry(replicable, netId, group));
group.CreateClientData(clientData.State);
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:13,代码来源:MyReplicationServer.cs
示例14: PrepareForceReplicable
bool PrepareForceReplicable(IMyReplicable obj)
{
Debug.Assert(obj != null);
if (!IsTypeReplicated(obj.GetType()))
{
Debug.Fail(String.Format("Cannot replicate {0}, type is not replicated", obj));
return false;
}
NetworkId id;
if (!TryGetNetworkIdByObject(obj, out id))
{
Replicate(obj);
}
return true;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:16,代码来源:MyReplicationServer.cs
示例15: AddStateGroups
public void AddStateGroups(IMyReplicable replicable)
{
using (m_tmpGroups)
{
replicable.GetStateGroups(m_tmpGroups);
foreach (var group in m_tmpGroups)
{
if (group != replicable)
AddNetworkObjectServer(group);
}
m_replicableGroups.Add(replicable, new List<IMyStateGroup>(m_tmpGroups));
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:13,代码来源:MyReplicationServer.cs
示例16: MyGridPhysicsStateGroup
public MyGridPhysicsStateGroup(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
m_positionValidation = ValidatePosition;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:5,代码来源:MyGridPhysicsStateGroup.cs
示例17: MyGridPhysicsStateGroup
public MyGridPhysicsStateGroup(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
}
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:4,代码来源:MyGridPhysicsStateGroup.cs
示例18: IsReplicableReady
public bool IsReplicableReady(IMyReplicable replicable)
{
MyReplicableClientData info;
return Replicables.TryGetValue(replicable, out info) && !info.IsPending;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:5,代码来源:MyReplicationServer.cs
示例19: RefreshReplicable
private void RefreshReplicable(IMyReplicable replicable)
{
MyTimeSpan now = m_timeFunc();
foreach (var client in m_clientStates)
{
MyReplicableClientData replicableInfo;
bool hasObj = client.Value.Replicables.TryGetValue(replicable, out replicableInfo);
bool isRelevant = replicable.GetPriority(client.Value.State) > 0;
if(isRelevant)
{
var dependency = replicable.GetDependency();
isRelevant = dependency == null || client.Value.IsReplicableReady(dependency);
}
if (!hasObj && isRelevant)
{
AddForClient(replicable, client.Key, client.Value);
}
else if (hasObj)
{
// Hysteresis
replicableInfo.UpdateSleep(isRelevant, now);
if (replicableInfo.ShouldRemove(now, MaxSleepTime))
RemoveForClient(replicable, client.Key, client.Value, true);
}
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:28,代码来源:MyReplicationServer.cs
示例20: ResetForClients
/// <summary>
/// Destroys replicable for all clients (used for testing and debugging).
/// </summary>
public void ResetForClients(IMyReplicable obj)
{
foreach(var client in m_clientStates)
{
if(client.Value.Replicables.ContainsKey(obj))
{
RemoveForClient(obj, client.Key, client.Value, true);
}
}
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:13,代码来源:MyReplicationServer.cs
注:本文中的IMyReplicable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论