public void addRow(SJResRow para_nwRow) { if(rows == null) { rows = new List<SJResRow>(); } rows.Add(para_nwRow); }
public override void buildPage(int para_pageID, GameObject para_pageParent) { if(pageInitFlags == null) { pageInitFlags = new bool[]{false,false}; } if(para_pageID == 0) { string reqPageObjName = "ResultScreens_A"; Transform reqResultScreenPage = transform.FindChild(reqPageObjName); Transform subPageTemplate = reqResultScreenPage.FindChild("Pages").FindChild("Ac"+acPKey); subPageTemplate.gameObject.SetActive(true); if(pageInitFlags[0] == false) { // Load necessary items. string fullPathToTemplate = reqPageObjName + "*" + "Pages" + "*" + ("Ac"+acPKey); // Init Items. SJGameyResultData gameyData = (SJGameyResultData) acResultData.getGameyData(); int numLinesCompleted = gameyData.numOfLines; int numCorrectSplits = gameyData.numCorrectSplits; int numIncorrectSplits = gameyData.numWrongSplits; string[] elementNames = {"FieldTitle-0","FieldTitle-1","FieldTitle-2","FieldContent-0","FieldContent-1","FieldContent-2"}; string[] elementContent = {LocalisationMang.translate("Lines completed"),LocalisationMang.translate("Correct splits"),LocalisationMang.translate("Incorrect splits"),""+numLinesCompleted,""+numCorrectSplits,""+numIncorrectSplits}; bool[] destroyGuideArr = {false,false,false,false,false,false}; int[] textElementTypeArr = {0,0,0,0,0,0}; prepTextElements(elementNames,elementContent,destroyGuideArr,textElementTypeArr,fullPathToTemplate); pageInitFlags[0] = true; } } else if(para_pageID == 1) { string reqPageObjName = "ResultScreens_B"; Transform reqResultScreenPage = transform.FindChild(reqPageObjName); Transform subPageTemplate = reqResultScreenPage.FindChild("Pages").FindChild("Ac"+acPKey); subPageTemplate.gameObject.SetActive(true); if(pageInitFlags[1] == false) { // Load necessary items. string fullPathToTemplate = reqPageObjName + "*" + "Pages" + "*" + ("Ac"+acPKey); // Init Items. resTable = new SJResTable(); List<SJResColumn> columnData = new List<SJResColumn>(); columnData.Add(new SJResColumn()); columnData.Add(new SJResColumn()); List<ILevelConfig> presentedContent = acResultData.getPresentedContent(); List<LevelOutcome> outcomeList = acResultData.getOutcomeList(); for(int i=0; i<presentedContent.Count; i++) { SJLevelConfig tmpContent = (SJLevelConfig) presentedContent[i]; SJLevelOutcome tmpOutcome = (SJLevelOutcome) outcomeList[i]; List<int> correctSplitPositions = new List<int>(tmpContent.getWordItem().getSyllSplitPositions()); string presentedWord = tmpContent.getWordItem().getWordAsString(); string presentedWordFancy = tmpContent.createFormattedSplitString(presentedWord,correctSplitPositions); if(i == 0) { // Add headers. resTable.addHeaderName(LocalisationMang.translate("Success")); resTable.addHeaderName(LocalisationMang.translate("Revise")); } if(tmpOutcome.isPositiveOutcome()) { columnData[0].addCell(new SJResCell(presentedWordFancy)); } else { columnData[1].addCell(new SJResCell(presentedWordFancy)); } } // Convert columns to rows. bool canMakeMoreRows = true; int dataRowIndex = 0; while(canMakeMoreRows) { canMakeMoreRows = false; List<SJResCell> nwRowData = new List<SJResCell>(); for(int i=0; i<columnData.Count; i++) { List<SJResCell> columnContent = columnData[i].columnContent; if((columnContent != null)&&(dataRowIndex < (columnContent.Count))) { nwRowData.Add(columnContent[dataRowIndex]); canMakeMoreRows = true; } else { nwRowData.Add(null); } } if(canMakeMoreRows) { SJResRow nwRow = new SJResRow(nwRowData); resTable.addRow(nwRow); } dataRowIndex++; } string[] elementNames = {"TableScrollArea"}; string[] elementContent = {"Table Scroll Area"}; bool[] destroyGuideArr = {true}; int[] textElementTypeArr = {0}; prepTextElements(elementNames,elementContent,destroyGuideArr,textElementTypeArr,fullPathToTemplate); columnEqualGuiWidth = ((uiBounds["TableScrollArea"].width * 0.9f) / (2 * 1.0f)); float minimumColumnWidth = (uiBounds["TableScrollArea"].width * 0.45f); if(columnEqualGuiWidth <= minimumColumnWidth) { columnEqualGuiWidth = minimumColumnWidth; } pageInitFlags[1] = true; } } }