public static async void DialogASyncCommandLogintest(GtaPlayer player) { var dialog = new InputDialog("Hello", "Login please!", true, "Login", "Cancel"); var timerToShowThingsWork = new Timer(1000, true); timerToShowThingsWork.Tick += (sender, args) => { player.SendClientMessage("Things still work in the background!"); }; var response = await dialog.ShowAsync(player); player.SendClientMessage("Your input was {1}... Do we require a sync? {0}. So thats awesome! Lets move you up a lill. ", Sync.IsRequired, response.InputText); player.Position += new Vector3(0,1,0); timerToShowThingsWork.Dispose(); }
public void Start(GameMode gameMode) { //Proof timers and C# async can run at the same time //while the game is still functioning properly //also proof calls to native from other threads work all right. (due to being synced) _main = Thread.CurrentThread; ASyncTestMethod(); ASyncTestMethod2(); ASyncTestMethod3(); ASyncTestMethod4(); _timerStart = DateTime.Now; var timer = new Timer(new TimeSpan(0, 0, 0, 2, 500), false); timer.Tick += TimerOnTick; gameMode.PlayerConnected += gameMode_PlayerConnected; }
public void Start(GameMode gameMode) { //Proof timers and C# async can run at the same time //while the game is still functioning properly //also proof calls to native from other threads work all right. (due to being synced) _main = Thread.CurrentThread; ASyncTestMethod(); ASyncTestMethod2(); ASyncTestMethod3(); ASyncTestMethod4(); _timerStart = DateTime.Now; var timer = new Timer(new TimeSpan(0, 0, 0, 2, 500), false); timer.Tick += TimerOnTick; gameMode.PlayerConnected += gameMode_PlayerConnected; }
public void Start(GameMode gameMode) { //Proof timers and C# async can run at the same time //while the game is still functioning properly _main = Thread.CurrentThread; ASyncTestMethod(); ASyncTestMethod2(); ASyncTestMethod3(); ASyncTestMethod4(); DateTime tstart = DateTime.Now; var timer = new Timer(new TimeSpan(0, 0, 0, 2, 500), false); timer.Tick += (sender, args) => Console.WriteLine("Timer: Mainthread: {0} !{2}!; took {1}", _main == Thread.CurrentThread, DateTime.Now - tstart, Native.IsMainThread()); Console.WriteLine("Started async methods !{0}!", Native.IsMainThread()); gameMode.PlayerConnected += gameMode_PlayerConnected; }
public void Start(GameMode gameMode) { //Proof timers and C# async can run at the same time //while the game is still functioning properly _main = Thread.CurrentThread; ASyncTestMethod(); ASyncTestMethod2(); ASyncTestMethod3(); ASyncTestMethod4(); DateTime tstart = DateTime.Now; var timer = new Timer(new TimeSpan(0, 0, 0, 2, 500), false); timer.Tick += (sender, args) => Console.WriteLine("Timer: Mainthread: {0} !{2}!; took {1}", _main == Thread.CurrentThread, DateTime.Now - tstart, Native.IsMainThread()); Console.WriteLine("Started async methods !{0}!", Native.IsMainThread()); gameMode.PlayerConnected += gameMode_PlayerConnected; }