示例#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");
                }
            };
        }
示例#2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var decorView = Window.DecorView;

            var uiOptions = (int)decorView.SystemUiVisibility;

            uiOptions |= (int)SystemUiFlags.LowProfile;
            uiOptions |= (int)SystemUiFlags.Fullscreen;
            uiOptions |= (int)SystemUiFlags.HideNavigation;
            uiOptions |= (int)SystemUiFlags.ImmersiveSticky;

            decorView.SystemUiVisibility = (StatusBarVisibility)uiOptions;

            var layout  = new FrameLayout(this);
            var surface = UrhoSurface.CreateSurface(this);

            layout.AddView(surface);
            SetContentView(layout);


            MHUrhoApp.FileManager = FileManagerDroid.LoadConfig(Assets);
            MHUrhoApp.FileManager.CopyStaticToDynamic(Path.Combine("Data", "Test"));

            try {
                myGame = await surface.Show <MHUrhoApp>(new ApplicationOptions("Data"));
            }
            catch (Exception e) {
                Urho.IO.Log.Write(LogLevel.Debug, e.ToString());
            }
            //to stop the game use await surface.Stop().
        }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);
            var surface = UrhoSurface.CreateSurface <SamplyGame>(this, new Urho.ApplicationOptions("Data"));

            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
示例#4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var layout  = new AbsoluteLayout(this);
            var surface = UrhoSurface.CreateSurface <MyGame>(this);

            layout.AddView(surface);
            SetContentView(layout);
        }
示例#5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);

            surface = UrhoSurface.CreateSurface(this, Type.GetType(Intent.GetStringExtra("Type")), new ApplicationOptions("Data"), true);
            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
示例#6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);

            surface = UrhoSurface.CreateSurface(this, typeof(UrhoApp), new ApplicationOptions("Data"), true);
            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
示例#7
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"));
        }
示例#8
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"));
        }
示例#9
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);
            var surface = UrhoSurface.CreateSurface(this);            // (this, , true);

            mLayout.AddView(surface);
            SetContentView(mLayout);
            var app = await surface.Show <SamplyGame>(new Urho.ApplicationOptions("Data"));
        }
示例#10
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();
        }
示例#11
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var mLayout = new RelativeLayout(this);
            var surface = UrhoSurface.CreateSurface(this);

            mLayout.AddView(surface);
            SetContentView(mLayout);
            app = await surface.Show <BertApp>(new ApplicationOptions("Data"));
        }
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var layout  = new AbsoluteLayout(this);
            var surface = UrhoSurface.CreateSurface(this);

            layout.AddView(surface);
            SetContentView(layout);
            //  myGame = await surface.Show<SamplyGame>(new ApplicationOptions("Data"));
            //to stop the game use await surface.Stop().
        }
示例#13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var mLayout = new AbsoluteLayout(this);

            UrhoEngine.Init();
            var surface = UrhoSurface.CreateSurface <SamplyGame>(this);

            mLayout.AddView(surface);
            SetContentView(mLayout);
        }
示例#14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var layout = new AbsoluteLayout(this);

            Urho.Application.Started += UrhoAppStarted;
            var surface = UrhoSurface.CreateSurface <UrhoApp>(this);

            layout.AddView(surface);
            SetContentView(layout);
        }
示例#15
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));
        }
示例#16
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());
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RenderScript = RenderScript.Create(this);

            var layout = new AbsoluteLayout(this);

            Urho.Application.Started += UrhoAppStarted;
            var surface = UrhoSurface.CreateSurface <UrhoApp>(this);

            surface.SetBackgroundColor(Color.Transparent);
            layout.AddView(surface);
            SetContentView(layout);
        }
示例#18
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"));
        }
示例#19
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var layout  = new FrameLayout(this);
            var surface = UrhoSurface.CreateSurface(this);

            layout.AddView(surface);
            SetContentView(layout);

            var options = new ApplicationOptions()
            {
                ResourcePaths = new[] { "Data" }
            };
            var app = await surface.Show <SamplyGame>(options);
        }
示例#20
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);
        }
示例#21
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);
        }
示例#22
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"));
        }
示例#23
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>();
        }
示例#24
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"));
        }