/// <summary> /// 设置游戏分辨率,如果显示模式为全屏,无论改width,height都是全屏 /// 通知UIManager和XRenderTextureManager分辨率改了 /// </summary> /// <param name="nWidth"></param> /// <param name="nHeight"></param> /// <param name="eDisplayMode"></param> public void SetResolution(int nWidth, int nHeight, EnumDisplayMode eDisplayMode) { if (eDisplayMode == EnumDisplayMode.eDisplayMode_FullScreen) { if (GraphicsManager.GoodGraphicsResolution.Count > 0) { IGraphicsResolution graphicsResolution = GraphicsManager.GoodGraphicsResolution[GraphicsManager.GoodGraphicsResolution.Count - 1]; nWidth = graphicsResolution.Width; nHeight = graphicsResolution.Height; } } this.SetResolution(nWidth, nHeight, eDisplayMode == EnumDisplayMode.eDisplayMode_FullScreen); }
private static bool Add(int width, int height) { IGraphicsResolution item = GraphicsManagerImplement.CreateResolution(width, height); bool result; if (GraphicsManagerImplement.s_resolutions.BinarySearch(item) >= 0) { result = false; } else { GraphicsManagerImplement.s_resolutions.Add(item); GraphicsManagerImplement.s_resolutions.Sort(); result = true; } return(result); }
public override void Init() { if (base.uiBehaviour.m_Poplist_RS != null) { this.uiBehaviour.m_Poplist_RS.Clear(); Debug.Log(GraphicsManager.GoodGraphicsResolution.Count); for (int i = 0; i < GraphicsManager.GoodGraphicsResolution.Count; i++) { IGraphicsResolution resolution = GraphicsManager.GoodGraphicsResolution[i]; string item = string.Format("{0}X{1}", resolution.Width, resolution.Height); this.uiBehaviour.m_Poplist_RS.AddItem(item, resolution); if (resolution.Width == Singleton <ScreenManager> .singleton.CurrentWidth && resolution.Height == Singleton <ScreenManager> .singleton.CurrentHeight) { this.uiBehaviour.m_Poplist_RS.SelectedIndex = (short)i; } } } }
private bool OnPopupListResolutionSelect(IXUIPopupList uiPopupList) { XLog.Log.Debug("OnPoP"); bool result; if (1 == UserOptions.Singleton.DisplayMode) { IGraphicsResolution graphicsResolution = (IGraphicsResolution)uiPopupList.GetDataByIndex((int)uiPopupList.SelectedIndex); if (null == graphicsResolution) { result = false; return(result); } UserOptions.Singleton.Resolution = graphicsResolution; XLog.Log.Debug("Set"); Singleton <ScreenManager> .singleton.SetResolution(graphicsResolution.Width, graphicsResolution.Height, (EnumDisplayMode)UserOptions.Singleton.DisplayMode); } else { uiPopupList.SelectedIndex = this.m_cacheResolutionIndexWhenFullSceen; } result = true; return(result); }
private void LoadUserConfig() { string fullPath = ResourceManager.GetFullPath("config/user/useroptionscfg.xml", false); if (File.Exists(fullPath)) { using (XmlReader xmlReader = XmlReader.Create(fullPath)) { if (null != xmlReader) { this.m_bHasSet = true; while (xmlReader.Read()) { if (xmlReader.Name == "element" && xmlReader.NodeType == XmlNodeType.Element) { string text = xmlReader.GetAttribute("id").ToLower(); string attribute = xmlReader.GetAttribute("value"); string text2 = text; switch (text2) { case "rememberaccount": this.m_bIsRememberAccount = (Convert.ToInt32(attribute) != 0); break; case "userid": this.m_strUserId = attribute; break; case "servername": this.m_strServerName = attribute; break; case "displaymode": this.m_nDisplayMode = Convert.ToInt32(attribute); break; case "resolution": { string[] array = attribute.Split(new char[] { ',' }); if (array.Length == 2) { int nWidth = Convert.ToInt32(array[0]); int nHeight = Convert.ToInt32(array[1]); this.m_IGraphicsResolution = GraphicsManager.CreateResolution(nWidth, nHeight); } break; } case "mutesound": this.m_bMuteSound = (Convert.ToInt32(attribute) != 0); break; case "bgsoundvalue": this.m_fBGSoundValue = (float)Convert.ToDouble(attribute); break; case "uisoundvalue": this.m_fUISoundValue = (float)Convert.ToDouble(attribute); break; case "soundvalue": this.m_fSoundValue = (float)Convert.ToDouble(attribute); break; case "herovoicevalue": this.m_fBeastVoiceValue = (float)Convert.ToDouble(attribute); break; case "roomname": this.m_strRoomName = attribute; break; case "roompassword": this.m_strRoomPW = attribute; break; case "roomcontrolmode": this.m_nRoomControlMode = Convert.ToInt32(attribute); break; case "roommapid": this.m_unRoomMapID = Convert.ToUInt32(attribute); break; case "roomheroselectmode": this.m_nRoomHeroSelectMode = Convert.ToInt32(attribute); break; case "roomactionmode": this.m_nRoomActionMode = Convert.ToInt32(attribute); break; case "followrole": this.m_bFollowHero = (Convert.ToInt32(attribute) != 0); break; case "opencombatlog": this.m_bCombatlog = (Convert.ToInt32(attribute) != 0); break; case "notopenresignprompt": this.m_bNotOpenResignPrompt = (Convert.ToInt32(attribute) != 0); break; } } } } } } }
public UserOptions() { this.m_IGraphicsResolution = GraphicsManager.Default; }