Exemplo n.º 1
0
 public void Dispose(GameObject gob, float angle, float depth)
 {
     //如果是考核,记录当前穴位名字作为答案,并开启下一题
     if (Status.GetInstance().IsAssess)
     {
         Status.GetInstance().CurrentAnswer = gob.name;
         QuestionControl.GetInstance().SetNextQuestion();
     }
     else//如果是练习,就显示穴位的信息
     {
         string name = gob.name.Split('-')[0];
         List <AcupointureSkill> skills = TextData.GetInstance().AcupointSkills[name];
         string text = "当前针与皮肤的夹角为" + angle + "度" + "深度为" + GetLnch(depth) + "寸";
         text += name + ":\r\n";
         foreach (var skill in skills)
         {
             if (skill.Angle - 10 < angle && angle < skill.Angle + 10)
             {
                 if (skill.MinDepth < GetLnch(depth) && GetLnch(depth) < skill.MaxDepth)
                 {
                     Debug.Log("aaaa");
                     string[] feelings = skill.Feeling.Split();
                     for (int i = 0; i < feelings.Length; ++i)
                     {
                         Tool.GetInstance().DisplayPicture(feelings[i], gob.transform.position + (i + 1) * new Vector3(-7f, -3f, 1.5f));
                     }
                 }
             }
             text += "正确扎法为:" + skill + "\r\n";
         }
         Tool.GetInstance().DisplayText(text, gob.transform.position + new Vector3(-7f, -3f, 1.5f));
     }
 }
Exemplo n.º 2
0
    public TextMesh countDownText;                 //显示剩余时间的数字

    void Start()
    {
        leaveSeconds   = totalTime;
        singleInstance = this;
        sw.Start();        //开始计时
        SetNextQuestion(); //第一题
    }
Exemplo n.º 3
0
 public void Dispose(string name)
 {
     if (Status.GetInstance().IsAssess)//针扎身体,开启下一题
     {
         Status.GetInstance().CurrentAnswer = name;
         QuestionControl.GetInstance().SetNextQuestion();
     }
 }
