CreateScriptObject() публичный статический Метод

创建脚本对象
public static CreateScriptObject ( string rTypeName ) : object
rTypeName string
Результат object
Пример #1
0
    public Panel PushPanel(string rLogicName, UnityEngine.Events.UnityAction <object> onEnable = null)
    {
        if (panelCur != null && panelCur.LogicName != "Noting" && panelCur.PanelName != "Noting")
        {
            if (panelCur.LogicName == rLogicName)
            {
                Debug.Log(rLogicName + " is repeat");
                return(panelCur);
            }

            if (panelCur.LogicObject != null)
            {
                LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, disableName);
            }
        }


        Panel rPanel = null;
        bool  rGot   = TryGetPanel(rLogicName, out rPanel);

        if (rGot)
        {
            panelCur = rPanel;

            LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, enableName);
            StickUpElement(panelCur);
        }
        else
        {
            var rPanelName = rLogicName.Replace("Logic", "Panel");

            Panel rNewPanel = new Panel();
            rNewPanel.IsCreated   = false;
            rNewPanel.LogicName   = rLogicName;
            rNewPanel.PanelName   = rPanelName;
            rNewPanel.LogicObject = LShapUtil.CreateScriptObject(rLogicName);
            _panelStack.Push(rNewPanel);

            panelCur = rNewPanel;
            if (onEnable != null)
            {
                LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, startupName, RootNode, onEnable);
            }
            else
            {
                LShapUtil.CallScriptFunction(panelCur.LogicObject, panelCur.LogicName, startupName, RootNode);
            }
        }
        return(panelCur);
    }
Пример #2
0
 public void OnCreatedDuplicate(PopupsBehaviour duplicate)
 {
     duplicate.transform.SetParent(Global.PopupsWindow, false);
     duplicate.SetLShapObject(LShapUtil.CreateScriptObject(duplicate.TemplateName, duplicate));
 }