Example #1
0
        /// <summary>
        /// Strong Construction. Start a 'Normal' game
        /// <see cref="Init"/>, then <see cref="InitFX"/>, then <see cref="StartRender"/>
        /// </summary>
        /// <param name="aMap">Puzzle to play</param>
        public GameUI(Puzzle aPuzzle, PuzzleMap aMap, ISoundSubSystem sfx)
            : base(aPuzzle, aMap.Map)
        {
            solution = null;
            puzzleMap = aMap;

            initType = InitTypes.NewGame;

            GameCoords = new GameCoords(this);
            StepCurrent = 0;

            ResourceManager = ResourceFactory.Singleton.GetInstance("Default.GameTiles");
            GameCoords.GlobalTileSize = new SizeInt(32, 32);

            nodes = new List<NodeBase>();
            nodesToRemove = new List<NodeBase>();
            nodesToAdd = new List<NodeBase>();

            // I would like to move this somewhere else
            sound = sfx;
            sfxWelcome = sound.GetHandle("Welcome.wav");
            sfxUndo = sound.GetHandle("sound40.wav");
            sfxRestart = sound.GetHandle("sound31.wav");

            // Add blank bookmarks
            Add((Bookmark)null);
            Add((Bookmark)null);
            Add((Bookmark)null);
            Add((Bookmark)null);
            Add((Bookmark)null);
        }
Example #2
0
        /// <summary>
        /// Strong Construction. Start a 'Normal' game
        /// <see cref="Init"/>, then <see cref="InitFX"/>, then <see cref="StartRender"/>
        /// </summary>
        /// <param name="aMap">Puzzle to play</param>
        public GameUI(Puzzle aPuzzle, PuzzleMap aMap, ISoundSubSystem sfx)
            : base(aPuzzle, aMap.Map)
        {
            solution = null;
            puzzleMap = aMap;

            initType = InitTypes.NewGame;

            GameCoords = new GameCoords(this);
            StepCurrent = 0;

            ResourceFactory = ResourceController.Singleton.GetInstance("Default.GameTiles");
            GameCoords.GlobalTileSize = new SizeInt(48, 48);

            nodes = new List<NodeBase>();
            nodesToRemove = new List<NodeBase>();
            nodesToAdd = new List<NodeBase>();

            // I would like to move this somewhere else
            sound = sfx;

            // Add blank bookmarks
            Add((Bookmark)null);
            Add((Bookmark)null);
            Add((Bookmark)null);
            Add((Bookmark)null);
            Add((Bookmark)null);
        }
        //Метод для реинициализации трекера, принимает в себя тип детектирования и изображение
        //Возвращает инициализированный трекер
        public static MultiTracker Reinit_Tracker(InitTypes type, Mat frame)
        {
            //Результаты детектирования для иницилазиции KFC трекеров
            List <Rectangle> Result = new List <Rectangle>();

            //Детектирование с помощью каскадов Хаара
            if (type == InitTypes.Haar)
            {
                var Rects = Haar.DetectMultiScale(frame, HScaleFactor, HMinNeighbors, HMinSize, HMaxSize);
                foreach (var rect in Rects)
                {
                    if (rect != null)
                    {
                        Result.Add(rect);
                    }
                }
            }
            //Детектирования с помощью Хог дескриптора
            else
            {
                var RowRects = Hog.DetectMultiScale(frame, 0, HogWinStride, scale: HogScaleFactor);
                foreach (var rowRect in RowRects)
                {
                    Result.Add(rowRect.Rect);
                }
            }
            //Инициализация KCF трекерами
            var TTracker = new MultiTracker();

            foreach (var rect in Result)
            {
                TTracker.Add(new TrackerKCF(), frame, rect);
            }
            return(TTracker);
        }
 //Step 2
 public bool InitBase(InitTypes initType, Dictionary <int, Dictionary <int, byte[]> > fingerPrints, out string strError)
 {
     this.InitType = initType;
     strError      = "";
     if (this.IsInit)
     {
         return(true);
     }
     this.FingerPrints = fingerPrints;
     this._lstControlPackets.Clear();
     this.IsInit = Init(initType, fingerPrints, out strError);
     return(this.IsInit);
 }
 //Обработчик на смену значения свитча метода детектирования
 private void InitModeSwitch_Click(object sender, RoutedEventArgs e)
 {
     //Если он активен, то присваиваем текущему методу каскад
     if ((bool)InitModeSwitch.IsChecked)
     {
         InType = InitTypes.Haar;
     }
     //Если же нет, то Хог дескриптор
     else
     {
         InType = InitTypes.Hog;
     }
     //Перерисовываем
     RedrawComponents();
 }
 protected abstract bool Init(InitTypes initType, Dictionary<int, Dictionary<int, byte[]>> fingerPrints, out string strError);
 //Step 2
 public bool InitBase(InitTypes initType, Dictionary<int, Dictionary<int, byte[]>> fingerPrints, out string strError)
 {
     this.InitType = initType;
     strError = "";
     if (this.IsInit)
     {
         return true;
     }
     this.FingerPrints = fingerPrints;
     this._lstControlPackets.Clear();
     this.IsInit = Init(initType, fingerPrints, out strError);
     return this.IsInit;
 }
Example #8
0
        /// <summary>
        /// Strong Construction. Replay a solution
        /// </summary>
        /// <param name="aPuzzle"></param>
        /// <param name="aMap"></param>
        /// <param name="aSolution"></param>
        public GameUI(Puzzle aPuzzle, PuzzleMap aMap, Solution aSolution)
            : base(aPuzzle, aMap.Map)
        {
            solution = aSolution;
            puzzleMap = aMap;

            initType = InitTypes.SolutionReplay;

            GameCoords = new GameCoords(this);
            StepCurrent = 0;

            ResourceManager = ResourceFactory.Singleton.GetInstance("Default.GameTiles");
            GameCoords.GlobalTileSize = new SizeInt(32, 32);

            nodes = new List<NodeBase>();
            nodesToRemove = new List<NodeBase>();
            nodesToAdd = new List<NodeBase>();
        }
Example #9
0
 /// <summary>
 /// Undo a single move
 /// </summary>
 public override void Undo()
 {
     initType = InitTypes.Undo;
     base.Undo();
     Init();
 }
Example #10
0
        /// <summary>
        /// Start the game
        /// </summary>
        public void StartSolution()
        {
            initType = InitTypes.SolutionReplay;
            Init();
            Active = true;

            foreach (Direction dir in solution.ToPath().Moves)
            {
                Player.doMove(dir);
            }
        }
Example #11
0
 /// <summary>
 /// Start the game
 /// </summary>
 public void Start()
 {
     initType = InitTypes.NewGame;
     Init();
     Active = true;
 }
Example #12
0
 /// <summary>
 /// Reset/Restart the puzzle to its initial condition
 /// </summary>
 public override void Reset(Bookmark bookMark)
 {
     initType = InitTypes.Restart;
     base.Reset(bookMark);
     Init();
 }
Example #13
0
 /// <summary>
 /// Reset/Restart the puzzle to its initial condition
 /// </summary>
 public override void Reset()
 {
     initType = InitTypes.Restart;
     base.Reset();
     Init();
 }
 protected abstract bool Init(InitTypes initType, Dictionary <int, Dictionary <int, byte[]> > fingerPrints, out string strError);
Example #15
0
 public static void SetInitType(InitTypes init)
 {
     GameSetup.Init = init;
 }