Ejemplo n.º 1
0
    public void Generate(string text)
    {
        //  文字列をランダム選択
        QT = new QuestionText();
        QT.selectedText = text;

        //  ゲームオブジェクトを保存
        questionObjects = new GameObject[QT.selectedText.Length];

        //  サイズを図る
        sizeX = 100;
        posX  = QT.selectedText.Length / 2f * -sizeX + sizeX / 2f;

        //  問題を生成
        for (int i = 0; i < QT.selectedText.Length; i++)
        {
            questionObjects[i] = Instantiate(basePrefub);
            questionObjects[i].transform.SetParent(transform, true);  //  親を設定
            questionObjects[i].GetComponent <RectTransform>().anchoredPosition      = new Vector2(posX + sizeX * i, 200);
            questionObjects[i].transform.GetChild(0).GetComponent <Text>().text     = QT.selectedText[i].ToString();
            questionObjects[i].transform.GetChild(0).GetComponent <Text>().enabled  = false; //  文字を見えなくする
            questionObjects[i].GetComponent <RectTransform>().sizeDelta             = new Vector2(sizeX, sizeX);
            questionObjects[i].transform.GetChild(0).GetComponent <Text>().fontSize = (int)sizeX;
        }
    }
Ejemplo n.º 2
0
        private void ToggleContainer(object sender, EventArgs e)
        {
            var toggleContainerParent = ((StackLayout)((StackLayout)((Frame)((Grid)((Grid)sender).Parent).Parent).Parent).Parent);
            var senderParent          = (Grid)sender;
            var parentOfSenderParent  = (Grid)senderParent.Parent;

            (parentOfSenderParent.Children[1] as StackLayout).IsVisible = !(parentOfSenderParent.Children[1] as StackLayout).IsVisible;
            if ((parentOfSenderParent.Children[1] as StackLayout).IsVisible)
            {
                senderParent.BackgroundColor = Color.FromHex("#000");
                ((Label)senderParent.Children[1]).TextColor = Color.FromHex("#fff");
                ((Image)senderParent.Children[2]).Source    = "icon_arrow_top";
            }
            else
            {
                ((Image)senderParent.Children[1]).Source = "icon_down_arrow";
            }
            QuestionText = (e as TappedEventArgs)?.Parameter as string;
            QuestionGuid = ((Label)senderParent.Children[0]).Text;
            foreach (var item in toggleContainerParent.Children)
            {
                var child1 = item as StackLayout;
                var child2 = child1.Children[2] as Frame;
                var child3 = child2.Content as Grid;
                var grid   = child3.Children[0] as Grid;
                var label  = grid.Children[1] as Label;
                if (label?.Text?.ToLower() != QuestionText.ToLower())
                {
                    ((StackLayout)child3.Children[1]).IsVisible = false;
                }
            }
        }
