少年修仙传客户端基础资源
0312 打包更改
咪噜打包
1.安卓sdk 用appid原名 为apk渠道包, mlgtgame_1wjo为aab包
2.苹果sdk 用appid原名
《《打包流程放苹果机桌面》》

quick国内打包
1.安卓sdk 别名mlgtgame_quick
2.苹果sdk 别名mlgtgame_quick
《《打包流程参考国内quick ios打包即可》》
3个文件已修改
193 ■■■■ 已修改文件
Assets/Editor/Tool/ClientPackage.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/VersionConfigs/Versions.txt 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/XCodeProjectMod.cs 151 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/ClientPackage.cs
@@ -8,6 +8,7 @@
using System.Text;
using Beebyte.Obfuscator;
using static UnityEditor.UIElements.ToolbarMenu;
public class ClientPackage
{
@@ -442,6 +443,12 @@
        var channelSdkPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/", variant);
        var manifeastPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.appId, "/AndroidManifest.xml");
        if (versionConfig.sdkFileName.Trim().Length != 0)
        {
            channelSdkPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/", variant);
            manifeastPath = StringUtility.Contact(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/AndroidManifest.xml");
        }
        // if (File.Exists(manifestpath))
        // {
        //     File.Copy(manifestpath, MANIFEST_PATH);
@@ -496,22 +503,27 @@
        }
    }
    public static VersionConfig versionConfig1 = null;
    public static void BuildIpa(string _sdkPath, string _publisher, int _buildIndex, bool _replace)
    {
        PreBuild(_publisher, _buildIndex);
        var versionName = string.Empty;
        var versionConfig = GetVersionConfig(_publisher, out versionName);
        versionConfig1 = GetVersionConfig(_publisher, out versionName);
        if (Directory.Exists(iOS_PLUGIN_PATH))
        {
            Directory.Delete(iOS_PLUGIN_PATH, true);
        }
        // if (!versionConfig.appId.Equals("test"))
        // {
        FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/Channel/iOS/", versionConfig.appId, "/Plugins"), iOS_PLUGIN_PATH);
        // }
        if (versionConfig1.sdkFileName.Trim().Length != 0)
        {
            FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/Channel/iOS/", versionConfig1.sdkFileName, "/Plugins"), iOS_PLUGIN_PATH);
        }
        else
        {
            FileExtersion.DirectoryCopy(StringUtility.Contact(_sdkPath, "/Channel/iOS/", versionConfig1.appId, "/Plugins"), iOS_PLUGIN_PATH);
        }
        DateTime outTime;
        var correct = DateTime.TryParse(auditOutTime, out outTime);
Assets/Editor/VersionConfigs/Versions.txt
@@ -1,10 +1,10 @@
Id    name    AppId    VersionAuthority    m_Version    m_ClientPackageFlag    m_Branch    m_GameId    m_AssetAccess    m_PartAssetPackage    m_ProductName    m_BundleIdentifier    m_KeystoreFileName    m_KeystorePassword    m_KeystoreAlias    m_KeystoreAliasPassword    m_AppleDeveloperTeamID    m_DebugVersion    m_IsBanShu    m_LogoPosition    m_BanHao    m_SpID    m_Recharge    m_CreateRolePattern
版本标识    版本名称    渠道id    版本权限,0是测试版本,1是发布版本    版本号    客户端标识    分支    游戏项目标识    资源,0NullAsset,1HalfAsset,2FullAsset,3IgnoreDownLoad    是否分包,0不分包,1分包    产品名    产品包名    签名文件名    签名文件密码    签名文件别名    签名文件别名密码    开发者账号密码    是否debug版本,0否1是    是否版署版本,0否1是    登录界面的Logo位置    版号    运营商ID    充值界面风格    创角场景风格
9999    TheSecondWorld    test    0    2.0.600    2021    2    xbqy    1    1    仙宝奇缘    com.secondworld.snxxz    thesecondworld    thesecondworld2018    thesecondworld    thesecondworld2018        0    0    (-32,144)            0
10000    TheSecondWorld    test    0    1.104.1    2021    900    xbqy    1    1    仙宝奇缘    com.secondworld.snxxz    thesecondworld    thesecondworld2018    thesecondworld    thesecondworld2018        0    0    (-32,144)            0
1    mlgtgame    mlgtgame    1    1.104.1    2021    1    xbqy    1    1    刀劍萌俠    com.hy.gameyouqu.quick    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0
2    mlgtgame    mlgtgame    1    1.104.1    2021    3    xbqy    1    1    刀劍萌俠    com.hy.gameyouqu.quick    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0
11    mlgtgame    mlgtgame    1    1.104.1    2021    1    xbqy    1    1    刀劍萌俠    com.hhxk.djmx    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0
12    mlgtgame    mlgtgame    1    1.104.1    2021    3    xbqy    1    1    刀劍萌俠    com.hhxk.djmx    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0
21    mlgtgame    mlgtgame    1    1.104.1    2021    11    xbqy    1    1    刀劍萌俠    com.hy.djmxgzb.quick    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (-15,64)    出版单位名称:上海绿岸网络科技股份有限公司 著作权人名称:海南创娱网络科技有限公司</r>运营单位:上海绿岸网络科技股份有限公司 游戏内容类别:移动游戏 批文号:国新出审[2018]1225 号 游戏版号:ISBN 978-7-498-05565-1    mlgtgame    0
911    TheSecondWorld    test    0    1.104.1    2021    911    xbqy    0    0    仙宝奇缘    com.secondworld.snxxz    thesecondworld    thesecondworld2018    thesecondworld    thesecondworld2018        1    0     (-32,144)            0
Id    name    AppId    VersionAuthority    m_Version    m_ClientPackageFlag    m_Branch    m_GameId    m_AssetAccess    m_PartAssetPackage    m_ProductName    m_BundleIdentifier    m_KeystoreFileName    m_KeystorePassword    m_KeystoreAlias    m_KeystoreAliasPassword    m_AppleDeveloperTeamID    m_DebugVersion    m_IsBanShu    m_LogoPosition    m_BanHao    m_SpID    m_Recharge    m_CreateRolePattern    SdkFileName
版本标识    版本名称    渠道id    版本权限,0是测试版本,1是发布版本    版本号    客户端标识    分支    游戏项目标识    资源,0NullAsset,1HalfAsset,2FullAsset,3IgnoreDownLoad    是否分包,0不分包,1分包    产品名    产品包名    签名文件名    签名文件密码    签名文件别名    签名文件别名密码    开发者账号密码    是否debug版本,0否1是    是否版署版本,0否1是    登录界面的Logo位置    版号    运营商ID    充值界面风格    创角场景风格    sdk目录别名
9999    TheSecondWorld    test    0    2.0.600    2021    2    xbqy    1    1    仙宝奇缘    com.secondworld.snxxz    thesecondworld    thesecondworld2018    thesecondworld    thesecondworld2018        0    0    (-32,144)            0
10000    TheSecondWorld    test    0    1.104.1    2021    900    xbqy    1    1    仙宝奇缘    com.secondworld.snxxz    thesecondworld    thesecondworld2018    thesecondworld    thesecondworld2018        0    0    (-32,144)            0
1    mlgtgame    mlgtgame    1    1.104.1    2021    1    xbqy    1    1    刀劍萌俠    com.hy.gameyouqu.quick    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0        mlgtgame_quick
2    mlgtgame    mlgtgame    1    1.104.1    2021    3    xbqy    1    1    刀劍萌俠    com.hy.gameyouqu.quick    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0        mlgtgame_quick
11    mlgtgame    mlgtgame    1    1.104.1    2021    1    xbqy    1    1    刀劍萌俠    com.hhxk.djmx    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0
12    mlgtgame    mlgtgame    1    1.104.1    2021    3    xbqy    1    1    刀劍萌俠    com.hhxk.djmx    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (0,144)    1    mlgtgame    0
21    mlgtgame    mlgtgame    1    1.104.1    2021    11    xbqy    1    1    刀劍萌俠    com.hy.djmxgzb.quick    gatgame    miluxyjh20231107    gatKey    miluxyjh20231107        0    0    (-15,64)    出版单位名称:上海绿岸网络科技股份有限公司 著作权人名称:海南创娱网络科技有限公司</r>运营单位:上海绿岸网络科技股份有限公司 游戏内容类别:移动游戏 批文号:国新出审[2018]1225 号 游戏版号:ISBN 978-7-498-05565-1    mlgtgame    0
911    TheSecondWorld    test    0    1.104.1    2021    911    xbqy    0    0    仙宝奇缘    com.secondworld.snxxz    thesecondworld    thesecondworld2018    thesecondworld    thesecondworld2018        1    0     (-32,144)            0
Assets/Editor/XCodeProjectMod.cs
@@ -1,4 +1,6 @@
using System.Collections.Generic;
using DG.Tweening.Plugins.Core.PathCore;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.iOS.Xcode.Custom;
@@ -20,6 +22,32 @@
            return;
        }
        if (ClientPackage.versionConfig1.sdkFileName.Trim().Length == 0)
        {
            DoPBXProject(path);
            BuildPlist(path);
            ModifyFile(path);
        }
        else if (ClientPackage.versionConfig1.sdkFileName == "mlgtgame_quick")
        {
            DoPBXProject1(path);
            BuildPlist1(path);
            ModifyFile1(path);
        }
        else if (ClientPackage.versionConfig1.sdkFileName == "mlgtgame_quickhy")
        {
            DoPBXProject(path);
            ModifyFile(path);
        }
    }
    //咪噜
    static void DoPBXProject(string path)
    {
        string _projectPath = PBXProject.GetPBXProjectPath(path);
        PBXProject project = new PBXProject();
@@ -27,9 +55,6 @@
        string targetGUID = project.TargetGuidByName(PBXProject.GetUnityTargetName());
        string fwTargetGUID = project.TargetGuidByName("UnityFramework");
        //var _codeSign = Debug.isDebugBuild ? CODE_SIGN_DEVELOPER : CODE_SIGN_DISTRIBUTION;
        //var _provision = Debug.isDebugBuild ? PROVISIONING_DEVELOPER : PROVISIONING_DISTRIBUTION;
        // BuildSetting里的相关设置
        project.SetBuildProperty(project.ProjectGuid(), "ENABLE_BITCODE", "NO");
@@ -39,8 +64,8 @@
        project.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-ObjC");
        project.AddBuildProperty(targetGUID, "GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
        //wkwebview
        project.AddFrameworkToProject(fwTargetGUID, "WebKit.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "WebKit.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "SystemConfiguration.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "Security.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "JavaScriptCore.framework", true);
@@ -56,21 +81,44 @@
        //UnityFramework
        project.AddBuildProperty(fwTargetGUID, "OTHER_LDFLAGS", "-ObjC");
        File.WriteAllText(_projectPath, project.WriteToString());
    }
    //quick国内
    static void DoPBXProject1(string path)
    {
        string _projectPath = PBXProject.GetPBXProjectPath(path);
        PBXProject project = new PBXProject();
        project.ReadFromString(File.ReadAllText(_projectPath));
        string targetGUID = project.TargetGuidByName(PBXProject.GetUnityTargetName());
        string fwTargetGUID = project.TargetGuidByName("UnityFramework");
        // BuildSetting里的相关设置
        project.SetBuildProperty(project.ProjectGuid(), "ENABLE_BITCODE", "NO");
        project.SetBuildProperty(targetGUID, "ENABLE_BITCODE", "NO");
        project.SetBuildProperty(targetGUID, "DEVELOPMENT_TEAM", TEAM);
        project.AddBuildProperty(targetGUID, "OTHER_LDFLAGS", "-ObjC");
        project.AddBuildProperty(targetGUID, "GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
        //wkwebview
        project.AddFrameworkToProject(fwTargetGUID, "WebKit.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "SystemConfiguration.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "Security.framework", true);
        project.AddFrameworkToProject(fwTargetGUID, "JavaScriptCore.framework", true);
        // 处理 库文件
        project.AddFileToBuild(fwTargetGUID, project.AddFile("/usr/lib/libz.tbd", "Frameworks/libz.tbd", PBXSourceTree.Sdk));
        project.AddFileToBuild(fwTargetGUID, project.AddFile("/usr/lib/libsqlite3.tbd", "Frameworks/libsqlite3.tbd", PBXSourceTree.Sdk));
        project.AddFileToBuild(fwTargetGUID, project.AddFile("/usr/lib/libc++.tbd", "Frameworks/libc++.tbd", PBXSourceTree.Sdk));
        project.AddFileToBuild(fwTargetGUID, project.AddFile("/usr/lib/libiconv.tbd", "Frameworks/libiconv.tbd", PBXSourceTree.Sdk));
        project.AddFileToBuild(fwTargetGUID, project.AddFile("/usr/lib/libresolv.tbd", "Frameworks/libresolv.tbd", PBXSourceTree.Sdk));
        //UnityFramework
        project.AddBuildProperty(fwTargetGUID, "OTHER_LDFLAGS", "-ObjC");
        File.WriteAllText(_projectPath, project.WriteToString());
        //加推送
        //var _capabilityMgr = new ProjectCapabilityManager(_projectPath, "game003.entitlements", PBXProject.GetUnityTargetName());
        //_capabilityMgr.AddInAppPurchase();
        //_capabilityMgr.AddPushNotifications(true);
        //_capabilityMgr.WriteToFile();
        BuildPlist(path);
        if (!s_IsAppend)
        {
            ModifyFile(path);
        }
    }
    private static void BuildPlist(string path)
@@ -161,6 +209,28 @@
        File.WriteAllText(_plistPath, _plist.WriteToString());
    }
    private static void BuildPlist1(string path)
    {
        string _plistPath = path + "/Info.plist";
        PlistDocument _plist = new PlistDocument();
        _plist.ReadFromString(File.ReadAllText(_plistPath));
        PlistElementDict _rootDict = _plist.root;
        PlistElementDict _nsAppTransportSecurity = _rootDict.CreateDict("NSAppTransportSecurity");
        _nsAppTransportSecurity.SetBoolean("NSAllowsArbitraryLoads", true);
        PlistElementDict _dict = _nsAppTransportSecurity.CreateDict("Exception Domains");
        _dict = _dict.CreateDict("jpush.cn");
        _dict.SetBoolean("NSIncludesSubdomains", true);
        _dict.SetBoolean("NSExceptionAllowsInsecureHTTPLoads", true);
        _rootDict.SetString("NSMicrophoneUsageDescription", "使用麦克风权限");
        _rootDict.SetString("NSPhotoLibraryAddUsageDescription", "使用相册权限,用以存储截屏的账号信息,以防忘记账号密码");
        File.WriteAllText(_plistPath, _plist.WriteToString());
    }
    private static void ModifyFile(string projectPath)
    {
        //修改UnityAppController.mm 文件
@@ -193,6 +263,49 @@
                           "@property (readonly, copy, nonatomic) UniversalSDK*         universalSDK;");
    }
    private static void ModifyFile1(string projectPath)
    {
        //修改UnityAppController.mm 文件
        var _xclass = new XClass(projectPath + "/Classes/UnityAppController.mm");
        //引入UniversalSDK
        _xclass.WriteBelow("#include \"PluginBase/AppDelegateListener.h\"", "#include \"UniversalSDK.h\"" + "\n#import <SMPCQuickSDK/SMPCQuickSDK.h>");
        //unity交互调用的方法
        string newCode = "\n" +
                 "extern \"C\" void IOSMessageHandle(const char* jsonString) {\n" +
                 "    [GetAppController().universalSDK HandleUnityMessage:[NSString stringWithUTF8String:jsonString]];\n" +
                 "}";
        _xclass.WriteBelow("extern \"C\" ScreenOrientation    UnityCurrentOrientation()   { return GetAppController().unityView.contentOrientation; }", newCode);
        //初始化UniversalSDK
        newCode = "\n" +
                "    _universalSDK = [[UniversalSDK alloc] init];\n    [_universalSDK QuickSDKInit:application didFinishLaunchingWithOptions:launchOptions];";
        _xclass.WriteBelow("[KeyboardDelegate Initialize];", newCode);
        newCode = "\n" +
            "if([SMPCQuickSDK defaultInstance].channelType == 39 ||[SMPCQuickSDK defaultInstance].channelType == 1803 ){\n" +
            "return [[SMPCQuickSDK defaultInstance] application: application supportedInterfaceOrientationsForWindow:window];}\n" +
            "else {\n" +
            "[[SMPCQuickSDK defaultInstance] application: application supportedInterfaceOrientationsForWindow:window];}\n";
        //quick sdk 生命周期
        _xclass.WriteBelow("supportedInterfaceOrientationsForWindow:(UIWindow*)window\n{", newCode);
        _xclass.WriteBelow("UnitySendRemoteNotification(userInfo);", "[[SMPCQuickSDK defaultInstance] application:application didReceiveRemoteNotification:userInfo];");
        _xclass.WriteBelow("UnitySendDeviceToken(deviceToken);", "[[SMPCQuickSDK defaultInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];");
        _xclass.WriteBelow("UnitySendRemoteNotificationError(error);", "[[SMPCQuickSDK defaultInstance] application:application didFailToRegisterForRemoteNotificationsWithError:error];");
        _xclass.WriteBelow("- (BOOL)application:(UIApplication*)app openURL:(NSURL*)url options:(NSDictionary<NSString*, id>*)options\n{", "[[SMPCQuickSDK defaultInstance] openURL:url application:app options:options];");
        _xclass.WriteBelow("::printf(\"-> applicationDidEnterBackground()\\n\");", "[[SMPCQuickSDK defaultInstance] applicationDidEnterBackground:application];");
        _xclass.WriteBelow("::printf(\"-> applicationWillEnterForeground()\\n\");", "[[SMPCQuickSDK defaultInstance] applicationWillEnterForeground:application];");
        _xclass.WriteBelow("::printf(\"-> applicationDidBecomeActive()\\n\");", "[[SMPCQuickSDK defaultInstance] applicationDidBecomeActive:application];");
        _xclass.WriteBelow("::printf(\"-> applicationWillResignActive()\\n\");", "[[SMPCQuickSDK defaultInstance] applicationWillResignActive:application];");
        _xclass.WriteBelow("::printf(\"-> applicationWillTerminate()\\n\");", "[[SMPCQuickSDK defaultInstance] applicationWillTerminate:application];");
        //修改UnityAppController.h 文件
        _xclass = new XClass(projectPath + "/Classes/UnityAppController.h");
        _xclass.WriteBelow("@class DisplayConnection;", "@class UniversalSDK;");
        _xclass.WriteBelow("DisplayConnection*  _mainDisplay;", "UniversalSDK* _universalSDK;");
        _xclass.WriteBelow("@property (readonly, copy, nonatomic) DisplayConnection*    mainDisplay;",
                           "@property (readonly, copy, nonatomic) UniversalSDK*         universalSDK;");
    }
    private static string GetBuildPath()
    {
        string _buildPath = Application.dataPath + "/../IOS_BUILD";