Beispiel #1
0
        public static async void LoadLevels()
        {
            Settings.GetInstance().RestoreAllSettings();

            bool res = await LoadDBAsync();

            if (!res)
            {
                MessageBox.Show("Не удалось загрузить базу данных " + Settings.GetInstance().AttachedDBCardsFilename, "Ошибка загрузки БД", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Random random = new Random();

            //Перемешиваем уровни  //что за алгоритм - хз - раньше работал вроде
            //for (int i = DB.Levels.Count - 1; i >= 1; i--)
            //{
            //    int j = random.Next(i+1);
            //    var tmpLevel = DB.Levels[j];
            //    DB.Levels[j] = DB.Levels[i];
            //    DB.Levels[i] = tmpLevel;
            //}
            Console.WriteLine("Repack Levels");
            foreach (var level in DBTools.Context.Levels)
            {
                VGameCore.Struct.Level NewLevel = new CardsNewDBLevel(level);
                Game.Levels.Enqueue(NewLevel);
            }
            Console.WriteLine("End repack Levels");
            Settings.GetInstance().AddRecentlyDBFilename(Settings.GetInstance().AttachedDBCardsFilename);
            ((SettingsWindowVM)Game.SettingsWindow.DataContext).RefreshAllDependencyProperties();
            AddLevelsInPrevMenu();
        }
Beispiel #2
0
        public static void LoadSetsFromDBRecord(CardsNewDBLevel Level)
        {
            Level.Scenes.Clear();
            Level.Sets.Name        = Level.DbLevelRecord.Name;
            Level.Sets.Description = Level.Sets.Name;
            Level.Sets.PreviewURL  = Level.DbLevelRecord.ImageAddress;
            Level.Sets.PreviewType = "local";
            Scene NewScene = new CardsNewDBScene(Level);

            Level.Scenes.Add(NewScene.Name, NewScene);
        }
Beispiel #3
0
        public CardsNewDBScene(CardsNewDBLevel _Level) : base(_Level, _Level.Sets.Name)
        {
            this.Level    = _Level;
            Sets          = new SceneSets(_Level, this);
            numberDBLevel = _Level;
            GetComponent <Loader>().LoadSets    = LoadSets;
            GetComponent <Loader>().LoadContent = LoadContent;

            GetComponent <Starter>().StartElements.Add(Start);

            UnitsCol        = new UnitsCollection <CardUnit>("UnitsCollection", this);
            ReadyToNextUnit = true;
        }
Beispiel #4
0
        public void SceneEnded(Scene SL, CardsNewDBLevel level)
        {
            foreach (var u in UnitsCol.GetAllUnits())
            {
                u.MouseClicked -= U_MouseClicked;
            }

            Game.Owner.TextForCardTag.Text          = "";
            Game.UserActivity.UserDoSomethingEvent -= UserDoSomething;

            Game.Music.Pause();
            Game.Owner.WrapPanelMain.Children.Clear();

            speakAgainTimer?.Dispose();
            flashTimer?.Dispose();

            level.NextScene();
        }