Example #1
0
    GuiBase Display_SetParent(string guiTypeName, Transform parentTrans, JSONNode pParams)
    {
        GuiBase guiBase = null;

        if (_showGuiEntityList.TryGetValue(guiTypeName, out guiBase))
        {
            if (parentTrans == guiBase.transform.parent)
            {
                return(guiBase);
            }
            else
            {
                guiBase.transform.parent        = parentTrans;
                guiBase.transform.localPosition = Vector3.zero;
                guiBase.transform.localRotation = Quaternion.identity;
                guiBase.transform.localScale    = Vector3.one;
                guiBase.SetParameter(pParams);

                UIAnchor anchortmp = guiBase.GetComponent <UIAnchor>();
                if (anchortmp)
                {
                    anchortmp.uiCamera = parentTrans.GetComponent <Camera>();
                }
                return(guiBase);
            }
        }
        return(guiBase);
    }