Ejemplo n.º 3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (QuestionText != null ? QuestionText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ State.GetHashCode();
         hashCode = (hashCode * 397) ^ Type.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (QuestionText != null ? QuestionText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Type.GetHashCode();
         hashCode = (hashCode * 397) ^ Position;
         hashCode = (hashCode * 397) ^ (QuestionId.HasValue ? QuestionId.Value : 0);
         hashCode = (hashCode * 397) ^ (ExPossibleAnswers != null ? ExPossibleAnswers.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public async Task <string> getQuestionTextByRow(string questionId, int questionTextRow)
        {
            var contract = web3.Eth.GetContract(abi, contractAddress);
            var function = contract.GetFunction("getQuestionTextByRow");

            object[] param = new object[2];
            param[0] = questionId;
            param[1] = questionTextRow;

            QuestionText result = await function.CallDeserializingToObjectAsync <QuestionText>(param);

            string s = HexStringUTF8ConvertorExtensions.HexToUTF8String(result.textLine.ToHex());

            return(s);
        }
Ejemplo n.º 6
0
        public ActionResult Question(QuestionText q)
        {
            if (ModelState.IsValid)
            {
                ref_questions obj = new ref_questions();
                obj.Question = q.Question;
                obj.CourseId = q.CourseId;
                obj.Option1  = q.Option1;
                obj.Option2  = q.Option2;
                obj.Option3  = q.Option3;
                obj.Option4  = q.Option4;
                obj.Answer   = q.Answer;
                obj.Active   = q.Active;
                db.ref_questions.Add(obj);
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
    private void createQuestion()
    {
        if (difficult) { // !
            isPicture = true;
            currentQuestion = new QuestionPicture (questionList [++index]);

        }else {
            if(Mathf.Round(Random.value) == 0) {
                isPicture = true;
                hud.switchToPicture();
                currentQuestion = new QuestionPicture (questionList [++index]);

            }else{
                isPicture = false;
                hud.switchToText();
                currentTQuestion = new QuestionText(questionList[++index]);
            }
        }
    }
Ejemplo n.º 8
0
        private void OpenFileButton_Click(object sender, EventArgs e)
        {
            //Очистка RichTextBox и открытие файла
            AutorText.Clear();
            QuestionsText.Clear();
            QuestionText.Clear();
            ObjectsText.Clear();

            openFile.ShowDialog();
            string path = openFile.FileName;

            parser.ParseFile(path);

            Questions      = parser.Questions;
            Autor          = parser.Autor;
            Objects        = parser.Objects;
            NubmerQuestion = 0;

            Reload();

            GoButton.Enabled = true;
        }
Ejemplo n.º 9
0
 private void createQuestion()
 {
     if (difficult)           // !
     {
         isPicture       = true;
         currentQuestion = new QuestionPicture(questionList [++index]);
     }
     else
     {
         if (Mathf.Round(Random.value) == 0)
         {
             isPicture = true;
             hud.switchToPicture();
             currentQuestion = new QuestionPicture(questionList [++index]);
         }
         else
         {
             isPicture = false;
             hud.switchToText();
             currentTQuestion = new QuestionText(questionList[++index]);
         }
     }
 }
Ejemplo n.º 10
0
        public void SetEntityMatchAndDisambiguationOptions(EntityMatch entityMatch, IList <string> disambiguationOptionsText, Dialog dialog)
        {
            EntityMatch = entityMatch;
            if (entityMatch == null)
            {
                dialog.LogMessage(LineNumber, MessageType.IncorrectPattern, "Disambiguation question \"" + QuestionText.Replace('\r', ' ').Replace('\n', ' ').Trim() + "\" without any entity match => dead end");
            }
            else
            {
                if (entityMatch.EntityVariable1 != null)
                {
                    entityMatch.EntityVariable1.AddDialogNodeReference(this, VariableReferenceType.Write);
                }
                if (entityMatch.EntityVariable2 != null)
                {
                    entityMatch.EntityVariable2.AddDialogNodeReference(this, VariableReferenceType.Write);
                }
            }

            DisambiguationOptions = new List <DisambiguationOption>();
            if (disambiguationOptionsText == null || disambiguationOptionsText.Count == 0)
            {
                dialog.LogMessage(LineNumber, MessageType.IncorrectPattern, "Disambiguation question \"" + QuestionText.Replace('\r', ' ').Replace('\n', ' ').Trim() + "\" doesn't provide options to guide the user");
            }
            else if (entityMatch != null)
            {
                foreach (var optionText in disambiguationOptionsText)
                {
                    var entityValuesMatchResult = dialog.MatchEntityValueInOptionText(this, entityMatch.Entity, optionText);
                    if (entityValuesMatchResult.EntityValues.Count == 0)
                    {
                        string message = "Option \"" + optionText + "\" for question \"" + QuestionText.Replace('\r', ' ').Replace('\n', ' ').Trim() + "\" can't be matched with any entity value for entity " + entityMatch.Entity.Name;
                        if (entityValuesMatchResult.ConceptSubstitutions != null)
                        {
                            foreach (var conceptSubstitution in entityValuesMatchResult.ConceptSubstitutions)
                            {
                                message += ",  " + conceptSubstitution.ToString();
                            }
                        }
                        var suggestedOptionText = entityMatch.Entity.SuggestEntityValueFromText(optionText);
                        if (suggestedOptionText != null && !suggestedOptionText.Equals(optionText, StringComparison.InvariantCultureIgnoreCase))
                        {
                            message += ", you may want to replace the option text with \"" + suggestedOptionText + "\"";
                        }
                        dialog.LogMessage(LineNumber, MessageType.InvalidReference, message);
                    }
                    else
                    {
                        var matchedEntityValue = entityValuesMatchResult.EntityValues[0];
                        DisambiguationOptions.Add(new DisambiguationOption(optionText, matchedEntityValue));
                        matchedEntityValue.AddDialogNodeReference(this);
                    }
                }
            }
        }
Ejemplo n.º 11
0
 public override int GetHashCode()
 {
     return(QuestionText != null ? QuestionText.GetHashCode() : 0);
 }
Ejemplo n.º 12
0
 public ChatForm()
 {
     InitializeComponent();
     ChatText.ReadOnly = true;
     QuestionText.Select();
 }