Exemplo n.º 4
0
 public ActionResult EditControl(QuestionControl questionControl)
 {
     if (ModelState.IsValid)
     {
         questionControl.UpdatedDate     = DateTime.Now;
         db.Entry(questionControl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(questionControl));
 }
Exemplo n.º 5
0
 public ActionResult AddControl(QuestionControl questionControl)
 {
     if (ModelState.IsValid)
     {
         questionControl.UpdatedDate = DateTime.Now;
         db.questionControls.Add(questionControl);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(questionControl));
 }
Exemplo n.º 6
0
        private void Windows_Loaded(object sender, EventArgs e)
        {
            var list = App.TestContext.Questions.ToList();

            foreach (var item in list)
            {
                var control = new QuestionControl(item);
                control.PreviewMouseDown += Element_MouseDown;
                control.PreviewMouseUp   += Element_MouseUp;
                control.PreviewMouseMove += Element_MouseMove;
                canvas.Children.Add(control);

                control.SetValue(Canvas.LeftProperty, item.X + 400);
                control.SetValue(Canvas.TopProperty, item.Y + 400);
            }
            CreateLines();
        }
Exemplo n.º 7
0
        /// <summary>
        /// 创建常规多选题
        /// </summary>
        /// <param name="taskmode"></param>
        public void creatQuestionBy(ResouresModel resmode)
        {
            QuestionControl QC = new QuestionControl(resmode);

            QC.Size = this.panel1.Size;
            QC.qr  += (QuestionControl v, int tag) =>
            {
                //1、创建一个新的元素时,将当前这个删除
                v.Dispose();
                //2、创建
                if (GameHelper.mode == GameHelper.Mode.Online)
                {
                    ClientDAL.GetInstance().SendMessage("Next");
                }
                else
                {
                    //3、创建下一个
                    this.button2_Click(this, new EventArgs());
                }
            };
            this.panel1.Controls.Add(QC);
        }
Exemplo n.º 8
0
        public Form1()
        {
            InitializeComponent();
            QuestionDAO db = new QuestionDAO();

            questions = db.getQuestions();
            for (int i = 0; i < questions.Count; i++)
            {
                Button btnButtonQuestion = new Button();
                btnButtonQuestion.Text = (i + 1).ToString();
                pnQuestionButtons.Controls.Add(btnButtonQuestion);
                question_buttons.Add(btnButtonQuestion);
                btnButtonQuestion.BackColor = Color.White;
                btnButtonQuestion.Click    += BtnButtonQuestion_Click;
                QuestionControl qc = new QuestionControl(questions[i], this);
                question_controls.Add(qc);
                ReamainingTime += questions[i].duration;
            }
            displayQuestionControl(question_controls[0]);
            counterDown.Enabled = true;
            displayRemainingTime();
            numericUpDown1.Maximum = 100;
        }
        private void AddQuestions(List <Question> questions)
        {
            foreach (var q in questions)
            {
                var pivot = new PivotItem()
                {
                    Name = "pivotItemQ" + q.QuestionID, Header = q.Name
                };
                var qc = new QuestionControl();
                var v1 = ((Viewbox)((Grid)(qc.Content)).Children.ToList().First());
                var v2 = ((Viewbox)((Grid)(qc.Content)).Children.ToList()[1]);
                var v3 = ((Viewbox)((Grid)(qc.Content)).Children.ToList()[2]);



                ((TextBlock)v1.Child).Text = $"{q.Name}/{questions.Count}";

                switch (q.ContentType)
                {
                case QuestionContentType.Text:
                    v2.Child = new TextBlock()
                    {
                        Width = v2.Width * 0.9, TextWrapping = TextWrapping.Wrap, Text = q.TextContent
                    };
                    break;

                case QuestionContentType.Picture:
                    v2.Child = new Image()
                    {
                        Source = new BitmapImage(new Uri(q.ImageUrl))
                    };
                    break;

                case QuestionContentType.Dual:

                    Grid g = new Grid();

                    g.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(5, GridUnitType.Star)
                    });
                    g.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(5, GridUnitType.Star)
                    });

                    var txt = new TextBlock()
                    {
                        Width = v2.Width * 0.9, TextWrapping = TextWrapping.Wrap, Text = q.TextContent
                    };
                    Grid.SetColumn(txt, 1);

                    var pic = new Image()
                    {
                        Source = new BitmapImage(new Uri(q.ImageUrl))
                    };
                    Grid.SetColumn(pic, 0);

                    g.Children.Add(pic);
                    g.Children.Add(txt);

                    v2.Child = g;
                    break;

                default:
                    break;
                }

                var c = 'A';

                foreach (var answer in q.Answers)
                {
                    UIElement el = null;
                    switch (answer.ContentType)
                    {
                    case AnswerContentType.Text:
                        var cb = new CheckBox()
                        {
                            HorizontalAlignment      = HorizontalAlignment.Left,
                            VerticalContentAlignment = VerticalAlignment.Top,
                            Tag = q.QuestionID
                        };

                        cb.Content = answer.TextContent;

                        cb.Checked += AnswerClicked;

                        el = cb;
                        break;

                    case AnswerContentType.Picture:
                        el = new Button()
                        {
                            Content = new Image()
                            {
                                Source = new BitmapImage(new Uri(answer.ImageUrl))
                            }, Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255))
                        };
                        var b = (Button)el;
                        b.Click += AnswerClickedButton;
                        break;

                    case AnswerContentType.Audio:
                        break;

                    case AnswerContentType.Video:
                        break;

                    case AnswerContentType.Html:
                        break;

                    default:
                        break;
                    }
                    c++;
                    //btn.Click += (sender, e) => new ContentDialog() { Content = sender };
                    ((StackPanel)((RelativePanel)v3.Child).Children[0]).Children.Add(el);
                }

                foreach (var item in ((StackPanel)((RelativePanel)v3.Child).Children[0]).Children)
                {
                    //var max = ((StackPanel)((RelativePanel)v3.Child).Children[0]).Children.Where(x => x is StackPanel).Max(x => ((StackPanel)x).Width);
                    //if (item is StackPanel)
                    //{
                    //    ((StackPanel)item).Width = max;
                    //}
                }

                pivot.Content = qc;
                //Add Item
                pivotQuestions.Items.Add(pivot);

                v2.SizeChanged += V2_SizeChanged;
            }
        }
Exemplo n.º 10
0
 private void displayQuestionControl(QuestionControl qc)
 {
     pnQuestionControl.Controls.Clear();
     pnQuestionControl.Controls.Add(qc);
 }