| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class UpData : MonoBehaviour
- {
- public GameObject canvas;
- public ShowPrefab showPrefab;
- public Transform showParent;
- private List<GameObject> createGameObjects;
- private ArrayData arrayData;
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void Init(List<QuestionData> saveData)
- {
- if (createGameObjects != null)
- {
- foreach (GameObject item in createGameObjects)
- {
- Destroy(item);
- }
- }
- canvas.SetActive(true);
- gameObject.SetActive(true);
- createGameObjects = new List<GameObject>();
- arrayData = new ArrayData();
- arrayData.wrongCount = 0;
- arrayData.correctCount = 0;
- arrayData.wrongQuestions = new List<WrongQuestionsItem>();
- for (int i = 0; i < saveData.Count; i++)
- {
- ShowPrefab obj = Instantiate(showPrefab, showParent);
- obj.text.text = "ÌâºÅ" + i;
- createGameObjects.Add(showPrefab.gameObject);
- if (saveData[i].isRight)
- {
- obj.falseObject.SetActive(false);
- obj.trueObject.SetActive(true);
- arrayData.correctCount += 1;
- }
- else
- {
- obj.falseObject.SetActive(true);
- obj.trueObject.SetActive(false);
- WrongQuestionsItem item = new WrongQuestionsItem();
- item.questionId = i.ToString();
- item.userWrongOption = saveData[i].selectIndex;
- arrayData.wrongQuestions.Add(item);
- arrayData.wrongCount += 1;
- }
- }
- }
- public void StartUpDate()
- {
- Login.Instance.SendList(arrayData);
- }
- }
|