示例#1
0
    public GamePage()
    {
        InitializeComponent();
        _game = XamlGame <LoonieGame> .Create("", this);

        this.Unloaded += GamePage_Unloaded;
    }
示例#2
0
        // Constructor
        public GamePage()
        {
            AppLoaded = false;

            InitializeComponent();

            if (Instance != null)
            {
                throw new InvalidOperationException("There can be only one GamePage object!");
            }
            Instance = this;

            this.Loaded      += GamePage_Loaded;
            adView.Visibility = Visibility.Collapsed;

            //vserv ad
            vservAdControl = VservAdControl.Instance;
            vservAdControl.VservAdNoFill += vservAdControl_VservAdNoFill;
            vservAdControl.SetRefreshRate(30);
            vservAdControl.SetRequestTimeOut(30);
            //end vserv ad

            //google admob
            admobBanner = new AdView
            {
                Format   = AdFormats.Banner,
                AdUnitID = "ca-app-pub-0642081750064354/3748100349"
            };
            admobBanner.ReceivedAd        += admobBanner_ReceivedAd;
            admobBanner.FailedToReceiveAd += admobBanner_FailedToReceiveAd;
            admobRequest = new AdRequest();
            //google admob

            _game = XamlGame <Main> .Create("", this);
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            //Copy test files to isolatedstorage if needed
            if (!IsolatedStorageSettings.ApplicationSettings.Contains("Copiedinitialfiles"))
            {
                IsolatedStorageSettings.ApplicationSettings.Add("Copiedinitialfiles", true);

                var resource = App.GetResourceStream(new Uri("/RepRap Phone Host;component/test.stl", UriKind.Relative));

                var file = IsolatedStorageFile.GetUserStoreForApplication();

                var stream = new IsolatedStorageFileStream("test.stl", System.IO.FileMode.CreateNew, file);

                byte[] bytes = new byte[resource.Stream.Length];

                resource.Stream.Read(bytes, 0, bytes.Length);

                stream.Write(bytes, 0, bytes.Length);

                resource.Stream.Dispose();
                stream.Dispose();

                var resource2 = App.GetResourceStream(new Uri("/RepRap Phone Host;component/test.gcode", UriKind.Relative));

                var stream2 = new IsolatedStorageFileStream("test.gcode", System.IO.FileMode.CreateNew, file);

                bytes = new byte[resource2.Stream.Length];

                resource2.Stream.Read(bytes, 0, bytes.Length);

                stream2.Write(bytes, 0, bytes.Length);

                resource2.Stream.Dispose();
                stream2.Dispose();
            }

            renderingController = XamlGame <RenderingController> .Create("", this);

            //All the pivot item constructrs should be called here
            Construct_StlPivot();
            Construct_SlicerPivot();
            Construct_GCodePivot();
            Construct_GCode_TextPivot();
            Construct_ConnectionPivot();//This has to be called before the controlpivot because the cocontroller gets initialised first
            Construct_ControlPivot();
            Construct_SettingsPivot();
            Construct_FilesPivot();

            BackKeyPress += PhoneApplicationPage_BackKeyPress;

            Values.GCode_Items = FileFinder.findFilesAndCreateList("GCode", ".gcode");
            Values.Stl_Items   = FileFinder.findFilesAndCreateList("Stl", ".stl");

            if (Values.startFileType == "gcode")
            {
                MainPivot.SelectedItem = GCodePivot;
            }
        }
示例#4
0
        public GamePage(string launchArguments)
        {
            this.InitializeComponent();

            // Create the game.
            _game = XamlGame <Game1> .Create(launchArguments, Window.Current.CoreWindow, this);
        }
