示例#1
0
        /// <summary>
        /// DO NOT MODIFY THIS METHOD!
        /// THIS METHOD IS USED FOR GENERATE CALLBACK INVOCATION!
        /// </summary>
        /// <param name="output">OUTPUT PATH</param>
        public static void Build(string output)
        {
            var options = new StubOptions
            {
                stubName             = "MiniGameAdaptor",
                outputPath           = output,
                whiteList            = WhiteList,
                namespaceInterceptor = type => {
                    // 不允许没有 Namespace

                    if (type == null)
                    {
                        return(Utils.NamespaceName);
                    }
                    var ns = type.Namespace;
                    if (string.IsNullOrEmpty(ns))
                    {
                        return(Utils.NamespaceName);
                    }

                    // 如果是 UnityEngine 替换成 MiniGameAdaptor
                    if (!ns.Contains("UnityEngine"))
                    {
                        return(null);
                    }
                    return(Utils.EscapeNamespace(ns));
                }
            };

            StubBuilder.Build(options);
        }
示例#2
0
        /// <summary>
        /// DO NOT MODIFY THIS METHOD
        /// THIS METHOD IS USED TO GENERATE CALLBACK INVOCATION
        /// </summary>
        /// <param name="output">OUTPUT PATH</param>
        public static void Build(string output)
        {
            var options = new StubOptions
            {
                stubName   = "MiniGameAdaptor",
                outputPath = output,
                whiteList  = WhiteList
            };

            StubBuilder.Build(options);
        }
示例#3
0
        protected override void BuildIntern(StubOptions options)
        {
            var black = JSBindingSettings.LoadBridgeDefinedTypes(false);

            foreach (var t in options.blackList)
            {
                black.Add(t.FullName);
            }
            // var a = typeof(UnityEngine.Object).Assembly;
            // var b = typeof(UnityEditor.EditorWindow).Assembly;
            // var set = new HashSet<string> {
            //     "UnityEngine",
            //     "UnityEditor",
            //     "UnityEngine.AI",
            //     "UnityEngine.Profiling",
            //     // "UnityEngine.Serialization",
            //     "UnityEngine.EventSystems",
            //     "UnityEngine.SceneManagement",
            //     "UnityEngine.Networking",
            //     "UnityEngine.Events",
            //     "UnityEngine.UI"
            // };

            // var bl = new HashSet<string> {
            //     "UnityEngine.Experimental"
            // };

            // var all = a.GetTypes().Concat(b.GetTypes()).Where(
            //     t => t.IsClass &&
            //          t.IsPublic).ToArray();
            // foreach(var z in all) {
            //     Debug.Log(z.Namespace);
            // }
            // JSBindingSettings.classes = all;

            JSBindingSettings.classes     = options.whiteList.ToArray();
            JSBindingSettings.CswFilePath = options.outputPath;
            var dir = Path.GetDirectoryName(options.outputPath);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            // Debug.Log(JSBindingSettings.CswFilePath);
            CSWrapGenerator.stubName             = options.stubName;
            CSWrapGenerator.namespaceInterceptor = options.namespaceInterceptor;
            CSWrapGenerator.GenWraps(JSBindingSettings.classes, black, options.filter);

            // clear it
            CSWrapGenerator.stubName             = "";
            CSWrapGenerator.namespaceInterceptor = null;
        }
示例#4
0
 protected abstract void BuildIntern(StubOptions options);
示例#5
0
 public static void Build(StubOptions options)
 {
     Impl.BuildIntern(options);
 }