private void QuestionInit() { CCSize size = CCDirector.sharedDirector().getWinSize(); GetAnswerNumber(); m_Answers = new List <Selection>(); List <Word> list = Data.DataManager.GetRandom(Platform.QuestionNum); Int32 length = m_Answers.Count; Int32 lineNum = Platform.QuestionNum / 2; Int32 vertical = Platform.QuestionNum / lineNum; CCSize oneSize = new CCSize((size.width - m_StillWhile * lineNum) / lineNum, (size.height - m_StillWhile * vertical) / vertical); CCPoint curr = new CCPoint((m_StillWhile / 2) + (oneSize.width / 2), size.height - ((m_StillWhile / 4) + (oneSize.height / 2))); for (var i = 0; i < list.Count; i++) { if (i > 0 && (i % lineNum) == 0) { curr.x = (m_StillWhile / 2) + (oneSize.width / 2); curr.y -= (oneSize.height + m_StillWhile / 4); } Selection select = null; select = new Selection(list[i], i == AnswerNumber - 1, (Int32)oneSize.width, (Int32)oneSize.height); select.position = new CCPoint(curr.x, curr.y); curr.x += oneSize.width + m_StillWhile; if (i == AnswerNumber - 1) { m_Floor = new FloorLayer(select.StudyInfo); } select.visible = true; this.addChild(select); m_Answers.Add(select); } this.addChild(m_Floor); }
private void QuestionInit() { CCSize size = CCDirector.sharedDirector().getWinSize(); GetAnswerNumber(); m_Answers = new List<Selection>(); List<Word> list = Data.DataManager.GetRandom(Platform.QuestionNum); Int32 length = m_Answers.Count; Int32 lineNum = Platform.QuestionNum / 2; Int32 vertical = Platform.QuestionNum / lineNum; CCSize oneSize = new CCSize((size.width - m_StillWhile * lineNum) / lineNum, (size.height - m_StillWhile * vertical) / vertical); CCPoint curr = new CCPoint((m_StillWhile/2) + (oneSize.width / 2), size.height-( (m_StillWhile/4) + (oneSize.height / 2))); for (var i = 0; i < list.Count; i++) { if (i > 0 && (i % lineNum) == 0) { curr.x = (m_StillWhile / 2) + (oneSize.width / 2); curr.y -= (oneSize.height + m_StillWhile/4); } Selection select = null; select = new Selection(list[i], i == AnswerNumber - 1, (Int32)oneSize.width, (Int32)oneSize.height); select.position = new CCPoint(curr.x, curr.y); curr.x += oneSize.width + m_StillWhile; if (i == AnswerNumber - 1) { m_Floor = new FloorLayer(select.StudyInfo); } select.visible = true; this.addChild(select); m_Answers.Add(select); } this.addChild(m_Floor); }