示例#5
0
        public void StlPivot_Load()
        {
            if (Values.stl_IsBusy)
            {
                return;
            }

            Values.currentStlFileChangedEvent += Stl_currentStlFileChangedEvent;

            if (Values.currentStlFile == "")
            {
                return;
            }

            try
            {
                XamlGame.assignDrawingSurface(renderingController, StlSurface, ref drawingSurfaceUpdateHandler);
                renderingController.Components.Add(new StlComponent(renderingController, this));
                (renderingController.Components[0] as StlComponent).loadStlContent();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
        }
示例#6
0
        public MainPage()
        {
            InitializeComponent();

            ApplicationView.PreferredLaunchViewSize      = new Size(_width, _height);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            var launchArguments = string.Empty;

            _game = XamlGame <RellowBootstrap> .Create(
                gameConstructor : () => new RellowBootstrap(
                    textFileAssetsLoader: new UWPTextFileImporter(),
                    settingsRepository: new UWPSettingsRepository(),
                    webPageOpener: new UWPWebPageOpener(Window.Current),
                    gameCulture: CultureInfo.CurrentCulture,
                    isPc: true,
                    isFullScreen: false,
                    rateMeUri: new Uri("https://www.microsoft.com/store/apps/9N5JJ68QFBPB"),
                    deviceWidth: _width, deviceHeight: _height),
                window : Window.Current.CoreWindow,
                launchParameters : launchArguments,
                swapChainPanel : swapChainPanel);

            Window.Current.VisibilityChanged += Current_VisibilityChanged;
        }
示例#7
0
        public GamePage(LaunchActivatedEventArgs args)
        {
            this.InitializeComponent();

            // Create the game.
            _game = XamlGame <Game1> .Create(args, Window.Current.CoreWindow, this);
        }
示例#8
0
        public static void Create(CCApplicationDelegate appDelegate, string launchParameters, PhoneApplicationPage page)
        {
            var game = XamlGame <CCGame> .Create(launchParameters, page);

            var instance = new CCApplication(game);

            instance.ApplicationDelegate = appDelegate;
        }
示例#9
0
        public GamePage(string launchArguments)
        {
            game = XamlGame <Game1> .Create(launchArguments, Window.Current.CoreWindow, this);

            controlClient = game.Services.GetService(typeof(IControlClient)) as IControlClient;
            DataContext   = new AuthoringViewModel(controlClient);
            this.InitializeComponent();
        }
示例#10
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();
            _game = XamlGame <Game1> .Create("", this);

            //kick off timer to check for advert changes
            DispatcherTimerSetup();
        }
        public GamePage()
        {
            InitializeComponent();
            // Create the game.
            var launchArguments = string.Empty;

            _game = XamlGame <BasicOne> .Create(launchArguments, Window.Current.CoreWindow, swapChainPanel);
        }
示例#12
0
        public GamePage(string launchArguments)
        {
            this.InitializeComponent();

            _impl = new WinPhoneBridge();
            _game = XamlGame <MainGame> .Create(launchArguments, Window.Current.CoreWindow, this);

            _game.Construct(_impl);
        }
示例#13
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <DeviceCapabilitiesGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#14
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <SoundEffectInstancesGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#15
0
        public MainPage()
        {
            this.InitializeComponent();

            // Create the game.
            var launchArguments = string.Empty;

            _game = XamlGame <Game1> .Create(launchArguments, Window.Current.CoreWindow, SwapChainPanel);
        }
示例#16
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <HitTestingGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#17
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <CosmicRocksPartIIIGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <XnaVoxViewer.VoxViewer> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#19
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <Game1> .Create("", XnaSurface);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <SpritesAndSolidsGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#21
0
        public GamePage()
        {
            InitializeComponent();

            // Create the game.
            var launchArguments = string.Empty;

            XamlGame <Arkanoid> .Create(launchArguments, Window.Current.CoreWindow, SwapChainPanel);
        }
示例#22
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <VertexAndIndexBuffersGame> .Create("", this);

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#23
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <Game1> .Create("", this);

            ScalingClever.ResolutionScaling.SetupScreenAutoScaling(this, this.XnaSurface);
            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
        /// <summary>
        /// Class constructor
        /// </summary>
        public GamePage()
        {
            InitializeComponent();

            // Set the current instance of the page so that the game can access it
            Current = this;

            // Create the game
            _game = XamlGame <MonoGameAndXAMLGame> .Create("", this);
        }
