Exemplo n.º 1
0
        public override void AnalysisBinding(GameObject gameObject, ComponentItem[] componentItems)
        {
            var scriptPath = GenCodeUtil.InitScriptPath(gameObject, "_Internal");

            if (System.IO.File.Exists(scriptPath))
            {
                var script = System.IO.File.ReadAllText(scriptPath, System.Text.Encoding.UTF8);

                if (componentItems != null)
                {
                    script = script.Replace(" ", "");
                    //解析componentItem
                    AnalysisBindingMembers(script, componentItems);
                    AnalysisBindingEvents(script, componentItems);
                }
            }
            else
            {
                Debug.Assert(System.IO.File.Exists(scriptPath), "未找到:" + scriptPath);
            }
        }
        public override void AnalysisBinding(GameObject gameObject, ComponentItem[] componentItems)
        {
            var scriptPath = GenCodeUtil.InitScriptPath(gameObject, "_Internal");

            if (System.IO.File.Exists(scriptPath))
            {
                var script = System.IO.File.ReadAllText(scriptPath, System.Text.Encoding.UTF8);

                if (componentItems != null)
                {
                    //解析componentItem
                    var bindingMembers = new List <string>();
                    var bindingEvents  = new List <string>();
                    GetInvocations(script, ref bindingMembers, ref bindingEvents);
                    bindingMembers.ForEach(x => AnalysisBindingMembers(x, componentItems));
                    bindingEvents.ForEach(x => AnalysisBindingEvents(x, componentItems));
                }
            }
            else
            {
                Debug.Assert(System.IO.File.Exists(scriptPath), "未找到:" + scriptPath);
            }
        }