static void WrapUIClass(FCClassWrap pWrap) { pWrap.BeginModleWrap("UnityUI"); // 导出UI类 pWrap.WrapClass(typeof(UnityEngine.UI.Button)); pWrap.PushCurrentDontWrapName("OnRebuildRequested"); pWrap.WrapClass(typeof(UnityEngine.UI.Text)); pWrap.EndModleWrap(); }
static void WrapCustomClass(FCClassWrap pWrap) { pWrap.BeginModleWrap("Custom"); pWrap.WrapClass(typeof(TestExport)); // 导出一个测试的类 pWrap.EndModleWrap(); }
static void WrapUnityClass(FCClassWrap pWrap) { pWrap.BeginModleWrap("Unity"); //pWrap.WrapClass(typeof(System.Type)); pWrap.WrapClass(typeof(UnityEngine.Object)); pWrap.WrapClass(typeof(UnityEngine.Transform)); pWrap.WrapClass(typeof(UnityEngine.Component)); pWrap.WrapClass(typeof(UnityEngine.Texture2D)); pWrap.WrapClass(typeof(UnityEngine.GameObject)); pWrap.WrapClass(typeof(UnityEngine.Behaviour)); pWrap.PushCurrentDontWrapName("Item"); pWrap.WrapClass(typeof(UnityEngine.Animation)); pWrap.WrapClass(typeof(UnityEngine.Transform)); pWrap.WrapClass(typeof(UnityEngine.SkinnedMeshRenderer)); pWrap.WrapClass(typeof(UnityEngine.Input)); pWrap.EndModleWrap(); }
// 功能:导出带有标签的类 static void WrapCustomAttribClass(FCClassWrap pWrap) { pWrap.BeginModleWrap("AutoClass"); Assembly assembly = Assembly.Load("Assembly-CSharp"); Type[] types = assembly.GetExportedTypes(); foreach (Type t in types) { if (t.IsDefined(typeof(AutoWrapAttribute), false)) { pWrap.WrapClass(t, false); } else if (t.IsDefined(typeof(PartWrapAttribute), false)) { pWrap.WrapClass(t, true); } } pWrap.EndModleWrap(); }
static void TestExport() { Type t1 = typeof(IEnumerable <AssetBundle>); FCValueType v1 = FCValueType.TransType(t1); string s1 = v1.GetValueName(true); int iiii = 0; FCClassWrap pWrap = new FCClassWrap(); pWrap.BeginExport(""); pWrap.BeginModleWrap("AutoClass"); pWrap.WrapClass(typeof(UnityEngine.AssetBundle)); pWrap.EndModleWrap(); pWrap.EndExport(); MakeFCProj(); }
// 功能:导出这个模块下的所有类 static void WrapAllClass(FCClassWrap pWrap, string szNamespace, List <Type> rList) { string szModleName = szNamespace.Replace('.', '_'); pWrap.BeginModleWrap(szModleName); int nIndex = 0; foreach (Type t in rList) { ++nIndex; try { PrepareWrap(pWrap, t); pWrap.WrapClass(t); } catch (Exception e) { Debug.LogError("导出异常, nIndex = " + nIndex); Debug.LogException(e); } } pWrap.EndModleWrap(); }
static void WrapUnityClass(FCClassWrap pWrap) { pWrap.BeginModleWrap("Unity"); //pWrap.WrapClass(typeof(System.Type)); pWrap.WrapClass(typeof(UnityEngine.Time)); pWrap.WrapClass(typeof(UnityEngine.Object)); AddTemplateSurport(pWrap); // 添加模板函数的wrap支持 pWrap.WrapClass(typeof(UnityEngine.Component)); pWrap.WrapClass(typeof(UnityEngine.Transform)); pWrap.PushCurrentDontWrapName("alphaIsTransparency"); pWrap.WrapClass(typeof(UnityEngine.Texture2D)); AddTemplateSurport(pWrap); // 添加模板函数的wrap支持 pWrap.WrapClass(typeof(UnityEngine.GameObject)); pWrap.WrapClass(typeof(UnityEngine.Behaviour)); pWrap.PushCurrentDontWrapName("Item"); pWrap.WrapClass(typeof(UnityEngine.Animation)); pWrap.WrapClass(typeof(UnityEngine.Transform)); pWrap.WrapClass(typeof(UnityEngine.Renderer)); pWrap.WrapClass(typeof(UnityEngine.MeshRenderer)); pWrap.WrapClass(typeof(UnityEngine.SkinnedMeshRenderer)); pWrap.PushCurrentDontWrapName("IsJoystickPreconfigured"); pWrap.WrapClass(typeof(UnityEngine.Input)); pWrap.PushCurrentDontWrapName("areaSize"); pWrap.PushCurrentDontWrapName("lightmapBakeType"); pWrap.WrapClass(typeof(UnityEngine.Light)); pWrap.WrapClass(typeof(UnityEngine.Material)); pWrap.WrapClass(typeof(UnityEngine.Events.UnityEvent)); pWrap.EndModleWrap(); }
static void WrapType(FCClassWrap pWrap, Type nType) { PrepareWrap(pWrap, nType); pWrap.WrapClass(nType); }