Exemplo n.º 1
0
    public QuizPanelController getQuizPanel()
    {
        if (m_quizList.Count == 0 || m_quizList [m_index].gameObject.activeSelf)           //Instantiate new object if none above is available
        {
            QuizPanelController _obj = Instantiate(m_quizPrefab, transform).GetComponent <QuizPanelController> ();
            m_quizList.Insert(m_index, _obj);
        }
        int _index = m_index;

        nextIndex();
        return(m_quizList [_index]);
    }
Exemplo n.º 2
0
    public void addQuiz(Quiz _quiz)
    {
        List <Line> _lines = ((Mini1Quiz)_quiz).getLines();

        Debug.Log("Adding quiz " + _lines.Count + " lines");
        QuizPanelController _panel = QuizPanelPoolController.Instance.getQuizPanel();
        int _count = 0;

        foreach (Line _line in _lines)
        {
            _count++;
            List <BlockObjectController> _leftList = new List <BlockObjectController> ();
            foreach (Block _left in _line.m_leftBlock)
            {
                //Debug.Log ("Left " + _left.getNumber () + " type " + _left.getType ().ToString ());
                BlockObjectController _newLeft = BlockObjectPoolController.Instance.getBlockObject();
                _newLeft.transform.parent = _panel.transform;
                Vector3 _leftPos = Vector3.left * m_blockPadding;
                _leftPos.y = m_quizSize * (_count - (float)(_lines.Count + 1) / 2f);
                _newLeft.transform.localPosition = _leftPos;
                _newLeft.initialise(_left.getNumber(), _left.getType(), _left.getInverse());
                _newLeft.gameObject.SetActive(true);
                _leftList.Add(_newLeft);
            }
            List <BlockObjectController> _rightList = new List <BlockObjectController> ();
            foreach (Block _right in _line.m_rightBlock)
            {
                //Debug.Log ("Right " + _right.getNumber());
                BlockObjectController _newRight = BlockObjectPoolController.Instance.getBlockObject();
                Vector3 _rightPos = Vector3.right * m_blockPadding;
                _rightPos.y = m_quizSize * (_count - (float)(_lines.Count + 1) / 2f);
                _newRight.transform.parent        = _panel.transform;
                _newRight.transform.localPosition = _rightPos;
                _newRight.initialise(_right.getNumber(), _right.getType(), _right.getInverse());
                _newRight.gameObject.SetActive(true);
                _rightList.Add(_newRight);
            }
            _panel.addLine(_leftList, _rightList);
        }
        _lineCount += _count;
        if (_lineCount == 1)
        {
            _panel.animateActive();
        }
        m_panelList.Add(_panel);
        float _location = m_quizPadding + m_quizSize * (_lineCount - _lines.Count + 1) + (m_quizSize / 2 * (_lines.Count - 1));

        _panel.transform.localPosition = Vector3.up * (_location + m_halfScreenHeight);
        _panel.gameObject.SetActive(true);
        _panel.moveTo(_location - m_halfScreenHeight);
    }
Exemplo n.º 3
0
    public void addQuiz(Quiz _quiz)
    {
        List <Line>         _lines = ((Mini1Quiz)_quiz).getLines();
        QuizPanelController _panel = QuizPanelPoolController.Instance.getQuizPanel();
        int _count = 0;

        foreach (Line _line in _lines)
        {
            _count++;

            BlockObjectController _newLeft  = null;
            BlockObjectController _newRight = null;

            _newLeft = _line.m_leftBlock.Count == 1 ? BlockObjectPoolController.Instance.getBlockObject()
                                : BlockObjectPoolController.Instance.getDuoBlockObject();
            _newLeft.transform.SetParent(_panel.transform);
            int _blockCount = 0;
            foreach (Block _left in _line.m_leftBlock)
            {
                _newLeft.initialise(_left.getNumber(), _left.getType(), _left.getInverse(), _blockCount);
                _blockCount++;
            }
            _newLeft.gameObject.SetActive(true);

            _newRight = _line.m_rightBlock.Count == 1 ? BlockObjectPoolController.Instance.getBlockObject()
                                : BlockObjectPoolController.Instance.getDuoBlockObject();
            _newRight.transform.SetParent(_panel.transform);
            _blockCount = 0;
            foreach (Block _right in _line.m_rightBlock)
            {
                _newRight.initialise(_right.getNumber(), _right.getType(), _right.getInverse(), _blockCount);
                _blockCount++;
            }
            _newRight.gameObject.SetActive(true);

            _panel.addLine(_newLeft, _newRight);
        }

        _lineCount += _count;
        m_panelList.Add(_panel);
        float _location = m_quizPadding + m_quizSize * (_lineCount - _lines.Count + 1) + (m_quizSize / 2 * (_lines.Count - 1));

        _panel.transform.localPosition = Vector3.up * (_location + m_halfScreenHeight);
        _panel.gameObject.SetActive(true);
        if (_lineCount - _count == 0)
        {
            _panel.animateActive();
        }
        _panel.moveTo(_location - m_halfScreenHeight);
    }