Exemplo n.º 1
0
    public static void ChangeSDKSetting()
    {
        var gameSetting = GameSetting.LoadGameSettingData();
        var channelDict = SPSdkManager.SpChannelDic(gameSetting.configSuffix, false);

        if (!channelDict.ContainsKey(gameSetting.channel))
        {
            return;
        }

        var curChannel = channelDict[gameSetting.channel];

        foreach (var setting in _sdkSettingList)
        {
            var path   = setting.propertiesPath;
            var plugin = AssetImporter.GetAtPath(path) as PluginImporter;
            if (plugin == null)
            {
                continue;
            }

            var openFlag = (setting.IsSymbolEnable && curChannel.symbol.Contains(setting.Symbol)) ||
                           (!setting.IsSymbolEnable && !curChannel.symbol.Contains(setting.Symbol));
            foreach (var buildTarget in setting.Targets)
            {
                plugin.SetCompatibleWithPlatform(buildTarget, openFlag);
            }
            plugin.SaveAndReimport();
        }
    }
Exemplo n.º 2
0
 private void LoadSPChannelConfig(string configSuffix, bool forceLoad)
 {
     _spChannelDic = SPSdkManager.SpChannelDic(configSuffix, forceLoad);
 }
Exemplo n.º 3
0
    public static void ChangeIcons()
    {
        var gameSetting = GameSetting.LoadGameSettingData();
        var channelDict = SPSdkManager.SpChannelDic(gameSetting.configSuffix, false);

        if (!channelDict.ContainsKey(gameSetting.channel))
        {
            return;
        }

        var curChannel = channelDict[gameSetting.channel];
        var pIcon      = ProjectIcon.Android;
        var cIconList  = new List <ChannelIcon>();

        switch (gameSetting.platformType)
        {
        case GameSetting.PlatformType.Android:
        {
            pIcon = ProjectIcon.Android;
            cIconList.Add(ChannelIcon.Android);
            break;
        }

        case GameSetting.PlatformType.ROOTIOS:
        case GameSetting.PlatformType.IOS:
        {
            pIcon = ProjectIcon.iOS;
            cIconList.Add(ChannelIcon.iPad);
            cIconList.Add(ChannelIcon.iPhone);
            break;
        }
        }

        string configSuffix = gameSetting.configSuffix;

        if (string.IsNullOrEmpty(configSuffix))
        {
            configSuffix = "xlsj";
        }

        var checkChannelFolder = new List <string>();

        foreach (var channelIcon in cIconList)
        {
            var checkFolder = string.Format(ChannelIconFolderFormat, configSuffix, curChannel.name, channelIcon);
            Debug.Log(checkFolder);
            if (!Directory.Exists(checkFolder))
            {
                checkFolder = string.Format(CommonIconFolderFormat, configSuffix, channelIcon);
                Debug.Log(checkFolder);
            }
            checkChannelFolder.Add(checkFolder);
        }

        var tex = new Texture2D(0, 0);

        foreach (var folder in checkChannelFolder)
        {
            foreach (var file in Directory.GetFiles(folder, "*.png", SearchOption.AllDirectories))
            {
//                Debug.Log(file);
                var bytes = File.ReadAllBytes(file);
                tex.LoadImage(bytes);
                var projectIconPath = string.Format(ProjectIconPathFormat, pIcon, string.Format("{0}x{0}", tex.width));
//                Debug.Log(projectIconPath);
                if (File.Exists(projectIconPath))
                {
                    File.WriteAllBytes(projectIconPath, bytes);
                }
                else
                {
//                    Debug.Log(file);
//                    Debug.Log(projectIconPath);
                }

                if (tex.width == ResourcesIconSize)
                {
                    File.WriteAllBytes(ResourcesIconPath, bytes);
                }
            }
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Android和iOS共用Mobile Splash Screen
    /// </summary>
    public static void ChangeSplash()
    {
        var gameSetting = GameSetting.LoadGameSettingData();
        var channelDict = SPSdkManager.SpChannelDic(gameSetting.configSuffix, false);

        if (!channelDict.ContainsKey(gameSetting.channel))
        {
            return;
        }

        var curChannel = channelDict[gameSetting.channel];

        string configSuffix = gameSetting.configSuffix;

        if (string.IsNullOrEmpty(configSuffix))
        {
            configSuffix = "xlsj";
        }

        foreach (ChannelSplash cSplash in Enum.GetValues(typeof(ChannelSplash)))
        {
            var checkFolder = string.Format(ChannelSplashFolderFormat, configSuffix, curChannel.name, cSplash);
            if (!Directory.Exists(checkFolder))
            {
                checkFolder = string.Format(CommonSplashFolderFormat, configSuffix, cSplash);
            }
            Debug.Log(checkFolder);

            var tex = new Texture2D(0, 0);
            foreach (var file in Directory.GetFiles(checkFolder, "*.jpg", SearchOption.AllDirectories))
            {
                //Debug.Log(file);
                var bytes = File.ReadAllBytes(file);

                if (cSplash == ChannelSplash.iOS)
                {
                    tex.LoadImage(bytes);
                    var projectSplashPath = string.Format(ProjectSplashPathFormat, cSplash, string.Format("{0}x{1}", tex.width, tex.height));
                    //	Debug.Log(projectSplashPath);
                    if (File.Exists(projectSplashPath))
                    {
                        File.WriteAllBytes(projectSplashPath, bytes);
                    }
                    else
                    {
                        //Debug.Log(file);
                        //Debug.Log(projectSplashPath);
                    }
                }

                if (cSplash == ChannelSplash.Android)
                {
                    var projectSplashPath2 = string.Format(ProjectSplashPathFormat, cSplash, "splash");
                    //	Debug.Log(projectSplashPath);
                    if (File.Exists(projectSplashPath2))
                    {
                        File.WriteAllBytes(projectSplashPath2, bytes);
                    }
                    else
                    {
                        //Debug.Log(file);
                        //Debug.Log(projectSplashPath);
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// 初始化
 /// </summary>
 public static void InitModeDict()
 {
     _curChannel = SPSdkManager.SpChannelDic()[GameSetting.LoadGameSettingData().channel];
 }