示例#25
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var info = e.Parameter as GameDetected;

            Info  = info;
            _game = XamlGame <ScummGame> .Create("", Window.Current.CoreWindow, GamePanel);

            _menuService.Game = _game;
            _game.Services.AddService <IMenuService>(_menuService);
        }
        /// <summary>
        /// Class constructor
        /// </summary>
        public GamePage(string launchArguments)
        {
            this.InitializeComponent();

            // Set the current instance of the page so that the game can access it
            Current = this;

            // Create the game
            _game = XamlGame <MonoGameAndXAMLGame> .Create(launchArguments, Window.Current.CoreWindow, this);
        }
示例#27
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            this.game = XamlGame <GameManager> .Create("", this);

            this.dataStorageManager      = new DataStorageManager();
            this.game.DataStorageManager = this.dataStorageManager;
            this.Loaded += (sender, e) =>
            {
                GoogleAnalytics.EasyTracker.GetTracker().SendView("Game");
            };

            this.BackKeyPress     += GamePage_BackKeyPress;
            this.game.Exiting     += (sender, e) => App.Current.Terminate();
            this.game.GameStarted += () => this.Dispatcher.BeginInvoke(new Action(() => this.AddViewControl.Visibility = System.Windows.Visibility.Collapsed));
            this.game.GameStoped  += () => this.Dispatcher.BeginInvoke(new Action(() => this.AddViewControl.Visibility = System.Windows.Visibility.Visible));
            this.game.GameOver    += () => this.Dispatcher.BeginInvoke(new Action(() =>
            {
                this.AddViewControl.Visibility = System.Windows.Visibility.Visible;
                this.UpdatesOnlineScores();
            }));
            this.Unloaded  += (sender, e) => this.game.StopGame();
            this.GotFocus  += (sender, e) => this.game.PauseGame();
            this.LostFocus += (sender, e) => this.game.PauseGame();


            // remove after few versions (added in 1.4 along with online score
            {
                string userName = this.dataStorageManager.GetDataOrDefault("UserName", string.Empty);
                if (!string.IsNullOrEmpty(userName))
                {
                    this.dataStorageManager.AddOrUpdateData("PlayerName", userName);
                }

                string normalScore = this.dataStorageManager.GetDataOrDefault("normalMaxScore", "0");
                if (!normalScore.Equals("0"))
                {
                    this.dataStorageManager.AddOrUpdateData("NormalMaxScore", normalScore);
                }

                string hardScore = this.dataStorageManager.GetDataOrDefault("hardMaxScore", "0");
                if (!hardScore.Equals("0"))
                {
                    this.dataStorageManager.AddOrUpdateData("HardMaxScore", hardScore);
                }
            }

            // set user for online scoring
            this.game.RefreshScores();
            this.InitializeOnlineScoreManager();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#28
0
        // Constructor
        public GamePage()
        {
            InitializeComponent();

            _game = XamlGame <TheGame> .Create("", XnaSurface);

            //DebugLabel.Text = GameConfig.DBPATH;

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        }
示例#29
0
        public MainPage(LaunchActivatedEventArgs e)
        {
            var ppv    = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
            var bounds = Window.Current.CoreWindow.Bounds;

            JitterPhysicsGame.PreferredSize = new Vector2(
                (float)(bounds.Width * ppv),
                (float)(bounds.Height * ppv));

            game = XamlGame <JitterPhysicsGame> .Create(e, Window.Current.CoreWindow, this);
        }
示例#30
0
        public GamePage()
        {
            this.InitializeComponent();

            // Create the game.
            var launchArguments = string.Empty;

            _impl = new WinPhoneBridge();
            MonoSAMGame.StaticBridge = _impl;
            _game = XamlGame <MainGame> .Create(launchArguments, Window.Current.CoreWindow, swapChainPanel);
        }