コード例 #1
0
        public CardsNewDBLevel(Model.Level _DbLevelRecord) : base()
        {
            DbLevelRecord = DBTools.Context.Levels.Find(_DbLevelRecord.Id);
            if (DbLevelRecord == null)
            {
                DbLevelRecord = _DbLevelRecord;
            }
            Sets = new LevelSets(this);

            GetComponent <Loader>().LoadSets    = LoadSets;
            GetComponent <Loader>().LoadContent = LoadContent;
            GetComponent <Starter>().StartElements.Add(Start);
        }
コード例 #2
0
        private void Start()
        {
            if (IsAborted)
            {
                return;
            }
            CurLevelPassing = new LevelPassing()
            {
                DateAndTime = DateTime.Now.ToString()
            };
            LevelPassings.Add(CurLevelPassing);
            DBTools.Context.Entry(DbLevelRecord).State = System.Data.Entity.EntityState.Modified;
            DBTools.Context.SaveChanges();
            OnPropertyChanged("LevelPassingsCount");
            OnPropertyChanged("CardsCount");
            OnPropertyChanged("AvgCardsErrorsPercentInLast3LevelPassings");

            int id = DbLevelRecord.Id;
            var RefreshedDbLevelRecord = DBTools.Context.Levels.Find(id);

            if (RefreshedDbLevelRecord != null)
            {
                DbLevelRecord = RefreshedDbLevelRecord;
            }

            LoadMedia();
            LoadScenes();
            if (Settings.GetInstance().ShuffleMusic)
            {
                Game.Music.PlayRandom(Settings.GetInstance().RepeatMusicPlaylist);
            }
            else
            {
                Game.Music.PlayInOrder(Settings.GetInstance().RepeatMusicPlaylist);
            }
            Game.Music.Pause();

            CurScene.GetComponent <Starter>().Start();
            Game.Owner.AbortLevelButton.Visibility = Visibility.Visible;
        }