Esempio n. 1
0
        protected override void Initialize()
        {
            Setting setting = Setting.Create();

            Global.MusicEnabled = setting.Get <bool>("music");
            Global.SFXEnabled   = setting.Get <bool>("sfx");
            Global.Control      = setting.Get <int>("control").Cast <ControlTypes>();


            //need to check if android can actually store longs
            for (int i = 0; i < Global.HighScores.Length; i++)
            {
                Global.HighScores[i]     = TimeSpan.FromTicks(setting.Get <long>(String.Format("HighScore{0}", i)));
                Global.HighScoresType[i] = setting.Get <int>(String.Format("HighScoreControl{0}", i)).Cast <ControlTypes>();
                Global.HighScoreDates[i] = new DateTime(setting.Get <long>(String.Format("HighScoresDate{0}", i)));
            }


            Global.PlayTutorial = true;

            setting.Set("music", Global.MusicEnabled, typeof(bool));
            setting.Set("sfx", Global.SFXEnabled, typeof(bool));
            setting.Set("control", Global.Control.ToInt(), typeof(int));

            for (int i = 0; i < Global.HighScores.Length; i++)
            {
                setting.Set(String.Format("HighScore{0}", i), Global.HighScores[i].Ticks, typeof(long));
                setting.Set(String.Format("HighScoreControl{0}", i), Global.HighScoresType[i].ToInt(), typeof(int));
                setting.Set(String.Format("HighScoresDate{0}", i), Global.HighScoreDates[i].Ticks, typeof(long));
            }
#if !WINDOWS
            TouchManager touchManager = TouchManager.Create(this);
            touchManager.GestureTypes = GestureType.DragComplete | GestureType.Flick | GestureType.HorizontalDrag | GestureType.FreeDrag | GestureType.Tap;

            Components.Add(touchManager);
            //TouchPanel.EnabledGestures = GestureType.DragComplete | GestureType.VerticalDrag | GestureType.HorizontalDrag | GestureType.Tap;
#else
            Components.Add(KeyBoardManager.Create(this));
            Components.Add(MouseManager.Create(this));
            Global.Control = ControlTypes.Tap;
#endif



            //TargetElapsedTime = TimeSpan.FromMilliseconds(1000f / 30f);
            //IsFixedTimeStep = false;

            base.Initialize();
        }