示例#1
0
        public static List<object> GetResolutionList()
        {
            if (null == _resolutionList) // lazy
            {
                Resolution[] resolutions = Screen.resolutions;

                _resolutionList = new List<object>();

                int count = resolutions.Length;

                for (int i = count - 1; i >= 0; i--) // bigger on top
                {
                    Resolution resolution = resolutions[i];
                    ListItem li = new ListItem(
                        new ResolutionDescriptor(i, resolution), 
                        string.Format("{0}x{1}", resolution.width, resolution.height)
                    );
                    _resolutionList.Add(li);
                }
            }

            return _resolutionList;
        }
示例#2
0
        /// <summary>
        /// Returns dummy resolution list (when in editor)
        /// </summary>
        /// <returns></returns>
        public static List<object> GetDummyResolutionList()
        {
            if (null == _resolutionList) // lazy
            {
                List<ResolutionDescriptor> resolutions = new List<ResolutionDescriptor>
                                                   {
                                                       new ResolutionDescriptor(0, new Resolution {width = 100, height = 100}),
                                                       new ResolutionDescriptor(1, new Resolution {width = 200, height = 200}),
                                                       new ResolutionDescriptor(2, new Resolution {width = 300, height = 300}),
                                                       new ResolutionDescriptor(3, new Resolution {width = 400, height = 400}),
                                                       new ResolutionDescriptor(4, new Resolution {width = 500, height = 500}),
                                                   };

                _resolutionList = new List<object>();

                foreach (ResolutionDescriptor resolution in resolutions)
                {
                    ListItem li = new ListItem(resolution, string.Format("{0}x{1}", resolution.Resolution.width, resolution.Resolution.height));
                    _resolutionList.Add(li);
                }
            }

            return _resolutionList;
        }