Exemplo n.º 1
0
    private static void ModifyPlayerSettingForiOS(ExportXcodeConfiguration config)
    {
        //宏定义设置
        //PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "ISSDK;IRIS");

        PlayerSettings.companyName           = config.CompanyName;
        PlayerSettings.productName           = config.ProductName;
        PlayerSettings.applicationIdentifier = config.ApplicationIdentifier;
        PlayerSettings.bundleVersion         = config.ClientVersion;
        PlayerSettings.iOS.buildNumber       = config.VersionCode;
        Texture2D splash_tx = config.Splash;

        PlayerSettings.SplashScreen.show = false;
        PlayerSettings.iOS.SetiPadLaunchScreenType(iOSLaunchScreenType.Default);
        PlayerSettings.iOS.SetiPhoneLaunchScreenType(iOSLaunchScreenType.Default);

        PlayerSettings.virtualRealitySplashScreen = splash_tx;

        //Selection.activeObject = Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings");
        SerializedObject   serializeObj     = new SerializedObject(Unsupported.GetSerializedAssetInterfaceSingleton("PlayerSettings"));
        SerializedProperty iOSSplashTexture = serializeObj.FindProperty("iPhoneSplashScreen");

        iOSSplashTexture.objectReferenceValue = splash_tx;
        serializeObj.ApplyModifiedProperties();
    }
Exemplo n.º 2
0
    private static void ReloadConfigs()
    {
        if (m_ConfigsNames == null)
        {
            m_ConfigsNames = new List <string>();
        }
        else
        {
            m_ConfigsNames.Clear();
        }
        if (m_Configs == null)
        {
            m_Configs = new Dictionary <string, ExportXcodeConfiguration>();
        }
        else
        {
            m_Configs.Clear();
        }

        List <ExportXcodeConfiguration> configs = ExportXcodeParam.Instance.Configs;

        //m_CurrentSelectIndex = 0;

        for (int i = 0, count = configs.Count; i < count; i++)
        {
            m_ConfigsNames.Add(configs[i].Name);
            m_Configs.Add(configs[i].Name, configs[i]);
        }

        m_CurrentSelectIndex = EditorPrefs.GetInt(LastButtonIndxkey, 0);
        //m_CurrentConfig = DeepClone<ExportXcodeConfiguration>(m_Configs[m_ConfigsNames[m_CurrentSelectIndex]]);
        m_CurrentConfig = m_Configs[m_ConfigsNames[m_CurrentSelectIndex]].Clone();
    }
Exemplo n.º 3
0
    public static void ExportXCodeProject(ExportXcodeConfiguration config)
    {
        m_ExportParam = config;
        EditorPrefs.SetBool(Key_BuildPackageOnScriptReloaded, false);

        string date       = DateTime.Now.ToString("yy_MM_dd");
        string exportPath = $"{ExportBasePath}{m_ExportParam.Name}_{date}_{m_ExportParam.ClientVersion}_{m_ExportParam.VersionCode}_{GetSVNRevision()}";

        EditorPrefs.SetString(Key_XcodeExportPath, exportPath);

        DeleteDirectoryContentEx($"{Application.dataPath}/Script/BattleNew/Global");
        DeleteDirectoryContentEx($"{Application.dataPath}/Script/BattleNew/NativeDll");
        DeleteDirectoryContentEx($"{Application.dataPath}/Plugins/iOS/Cardboard");
        ModifyPlayerSettingForiOS(m_ExportParam);
        ModifyGlobalFile(m_ExportParam.EnableGuest);
        ModifyDataDefineCSFile(m_ExportParam);
    }
Exemplo n.º 4
0
    public ExportXcodeConfiguration Clone()
    {
        ExportXcodeConfiguration result = new ExportXcodeConfiguration();

        result.Name                  = this.Name;
        result.Platform              = this.Platform;
        result.CompanyName           = this.CompanyName;
        result.ProductName           = this.ProductName;
        result.ApplicationIdentifier = this.ApplicationIdentifier;
        result.ClientVersion         = this.ClientVersion;
        result.VersionCode           = this.VersionCode;
        result.DefualtLanguage       = this.DefualtLanguage;
        result.Splash                = this.Splash;
        result.OutLine               = this.OutLine;
        result.EnableGuest           = this.EnableGuest;
        return(result);
    }
