/// <summary> /// 取得当前AndroidSDK设定信息. /// </summary> /// <returns>当前AndroidSDK设定信息.</returns> private static IAndroidSdkSettings GetCurAndroidSdkSetting() { IAndroidSdkSettings settings = null; // 平台类型 var platformType = SysSettings.GetInstance().PlatformType; Loger.BuildLog($"PlatformType:{platformType}."); switch (platformType) { // 华为 case PlatformType.Huawei: { settings = HuaweiSdkSettings.GetInstance(HuaweiSdkSettings.AssetFileDir); } break; // 天鸽 case PlatformType.Tiange: { settings = TiangeSdkSettings.GetInstance(TiangeSdkSettings.AssetFileDir); } break; case PlatformType.Android: break; case PlatformType.None: break; case PlatformType.iOS: break; default: { // 清空/Plugins/Android下的文件 } break; } return(settings); }
/// <summary> /// 初始化SDK版本信息. /// </summary> /// <returns>SDK版本信息节点.</returns> protected override XmlElement InitSdkVersions() { var _useSdkNode = base.InitSdkVersions(); if (null == _useSdkNode) { return(null); } if (-1 >= HuaweiSdkSettings.GetInstance().MinSdkVersion) { MinSdkVersion = GetNodeAttribute_i(_useSdkNode, "minSdkVersion"); } else { MinSdkVersion = HuaweiSdkSettings.GetInstance().MinSdkVersion; SetNodeAttribute(_useSdkNode, "minSdkVersion", MinSdkVersion.ToString()); } if (-1 >= HuaweiSdkSettings.GetInstance().MaxSdkVersion) { MaxSdkVersion = GetNodeAttribute_i(_useSdkNode, "android:maxSdkVersion"); } else { MaxSdkVersion = HuaweiSdkSettings.GetInstance().MaxSdkVersion; SetNodeAttribute(_useSdkNode, "maxSdkVersion", MaxSdkVersion.ToString()); } if (-1 >= HuaweiSdkSettings.GetInstance().TargetSdkVersion) { TargetSdkVersion = GetNodeAttribute_i(_useSdkNode, "android:targetSdkVersion"); } else { TargetSdkVersion = HuaweiSdkSettings.GetInstance().TargetSdkVersion; SetNodeAttribute(_useSdkNode, "targetSdkVersion", TargetSdkVersion.ToString()); } return(_useSdkNode); }
/// <summary> /// 应用用户自定义数据. /// </summary> /// <param name="iGameName">游戏名.</param> protected override void ApplyUserData(string iGameName) { // 本地设定 { const string name = "Huawei_Local"; var value = HuaweiSdkSettings.GetInstance().Local.ToString(); if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value, false); } if (HuaweiSdkSettings.GetInstance().Local == false) { return; } } // 游戏名 { const string name = "Huawei_GameName"; var value = iGameName; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 自动登录 { const string name = "Huawei_AutoLogin"; var value = HuaweiSdkSettings.GetInstance().AutoLogin.ToString(); if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value, false); } if (HuaweiSdkSettings.GetInstance().Local == false) { return; } } // AppID { const string name = "Huawei_AppID"; var value = HuaweiSdkSettings.GetInstance().AppId; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 浮标密钥 { const string name = "Huawei_BuoySecret"; var value = HuaweiSdkSettings.GetInstance().BuoySecret; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 支付ID { const string name = "Huawei_PayID"; var value = HuaweiSdkSettings.GetInstance().PayId; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 支付私钥 { const string name = "Huawei_PayPrivateRsa"; var value = HuaweiSdkSettings.GetInstance().PayPrivateRsa; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 支付公钥 { const string name = "Huawei_PayPublicRsa"; var value = HuaweiSdkSettings.GetInstance().PayPublicRsa; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // CPID { const string name = "Huawei_CPID"; var value = HuaweiSdkSettings.GetInstance().Cpid; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 登录签名公钥 { const string name = "Huawei_LoginPublicRsa"; var value = HuaweiSdkSettings.GetInstance().LoginPublicRsa; if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value); } } // 屏幕方向 { const string name = "Huawei_Orientation"; var value = "1"; var _orientation = HuaweiSdkSettings.GetInstance().Orientation; if (UIOrientation.LandscapeLeft == _orientation || UIOrientation.LandscapeRight == _orientation) { value = "2"; } if (false == string.IsNullOrEmpty(value)) { AddUserDefineNode(name, value, false); } } // 保存strings.xml StringsXml?.Save(); }