void Awake() { Instance = this; setNumber = 0; panel = GameObject.Find("Answer Panel").transform; GetNextSet(); }
void OnTriggerEnter(Collider planet) { if (planet.gameObject.tag == gameObject.tag) { Debug.Log("Planet" + gameObject.tag + "Touched"); QuizManager.AddPlanetCorrect(); correctMaterial.color = Color.green; } }
private void WrongAnswer() { QuizManager Qm = QuizManager.instance; AnswerScript answerScript = AnswerScript.instance; answerScript.wrong.SetActive(false); Qm.QuizPanel.SetActive(false); Qm.Level = Qm.Level + 1; }
public IActionResult Get(String id) { NewQuiz = new QuizManager(); QuizLibrary.Question GotQuestion = NewQuiz.GetQuestionById(id); if (GotQuestion == null) { return(NotFound()); } return(Ok(GotQuestion)); }
void Awake() { // hence we Should only have one shop instance at all time if (instance != null) { Destroy(instance); } instance = this; }
public IActionResult Post([FromBody] QuizLibrary.Question question) { NewQuiz = new QuizManager(); if (!ModelState.IsValid) { return(BadRequest()); } NewQuiz.AddQuestion(question); return(Ok(question.Question_statement)); }
public void AnswerBtnClicked() { if (ps == null) { ps = GameObject.FindObjectOfType <PostScript>(); } if (qm == null) { qm = GameObject.FindObjectOfType <QuizManager>(); } if (gameObject.GetComponent <Toggle>().isOn == true) { //gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color = new Color(gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color.r, gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color.g, gameObject.transform.Find("Background").Find("Checkmark").GetComponent<Image>().color.b, 1.0f); Debug.Log(Int32.Parse(gameObject.name.Remove(0, gameObject.name.Length - 1)) - 1); if (Int32.Parse(gameObject.name.Remove(0, gameObject.name.Length - 1)) - 1 == RandomQuizScript.quiz1_answer_choice) { ResultScore(); //StartCoroutine(Plus()); //QuizManager.page_currentScore[QuizManager.pageNum] = page_currentScore[QuizManager.pageNum]; //gameObject.transform.Find("Label").GetComponent<Text>().color = new Color(0.113f, 0.859f, 0.086f); Debug.Log("Correct"); currentText.transform.position = new Vector3(this.transform.position.x + 30.0f, this.transform.position.y + 20.0f, this.transform.position.z); currentText.gameObject.SetActive(true); //gameObject.transform.parent.parent.parent.parent.parent.Find("UIpage").Find("Oimage").gameObject.SetActive(true); //qm.AnswerCheck(1); //val_str = QuizManager.sentence_count.ToString() + ",TestResultTable,q1_result" + ",1"; //ps.PostInit(val_str); } else { //WrongScore(); //StartCoroutine(Minus()); //QuizManager.page_currentScore[QuizManager.pageNum] = page_currentScore[QuizManager.pageNum]; Debug.Log("fault"); //qm.AnswerCheck(0); //val_str = QuizManager.sentence_count.ToString() + ",TestResultTable,q1_result" + ",0"; //ps.PostInit(val_str); } CantTouchPage.SetActive(true); Transform tempTransform = GameObject.Find("Quiz1").transform; tempTransform.GetComponent <RandomQuizScript>().GoNext(); } }
// Use this for initialization void Start() { gm = QuizManager.instance; // gm.SetQuiz(); txtQuestion.text = gm.GetCurrentQuestion(); panel = GameObject.Find("Panel"); timeSpan = 0.0f; checkTime = 3.0f; GameObject.Find("SoundOpen").GetComponent <AudioSource>().Play(); }
private string answerWord; //string to store answer of current question private void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } }
public void SetQuizDish(int cardID, bool isAnswer) { //CardEntity cardEntity = Resources.Load<CardEntity>("CardEntityList/Dishes/Card" + cardID); CardEntity cardEntity = CardData.instance.dishCardEntity[cardID]; iconImage.sprite = cardEntity.icon; nameText.text = cardEntity.name; this.isAnswer = isAnswer; quizManager = GameObject.Find("QuizManager").GetComponent <QuizManager>(); }
private void CorrectAnswer() { QuizManager Qm = QuizManager.instance; AnswerScript answerScript = AnswerScript.instance; answerScript.correct.SetActive(false); Qm.QuizPanel.SetActive(false); Qm.Level = Qm.Level + 1; Mission.AddScore(500); }
void Awake() { if (manager == null) { manager = this; } else if (manager != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { gm = GameObject.FindGameObjectWithTag("GameController").GetComponent<QuizManager>(); if (isFlag) { shoeRender = gameObject.transform.parent.GetComponent<Renderer>(); } else { shoeRender = gameObject.GetComponent<Renderer>(); } }
public virtual void Act(PlayerCtr player, Action _End) { if (Belong == true) { if (!player.DoYouHaveGround(Id)) { player.GetDamaged(Power); player.SetUI(true); _End(); } else { _End(); } return; } if (QuizManager == null) { QuizManager = GameObject.Find("Quiz").GetComponent <QuizManager>(); } int level = 0; if (Power == 100) { level = 1; } else if (Power == 150) { level = 2; } else { level = 3; } QuizCtr quiz = QuizManager.GetQuiz(level); if (player.GetType() == typeof(AI)) { quiz.SetQuiz(Done, true); } else { quiz.SetQuiz(Done); } NActPlayer = player; this.End = _End; }
public static void SaveScore(QuizManager player) { BinaryFormatter formatter = new BinaryFormatter(); //vytvori path nezavisle od OS string path = Application.persistentDataPath + "/player.quiz"; FileStream stream = new FileStream(path, FileMode.Create); PlayerData data = new PlayerData(player); formatter.Serialize(stream, data); stream.Close(); }
public void PassPercentageFiftyWhenCreated() { // Arrange QuizManager qm = new QuizManager(); int expectedResult = 50; // Act int result = qm.GetPassPercentage(); // Assert Assert.AreEqual(expectedResult, result); }
public void ZeroPercentageCorrectWhenCreated() { // Arrange QuizManager qm = new QuizManager(); int expectedResult = 0; // Act int result = qm.GetPercentageQuestionsCorrect(); // Assert Assert.AreEqual(expectedResult, result); }
public void QuizTestSetPreguntasToQuizManager() { // Use the Assert class to test conditions. GameManager gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); QuizManager quizManager = GameObject.Find("QuizManager").GetComponent <QuizManager>(); gameManager.setScene("QuizScene"); gameManager.conectarServidorBD(); gameManager.getPreguntasFromBD(); Assert.That(quizManager.getPreguntas() != null); }
public void StartPublicQuiz(Text quizName) { foreach (Quiz quiz in quizList) { if (quiz.name == quizName.text) { QuizManager.UpdateQuiz(quiz); LoadScene("Quiz"); break; } } }
private void Awake() { QuizManager[] qm = FindObjectsOfType <QuizManager>(); if (qm.Length > 1) { Debug.Log("QuizManager already exists: DESTROY!"); Destroy(gameObject); return; } Singleton = this; LoadQuestions(); }
public IActionResult Get() { NewQuiz = new QuizManager(); List <QuizLibrary.Question> NewList = NewQuiz.GetAllQuestions(); if (NewList == null) { return(NotFound()); } return(Ok(NewQuiz.GetAllQuestions())); }
public void ZeroTotalAttemptedWhenCreated() { // Arrange QuizManager qm = new QuizManager(); int expectedResult = 0; // Act int result = qm.GetTotalQuestionsAttempted(); // Assert Assert.AreEqual(expectedResult, result); }
public IActionResult Delete(string id) { NewQuiz = new QuizManager(); if (!ModelState.IsValid) { return(BadRequest()); } if (NewQuiz.DeleteQuestion(id)) { Console.WriteLine("success"); } return(Ok()); }
public void InterpolateAnswerNames_LetterPositionSuccess() { var answer = new Answer { Id = 1000, Name = "{LetterPosition}." }; var quizManager = new QuizManager(); var interpolated = quizManager.InterpolateAnswerName(answer, 3); Assert.AreEqual("D.", interpolated); }
public void IsValid(bool expected, bool timeConstraint, int timeLimitInSeconds, int?passScore, int?availableFromYear, int?availableToYear) { var actual = QuizManager.IsValid(new Quiz { TimeConstraint = timeConstraint, TimeLimitInSeconds = timeLimitInSeconds, PassScore = passScore, AvailableFrom = availableFromYear.HasValue ? new DateTime(availableFromYear.Value, 1, 1) : default(DateTime?), AvailableTo = availableToYear.HasValue ? new DateTime(availableToYear.Value, 1, 1) : default(DateTime?) }); Assert.AreEqual(expected, actual); }
// Start is called before the first frame update void Start() { myRigidbody = GetComponent <Rigidbody2D>(); myAnimator = GetComponent <Animator>(); respawnPosition = transform.position; theLevelManager = FindObjectOfType <LevelManager>(); canMove = true; theQuizManager = FindObjectOfType <QuizManager>(); }
public void Setup(Game gb, Sprite spr, QuizManager quiz) { canvas = GameObject.FindGameObjectWithTag("Canvas"); this.quiz = quiz; gameIAm = gb; gameIMG.sprite = spr; spriteToUse = spr; startPos = ownRect.anchoredPosition; }
public void InterpolateAnswerNames_IndexSuccess() { var answer = new Answer { Id = 1000, Name = "Prefix{Index}." }; var quizManager = new QuizManager(); var interpolated = quizManager.InterpolateAnswerName(answer, 3); Assert.AreEqual("Prefix3.", interpolated); }
public async Task IsOwnerNull() { const int userId = 54; bool result; using (var context = new QuizContext(ManagerTestHelper.Options)) { var sut = new QuizManager(context, Mock.Of <IQuizAttemptManager>(), Mock.Of <ILogManager>()); result = await sut.IsOwner(userId, 522); } Assert.IsFalse(result); }
public void OneHundredPercentageCorrectWhenOneCorrectZeroWrong() { // Arrange QuizManager qm = new QuizManager(); int expectedResult = 100; qm.AddOneToCorrectTotal(); // Act int result = qm.GetPercentageQuestionsCorrect(); // Assert Assert.AreEqual(expectedResult, result); }
public async Task AuthorizeQuizUpdateRequestNull() { const int userId = 54; SaveQuizResultStatus result; using (var context = new QuizContext(ManagerTestHelper.Options)) { var sut = new QuizManager(context, Mock.Of <IQuizAttemptManager>(), Mock.Of <ILogManager>()); result = await sut.AuthorizeQuizUpdateRequest(userId, null); } Assert.AreEqual(SaveQuizResultStatus.GeneralError, result); }
public async Task InsertQuizNull() { const int userId = 54; SaveQuizResult result = null; using (var context = new QuizContext(ManagerTestHelper.Options)) { var sut = new QuizManager(context, Mock.Of <IQuizAttemptManager>(), Mock.Of <ILogManager>()); result = await sut.InsertQuiz(userId, null); } Assert.AreEqual(SaveQuizResultStatus.GeneralError, result.Status); }
void Start() { gm = GameObject.FindGameObjectWithTag("GameController").GetComponent<QuizManager>(); bucketMat = gameObject.GetComponent<Renderer>().material; controller = new Controller(); }
void Start () { _quizManager = GameObject.FindGameObjectWithTag ("QuizManager").GetComponent<QuizManager> (); }
void Initialize() { this.quizManager = this.GetComponent<QuizManager>(); this.rightAnswerCount = 0; this.quizImage = GameObject.Find("QuizImage"); this.answerText = new Text[2]; this.answerText[0] = GameObject.Find("LeftAnswerText").GetComponent<Text>(); this.answerText[1] = GameObject.Find("RightAnswerText").GetComponent<Text>(); this.countText = GameObject.Find("CountText").GetComponent<TextMeshProUGUI>(); this.timeText = GameObject.Find("TimeText").GetComponent<TextMeshProUGUI>(); this.startPos = this.quizImage.transform.position; DOTween.Init(true, false, LogBehaviour.Default);//初期化 this.stopWatch = this.GetComponent<StopWatch>(); this.audioSource = this.GetComponent<AudioSource>(); }