public FormHome() { InitializeComponent(); //Menambahkan timer untuk menggerakkan tombol TimerTombol.Tick += new System.EventHandler(this.TimerTombol_Tick); TimerTombol.Start(); kendali = new KendaliTombol(); wx = new List <double>(); wy = new List <double>(); wx.Add(0); wy.Add(0); wx.Add(0); wy.Add(0); //lokasi awal tiap tombol wx[0] = 1592; wy[0] = 800; wx[1] = 218; wy[1] = 427; //penambahan eventhandler tiap tombol untuk seleksi objek menggunakan eyetracking kendali.TambahTombol(BtnMisi, new FungsiTombol(TombolMisiTekan)); kendali.TambahTombol(BtnTahu, new FungsiTombol(TombolTahukahKamu)); //mulai jalankan kelas KendaliTombol kendali.Start(); }
//eventhandler tombol Tahukah kamu menggunakan interaksi eyetracking private void TombolTahukahKamu(ArgumenKendaliTombol eawal) { if (eawal.CekMata) { PresenceCheck.Visible = true; } if (eawal.status) { FormTutorial FormGame = FormTutorial.getInstance(); FormGame.Show(); this.Hide(); TimerTombol.Stop(); TimerTombol.Tick -= TimerTombol_Tick; } BtnTahu.BackColor = Color.FromArgb(eawal.DataKor, 0, 150, 185); progressBar2.Value = eawal.DataKor; }
//eventhandler tombol Misi menggunakan interaksi eyetracking private void TombolMisiTekan(ArgumenKendaliTombol eawal) { PresenceCheck.Visible = false; if (eawal.CekMata) { PresenceCheck.Visible = true; } if (eawal.status) { FormTutorial FormGame = FormTutorial.getInstance(); FormGame.Show(); this.Hide(); TimerTombol.Stop(); TimerTombol.Tick -= TimerTombol_Tick; } BtnMisi.BackColor = Color.FromArgb(eawal.DataKor, 0, 150, 185); //untuk opacity progressBar1.Value = eawal.DataKor; //untuk progressbar }
//methode load dipanggil ketika form di load setelah dibuka private void FormHome_Load(object sender, EventArgs e) { TimerTombol.Interval = 1; TimerTombol.Tick += new System.EventHandler(this.TimerTombol_Tick); TimerTombol.Start(); }