Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            facade = OuyaFacade.Instance;
            facade.Init(Activity, "insert your developer key here");

            base.Initialize();

            // Start the IAP test as an async task so it runs in the background.
            DoIapTest();
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Game1.Activity = this;
            var g = new Game1();

            SetContentView(g.Window);
            g.Run();

            PurchaseFacade = OuyaFacade.Instance;
            PurchaseFacade.Init(this, DEVELOPER_ID);
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Game1.Activity = this;
            var g = new Game1();

            SetContentView(g.Window);
            g.Run();

            byte[] applicationKey = null;
            using (var stream = Resources.OpenRawResource(Resource.Raw.key))
            {
                using (var ms = new MemoryStream())
                {
                    stream.CopyTo(ms);
                    applicationKey = ms.ToArray();
                }
            }

            PurchaseFacade = OuyaFacade.Instance;
            PurchaseFacade.Init(this, DEVELOPER_ID, applicationKey);
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            sInstance = this;

            base.OnCreate(bundle);

            Game1.Activity = this;
            mGame = new Game1();
            SetContentView(mGame.Window);

            using (var ignore = new TV.Ouya.Sdk.OuyaInputView(this))
            {
                // do nothing
            }

            View content = FindViewById (Android.Resource.Id.Content);
            if (null != content) {
                content.KeepScreenOn = true;
            }
            mGame.Run();

            Bundle developerInfo = new Bundle();

            developerInfo.PutString(OuyaFacade.OUYA_DEVELOPER_ID, "310a8f51-4d6e-4ae5-bda0-b93878e5f5d0");

            byte[] applicationKey = null;

            // load the application key from assets
            try {
                AssetManager assetManager = ApplicationContext.Assets;
                AssetFileDescriptor afd = assetManager.OpenFd(SIGNING_KEY);
                int size = 0;
                if (null != afd) {
                    size = (int)afd.Length;
                    afd.Close();
                    using (Stream inputStream = assetManager.Open(SIGNING_KEY, Access.Buffer))
                    {
                        applicationKey = new byte[size];
                        inputStream.Read(applicationKey, 0, size);
                        inputStream.Close();
                    }
                }
            } catch (Exception e) {
                Log.Error (TAG, string.Format("Failed to read application key exception={0}", e));
            }

            if (null != applicationKey) {
                Log.Debug (TAG, "Read signing key");
                developerInfo.PutByteArray (OuyaFacade.OUYA_DEVELOPER_PUBLIC_KEY, applicationKey);
            } else {
                Log.Error (TAG, "Failed to authorize with signing key");
                Finish ();
                return;
            }

            developerInfo.PutString(OuyaFacade.XIAOMI_APPLICATION_ID, "0000000000000");
            developerInfo.PutString(OuyaFacade.XIAOMI_APPLICATION_KEY, "000000000000000000");

            developerInfo.PutStringArray(OuyaFacade.OUYA_PRODUCT_ID_LIST, Game1.PURCHASABLES);

            _ouyaFacade = OuyaFacade.Instance;
            _ouyaFacade.Init(this, developerInfo);
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            sInstance = this;

            base.OnCreate(bundle);

#if MONOGAME_3_4 || MONOGAME_3_5
            _game = new Game1();
            SetContentView((View)_game.Services.GetService(typeof(View)));
#else
            Game1.Activity = this;
            _game          = new Game1();
            SetContentView(_game.Window);
#endif

            _ouyaInputView = new TV.Ouya.Sdk.OuyaInputView(this);

            View content = FindViewById(Android.Resource.Id.Content);
            if (null != content)
            {
                content.KeepScreenOn = true;
            }
            _game.Run();

            Bundle developerInfo = new Bundle();

            developerInfo.PutString(OuyaFacade.OUYA_DEVELOPER_ID, DEVELOPER_ID);

            byte[] applicationKey = null;

            // load the application key from assets
            try {
                AssetManager        assetManager = ApplicationContext.Assets;
                AssetFileDescriptor afd          = assetManager.OpenFd(SIGNING_KEY);
                int size = 0;
                if (null != afd)
                {
                    size = (int)afd.Length;
                    afd.Close();
                    using (Stream inputStream = assetManager.Open(SIGNING_KEY, Access.Buffer))
                    {
                        applicationKey = new byte[size];
                        inputStream.Read(applicationKey, 0, size);
                        inputStream.Close();
                    }
                }
            } catch (Exception e) {
                Log.Error(TAG, string.Format("Failed to read application key exception={0}", e));
            }

            if (null != applicationKey)
            {
                Log.Debug(TAG, "Read signing key");
                developerInfo.PutByteArray(OuyaFacade.OUYA_DEVELOPER_PUBLIC_KEY, applicationKey);
            }
            else
            {
                Log.Error(TAG, "Failed to authorize with signing key");
                Finish();
                return;
            }

            //developerInfo.PutString(OuyaFacade.XIAOMI_APPLICATION_ID, "0000000000000");
            //developerInfo.PutString(OuyaFacade.XIAOMI_APPLICATION_KEY, "000000000000000000");

            //developerInfo.PutStringArray(OuyaFacade.OUYA_PRODUCT_ID_LIST, Game1.PURCHASABLES);

            _ouyaFacade = OuyaFacade.Instance;
            _ouyaFacade.Init(this, developerInfo);
        }