Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     ScriptMgr.Instance.LoadProject();
     inst            = new ScriptInstanceHelper(ScriptTypeName);
     inst.gameObject = this.gameObject;
     inst.Start();
 }
Esempio n. 2
0
    public void Initialize()
    {
        m_script.Reset();
        m_script.RegTypes();
        m_script.env.RegFunction((eDelay)Wait);

        if (m_codeType != ECodeType.FunctionsText)
        {
            switch (m_codeType)
            {
            case ECodeType.FileName:
                if (!s_projectBuilded)
                {
                    Script.Instance.BuildProject(Application.streamingAssetsPath + m_folderPath, m_pattern);
                    s_projectBuilded = true;
                }
                break;

            case ECodeType.TextAsset:
                Script.Instance.BuildFile(m_className, m_ta.text);
                break;

            case ECodeType.Text:
                Script.Instance.BuildFile(m_className, m_codeText);
                break;
            }
            inst            = new ScriptInstanceHelper(m_className);
            inst.gameObject = this.gameObject;
        }
        else
        {
            BuildBlock("Start", m_Start);
            BuildBlock("OnEnable", m_OnEnable);
            BuildBlock("OnDisable", m_OnDisable);
            BuildBlock("Start", m_Start);
            BuildBlock("Update", m_Update);
            BuildBlock("FixedUpdate", m_FixedUpdate);
            BuildBlock("OnDestroy", m_OnDestroy);
            content = m_script.env.CreateContent();             //创建上下文,并设置变量给脚本访问
            content.DefineAndSet("gameObject", typeof(GameObject), this.gameObject);
            content.DefineAndSet("transform", typeof(Transform), this.transform);
        }
    }
	// Use this for initialization
	void Start () {
        ScriptMgr.Instance.LoadProject();
        inst = new ScriptInstanceHelper(ScriptTypeName);
        inst.gameObject = this.gameObject;
        inst.Start();
	}