示例#1
0
 public void addRow(MSResRow para_nwRow)
 {
     if(rows == null) { rows = new List<MSResRow>(); }
     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.
                MSGameyResultData gameyData = (MSGameyResultData) acResultData.getGameyData();

                int numCorrectAttempts = gameyData.getNumCorrectAttempts();
                int numIncorrectAttempts = gameyData.getNumIncorrectAttempts();
                string timeStr = gameyData.getTimeString();

                string[] elementNames   = {"FieldTitle-0","FieldTitle-1","FieldTitle-2","FieldContent-0","FieldContent-1","FieldContent-2"};
                string[] elementContent = {LocalisationMang.translate("Correct attempts"),LocalisationMang.translate("Incorrect attempts"),LocalisationMang.translate("Time"),""+numCorrectAttempts,""+numIncorrectAttempts,timeStr};
                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);

                List<ILevelConfig> presentedContent = acResultData.getPresentedContent();
                List<LevelOutcome> outcomeList = acResultData.getOutcomeList();

                resTable = new MSResTable("");
                resTable.addHeaderName(LocalisationMang.translate("Postman"));
                resTable.addHeaderName(LocalisationMang.translate("Parcel"));
                resTable.addHeaderName("");

                for(int i=0; i<presentedContent.Count; i++)
                {
                    MSLevelConfig tmpContent = (MSLevelConfig) presentedContent[i];
                    MSLevelOutcome tmpOutcome = (MSLevelOutcome) outcomeList[i];

                    if(i > 0)
                    {
                        MSResRow blankRow = new MSResRow(new List<MSResCell>() { null,null,null });
                        resTable.addRow(blankRow);
                    }

                    string[] postmenWords = tmpContent.getPostmenWords();
                    string[] parcelWords = tmpContent.getParcelWords();

                    for(int k=0; k<postmenWords.Length; k++)
                    {
                        MSResRow nwDataRow = new MSResRow();

                        nwDataRow.addCell(new MSResCell(postmenWords[k]));
                        nwDataRow.addCell(new MSResCell(parcelWords[k]));

                        if(tmpOutcome.isPairWithIncorrectAttempts(k))
                        {
                            nwDataRow.addCell(new MSResCellRevise());
                        }
                        else
                        {
                            nwDataRow.addCell(null);
                        }

                        resTable.addRow(nwDataRow);
                    }
                }

                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) / (3 * 1.0f));
                float minimumColumnWidth = (uiBounds["TableScrollArea"].width * 0.30f);
                if(columnEqualGuiWidth <= minimumColumnWidth)
                {
                    columnEqualGuiWidth = minimumColumnWidth;
                }

                pageInitFlags[1] = true;

            }
        }
    }