示例#1
0
文件: Item.cs 项目: rbergen/R136.NET
        public static void TakeSnapshots(ISnapshotContainer container, IReadOnlyDictionary <ItemID, Item> items)
        {
            container.Items = items.Values
                              .Where(item => item is not Flashlight)
                              .Select(item => item.TakeSnapshot())
                              .ToArray();

            container.Flashlight = (items[ItemID.Flashlight] as Flashlight)?.TakeSnapshot();
        }
示例#2
0
文件: Item.cs 项目: rbergen/R136.NET
        public static bool RestoreSnapshots(ISnapshotContainer container, IReadOnlyDictionary <ItemID, Item> items)
        {
            bool result = true;

            if (container.Items != null)
            {
                foreach (var item in container.Items)
                {
                    result &= items ![item.ID].RestoreSnapshot(item);
示例#3
0
        public static bool RestoreSnapshots(ISnapshotContainer container, IReadOnlyDictionary <AnimateID, Animate> animates)
        {
            if (container.Animates == null)
            {
                return(false);
            }

            bool result = true;

            foreach (var animate in container.Animates)
            {
                result &= animates[animate.ID].RestoreSnapshot(animate);
            }

            return(result);
        }
示例#4
0
 public static void TakeSnapshots(ISnapshotContainer container, IReadOnlyDictionary <AnimateID, Animate> animates)
 => container.Animates = animates.Values
                         .Select(animate => animate.TakeSnapshot())
                         .ToArray();