示例#1
0
        /// <summary>
        /// Waits for completion of all updates and then fires the rebuild events if
        /// necessary.
        /// </summary>
        private void WaitForCompletion()
        {
            var inst = Game.Instance;

            if (running && inst != null && inst.IsInitialized() && !inst.IsLoading())
            {
                if (!onComplete.WaitAndMeasure(FastTrackMod.MAX_TIMEOUT))
                {
                    PUtil.LogWarning("Conduit updates did not finish within the timeout!");
                }
                // They are always clean after running
                if (updated[0])
                {
                    ConduitUtilityNetworkUpdater.TriggerEvent(inst.gasConduitSystem);
                }
                if (updated[1])
                {
                    ConduitUtilityNetworkUpdater.TriggerEvent(inst.liquidConduitSystem);
                }
                if (updated[2])
                {
                    SolidUtilityNetworkUpdater.TriggerEvent(inst.solidConduitSystem);
                }
                running = false;
            }
        }
示例#2
0
        public void InternalDoWorkItem(int index)
        {
            var inst = Game.Instance;

            if (inst != null && inst.IsInitialized() && !inst.IsLoading())
            {
                switch (index)
                {
                case 0:
                    updated[0] = inst.gasConduitSystem.IsDirty;
                    ConduitUtilityNetworkUpdater.Update(inst.gasConduitSystem);
                    break;

                case 1:
                    updated[1] = inst.liquidConduitSystem.IsDirty;
                    ConduitUtilityNetworkUpdater.Update(inst.liquidConduitSystem);
                    break;

                case 2:
                    updated[2] = inst.solidConduitSystem.IsDirty;
                    SolidUtilityNetworkUpdater.Update(inst.solidConduitSystem);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(index), index,
                                                          "Must be from 0 to " + (Count - 1));
                }
            }
        }