Exemplo n.º 1
0
        static void InitForAndroidBuild()
        {
            // 清空下载目录
            DownloadList _instance = DownloadList.GetInstance();

            if (_instance != null)
            {
                _instance.Clear(true);
            }
            // 初始化打包信息
            BuildSettings.GetInstance(BuildSettings.AssetFileDir);

                        #if UNITY_ANDROID
            // 设定选项
            // 天鸽的场合
            if (TPlatformType.Tiange == BuildInfo.GetInstance().PlatformType)
            {
                // 初始化SDK设定信息&导入最新
                TiangeSDKSettings.GetInstance(TiangeSDKSettings.AssetFileDir).ImportFromJsonFile(true);
                BuildLogger.LogMessage("TiangeSDKSettings -> ImportFromJsonFile().");
                BuildLogger.LogMessage("TiangeSDKSettings::OneSDK:{0}(MetaData:{1}).",
                                       TiangeSDKSettings.GetInstance().Data.Options.isOptionValid(BuildSystem.Options.TSDKOptions.OneSDK).ToString(),
                                       TiangeSDKSettings.GetInstance().Data.Options.OneSDK.MetaDatas.Count.ToString());

                TiangeSDKSettings.GetInstance().Data.Options.OptionsSettings =
                    BuildInfo.GetInstance().Data.Options.OptionsSettings;
            }

            // 清空Plugins/Android目录
            ClearPluginsAndroid();

            // 重置Plugins/Android
            ResetPluginsAndroid();

            // 设置相关AndroidSDK相关设定
            IAndroidSDKSettings androidSDK = GetCurAndroidSDKSetting();
            if (androidSDK != null)
            {
                string gameName    = BuildInfo.GetInstance().BuildName;
                string packageName = BuildInfo.GetInstance().BuildID;
                // 打包Android(apk文件)之前,提前应用设定
                androidSDK.PreApplyAndroidBuild(gameName, packageName);
            }
            else
            {
                BuildLogger.LogWarning("Android SDK invalid!!");
            }
                        #endif

            // 刷新
            UtilsAsset.AssetsRefresh();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化SDK版本信息.
        /// </summary>
        /// <returns>SDK版本信息节点.</returns>
        protected override XmlElement InitSDKVersions()
        {
            XmlElement _useSDKNode = base.InitSDKVersions();

            if (null == _useSDKNode)
            {
                return(null);
            }
            if (-1 >= TiangeSDKSettings.GetInstance().MinSdkVersion)
            {
                this.MinSdkVersion = GetNodeAttribute_i(_useSDKNode, "minSdkVersion");
            }
            else
            {
                this.MinSdkVersion = TiangeSDKSettings.GetInstance().MinSdkVersion;
                this.SetNodeAttribute(_useSDKNode, "minSdkVersion", this.MinSdkVersion.ToString());
            }
            if (-1 >= TiangeSDKSettings.GetInstance().MaxSdkVersion)
            {
                this.MaxSdkVersion = GetNodeAttribute_i(_useSDKNode, "android:maxSdkVersion");
            }
            else
            {
                this.MaxSdkVersion = TiangeSDKSettings.GetInstance().MaxSdkVersion;
                this.SetNodeAttribute(_useSDKNode, "maxSdkVersion", this.MaxSdkVersion.ToString());
            }
            if (-1 >= TiangeSDKSettings.GetInstance().TargetSdkVersion)
            {
                this.TargetSdkVersion = GetNodeAttribute_i(_useSDKNode, "android:targetSdkVersion");
            }
            else
            {
                this.TargetSdkVersion = TiangeSDKSettings.GetInstance().TargetSdkVersion;
                this.SetNodeAttribute(_useSDKNode, "targetSdkVersion", this.TargetSdkVersion.ToString());
            }
            return(_useSDKNode);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取得当前AndroidSDK设定信息.
        /// </summary>
        /// <returns>当前AndroidSDK设定信息.</returns>
        static IAndroidSDKSettings GetCurAndroidSDKSetting()
        {
            IAndroidSDKSettings settings = null;

            // 平台类型
            TPlatformType platformType = BuildInfo.GetInstance().PlatformType;

            BuildLogger.LogMessage("PlatformType:{0}.", platformType.ToString());

            switch (platformType)
            {
            // 华为
            case TPlatformType.Huawei:
            {
                settings = HuaweiSDKSettings.GetInstance();
            }
            break;

            // 天鸽
            case TPlatformType.Tiange:
            {
                settings = TiangeSDKSettings.GetInstance();
            }
            break;

            case TPlatformType.None:
            case TPlatformType.iOS:
            default:
            {
                // 清空/Plugins/Android下的文件
            }
            break;
            }

            return(settings);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 应用用户自定义数据.
        /// </summary>
        /// <param name="iGameName">游戏名.</param>
        protected override void ApplyUserData(string iGameName)
        {
            // 本地设定
            {
                string name  = "Local";
                string value = TiangeSDKSettings.GetInstance().Local.ToString();
                if (false == string.IsNullOrEmpty(value))
                {
                    this.AddUserDefineNode(name, value, false);
                }
                if (TiangeSDKSettings.GetInstance().Local == false)
                {
                    return;
                }
            }

            // 游戏名
            {
                string name  = "GameName";
                string value = iGameName;
                if (false == string.IsNullOrEmpty(value))
                {
                    this.AddUserDefineNode(name, value);
                }
            }

            // SDK自动初始化
            {
                string name  = "AutoSDKInit";
                string value = TiangeSDKSettings.GetInstance().AutoSDKInit.ToString();
                if (false == string.IsNullOrEmpty(value))
                {
                    this.AddUserDefineNode(name, value, false);
                }
                if (TiangeSDKSettings.GetInstance().Local == false)
                {
                    return;
                }
            }

            // 自动登录
            {
                string name  = "AutoLogin";
                string value = TiangeSDKSettings.GetInstance().AutoLogin.ToString();
                if (false == string.IsNullOrEmpty(value))
                {
                    this.AddUserDefineNode(name, value, false);
                }
                if (TiangeSDKSettings.GetInstance().Local == false)
                {
                    return;
                }
            }
            // 屏幕方向
            {
                string        name         = "Orientation";
                string        value        = "1";
                UIOrientation _Orientation = TiangeSDKSettings.GetInstance().Orientation;
                if ((UIOrientation.LandscapeLeft == _Orientation) ||
                    (UIOrientation.LandscapeRight == _Orientation))
                {
                    value = "2";
                }
                if (false == string.IsNullOrEmpty(value))
                {
                    this.AddUserDefineNode(name, value, false);
                }
            }

            // 易接SDK 设定
            if (true == TiangeSDKSettings.GetInstance().Data.Options.isOptionValid(TSDKOptions.OneSDK))
            {
                // 易接SDK Key
                {
                    string name  = "zy_class_name";
                    string value = TiangeSDKSettings.GetInstance().Data.Options.OneSDK.ZyClassName;
                    if (false == string.IsNullOrEmpty(value))
                    {
                        this.AddUserDefineNode(name, value);
                    }
                }

                // 易接SDK MetaDatas
                {
                    List <MetaDataInfo> _metaDatas = TiangeSDKSettings.GetInstance().Data.Options.OneSDK.MetaDatas;
                    foreach (MetaDataInfo _metaData in _metaDatas)
                    {
                        if ((null != _metaData) &&
                            (false == string.IsNullOrEmpty(_metaData.Name)) &&
                            (false == string.IsNullOrEmpty(_metaData.Value)))
                        {
                            this.AddUserDefineNode(_metaData.Name, _metaData.Value, false);
                        }
                    }
                }
            }

            // 保存strings.xml
            if (null != this._stringsXml)
            {
                this._stringsXml.Save();
            }
        }