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


C# IMyReplicable.GetDependency方法代码示例

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


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

示例1: TryGetDependency

 bool TryGetDependency(IMyReplicable replicable, out IMyReplicable parent)
 {
     parent = replicable.GetDependency();
     return parent != null;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:5,代码来源:MyReplicables.cs

示例2: 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

示例3: RefreshReplicable

        private void RefreshReplicable(IMyReplicable replicable)
        {
            ProfilerShort.Begin("m_timeFunc");
            MyTimeSpan now = m_timeFunc();
            ProfilerShort.End();

            foreach (var client in m_clientStates)
            {
                ProfilerShort.Begin("RefreshReplicablePerClient");

                ProfilerShort.Begin("TryGetValue Replicables");
                MyReplicableClientData replicableInfo;
                bool hasObj = client.Value.Replicables.TryGetValue(replicable, out replicableInfo);
                ProfilerShort.End();

                ProfilerShort.Begin("GetPriority");
                ProfilerShort.Begin(replicable.GetType().Name);
                float priority = replicable.GetPriority(new MyClientInfo(client.Value));

                if (hasObj)
                {
                    replicableInfo.Priority = priority;
                }

                bool isRelevant = priority > 0;
                ProfilerShort.End();
                ProfilerShort.End();

                if (isRelevant && !hasObj)
                {
                    ProfilerShort.Begin("CheckReady");
                    var dependency = replicable.GetDependency();
                    isRelevant = dependency == null || client.Value.IsReplicableReady(dependency);
                    ProfilerShort.End();

                    if (isRelevant)
                    {
                        ProfilerShort.Begin("AddForClient");
                        AddForClient(replicable, client.Key, client.Value, priority, false);
                        ProfilerShort.End();
                    }
                }
                else if (hasObj)
                {
                    ProfilerShort.Begin("UpdateSleepAndRemove");
                    // Hysteresis
                    replicableInfo.UpdateSleep(isRelevant, now);
                    if (replicableInfo.ShouldRemove(now, MaxSleepTime))
                        RemoveForClient(replicable, client.Key, client.Value, true);
                    ProfilerShort.End();
                }

                ProfilerShort.End();
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:55,代码来源:MyReplicationServer.cs


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