[QUOTE=hot_prinz;2161567]
Kodi PHP:
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Milioner
{
public partial class Form1 : Form
{
int pyetja;
string strAppPath = Environment.CurrentDirectory;
String[] strArray = new String[0];
bool bA;
bool bB;
bool bC;
bool bD;
bool bTastat;
Label pyetja_shtypur;
Timer timeri_suksesit;
Timer timeri_fitores;
bool j5050;
bool jTelefoni;
bool jPubliku;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
if (File.Exists(strAppPath + @"\intro.wav"))
{
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
myPlayer.SoundLocation = strAppPath + @"\intro.wav";
myPlayer.Play();
}
if (File.Exists(strAppPath + @"\data.bin"))
skeda_ne_matrice(strAppPath + @"\data.bin", ref strArray);
loje_e_re();
}
private void loje_e_re()
{
for (int i = 1; i < 16; i++)
{
if (this.gbEuro.Controls["lbl" + i].BackColor == Color.DarkOrange)
this.gbEuro.Controls["lbl" + i].BackColor = Color.Transparent;
if (i != 5 && i != 10)
this.gbEuro.Controls["lbl" + i].ForeColor = Color.DarkOrange;
else
this.gbEuro.Controls["lbl" + i].ForeColor = Color.White;
}
j5050 = false;
jPubliku = false;
jTelefoni = false;
pyetja = 1;
bA = false;
bB = false;
bC = false;
bD = false;
bTastat = false;
pastro_jokerat();
inicializo_lojen();
}
private void pastro_jokerat()
{
lbl5050.BackColor = Color.MidnightBlue;
lblTelefoni.BackColor = Color.MidnightBlue;
lblPubliku.BackColor = Color.MidnightBlue;
}
private void inicializo_lojen()
{
shto_handlerat_jokeri();
shto_handlerat_pyetje();
shto_handlerat_EL();
pastro_pyetjet();
lblA.Visible = true;
lblB.Visible = true;
lblC.Visible = true;
lblD.Visible = true;
if (pyetja <= 15)
{
if (pyetja >= 2)
{
lblMoney.Text = this.gbEuro.Controls["lbl" + (pyetja - 1)].Text + " ";
this.gbEuro.Controls["lbl" + (pyetja - 1)].BackColor = Color.Transparent;
if ((pyetja - 1) != 5 && (pyetja - 1) != 10)
this.gbEuro.Controls["lbl" + (pyetja - 1)].ForeColor = Color.DarkOrange;
else
this.gbEuro.Controls["lbl" + (pyetja - 1)].ForeColor = Color.White;
}
aktualizo_euro(pyetja);
merr_pyetje_randome();
}
else
{
fitore();
}
}
private void shto_handlerat_jokeri()
{
if (!j5050)
{
this.lbl5050.MouseLeave += new System.EventHandler(this.jokeri_MouseLeave);
this.lbl5050.MouseEnter += new System.EventHandler(this.jokeri_MouseEnter);
}
if (!jTelefoni)
{
this.lblTelefoni.MouseLeave += new System.EventHandler(this.jokeri_MouseLeave);
this.lblTelefoni.MouseEnter += new System.EventHandler(this.jokeri_MouseEnter);
}
if (!jPubliku)
{
this.lblPubliku.MouseLeave += new System.EventHandler(this.jokeri_MouseLeave);
this.lblPubliku.MouseEnter += new System.EventHandler(this.jokeri_MouseEnter);
}
}
private void largo_handlerat_jokeri()
{
this.lbl5050.MouseLeave -= new System.EventHandler(this.jokeri_MouseLeave);
this.lblTelefoni.MouseLeave -= new System.EventHandler(this.jokeri_MouseLeave);
this.lblPubliku.MouseLeave -= new System.EventHandler(this.jokeri_MouseLeave);
this.lbl5050.MouseEnter -= new System.EventHandler(this.jokeri_MouseEnter);
this.lblTelefoni.MouseEnter -= new System.EventHandler(this.jokeri_MouseEnter);
this.lblPubliku.MouseEnter -= new System.EventHandler(this.jokeri_MouseEnter);
}
private void fitore()
{
if (File.Exists(strAppPath + @"\wonmillion.wav"))
{
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
myPlayer.SoundLocation = strAppPath + @"\wonmillion.wav";
myPlayer.Play();
}
timeri_fitores = new Timer();
timeri_fitores.Interval = 3000;
timeri_fitores.Start();
timeri_fitores.Tick += new EventHandler(timeri_fitores_Tick);
lblPyetja.Text = "Urime fituat!\n1.000.000 ";
lblPyetje.Text = "";
lblPyetje.Visible = false;
}
public void timeri_fitores_Tick(object sender, EventArgs eArgs)
{
if (sender == timeri_fitores)
{
lblPyetje.Visible = true;
lblPyetja.Text = "";
timeri_fitores.Stop();
timeri_fitores.Tick -= new EventHandler(timeri_fitores_Tick);
label4.Text = "";
lblrezultati.Text = "Doni tė filloni nje lojė tė re?";
lblA.Text = "";
lblB.Text = "";
lblC.Text = "";
lblD.Text = "";
shto_gb_humbje();
}
}
private void shto_handlerat_pyetje()
{
this.lblA.Click += new System.EventHandler(this.pyetja_Click);
this.lblB.Click += new System.EventHandler(this.pyetja_Click);
this.lblC.Click += new System.EventHandler(this.pyetja_Click);
this.lblD.Click += new System.EventHandler(this.pyetja_Click);
}
private void shto_handlerat_EL()
{
this.lblA.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblB.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblC.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblD.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblA.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
this.lblB.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
this.lblC.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
this.lblD.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
}
private void largo_handlerat_pyetje()
{
this.lblA.Click -= new System.EventHandler(this.pyetja_Click);
this.lblB.Click -= new System.EventHandler(this.pyetja_Click);
this.lblC.Click -= new System.EventHandler(this.pyetja_Click);
this.lblD.Click -= new System.EventHandler(this.pyetja_Click);
}
private void largo_handlerat_EL()
{
this.lblA.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblB.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblC.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblD.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblA.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblB.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblC.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblD.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
}
private void pastro_pyetjet()
{
lblA.BackColor = Color.MediumBlue;
lblB.BackColor = Color.MediumBlue;
lblC.BackColor = Color.MediumBlue;
lblD.BackColor = Color.MediumBlue;
}
private void merr_pyetje_randome()
{
ArrayList strAL = new ArrayList();
foreach (string p in strArray)
{
p.TrimStart();
if (p.Substring(0, 1) != "#")
{
string[] strSpl = p.Split(';');
if (strSpl.Length >= 10)
{
if (strSpl[0] == pyetja.ToString())
{
strAL.Add(p);
}
}
}
}
if (strAL.Count > 0)
{
Random rnd = new Random();
int numri_random = rnd.Next(0, strAL.Count);
string pyetja_randome = strAL[numri_random].ToString();
string[] strSpl = pyetja_randome.Split(';');
lblPyetje.Text = strSpl[1];
lblA.Text = strSpl[2];
if (strSpl[3] == "0")
bA = false;
else
bA = true;
lblB.Text = strSpl[4];
if (strSpl[5] == "0")
bB = false;
else
bB = true;
lblC.Text = strSpl[6];
if (strSpl[7] == "0")
bC = false;
else
bC = true;
lblD.Text = strSpl[8];
if (strSpl[9].Substring(0, 1) == "0")
bD = false;
else
bD = true;
}
else
{
MessageBox.Show("Vendos pyetje per te gjitha ketegorite per te mos ndaluar!", "Ska pyetje per kete kategori!");
}
}
private void skeda_ne_matrice(string strFile, ref string[] strArray)
{
StreamReader myFile = new StreamReader(strFile, System.Text.Encoding.Default);
String strTemp = myFile.ReadToEnd();
strArray = strTemp.Split('\n');
myFile.Close();
}
private void aktualizo_euro(int pyetja)
{
this.gbEuro.Controls["lbl" + pyetja].BackColor = Color.DarkOrange;
this.gbEuro.Controls["lbl" + pyetja].ForeColor = Color.Yellow;
}
private void jokeri_MouseEnter(object sender, EventArgs e)
{
Label lbl_shtypur = (Label)sender;
lbl_shtypur.BackColor = Color.DarkOrange;
}
private void jokeri_MouseLeave(object sender, EventArgs e)
{
Label lbl_shtypur = (Label)sender;
lbl_shtypur.BackColor = Color.MidnightBlue;
}
private void pyetja_MouseEnter(object sender, EventArgs e)
{
Label lbl_shtypur = (Label)sender;
lbl_shtypur.BackColor = Color.DarkOrange;
}
private void pyetja_MouseLeave(object sender, EventArgs e)
{
Label lbl_shtypur = (Label)sender;
lbl_shtypur.BackColor = Color.Blue;
}
private void pyetja_Click(object sender, EventArgs e)
{
largo_handlerat_EL();
if (!bTastat)
{
bTastat = true;
pyetja_shtypur =(Label)sender;
pyetja_shtypur.BackColor = Color.DarkOrange;
shfaq_sigurte_Click();
}
}
private void shfaq_sigurte_Click()
{
if (File.Exists(strAppPath + @"\question.wav"))
{
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
myPlayer.SoundLocation = strAppPath + @"\question.wav";
myPlayer.Play();
}
largo_handlerat_jokeri();
gbSigurte.Visible = true;
this.lblPO.Click += new System.EventHandler(this.sigurte_Click);
this.lblJO.Click += new System.EventHandler(this.sigurte_Click);
this.lblPO.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblJO.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblPO.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
this.lblJO.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
}
private void sigurte_Click(object sender, EventArgs e)
{
largo_handlerat_pyetje();
if ((Label)sender == lblPO)
{
switch (pyetja_shtypur.Name)
{
case "lblA":
if (bA)
sukses(lblA);
else
deshtim(lblA);
break;
case "lblB":
if (bB)
sukses(lblB);
else
deshtim(lblB);
break;
case "lblC":
if (bC)
sukses(lblC);
else
deshtim(lblC);
break;
case "lblD":
if (bD)
sukses(lblD);
else
deshtim(lblD);
break;
}
}
else if ((Label)sender == lblJO)
{
bTastat = false;
pastro_pyetjet();
shto_handlerat_EL();
shto_handlerat_jokeri();
shto_handlerat_pyetje();
gbSigurte.Visible = false;
this.lblPO.Click -= new System.EventHandler(this.sigurte_Click);
this.lblJO.Click -= new System.EventHandler(this.sigurte_Click);
this.lblPO.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblJO.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblPO.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblJO.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblPO.BackColor = Color.MediumBlue;
this.lblJO.BackColor = Color.MediumBlue;
}
}
private void humbje_Click(object sender, EventArgs e)
{
largo_handlerat_pyetje();
if ((Label)sender == lblSerish)
{
largo_gb_humbje();
loje_e_re();
}
else if ((Label)sender == lblDil)
{
Application.Exit();
}
}
private void deshtim(Label l)
{
if (File.Exists(strAppPath + @"\hasta_la_vista.wav"))
{
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
myPlayer.SoundLocation = strAppPath + @"\hasta_la_vista.wav";
myPlayer.Play();
}
largo_sigurte();
shto_gb_humbje();
if (bA)
this.Controls["lblA"].BackColor = Color.Green;
if(bB)
this.Controls["lblB"].BackColor = Color.Green;
if(bC)
this.Controls["lblC"].BackColor = Color.Green;
if(bD)
this.Controls["lblD"].BackColor = Color.Green;
l.BackColor = Color.Red;
if (pyetja >= 2)
{
if (((pyetja - 1) >= 0) && ((pyetja - 1) < 5))
{
lblrezultati.Text = "Shuma e fituar: 0";
}
else if (((pyetja - 1) >= 5) && ((pyetja - 1) < 10))
{
lblMoney.Text = this.gbEuro.Controls["lbl" + 5].Text + " ";
lblrezultati.Text = "Shuma e fituar: " + lblMoney.Text;
}
else if (((pyetja - 1) >= 10) && ((pyetja - 1) < 15))
{
lblMoney.Text = this.gbEuro.Controls["lbl" + 10].Text + " ";
lblrezultati.Text = "Shuma e fituar: " + lblMoney.Text;
}
}
}
private void shto_gb_humbje()
{
gbHumbja.Visible = true;
this.lblSerish.Click += new System.EventHandler(this.humbje_Click);
this.lblDil.Click += new System.EventHandler(this.humbje_Click);
this.lblSerish.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblDil.MouseLeave += new System.EventHandler(this.pyetja_MouseLeave);
this.lblSerish.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
this.lblDil.MouseEnter += new System.EventHandler(this.pyetja_MouseEnter);
}
private void largo_gb_humbje()
{
gbHumbja.Visible = false;
this.lblSerish.Click -= new System.EventHandler(this.humbje_Click);
this.lblDil.Click -= new System.EventHandler(this.humbje_Click);
this.lblSerish.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblDil.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblSerish.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblDil.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
}
private void largo_sigurte()
{
gbSigurte.Visible = false;
this.lblPO.Click -= new System.EventHandler(this.sigurte_Click);
this.lblJO.Click -= new System.EventHandler(this.sigurte_Click);
this.lblPO.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblJO.MouseLeave -= new System.EventHandler(this.pyetja_MouseLeave);
this.lblPO.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblJO.MouseEnter -= new System.EventHandler(this.pyetja_MouseEnter);
this.lblPO.BackColor = Color.MediumBlue;
this.lblJO.BackColor = Color.MediumBlue;
}
private void sukses(Label l)
{
if (File.Exists(strAppPath + @"\good.wav"))
{
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
myPlayer.SoundLocation = strAppPath + @"\good.wav";
myPlayer.Play();
}
largo_sigurte();
timeri_suksesit = new Timer();
timeri_suksesit.Interval = 1500;
timeri_suksesit.Start();
timeri_suksesit.Tick += new EventHandler(timeri_suksesit_Tick);
l.BackColor = Color.Green;
lblPyetja.Text = "E SAKTĖ!";
lblPyetje.Text = "";
lblPyetje.Visible = false;
}
public void timeri_suksesit_Tick(object sender, EventArgs eArgs)
{
if (sender == timeri_suksesit)
{
bTastat = false;
pyetja++;
lblPyetje.Visible = true;
lblPyetja.Text = "";
timeri_suksesit.Stop();
timeri_suksesit.Tick -= new EventHandler(timeri_suksesit_Tick);
inicializo_lojen();
}
}
private void lbl5050_Click(object sender, EventArgs e)
{
if (!j5050)
{
j5050 = true;
lbl5050.BackColor = Color.DarkRed;
this.lbl5050.MouseLeave -= new System.EventHandler(this.jokeri_MouseLeave);
this.lbl5050.MouseEnter -= new System.EventHandler(this.jokeri_MouseEnter);
string[] pArr = new String[] { "lblA", "lblB", "lblC", "lblD" };
Random rnd = new Random();
int i = 0;
while (i < 2)
{
int numri_random = rnd.Next(0, pArr.Length);
switch (pArr[numri_random])
{
case "lblA":
if (!bA)
{
if (lblA.Visible == true)
{
lblA.Visible = false;i++;
}
}
break;
case "lblB":
if (!bB)
{
if (lblB.Visible == true)
{
lblB.Visible = false;i++;
}
}
break;
case "lblC":
if (!bC)
{
if (lblC.Visible == true)
{
lblC.Visible = false;i++;
}
}
break;
case "lblD":
if (!bD)
{
if (lblD.Visible == true)
{
lblD.Visible = false;i++;
}
}
break;
}
}
}
}
private void lblTelefoni_Click(object sender, EventArgs e)
{
if (!jTelefoni)
{
jTelefoni = true;
lblTelefoni.BackColor = Color.DarkRed;
this.lblTelefoni.MouseLeave -= new System.EventHandler(this.jokeri_MouseLeave);
this.lblTelefoni.MouseEnter -= new System.EventHandler(this.jokeri_MouseEnter);
if (bA)
mesazhi("lblA", "Xhokeri i Telefonit");
if (bB)
mesazhi("lblB", "Xhokeri i Telefonit");
if (bC)
mesazhi("lblC", "Xhokeri i Telefonit");
if (bD)
mesazhi("lblD", "Xhokeri i Telefonit");
}
}
private void mesazhi(string p,string q)
{
MessageBox.Show("Pėrgjigja e saktė duhet tė jetė:\n\n"
+ this.Controls[p].Text, q+" (100% i sigurte) :P",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void lblPubliku_Click(object sender, EventArgs e)
{
if (!jPubliku)
{
jPubliku = true;
lblPubliku.BackColor = Color.DarkRed;
this.lblPubliku.MouseLeave -= new System.EventHandler(this.jokeri_MouseLeave);
this.lblPubliku.MouseEnter -= new System.EventHandler(this.jokeri_MouseEnter);
if (bA)
mesazhi("lblA", "Xhokeri i publikut");
if (bB)
mesazhi("lblB", "Xhokeri i publikut");
if (bC)
mesazhi("lblC", "Xhokeri i publikut");
if (bD)
mesazhi("lblD", "Xhokeri i publikut");
}
}
}
}
ku mund ta fus ketne vb 6
Krijoni Kontakt