private void removeSubQuestionButton_Click(object sender, EventArgs e) { int count = mainQuestionPanelList.Count, i; int locationY; int locationX; int index = 0; for (i = 0; i < count; i++) { int subCount = mainQuestionPanelList[i].SubQuestionPanelsList.Count; for (int j = 0; j < subCount; j++) { ShortCutButton shortCutButton = this.shortCutButtonList[index]; locationY = (index / 4) * 27; locationX = (index % 4) * 77; shortCutButton.Location = new Point(locationX, locationY); shortCutButton.MainQuestionNo = i; shortCutButton.SubQuestionNo = j; index++; } } for (i = index; i < questionCount; i++) { this.examShortCutPanel.Controls.Remove(this.shortCutButtonList[i]); this.shortCutButtonList.RemoveAt(i); } questionCount = index; }
private void OnShortCutDown(EventContext context) { ShortCutButton scb = null; if (shortCutDic.TryGetValue(context.inputEvent.keyCode, out scb)) { if (scb.Skillinfo == null) { return; } scb.Skillinfo.UseSkill(GameObject.FindGameObjectWithTag("Player").transform); } }
private void addSubQuestionButton_Click(object sender, EventArgs e) { int locationX, locationY; int nowPageIndex; ShortCutButton shortCutButton = new ShortCutButton(customFonts, questionCount + 1); locationY = (questionCount / 4) * 27; locationX = (questionCount % 4) * 77; this.examShortCutPanel.Controls.Add(shortCutButton); this.shortCutButtonList.Add(shortCutButton); shortCutButton.Location = new Point(locationX, locationY); nowPageIndex = int.Parse(examPageNavigationPanel.NowPageTextBox.Text) - 1; shortCutButton.MainQuestionNo = nowPageIndex; shortCutButton.SubQuestionNo = mainQuestionPanelList[nowPageIndex].SubQuestionPanelsList.Count - 1; mainQuestionPanelList[nowPageIndex].SubQuestionPanelsList[shortCutButton.SubQuestionNo].DeleteButton.Click += removeSubQuestionButton_Click; shortCutButton.Click += shortCutButton_Click_1; questionCount++; }
private void LoadShortCutInfo() { shortCutInfoList = shortCutManagerDAL.LoadShortCutInfo(); for (int i = 0; i < shortCutInfoList.Count; i++) { ShortCutButton sc = (ShortCutButton)UIPackage.CreateObject("MainMenu", "SlotButton"); sc.ShortCutInfo = shortCutInfoList[i]; sc.Skillinfo = SkillManager.Instance.GetsKillByID(sc.ShortCutInfo.SkillID); if (sc.Skillinfo != null) { sc.icon = sc.Skillinfo.SkillSprite; } sc.title = i.ToString(); sc.data = i; sc.onDrop.Add(OnDrop); shortCutList.Add(sc); shortCutDic.Add((KeyCode)Enum.Parse(typeof(KeyCode), "Alpha" + (i + 1)), sc); } }
private void shortCutButton_Click_1(object sender, EventArgs e) { ShortCutButton shortCutButton = (ShortCutButton)sender; int i = shortCutButton.MainQuestionNo; int j = shortCutButton.SubQuestionNo; int locationY; locationY = examMainQuestionPanelList[i].SubQuestionPanelsList[j].Location.Y; this.examPageNavigationPanel.NowPageTextBox.Text = (i + 1).ToString(); try { this.examPanel.VerticalScroll.Value = locationY; this.examPanel.PerformLayout(); } catch (Exception error) { Console.WriteLine(error); } }
private void initShortCutButton() { int index = 0, count = examMainQuestionPanelList.Count, i; int locationY; int locationX; for (i = 0; i < count; i++) { int subCount = examMainQuestionPanelList[i].SubQuestionPanelsList.Count; for (int j = 0; j < subCount; j++) { ShortCutButton shortCutButton = new ShortCutButton(customFonts, index + 1); locationY = (index / 4) * 27; locationX = (index % 4) * 77; this.examShortCutPanel.Controls.Add(shortCutButton); this.shortCutButtonList.Add(shortCutButton); shortCutButton.Location = new Point(locationX, locationY); shortCutButton.MainQuestionNo = i; shortCutButton.SubQuestionNo = j; shortCutButton.Click += shortCutButton_Click_1; index++; if (!isStudent) { isScoredList.Add(false); examMainQuestionPanelList[i].SubQuestionPanelsList[j].ExamScorePanel.ScoreTextBox.BackColor = Color.White; examMainQuestionPanelList[i].SubQuestionPanelsList[j].StudentScorePanel.Visible = true; examMainQuestionPanelList[i].SubQuestionPanelsList[j].StudentScorePanel.ScoreTextBox.LostFocus += ScoreTextBox_LostFocus; } if (isStudent) { ExamSubQuestionPanel examSubQuestionPanel = examMainQuestionPanelList[i].SubQuestionPanelsList[j]; switch (examSubQuestionPanel.Type) { case 0: ExamOXPanel examOXPanel = (ExamOXPanel)examSubQuestionPanel; examOXPanel.OButton.Click += ox_enter_answer; examOXPanel.XButton.Click += ox_enter_answer; break; case 1: ExamShortAnswerQuestionPanel examShortAnswerQuestionPanel = (ExamShortAnswerQuestionPanel)examSubQuestionPanel; examShortAnswerQuestionPanel.AnswerPanel.AnswerTextBox.LostFocus += short_enter_answer; break; case 2: ExamEssayQuestionPanel examEssayQuestionPanel = (ExamEssayQuestionPanel)examSubQuestionPanel; examEssayQuestionPanel.AnswerPanel.AnswerTextBox.LostFocus += essay_enter_answer; break; case 3: ExamMultipleChoiceQuestionPanel examMultipleChoiceQuestionPanel = (ExamMultipleChoiceQuestionPanel)examSubQuestionPanel; add_event_at_radiobutton(examMultipleChoiceQuestionPanel.ChoicePaneList); break; default: break; } } } } }