public static void Start() { QuizON = true; Random Rand = new Random(); Container = new List<int>(); for (int x = 0; x < 20; x++) { Again: int Gen = Rand.Next(0, 70); if (!Container.Contains(Gen)) { Question Q = (Question)AllQuestions[(ushort)Gen]; Answer[] RealAnswers = new Answer[4]; bool[] Set = new bool[4]; for (int i = 0; i < 4; i++) { int e = Rand.Next(0, 4); while (Set[e]) e = Rand.Next(0, 4); RealAnswers[i] = Q.Answers[e]; Set[e] = true; } Q.Answers = RealAnswers; Questions.Add((ushort)x, Q); Container.Add(Gen); } else goto Again; } Timer = new System.Timers.Timer(); Timer.Interval = 30000; Timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed); foreach (GameState client in Kernel.GamePool.Values) { client.Send(new Conquer_Online_Server.Network.GamePackets.QuizInfo().StartBuffer()); client.QuizInfo = new Info(); } Scores = new QuizShowScore[500]; for (int x = 0; x < 501; x++) { try { Scores[x] = new QuizShowScore(); } catch { continue; } } Kernel.MainQuiz = new MainInfo(); Juststarted = true; QuestionNO = 0; Timer.Start(); Timer.AutoReset = true; }
public static void Start2() { QuizON = true; Random Rand = new Random(); Container = new List<int>(); Container.Clear(); Questions.Clear(); for (int x = 0; x < 20; x++) { Again: int Gen = Rand.Next(0, 71); if (!Container.Contains(Gen)) { Question Q = (Question)AllQuestions[(ushort)Gen]; Answer[] RealAnswers = new Answer[4]; bool[] Set = new bool[4]; for (int i = 0; i < 4; i++) { int e = Rand.Next(0, 4); while (Set[e]) e = Rand.Next(0, 4); RealAnswers[i] = Q.Answers[e]; Set[e] = true; } Q.Answers = RealAnswers; Questions.Add((ushort)x, Q); Container.Add(Gen); } else goto Again; } foreach (GameState client in Kernel.GamePool.Values) { client.Send(PhoenixProject.Network.GamePackets.QuizInfo.QuizShowStart((ushort)Questions.Count)); client.QuizInfo = new Info(); } Scores = new QuizShowScore[500]; for (int x = 0; x < 501; x++) { try { Scores[x] = new QuizShowScore(); } catch { continue; } } Kernel.MainQuiz = new MainInfo(); Juststarted = true; QuestionNO = 0; }