382 lines
10 KiB
C#
382 lines
10 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace BF
|
|
{
|
|
public class BFGateInfo
|
|
{
|
|
public string mainDomain;
|
|
public int mainPort;
|
|
public string chatDomain;
|
|
public int chatPort;
|
|
|
|
public BFGateInfo(string mainDomain, int mainPort, string chatDomain, int chatPort)
|
|
{
|
|
this.mainDomain = mainDomain;
|
|
this.mainPort = mainPort;
|
|
this.chatDomain = chatDomain;
|
|
this.chatPort = chatPort;
|
|
}
|
|
}
|
|
|
|
public class BFHttpsInfo
|
|
{
|
|
public string mainDomain;
|
|
public int mainPort;
|
|
public BFHttpsInfo(string mainDomain, int mainPort)
|
|
{
|
|
this.mainDomain = mainDomain;
|
|
this.mainPort = mainPort;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 集群类型
|
|
/// </summary>
|
|
public enum ClusterType
|
|
{
|
|
None = 0,
|
|
Normal = 1,
|
|
Review = 2,
|
|
Test = 3,
|
|
}
|
|
|
|
[Serializable]
|
|
public class CombineURL
|
|
{
|
|
public int cluster_type;
|
|
public string ugate_addr;
|
|
public string vsn_addr;
|
|
public string upay_addr;
|
|
public string uchat_addr;
|
|
public string community_web_addr;
|
|
public string community_srv_addr;
|
|
public string aics_http_addr;
|
|
public string aics_ws_addr;
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("cluster_type:{0} ugate_addr:{1} vsn_addr:{2} upay_addr:{3} uchat_addr:{4} community_web_addr:{5} community_srv_addr:{6} aics_http_addr:{7} aics_ws_addr:{8}", cluster_type, ugate_addr, vsn_addr, upay_addr, uchat_addr, community_web_addr, community_srv_addr, aics_http_addr, aics_ws_addr);
|
|
}
|
|
}
|
|
|
|
public partial class BFPlatform
|
|
{
|
|
const String LoginCenterURLDev = "https://entrance.wdd817.link";
|
|
const String LoginCenterURL = "https://entrance.wdd817.link";
|
|
const String LoginCenterURLRU = "https://entrance.wdd817.link";
|
|
//combine url解析的数据
|
|
static ClusterType clusterType;
|
|
|
|
static BFGateInfo _channelGate;
|
|
static BFHttpsInfo _vsnUrl;
|
|
|
|
//主链接
|
|
static string mainGateUrl;
|
|
static int mainGatePort;
|
|
|
|
//聊天链接
|
|
static string chatGateUrl;
|
|
static int chatGatePort;
|
|
|
|
//版本号
|
|
static string vsnHttpUrl;
|
|
static int vsnHttpPort;
|
|
|
|
//支付中心(包含port)
|
|
static string payUrl;
|
|
|
|
//客服(包含port)
|
|
static string aicsHttpUrl;//客服http地址
|
|
static string aicsWebSocketUrl;//客服webSocket地址
|
|
|
|
//社区(包含port)
|
|
static string communityWebUrl;//社区
|
|
static string communitySrvUrl;//社区红点
|
|
|
|
//登陆中心返回的信息齐全且格式正常
|
|
static bool isLoginCenterConfigValid;//请求的域名信息是否正确
|
|
|
|
/// <summary>
|
|
/// 获得集群类型 (1-普通,2-审核,3-测试)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ClusterType GetClusterType()
|
|
{
|
|
return clusterType;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 域名信息是否请求正确
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static bool IsLoginCenterConfigValid()
|
|
{
|
|
BFLog.Log("获取 Get IsLoginCenterConfigValid:" + isLoginCenterConfigValid);
|
|
|
|
return isLoginCenterConfigValid;
|
|
}
|
|
|
|
public static void SetLoginCenterConfigValid(bool valid)
|
|
{
|
|
BFLog.Log("设置 Set IsLoginCenterConfigValid:" + valid);
|
|
|
|
isLoginCenterConfigValid = valid;
|
|
}
|
|
|
|
static string identifier;
|
|
public static string Identifier
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(identifier))
|
|
{
|
|
identifier = Application.identifier;
|
|
}
|
|
return identifier;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 是否是正式发布渠道
|
|
/// </summary>
|
|
public static bool IsPublishChannel()
|
|
{
|
|
#if UNITY_EDITOR || BF_APP_DEV || BF_APP_TEST
|
|
return false;
|
|
#else
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME ||
|
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_GLOBAL ||
|
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE ||
|
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW ||
|
|
Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU)
|
|
{
|
|
// 深度链接可以强制改为内网环境
|
|
if (BFMain.DPIsLan)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
public static bool IsRuPackage()
|
|
{
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 是否使用ru支付
|
|
/// </summary>
|
|
public static bool IsSupportRuPay()
|
|
{
|
|
#if BF_APP_DEV || BF_APP_TEST
|
|
return false;
|
|
#else
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
/// <summary>
|
|
/// 是否使用ru商店好评
|
|
/// </summary>
|
|
public static bool IsSupportRuStoreReview()
|
|
{
|
|
#if BF_APP_DEV || BF_APP_TEST
|
|
return false;
|
|
#else
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
#endif
|
|
}
|
|
|
|
// 这是Facebook SDK
|
|
public static bool IsSupportFB()
|
|
{
|
|
#if BF_APP_DEV || BF_APP_TEST
|
|
return true;
|
|
#else
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
#endif
|
|
}
|
|
|
|
public static bool IsSupportGDPR()
|
|
{
|
|
#if BF_APP_DEV || BF_APP_TEST
|
|
return true;
|
|
#else
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
#endif
|
|
}
|
|
// 这是Facebook广告SDK
|
|
|
|
public static bool IsSupportFBAD()
|
|
{
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static bool IsSupportVK()
|
|
{
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RUSTORE || Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取当前渠道gate信息
|
|
/// </summary>
|
|
public static BFGateInfo GetCurrentGateInfo()
|
|
{
|
|
return _channelGate;
|
|
}
|
|
/// <summary>
|
|
/// mainGate url(无port)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetMainGateURL()
|
|
{
|
|
return mainGateUrl;
|
|
}
|
|
/// <summary>
|
|
/// mainGate port
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GetMainGatePort()
|
|
{
|
|
return mainGatePort;
|
|
}
|
|
/// <summary>
|
|
/// chatGate url(无port)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetChatGateURL()
|
|
{
|
|
return chatGateUrl;
|
|
}
|
|
/// <summary>
|
|
/// chatGate port
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GetChatGatePort()
|
|
{
|
|
return chatGatePort;
|
|
}
|
|
|
|
public static BFHttpsInfo GetVsnHttpsInfo()
|
|
{
|
|
return _vsnUrl;
|
|
}
|
|
/// <summary>
|
|
/// 版本号url(无port)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetVsnHttpURL()
|
|
{
|
|
return vsnHttpUrl;
|
|
}
|
|
/// <summary>
|
|
/// 版本号port
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static int GetVsnHttpPort()
|
|
{
|
|
return vsnHttpPort;
|
|
}
|
|
|
|
public static string GetLoginCenterURL()
|
|
{
|
|
#if BF_APP_DEV || UNITY_EDITOR
|
|
return LoginCenterURLDev;
|
|
#else
|
|
if (BFMain.DPIsLan)
|
|
{
|
|
return LoginCenterURLDev;
|
|
}
|
|
if (IsRuPackage())
|
|
{
|
|
return LoginCenterURLRU;
|
|
}
|
|
return LoginCenterURL;
|
|
#endif
|
|
}
|
|
|
|
public static string GetPayCenterURL()
|
|
{
|
|
return payUrl;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 社区地址
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetCommunityWebURL()
|
|
{
|
|
return communityWebUrl;
|
|
}
|
|
/// <summary>
|
|
/// 社区红点地址
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetCommunitySrvURL()
|
|
{
|
|
return communitySrvUrl;
|
|
}
|
|
|
|
public static string GetAicsHttpURL()
|
|
{
|
|
return aicsHttpUrl;
|
|
}
|
|
|
|
public static string GetAicsWebSocketURL()
|
|
{
|
|
return aicsWebSocketUrl;
|
|
}
|
|
//region 华为支付
|
|
/// <summary>
|
|
/// 是否使用hw支付
|
|
/// </summary>
|
|
public static bool IsSupportHWPay()
|
|
{
|
|
#if BF_APP_DEV || BF_APP_TEST
|
|
return false;
|
|
#else
|
|
if (Identifier == BFPlatform.ANDROID_GP_PACKAGE_NAME_RU_HW)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
#endif
|
|
}
|
|
//regionend
|
|
}
|
|
} |