コード例 #1
0
ファイル: ActionSet.cs プロジェクト: sergeev/NexusForever
        /// <summary>
        /// Remove one or more AMP's from <see cref="ActionSet"/> depending on supplied <see cref="AmpRespecType"/>.
        /// </summary>
        public void RemoveAmp(AmpRespecType type, uint value)
        {
            switch (type)
            {
            case AmpRespecType.Full:
            {
                foreach (ActionSetAmp amp in Amps.ToList())
                {
                    RemoveAmp(amp);
                }
                break;
            }

            case AmpRespecType.Section:
            {
                foreach (ActionSetAmp amp in Amps
                         .ToList()
                         .Where(a => a.Entry.EldanAugmentationCategoryId == value))
                {
                    RemoveAmp(amp);
                }
                break;
            }

            case AmpRespecType.Single:
            {
                ActionSetAmp amp = GetAmp((ushort)value);
                RemoveAmp(amp);
                break;
            }

            default:
                throw new ArgumentException();
            }
        }
コード例 #2
0
ファイル: ActionSet.cs プロジェクト: sergeev/NexusForever
        private void RemoveAmp(ActionSetAmp amp)
        {
            if (amp == null)
            {
                throw new ArgumentNullException();
            }

            checked
            {
                AmpPoints += (byte)amp.Entry.PowerCost;
            }

            if (amp.PendingCreate)
            {
                amps.Remove((ushort)amp.Entry.Id);
            }
            else
            {
                amp.EnqueueDelete(true);
                saveMask |= ActionSetSaveMask.ActionSetAmps;
            }

            log.Trace($"Removed AMP {amp.Entry.Id} from action set {Index}.");
        }