/// <summary> /// 设置渠道信息 /// </summary> /// <param name="xmlNodeList"></param> static void SetChannelInfo(XMLNode rootnode) { if (rootnode == null) { return; } XMLNodeList xmlNodeList = rootnode.GetNodeList("Resources>0>Channel>0>Property"); GameArea = EnumArea.None; if (string.IsNullOrEmpty(strChannelUniqueName)) { #if UNITY_IPHONE strChannelUniqueName = "appstore"; #else strChannelUniqueName = "android_snail"; #endif } ///解析首段中的类型定义 foreach (XMLNode n in xmlNodeList) { string strID = n.GetValue("@ID"); if (strID == strChannelUniqueName) { payCallBackURL = n.GetValue("@PayCallBackUrl"); ClientInstallUrl = n.GetValue("@ClientInstallUrl"); strNoticeName = n.GetValue("@NoticeName"); strChannelName = n.GetValue("@ChannelName"); mOrderType = StaticUtilTools.IntParse(n.GetValue("@OrderType")); //采集 bNeedDataCollect = "1".Equals(n.GetValue("@DataCollect")); #if UNITY_STANDALONE_OSX && !UNITY_EDITOR bNeedDataCollect = true; #endif //地区 string strArea = n.GetValue("@Area"); if (!string.IsNullOrEmpty(strArea)) { int iArea; if (int.TryParse(strArea, out iArea)) { GameArea = (EnumArea)iArea; } } return; } } LogSystem.LogWarning("channelName not have info ", strChannelUniqueName); }
// Use this for initialization public void init() { Resolution resolution = Screen.currentResolution; int resolutionWidth = resolution.width; int resolutionHeight = resolution.height; // make sure width is longer than height // or it will make GUI look smaller in iPhone 5 or iPhone 5S with IOS 7 or earlier version // xumc at 2016/11/23 if (resolutionWidth < resolutionHeight) { resolutionWidth = resolutionHeight; resolutionHeight = resolution.width; } double dpixles = resolutionWidth * resolutionHeight; float ratio = (float)resolutionWidth / (float)resolutionHeight; if (!string.IsNullOrEmpty(Config.mScreenMaxResolution)) { string[] maxResolution = Config.mScreenMaxResolution.Split('*'); if (maxResolution != null && maxResolution.Length == 2) { dbigRatioPixles = StaticUtilTools.FloatParse(maxResolution[0]) * StaticUtilTools.FloatParse(maxResolution[1]); } } float ratios = Mathf.Abs(ratio - SmallRatio); float ratiob = Mathf.Abs(ratio - BigRatio); if (ratios > ratiob) { ///big than dbigRatioPixles ,need change reslution if (dpixles > dbigRatioPixles) { /// big resolution best! currentResolution = BigResolution; #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY Screen.SetResolution((int)currentResolution.x, (int)currentResolution.y, true); #else Screen.SetResolution((int)currentResolution.x, (int)currentResolution.y, Screen.fullScreen); #endif } else { Vector2 vTemp = Vector2.zero; vTemp.x = resolutionWidth; vTemp.y = resolutionHeight; currentResolution = vTemp; } } else { ///big than dbigRatioPixles ,need change reslution if (dpixles > dsmallRatioPixles) { /// small resolution best! currentResolution = SmallResolution; #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY Screen.SetResolution((int)currentResolution.x, (int)currentResolution.y, true); #else Screen.SetResolution((int)currentResolution.x, (int)currentResolution.y, Screen.fullScreen); #endif } else { Vector2 vTemp = Vector2.zero; vTemp.x = resolutionWidth; vTemp.y = resolutionHeight; currentResolution = vTemp; } } #if UNITY_ANDROID #if __AUTO_TEST__ GameObject go = GameObject.Find("GUI/UICamera"); UICollectorConstructor ucc = go.GetComponent <UICollectorConstructor>(); if (ucc != null) { ucc.StartInit(); } #endif #endif }