예제 #1
0
    public void ShowResult(CommonPanel panel)
    {
        // clear old result
        for (int i = 0; i < transPanelCont.childCount; i++)
        {
            Destroy(transPanelCont.GetChild(i).gameObject);
        }

        resultText = "";
        // show title
        string valText = panel.GetTitleObj().GetTextObject().text;

        sentencePanel.SetValue(valText);

        // show result
        List <Label> labels = panel.GetLabels();

        for (int i = 0; i < labels.Count; i++)
        {
            Label label = labels[i];
            if (label is InputLabel)
            {
                // create simple label
                Label genLabel = Instantiate(prefLabel, transPanelCont).GetComponent <Label>();
                genLabel.Init();
                genLabel.SetText(label.GetTextObject());

                if (resultText.Length > 0)
                {
                    resultText += " ";
                }
                resultText += label.GetText();
            }
            else if (label is LinkLabel)
            {
                // create origin label (nest labels)
                OriginPanel genPanel = Instantiate(prefOriginPanel, transPanelCont).GetComponent <OriginPanel>();
                genPanel.Init();
                // change title for this panel
                CommonPanel referPanel = (label as LinkLabel).GetReferPanel();
                genPanel.SetTitle(referPanel.GetTitleLabel().GetTextObject().text);
                genPanel.SetColor(referPanel.GetColorType());

                // add child labels for genereted panel
                AddChildPanel(genPanel, label as LinkLabel);
            }
        }

        CanvasMgr.Instance.RefreshCanvas();

        (CanvasMgr.Instance.GetBoard <ResultBoard>() as ResultBoard).ShowResult(resultText);
    }
예제 #2
0
    public OriginPanel AddOriginPanel(CommonPanel panel)
    {
        GameObject prefOriginPanel = Resources.Load <GameObject>(DataConfig.prefOriginPanelPath);

        if (prefOriginPanel)
        {
            // add child panel
            OriginPanel genPanel = Instantiate(prefOriginPanel, transLabelCont).GetComponent <OriginPanel>();
            genPanel.Init();
            // change title
            genPanel.SetTitle(panel.GetTitleLabel().GetTextObject().text);
            genPanel.SetColor(panel.GetColorType());

            return(genPanel);
        }
        return(null);
    }