Ejemplo n.º 1
0
        private async Task LaunchGame()
        {
            var mLayout = new RelativeLayout(this);

            surface = UrhoSurface.CreateSurface(this);
            mLayout.AddView(surface);
            SetContentView(mLayout);

            app = await surface.Show <Game>(new ApplicationOptions("Data"));

            app.Update += (obj) => {
                if (app.IsClosed)
                {
                    Console.WriteLine("app is closed");
                }
                if (app.IsDeleted)
                {
                    Console.WriteLine("app is deleted");
                }
                if (app.IsExiting)
                {
                    Console.WriteLine("app is exiting");
                }
            };
        }
Ejemplo n.º 2
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
            urhoSurface       = new UrhoSurface();
            urhoSurface.Frame = UrhoSurfacePlaceholder.Bounds;

            //Add UrhoSurface to a NSView defined in the storyboard.
            UrhoSurfacePlaceholder.AddSubview(urhoSurface);
        }
Ejemplo n.º 3
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);

            surface = UrhoSurface.CreateSurface(this);            // (this, , true);
            mLayout.AddView(surface);
            SetContentView(mLayout);
            app = await surface.Show(Type.GetType(Intent.GetStringExtra("Type")), new ApplicationOptions("Data"));
        }
Ejemplo n.º 4
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new FrameLayout(this);

            surface = UrhoSurface.CreateSurface(this);
            mLayout.AddView(surface);
            SetContentView(mLayout);
            app = await surface.Show <MyApp>(new ApplicationOptions("MyData"));
        }
Ejemplo n.º 5
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var mLayout = new AbsoluteLayout(this);

            surface = UrhoSurface.CreateSurface(this); // (this, , true);
            mLayout.AddView(surface);
            SetContentView(mLayout);
            app = (DemoGame)await surface.Show(typeof(DemoGame), new ApplicationOptions("Data"));
        }
Ejemplo n.º 6
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            placeholder = new FrameLayout(this);
            surface     = UrhoSurface.CreateSurface(this);
            placeholder.AddView(surface);
            SetContentView(placeholder);

            LaunchUrho();
        }
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var layout = new FrameLayout(this);

            surface = UrhoSurface.CreateSurface(this);
            layout.AddView(surface);
            SetContentView(layout);
            myGame = await surface.Show <MyGame>(new ApplicationOptions("MyData"));

            //to stop the game use await surface.Stop().
        }
Ejemplo n.º 8
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);

            surface = UrhoSurface.CreateSurface(this);            // (this, , true);
            mLayout.AddView(surface);
            SetContentView(mLayout);
            app = await surface.Show(Type.GetType(Intent.GetStringExtra("Type")), new ApplicationOptions("Data"));

            AppCenter.Start("1ee54659-f01e-4605-a401-9b276c3708d7",
                            typeof(Analytics), typeof(Crashes));
        }
Ejemplo n.º 9
0
 async void OnRestart(object sender, EventArgs e)
 {
     if (surface != null)
     {
         surface.Stop();
         var viewGroup = surface.Parent as ViewGroup;
         viewGroup?.RemoveView(surface);
     }
     surface = UrhoSurface.CreateSurface(this);
     placeholder.AddView(surface);
     //game = await surface.Show<Game>(new Urho.ApplicationOptions());
     game = await surface.Show <ARCoreSample>(new Urho.ApplicationOptions());
 }
Ejemplo n.º 10
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);
            var appType = Assembly.Load("Sample").GetTypes()
                          .Where(_ => _.IsSubclassOf(typeof(Urho.Application)))
                          .Where(_ => !_.IsAbstract)
                          .FirstOrDefault();

            _surface = UrhoSurface.CreateSurface(this);
            mLayout.AddView(_surface);
            SetContentView(mLayout);

            _application = await _surface.Show(appType, new ApplicationOptions("Data"));
        }
Ejemplo n.º 11
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            urhoSurface                  = new UrhoSurface();
            urhoSurface.Frame            = UrhoSurfacePlaceholder.Frame;
            urhoSurface.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable;
            UrhoSurfacePlaceholder.AddSubview(urhoSurface);


            previewer = new PreviewerApplication(new AssetsResolver {
                AssetsImporterFormats = true, AssetsImporterRareFormats = true, Images = true
            });
            previewer.SurfaceRecreationRequested += OnSurfaceRequested;
        }
Ejemplo n.º 12
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new FrameLayout(this);

            surface = UrhoSurface.CreateSurface(this);
            mLayout.AddView(surface);
            SetContentView(mLayout);
            app = await surface.Show <MyApp>(new ApplicationOptions("MyData"));


            mSensorManager = (SensorManager)GetSystemService(Activity.SensorService);
            mAccSensor     = mSensorManager.GetDefaultSensor(SensorType.GeomagneticRotationVector);
            //mMagneticSensor = mSensorManager.GetDefaultSensor(SensorType.MagneticField);;
            mSensorManager.RegisterListener(this, mAccSensor, SensorDelay.Game);
            // mSensorManager.RegisterListener(this, mMagneticSensor, SensorDelay.Game);
        }
Ejemplo n.º 13
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            var layout = new FrameLayout(this);
            surface = UrhoSurface.CreateSurface(this);
            layout.AddView(surface);
            SetContentView(layout);

            var type = Type.GetType(Intent.GetStringExtra("Type"));
            var options = new ApplicationOptions()
            {
                ResourcePaths = new[] { "Data" }
            };
            app = await surface.Show(type, options);
        }
Ejemplo n.º 14
0
        async void LaunchUrho()
        {
            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) != Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.Camera }, 42);
                return;
            }

            if (launched)
            {
                return;
            }

            launched = true;
            surface  = UrhoSurface.CreateSurface(this);
            placeholder.AddView(surface);
            app = await surface.Show <MyApp>(new Urho.ApplicationOptions("MyData"));
        }
Ejemplo n.º 15
0
        private async Task Initialize()
        {
            if (ContextCompat.CheckSelfPermission(Context, Manifest.Permission.Camera) != Permission.Granted)
            {
                ActivityCompat.RequestPermissions(Context as Activity, new[] { Manifest.Permission.Camera }, 42);
                return;
            }

            if (surface != null)
            {
                return;
            }

            surface = UrhoSurface.CreateSurface(Context as Activity);
            SetNativeControl(surface);

            await surface.Show <Game>();
        }
Ejemplo n.º 16
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);
            var appType = Assembly.Load("UrhoSharpEditor").GetTypes()
                          .Where(_ => _.IsSubclassOf(typeof(Urho.Application)))
                          .Where(_ => !_.IsAbstract)
                          .FirstOrDefault();

            _surface = UrhoSurface.CreateSurface(this);
            mLayout.AddView(_surface);
            SetContentView(mLayout);

            Android.Views.View decorView = Window.DecorView;
            var uiOptions    = (int)decorView.SystemUiVisibility;
            var newUiOptions = (int)uiOptions;

            newUiOptions |= (int)SystemUiFlags.Fullscreen;
            newUiOptions |= (int)SystemUiFlags.HideNavigation;
            newUiOptions |= (int)SystemUiFlags.Immersive;
            decorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

            _application = await _surface.Show(appType, new ApplicationOptions("Data"));
        }