//这里封装了一个简单的通用方法。 public static void BulidTarget(string name, string publicer, string ver, string target, bool isDebug) { string app_name = name + ver + publicer; string target_dir = string.Empty; string target_name = app_name + ".exe"; BuildTargetGroup targetGroup = BuildTargetGroup.Standalone; BuildTarget buildTarget = BuildTarget.StandaloneWindows; string applicationPath = Application.dataPath.Replace("/Assets", ""); target_dir = applicationPath + "/TargetWin"; if (target == "Android") { string x86Dir = Application.dataPath + "/Plugins/x86"; string x64Dir = Application.dataPath + "/Plugins/x86_64"; if (Directory.Exists(x86Dir)) { Directory.Delete(x86Dir, true); } if (Directory.Exists(x64Dir)) { Directory.Delete(x64Dir, true); } AssetDatabase.Refresh(); Packager.BuildAndroidResource(); target_dir = applicationPath + "/TargetAndroid"; target_name = app_name + ".apk"; targetGroup = BuildTargetGroup.Android; buildTarget = BuildTarget.Android; } else if (target == "IOS") { target_dir = applicationPath + "/TargetIOS"; target_name = app_name; targetGroup = BuildTargetGroup.iOS; buildTarget = BuildTarget.iOS; } else { Packager.BuildWindowsResource(); } //每次build删除之前的残留 if (Directory.Exists(target_dir)) { if (File.Exists(target_name)) { File.Delete(target_name); } } else { Directory.CreateDirectory(target_dir); } // Player Setting // PlayerSettings.companyName = "HF"; // PlayerSettings.productName = name; // PlayerSettings.GetIconSizesForTargetGroup(targetGroup); // // PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeLeft; PlayerSettings.allowedAutorotateToLandscapeLeft = true; PlayerSettings.allowedAutorotateToLandscapeRight = true; PlayerSettings.allowedAutorotateToPortrait = false; PlayerSettings.allowedAutorotateToPortraitUpsideDown = false; // PlayerSettings.statusBarHidden = true; // PlayerSettings.apiCompatibilityLevel = ApiCompatibilityLevel.NET_2_0_Subset; // PlayerSettings.bundleVersion = ver; // PlayerSettings.forceSingleInstance = true; // bug? //PlayerSettings.gpuSkinning = true; // PlayerSettings.renderingPath = RenderingPath.Forward; // PlayerSettings.strippingLevel = StrippingLevel.Disabled; // PlayerSettings.stripUnusedMeshComponents = true; string[] SCENES = FindEnabledEditorScenes(); BuildOptions options = BuildOptions.None; if (isDebug) { EditorUserBuildSettings.development = true; EditorUserBuildSettings.connectProfiler = true; options |= BuildOptions.Development; options |= BuildOptions.ConnectWithProfiler; } else { EditorUserBuildSettings.development = false; EditorUserBuildSettings.connectProfiler = false; } //开始Build场景,等待吧~ GenericBuild(SCENES, target_dir + "/" + target_name, buildTarget, options); // 反定义宏 PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, ""); }
public void OnGUI() { //GUI.DrawTexture(this.mWelcomeScreenImageRect, this.mWelcomeScreenImage); GUI.Label(this.mWelcomeIntroRect, "欢迎使用SimpleFramework,它是个基于uLua/CSTOLUA,\n将C#类注册进Lua,并且附带了AssetBundle管理的演示框架。入门步骤如下:"); GUI.DrawTexture(this.mSamplesImageRect, this.mSamplesImage); GUI.Label(this.mSamplesHeaderRect, "新手入门 - 生成Wrap文件(必须)"); GUI.Label(this.mSamplesDescriptionRect, "单击Lua菜单里面Gen Lua Wrap File子菜单."); GUI.DrawTexture(this.mDocImageRect, this.mDocImage); GUI.Label(this.mDocHeaderRect, "新手入门 - 根据不同平台生成AssetBundle资源(必须)"); GUI.Label(this.mDocDescriptionRect, "单击Game菜单里面Build XXX Resources子菜单."); GUI.DrawTexture(this.mVideoImageRect, this.mVideoImage); GUI.Label(this.mVideoHeaderRect, "新手入门 - 改完注册到Lua的C#类,需清除文件缓存,重新生成"); GUI.Label(this.mVideoDescriptionRect, "单击Lua菜单里面Clear LuaBinder File + Wrap Files子菜单."); GUI.DrawTexture(this.mForumImageRect, this.mForumImage); GUI.Label(this.mForumHeaderRect, "新手入门 - Lua需要统一的UTF-8文件编码"); GUI.Label(this.mForumDescriptionRect, "单击Lua菜单里面Encode LuaFile with UTF-8子菜单."); GUI.DrawTexture(this.mContactImageRect, this.mContactImage); GUI.Label(this.mContactHeaderRect, " 加入技术支持社群"); GUI.Label(this.mContactDescriptionRect, "QQ群:469941220 或者 QQ群:62978170"); GUI.Label(this.mVersionRect, version); flag = GUI.Toggle(this.mToggleButtonRect, flag, "开始时候显示对话框"); if (flag) { PlayerPrefs.SetInt("ShowWelcomeScreen", 1); } else { PlayerPrefs.SetInt("ShowWelcomeScreen", 0); } EditorGUIUtility.AddCursorRect(this.mSamplesImageRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mSamplesHeaderRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mSamplesDescriptionRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mDocImageRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mDocHeaderRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mDocDescriptionRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mVideoImageRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mVideoHeaderRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mVideoDescriptionRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mForumImageRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mForumHeaderRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mForumDescriptionRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mContactImageRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mContactHeaderRect, MouseCursor.Link); EditorGUIUtility.AddCursorRect(this.mContactDescriptionRect, MouseCursor.Link); if (Event.current.type == EventType.MouseUp) { Vector2 mousePosition = Event.current.mousePosition; if ((this.mSamplesImageRect.Contains(mousePosition) || this.mSamplesHeaderRect.Contains(mousePosition)) || this.mSamplesDescriptionRect.Contains(mousePosition)) { LuaBinding.Binding(); } else if ((this.mDocImageRect.Contains(mousePosition) || this.mDocHeaderRect.Contains(mousePosition)) || this.mDocDescriptionRect.Contains(mousePosition)) { if (Application.platform == RuntimePlatform.WindowsEditor) { Packager.BuildWindowsResource(); } if (Application.platform == RuntimePlatform.OSXEditor) { //Packager.BuildiPhoneResource(); } } else if ((this.mVideoImageRect.Contains(mousePosition) || this.mVideoHeaderRect.Contains(mousePosition)) || this.mVideoDescriptionRect.Contains(mousePosition)) { LuaBinding.ClearLuaBinder(); } else if ((this.mForumImageRect.Contains(mousePosition) || this.mForumHeaderRect.Contains(mousePosition)) || this.mForumDescriptionRect.Contains(mousePosition)) { LuaBinding.EncodeLuaFile(); } else if ((this.mContactImageRect.Contains(mousePosition) || this.mContactHeaderRect.Contains(mousePosition)) || this.mContactDescriptionRect.Contains(mousePosition)) { Application.OpenURL("http://shang.qq.com/wpa/qunwpa?idkey=20a9db3bac183720c13a13420c7c805ff4a2810c532db916e6f5e08ea6bc3a8f"); } } }
public static void PackAllType() { Packager.BuildWindowsResource(); }