Exemplo n.º 5
0
    private void SaveConfig(string configName)
    {
        List <ExportXcodeConfiguration> configs = ExportXcodeParam.Instance.Configs;

        for (int i = 0; i < configs.Count; i++)
        {
            if (configs[i].Name.Equals(configName))
            {
                configs[i]       = m_CurrentConfig;
                m_ShowSaveAsView = false;
                EditorPrefs.SetInt(LastButtonIndxkey, m_CurrentSelectIndex);
                return;
            }
        }
        ExportXcodeConfiguration newConfig = m_CurrentConfig;

        newConfig.Name = configName;
        configs.Add(newConfig);
        m_ShowSaveAsView = false;
        EditorPrefs.SetInt(LastButtonIndxkey, configs.Count - 1);
    }
Exemplo n.º 6
0
    /// <summary>
    /// 修改Datadefine中的打包参数
    /// </summary>
    /// <param name="channel"></param>
    /// <param name="outline"></param>
    /// <param name="language"></param>
    private static void ModifyDataDefineCSFile(ExportXcodeConfiguration config)
    {
        string fileFullPath = $"{Application.dataPath}/Script/Data/DataDefine.cs";

        //SVNHelper.ProcessCommand("TortoiseProc.exe", $"/command:revert /path:{fileFullPath} /closeonend:1");
        ProcessCommand("cmd.exe", $"svn revert --recursive {fileFullPath}");

        AssetDatabase.Refresh();
        AssetDatabase.ImportAsset(fileFullPath);

        //EditorUtility.DisplayDialog("", "请等待编译完成", "继续");

        EditorPrefs.SetBool(Key_BuildPackageOnScriptReloaded, true);

        string CSFileStr;

        using (StreamReader sr = new StreamReader(fileFullPath))
        {
            CSFileStr = sr.ReadToEnd();
        }

        string source, target, flag;

        //修改渠道
        flag   = "public static PLATFOEMTYPE platformType = PLATFOEMTYPE";
        source = $"{flag}.*;";
        target = $"{flag}.{config.Platform.ToString()};";
        RegexReplace(source, target, fileFullPath);

        //修改内外网
        flag   = "public static bool isOutLine = ";
        source = $"{flag}.*;";
        target = $"{flag}{config.OutLine.ToString().ToLower()};";
        RegexReplace(source, target, fileFullPath);

        //修改默认语言
        flag   = "public static LanguageType languageType = LanguageType";
        source = $"{flag}.*;";
        target = $"{flag}.{config.DefualtLanguage.ToString()};";
        RegexReplace(source, target, fileFullPath);


        //修改版本号
        flag   = "public const string ClientVersion = ";
        source = $"{flag}.*;";
        target = $"{flag}\"{config.ClientVersion}\";";
        RegexReplace(source, target, fileFullPath);

        //修改构建号
        flag   = "public const string VersionCode = ";
        source = $"{flag}.*;";
        target = $"{flag}\"{config.VersionCode}\";";
        RegexReplace(source, target, fileFullPath);

        //修改语言选项
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.AppendLine("public static KeyValuePair<LanguageType, string>[] languagesUsed =");
        sb.AppendLine("    {");
        switch (config.Platform)
        {
        case PLATFOEMTYPE.FunRock:
            sb.AppendLine("        new KeyValuePair<LanguageType, string>(LanguageType.arabic,  \"العربية\"),// 阿拉伯语");
            break;

        case PLATFOEMTYPE.NONE:
            sb.AppendLine("        new KeyValuePair<LanguageType, string>(LanguageType.chinese, \"简体中文\"),//中文");
            break;

        default:
            sb.AppendLine("        new KeyValuePair<LanguageType, string>(LanguageType.english, \"English\"),//英文");
            break;
        }
        sb.AppendLine("    };");

        flag   = "public static KeyValuePair<LanguageType, string>";
        source = $"{flag}([\\d\\D]*)}};";
        target = sb.ToString();
        RegexReplace(source, target, fileFullPath);

        AssetDatabase.Refresh();
        AssetDatabase.ImportAsset(fileFullPath);
    }
