-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUi.cs
More file actions
56 lines (47 loc) · 1.59 KB
/
Copy pathUi.cs
File metadata and controls
56 lines (47 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;
using AndroidX.Core.View;
using Microsoft.Xna.Framework;
//using System.Runtime.Versioning;
namespace BattleMushroom
{
[Activity(
Label = "@string/app_name",
MainLauncher = true,
Icon = "@drawable/icon",
AlwaysRetainTaskState = true,
LaunchMode = LaunchMode.SingleInstance,
ScreenOrientation = ScreenOrientation.Landscape,
ConfigurationChanges = ConfigChanges.KeyboardHidden,
Theme = "@style/AppTheme"
)]
public class Main : AndroidGameActivity
{
private GameMain _game;
private View _view;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
EnableFullscreen(); // เปิด fullscreen
_game = new GameMain();
_view = _game.Services.GetService(typeof(View)) as View;
SetContentView(_view);
_game.Run();
}
void EnableFullscreen()
{
WindowCompat.SetDecorFitsSystemWindows(Window, false);
var controller = WindowCompat.GetInsetsController(Window, Window.DecorView);
if (controller != null)
{
controller.Hide(WindowInsetsCompat.Type.SystemBars());
controller.SystemBarsBehavior =
(int)WindowInsetsControllerCompat.BehaviorShowTransientBarsBySwipe;
}
Window.Attributes.LayoutInDisplayCutoutMode =
LayoutInDisplayCutoutMode.ShortEdges;
}
}
}