Пример #1
0
 public void addRow(SHResRow para_nwRow)
 {
     if(rows == null) { rows = new List<SHResRow>(); }
     rows.Add(para_nwRow);
 }
Пример #2
0
    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.
                SHGameyResultData gameyData = (SHGameyResultData) acResultData.getGameyData();

                int numCorrectSentences = gameyData.getNumCorrectSentences();
                int numIncorrectTries = gameyData.getNumIncorrectTries();
                int finalMusPeepCount = gameyData.getFinalMusPeepCount();
                string timeStr = gameyData.getTimeString();

                string[] elementNames   = {"FieldTitle-0","FieldTitle-1","FieldTitle-2","FieldTitle-3","FieldContent-0","FieldContent-1","FieldContent-2","FieldContent-3"};
                string[] elementContent = {LocalisationMang.translate("Correct words"),LocalisationMang.translate("Incorrect tries"),LocalisationMang.translate("Final person count"),LocalisationMang.translate("Time"),""+numCorrectSentences,""+numIncorrectTries,""+finalMusPeepCount,timeStr};
                bool[] destroyGuideArr = {false,false,false,false,false,false,false,false};
                int[] textElementTypeArr = {0,0,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 SHResTable();

                List<SHResColumn> columnData = new List<SHResColumn>();
                columnData.Add(new SHResColumn());
                columnData.Add(new SHResColumn());

                List<ILevelConfig> presentedContent = acResultData.getPresentedContent();
                List<LevelOutcome> outcomeList = acResultData.getOutcomeList();
                for(int i=0; i<presentedContent.Count; i++)
                {
                    SHeroLevelConfig tmpContent = (SHeroLevelConfig) presentedContent[i];
                    SHLevelOutcome tmpOutcome = (SHLevelOutcome) outcomeList[i];

                    if(i == 0)
                    {
                        // Add headers.
                        resTable.addHeaderName(LocalisationMang.translate("Items"));
                        resTable.addHeaderName("");
                    }

                    columnData[0].addCell(new SHResCell(tmpContent.getLevelSentence(false)));

                    if(tmpOutcome.isPositiveOutcome())
                    {
                        columnData[1].addCell(null);
                    }
                    else
                    {
                        columnData[1].addCell(new SHResCellRevise());
                    }

                }

                // Convert columns to rows.
                bool canMakeMoreRows = true;
                int dataRowIndex = 0;
                while(canMakeMoreRows)
                {
                    canMakeMoreRows = false;

                    List<SHResCell> nwRowData = new List<SHResCell>();
                    for(int i=0; i<columnData.Count; i++)
                    {
                        List<SHResCell> columnContent = columnData[i].columnContent;
                        if((columnContent != null)&&(dataRowIndex < (columnContent.Count)))
                        {
                            nwRowData.Add(columnContent[dataRowIndex]);
                            canMakeMoreRows = true;
                        }
                        else
                        {
                            nwRowData.Add(null);
                        }
                    }

                    if(canMakeMoreRows)
                    {
                        SHResRow nwRow = new SHResRow(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);

                columnGUIWidths = new float[2];
                columnGUIWidths[0] = ((uiBounds["TableScrollArea"].width * 0.9f) * 0.8f);
                columnGUIWidths[1] = ((uiBounds["TableScrollArea"].width * 0.9f) * 0.2f);

                pageInitFlags[1] = true;
            }
        }
    }