public static ProblemPart CreateProblemPart(Senseix.Message.Atom.Atom newAtom)
    {
        ProblemPart newProblemPart = new TextProblemPart(newAtom);

        bool actuallyConstructed = false;
        if (newAtom.type == Senseix.Message.Atom.Atom.Type.IMAGE)
        {
            newProblemPart = new ImageProblemPart(newAtom);
            actuallyConstructed = true;
        }
        if (newAtom.type == Senseix.Message.Atom.Atom.Type.TEXT)
        {
            newProblemPart = new TextProblemPart(newAtom);
            actuallyConstructed = true;
        }
        if (newAtom.type == Senseix.Message.Atom.Atom.Type.NUMBER)
        {
            newProblemPart = new NumberProblemPart(newAtom);
            actuallyConstructed = true;
        }
        if (!actuallyConstructed)
        {
            throw new Exception("I encountered an atom of an unimplemented type.");
        }

        return newProblemPart;
    }
Пример #2
0
 /// <summary>
 /// Don't use this unless you know what you're doing.  Instead, use the other constructors.
 /// </summary>
 public Answer(Senseix.Message.Problem.Answer protoAnswer)
 {
     foreach (Senseix.Message.Atom.Atom atom in protoAnswer.answers)
     {
         answerParts.Add(ProblemPart.CreateProblemPart(atom));
     }
 }
 public ProblemPart(Senseix.Message.Atom.Atom newAtom)
 {
     atom = newAtom;
 }
Пример #4
0
 private static void SetPlayerForProblemIfNeeded(ref Senseix.Message.Problem.ProblemPost problemPostBuilder)
 {
     if (problemPostBuilder.player_id == "no current player")
     {
         problemPostBuilder.player_id = (SenseixSession.GetCurrentPlayerID());
     }
     if (problemPostBuilder.player_id == "no current player")
     {
         UnityEngine.Debug.LogWarning("I'm sending a problem to the server with no player ID.");
     }
 }
 /// <summary>
 /// Don't use this unless you know what you're doing- instead get a problem from
 /// SenseixPlugin.NextProblem().
 /// </summary>
 public Problem(Senseix.Message.Problem.ProblemData newProtobufsProblemBuilder)
 {
     protobufsProblemData = newProtobufsProblemBuilder;
 }
 public NumberProblemPart(Senseix.Message.Atom.Atom atom)
     : base(atom)
 {
 }
 public LearningAction(Senseix.Message.Problem.LearningAction newLearningActionProto)
 {
     learningActionProto = newLearningActionProto;
 }
 public TextProblemPart(Senseix.Message.Atom.Atom atom)
     : base(atom)
 {
 }
 /// <summary>
 /// Don't use this constructor unless you know what you're doing.  You can get the question from a
 /// server-generated problem instead.  Take a look at Problem.GetQuestion().
 /// </summary>
 public Question(Senseix.Message.Problem.Question newQuestion)
 {
     question = newQuestion;
     atomList = newQuestion.atoms;
 }
Пример #10
0
 public static void SelectPlayer(Senseix.Message.Player.Player selectedPlayer)
 {
     SetCurrentPlayer (selectedPlayer);
     AvatarFace.UpdateButtonFaces ();
     GetSingletonInstance().StartCoroutine(RegisterPlayer (selectedPlayer));
 }