CommonConfig.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. /**通用配置(2021/12/18新增) */
  6. public class CommonConfig
  7. {
  8. //青凤鸾 WONDERFITTER ,WONDER FITTER Pro ,WONDER FITTER 运动
  9. public static readonly string[] AppNames = { "WONDERFITTER Pro 运动", "WONDER FITTER Pro", "WONDERFITTER PRO B" };
  10. public static readonly string[] AppNames9Axis = { "WONDERFITTER 运动", "WONDERFITTER" };
  11. //App地区(0:国内版;1:海外版;)
  12. public static int AppArea
  13. {
  14. get
  15. {
  16. //Application.identifier.Contains("com.xmjssvr.BowArrow.mi")
  17. //int index = Application.identifier == "com.xmjssvr.BowArrow" ? 0 : 1; // Array.IndexOf(AppNames, Application.productName);
  18. #if UNITY_IOS
  19. int index = Application.identifier == "com.xmjssvr.BowArrow" || Application.identifier == "com.xmjssvr.PadBowArrow" ? 0 : 1;//海外版 com.xmjssvr.BowArrowEn
  20. #endif
  21. #if UNITY_ANDROID
  22. int index = 0;
  23. if (StandaloneModeOrPlatformB)
  24. {
  25. //b端
  26. index = Application.identifier == "com.xmjssvr.BowArrow.miBClient" ? 0 : 1;//海外版 com.xmjssvr.BowArrowEn
  27. }
  28. else {
  29. index = Application.identifier == "com.xmjssvr.BowArrow.mi" ? 0 : 1;//海外版 com.xmjssvr.BowArrowEn
  30. }
  31. #endif
  32. #if UNITY_STANDALONE_WIN
  33. //pc版
  34. int index = 0;
  35. #endif
  36. if (index == 0) return 0;
  37. else return 1;
  38. }
  39. }
  40. //初始化一下使用的语言
  41. static Dictionary<string, int> areaKey = new Dictionary<string, int>() {{ "English", 1 }, { "Japanese", 2 } };
  42. //获取海外的默认语言
  43. public static int GetLanguageByKey(string key)
  44. {
  45. return areaKey.TryGetValue(key, out int lang) ? lang : areaKey["English"];
  46. }
  47. //根据产品名决定默认语言
  48. public static int AppLanguage
  49. {
  50. get
  51. {
  52. return AppArea == 0 ? 0 : GetLanguageByKey(startLanguageKey);
  53. }
  54. }
  55. //禁止语言切换(ios安全上架)
  56. // public static bool banLanguageChangeSwitch { get => Application.platform == RuntimePlatform.IPhonePlayer; }
  57. public static bool banLanguageChangeSwitch { get => false; }
  58. //禁止绑定关联账号的相关功能(找回密码,注册界面绑定手机邮箱,个人界面绑定手机邮箱)
  59. // public static bool banBindRelateAccount { get => Application.platform == RuntimePlatform.IPhonePlayer; }
  60. public static bool banBindRelateAccount { get => false; }
  61. public static bool iosTaoKe = false; //IOS套壳开关
  62. public static bool ReleaseVersion2 = true;
  63. /*
  64. 特定版本功能
  65. 1、长接瞄准键,出来鼠标的功能帮忙去掉
  66. 2、在初始状态下,就装备上五倍射程卡和二倍瞄准镜
  67. 3、将60寸,2.5米的5倍数更改为60寸,1.5米的3倍数
  68. 4、进入游戏时,默认加开启射程卡
  69. */
  70. public static bool SpecialVersion1 = true;
  71. //需要App商店审核?-标记用于特别处理某些功能
  72. public static bool needToExamine = false;
  73. //是否属于发布版本?-标记用于特别处理某些功能,比如屏蔽内部测试才有功能
  74. public static bool isReleaseVersion = false;
  75. //设备方案
  76. public static int devicePlan = 3;
  77. /**环数精度小数位 */
  78. public static readonly int ringsPrecision = 1;
  79. /**箭的速度精度小数位 */
  80. public static readonly int arrowSpeedPrecision = 1;
  81. //实体模具箭重,单位克
  82. public static float arrowWeight = 75;
  83. #region 校准引导时候。校准的时间
  84. /**弓箭方案时间 */
  85. public static float calibrationTimeArchery { get; } = 10;
  86. /**枪时间*/
  87. public static float calibrationTimeGun { get; } = 10;
  88. #endregion
  89. public enum ServerType { LocalTest, Produce, Test };
  90. private static ServerType serverType = ServerType.Produce;
  91. //网关服务器访问地址
  92. public static string gateServerURL
  93. {
  94. get
  95. {
  96. if (serverType == ServerType.Produce)
  97. {
  98. // Debug.Log("****************** 正式服务器: " + serverIndex + " ********************");
  99. if (serverIndex == 0)
  100. return "https://www.xmjssvr.com/SmartBowBusinessServer";//"http://118.195.187.121/SmartBowBusinessServer";等备案再使用域名
  101. else if (serverIndex == 1)
  102. return "https://www.wonderfittervr.com/SmartBowBusinessServer";//"http://54.165.56.200/SmartBowBusinessServer";
  103. }
  104. else if (serverType == ServerType.Test)
  105. {
  106. // Debug.Log("****************** 测试服务器 ********************");
  107. //测试服务器
  108. return "http://8.155.53.54:11432/SmartBowBusinessServer";
  109. }
  110. return "http://192.168.0.105:11432/SmartBowBusinessServer";
  111. }
  112. }
  113. //业务服务端WS访问地址
  114. public static string businessServerWsURL;
  115. //游戏对战服务器
  116. public static string gamePKServerWsURL;
  117. public static int serverIndex { get => AppArea; }
  118. /// <summary>
  119. /// 弓箭SDK的服务端地址
  120. /// </summary>
  121. public static readonly string SmartBowSdkURL = "http://43.132.127.96/SmartBowBusinessServer";
  122. #region 根据不同平台不同版本配置打包 bool
  123. /// <summary>
  124. /// 单机模式是否开启
  125. /// </summary>
  126. public static bool StandaloneMode { get; } = false; // 默认false
  127. /// <summary>
  128. /// 是否开启设备验证。
  129. /// 暂时Pc开启验证
  130. /// </summary>
  131. #if UNITY_STANDALONE_WIN || UNITY_EDITOR
  132. public static bool EnableDecryption = false; // 默认true
  133. #else
  134. public static bool EnableDecryption = false;
  135. #endif
  136. /// <summary>
  137. /// 是否打包红外软件App,这里主要和九轴有区别
  138. /// </summary>
  139. public static bool bInfraredApp { get; } = false;
  140. /// <summary>
  141. /// 隐藏调试按钮
  142. /// </summary>
  143. public static bool bHideInfraredDemoBtnSee { get; } = true;
  144. //打包App 的端,比如打包B 端就设置 B
  145. public static OperatingPlatform OP { get; } = OperatingPlatform.C;
  146. //是否是投币功能
  147. public static bool bSupportCoin { get; } = false;
  148. //是否禁用蓝牙(目前是b端端口连接情况下设置)
  149. public static bool bDisableBluetooth { get; } = false;
  150. /// <summary>
  151. /// 视频链接区分
  152. /// </summary>
  153. public static bool bInfraredURL { get; } = true;
  154. /// <summary>
  155. /// 是否显示双人游戏
  156. /// </summary>
  157. public static bool bDisplayTwoPlayerGames { get; } = true;
  158. #endregion
  159. //单机版,B端,投币功能
  160. public static bool StandaloneModeOrPlatformB { get => StandaloneMode && OP == OperatingPlatform.B && bSupportCoin; }
  161. //设置海外版的启动语言
  162. public static string startLanguageKey = "English";
  163. /// <summary>
  164. /// 是否启动CMD来连接蓝牙
  165. /// </summary>
  166. public static bool bUseCMD { get; } = true;
  167. }
  168. //打包App 的端
  169. public enum OperatingPlatform
  170. {
  171. //A端
  172. A,
  173. //B端
  174. B,
  175. //C端
  176. C,
  177. }