예제 #1
0
        public void Save(CharacterContext context)
        {
            if (saveMask == SaveMask.None)
            {
                return;
            }

            var model = new CharacterEntitlementModel
            {
                Id            = characterId,
                EntitlementId = (byte)Type,
                Amount        = amount
            };

            if ((saveMask & SaveMask.Create) != 0)
            {
                context.Add(model);
            }
            else
            {
                EntityEntry <CharacterEntitlementModel> entity = context.Attach(model);
                entity.Property(p => p.Amount).IsModified = true;
            }

            saveMask = SaveMask.None;
        }
예제 #2
0
        public override void Save(CharacterContext context)
        {
            if (saveMask == SaveMask.None)
            {
                return;
            }

            if ((saveMask & SaveMask.Create) != 0)
            {
                context.Add(new CharacterAchievementModel
                {
                    Id            = characterId,
                    AchievementId = Id,
                    Data0         = Data0,
                    Data1         = Data1,
                    DateCompleted = DateCompleted
                });
            }
            else
            {
                var model = new CharacterAchievementModel
                {
                    Id            = characterId,
                    AchievementId = Id
                };

                EntityEntry <CharacterAchievementModel> entity = context.Attach(model);
                if ((saveMask & SaveMask.Data0) != 0)
                {
                    model.Data0 = Data0;
                    entity.Property(p => p.Data0).IsModified = true;
                }
                if ((saveMask & SaveMask.Data1) != 0)
                {
                    model.Data1 = Data1;
                    entity.Property(p => p.Data1).IsModified = true;
                }
                if ((saveMask & SaveMask.TimeCompleted) != 0)
                {
                    model.DateCompleted = DateCompleted;
                    entity.Property(p => p.DateCompleted).IsModified = true;
                }
            }

            saveMask = SaveMask.None;
        }
예제 #3
0
        public void Save(CharacterContext context)
        {
            if ((saveMask & BindingSaveMask.Create) != 0)
            {
                var model = new CharacterKeybinding
                {
                    Id              = Owner,
                    InputActionId   = InputActionId,
                    DeviceEnum00    = DeviceEnum00,
                    DeviceEnum01    = DeviceEnum01,
                    DeviceEnum02    = DeviceEnum02,
                    Code00          = Code00,
                    Code01          = Code01,
                    Code02          = Code02,
                    MetaKeys00      = MetaKeys00,
                    MetaKeys01      = MetaKeys01,
                    MetaKeys02      = MetaKeys02,
                    EventTypeEnum00 = EventTypeEnum00,
                    EventTypeEnum01 = EventTypeEnum01,
                    EventTypeEnum02 = EventTypeEnum02
                };
                context.Add(model);
            }
            else
            {
                var model = new CharacterKeybinding
                {
                    Id            = Owner,
                    InputActionId = InputActionId
                };

                if ((saveMask & BindingSaveMask.Delete) != 0)
                {
                    context.Entry(model).State = EntityState.Deleted;
                }
                else
                {
                    EntityEntry <CharacterKeybinding> entity = context.Attach(model);

                    if ((saveMask & BindingSaveMask.DeviceEnum00) != 0)
                    {
                        model.DeviceEnum00 = DeviceEnum00;
                        entity.Property(p => p.DeviceEnum00).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.DeviceEnum01) != 0)
                    {
                        model.DeviceEnum01 = DeviceEnum01;
                        entity.Property(p => p.DeviceEnum01).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.DeviceEnum02) != 0)
                    {
                        model.DeviceEnum02 = DeviceEnum02;
                        entity.Property(p => p.DeviceEnum02).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.Code00) != 0)
                    {
                        model.Code00 = Code00;
                        entity.Property(p => p.Code00).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.Code01) != 0)
                    {
                        model.Code01 = Code01;
                        entity.Property(p => p.Code01).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.Code02) != 0)
                    {
                        model.Code02 = Code02;
                        entity.Property(p => p.Code02).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.MetaKeys00) != 0)
                    {
                        model.MetaKeys00 = MetaKeys00;
                        entity.Property(p => p.MetaKeys00).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.MetaKeys01) != 0)
                    {
                        model.MetaKeys01 = MetaKeys01;
                        entity.Property(p => p.MetaKeys01).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.MetaKeys02) != 0)
                    {
                        model.MetaKeys02 = MetaKeys02;
                        entity.Property(p => p.MetaKeys02).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.EventTypeEnum00) != 0)
                    {
                        model.EventTypeEnum00 = EventTypeEnum00;
                        entity.Property(p => p.EventTypeEnum00).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.EventTypeEnum01) != 0)
                    {
                        model.EventTypeEnum01 = EventTypeEnum01;
                        entity.Property(p => p.EventTypeEnum01).IsModified = true;
                    }

                    if ((saveMask & BindingSaveMask.EventTypeEnum02) != 0)
                    {
                        model.EventTypeEnum02 = EventTypeEnum02;
                        entity.Property(p => p.EventTypeEnum02).IsModified = true;
                    }

                    saveMask = BindingSaveMask.None;
                }
            }
        }