Exemplo n.º 7
0
    private void DrawConfigsDetails()
    {
        int selectedndex = GUILayout.Toolbar(m_CurrentSelectIndex, m_ConfigsNames.ToArray(), "LargeButton");

        if (m_CurrentSelectIndex != selectedndex)
        {
            m_CurrentSelectIndex = selectedndex;
            //m_CurrentConfig = DeepClone<ExportXcodeConfiguration>(m_Configs[m_ConfigsNames[m_CurrentSelectIndex]]);
            m_CurrentConfig = m_Configs[m_ConfigsNames[m_CurrentSelectIndex]].Clone();
        }
        m_SaveAsName = m_CurrentConfig.Name;
        GUILayout.Space(20);
        m_CurrentConfig.Platform = (PLATFOEMTYPE)EditorGUILayout.EnumPopup("Platform", m_CurrentConfig.Platform);
        EditorGUILayout.Space();
        m_CurrentConfig.OutLine = EditorGUILayout.Toggle("OutLine", m_CurrentConfig.OutLine);
        EditorGUILayout.Space();
        m_CurrentConfig.EnableGuest = EditorGUILayout.Toggle("EnableGuest", m_CurrentConfig.EnableGuest);
        EditorGUILayout.Space();
        m_CurrentConfig.CompanyName = EditorGUILayout.TextField("CompanyName", m_CurrentConfig.CompanyName);
        EditorGUILayout.Space();
        m_CurrentConfig.ProductName = EditorGUILayout.TextField("ProductName", m_CurrentConfig.ProductName);
        EditorGUILayout.Space();
        m_CurrentConfig.ApplicationIdentifier = EditorGUILayout.TextField("App-Identifier", m_CurrentConfig.ApplicationIdentifier);
        EditorGUILayout.Space();
        m_CurrentConfig.ClientVersion = EditorGUILayout.TextField("ClientVersion", m_CurrentConfig.ClientVersion);
        EditorGUILayout.Space();
        m_CurrentConfig.VersionCode = EditorGUILayout.TextField("VersionCode", m_CurrentConfig.VersionCode);
        EditorGUILayout.Space();
        m_CurrentConfig.DefualtLanguage = (LanguageType)EditorGUILayout.EnumPopup("DefualtLanguage", m_CurrentConfig.DefualtLanguage);
        EditorGUILayout.Space();
        m_CurrentConfig.Splash = (Texture2D)EditorGUILayout.ObjectField("Splash", m_CurrentConfig.Splash, typeof(Texture2D), false);

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Save Configuration"))
        {
            SaveConfig(m_SaveAsName);
            ReloadConfigs();
        }
        GUILayout.Space(3);
        if (GUILayout.Button("Save As ..."))
        {
            m_ShowSaveAsView = true;
        }
        GUILayout.Space(3);
        if (GUILayout.Button("Delete Configuration"))
        {
            List <ExportXcodeConfiguration> configs = ExportXcodeParam.Instance.Configs;
            int count = configs.Count;
            if (count <= 1)
            {
                EditorUtility.DisplayDialog("Warning", "至少保留一个配置方案", "OK");
                return;
            }
            for (int i = 0; i < count; i++)
            {
                if (configs[i].Name.Equals(m_ConfigsNames[m_CurrentSelectIndex]))
                {
                    configs.RemoveAt(i);
                    break;
                }
            }
            m_CurrentSelectIndex = 0;
            ReloadConfigs();
        }
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(20);
        Color temp = GUI.color;

        GUI.color = Color.cyan;
        if (GUILayout.Button("Start Export", GUILayout.MinHeight(50)))
        {
            SaveConfig(m_SaveAsName);
            ReloadConfigs();
            ExportHelper.ExportXCodeProject(m_CurrentConfig);
            //this.Close();
        }
        GUI.color = temp;
    }