Пример #1
0
    // Draws all ScreenCap entries of the specified group
    private static void DrawDefaultScreenCapGroup(xARMScreenCapGroup group)
    {
        // Header
        GUILayout.BeginHorizontal("box");

        DrawColumnHeader("Active", labelWidthEnabled + spacing, xARMScreenCap => xARMScreenCap.Enabled);
        DrawColumnHeader("OS", labelWidthGroup, xARMScreenCap => xARMScreenCap.Group);
        DrawColumnHeader("Name", labelWidthName, xARMScreenCap => xARMScreenCap.Name);
        DrawColumnHeader("Diagonal", labelWidthDiagonal, xARMScreenCap => xARMScreenCap.Diagonal);
        DrawColumnHeader("DPI Group", labelWidthDPILabel, xARMScreenCap => xARMScreenCap.DPILabel);
        DrawColumnHeader("DPI", labelWidthDPI, xARMScreenCap => xARMScreenCap.DPI);
        DrawColumnHeader("Aspect", labelWidthAspectLabel, xARMScreenCap => xARMScreenCap.AspectLabel);
        DrawColumnHeader("Resolution (px)", labelWidthResolution, xARMScreenCap => xARMScreenCap.Resolution.x);
        DrawColumnHeader("Resolution", labelWidthResolutionLabel, xARMScreenCap => xARMScreenCap.ResolutionLabel);
        DrawColumnHeader("Format", labelWidthFormat, xARMScreenCap => xARMScreenCap.IsLandscape);
        DrawColumnHeader("Stats (pos)", labelWidthStatsPos, xARMScreenCap => xARMScreenCap.StatisticsPositioning);
        DrawColumnHeader("Stats (%)", labelWidthStatsPerc, xARMScreenCap => xARMScreenCap.StatisticsUsedPercent);
        DrawColumnHeader("Sample devices", labelMinWidthDescription, xARMScreenCap => xARMScreenCap.Description, true);
        GUILayout.EndHorizontal();

        // Entries
        foreach (xARMScreenCap currScreenCap in xARMManager.AvailScreenCaps)
        {
            if (currScreenCap.Group == group && currScreenCap.OrientationIsActive)
            {
                DrawDefaultScreenCapEntry(currScreenCap);
            }
        }

        EditorGUILayout.Space();
    }
Пример #2
0
        public xARMScreenCap(string name, Vector2 res, string resLabel, string aspectLable, float diagonal, int dpi, string dpiLabel,
                             xARMScreenCapGroup scgroup, int statsPos, float usedPerc, string desc)
        {
            if (name != "")
            {
                Name = name;
            }
            else
            {
                Name = scgroup.ToString();
            }

            Description     = desc;
            Resolution      = res;
            ResolutionLabel = resLabel;
            Aspect          = res.x / res.y;

            if (aspectLable != "")
            {
                AspectLabel = aspectLable;
            }
            else
            {
                if (Aspect.Equals(3 / 2f))
                {
                    AspectLabel = "3:2";
                }
                else if (Aspect.Equals(5 / 3f))
                {
                    AspectLabel = "5:3";
                }
                else if (Aspect.Equals(5 / 4f))
                {
                    AspectLabel = "5:4";
                }
                else if (Aspect.Equals(4 / 3f))
                {
                    AspectLabel = "4:3";
                }
                else if (Aspect.Equals(16 / 9f))
                {
                    AspectLabel = "16:9";
                }
                else if (Aspect.Equals(16 / 10f))
                {
                    AspectLabel = "16:10";
                }
                else
                {
                    AspectLabel = "custom";
                }
            }

            Diagonal = diagonal;
            if (dpi == 0)
            {
                DPI = Mathf.RoundToInt(Mathf.Sqrt(Mathf.Pow(res.x, 2) + Mathf.Pow(res.y, 2)) / Diagonal);
            }
            else
            {
                DPI = dpi;
            }

            if (dpiLabel != "")
            {
                DPILabel = dpiLabel;
            }
            else
            {
                if (scgroup == xARMScreenCapGroup.Android)
                {
                    if (DPI < 140)
                    {
                        DPILabel = "ldpi";
                    }
                    else if (DPI < 200)
                    {
                        DPILabel = "mdpi";
                    }
                    else if (DPI > 210 && DPI < 220)
                    {
                        DPILabel = "tvdpi";                         // 213
                    }
                    else if (DPI < 280)
                    {
                        DPILabel = "hdpi";
                    }
                    else if (DPI < 400)
                    {
                        DPILabel = "xhdpi";
                    }
                    else if (DPI < 560)
                    {
                        DPILabel = "xxhdpi";
                    }
                    else
                    {
                        DPILabel = "xxxhdpi";
                    }
                }
            }

            switch (DPILabel)
            {
            case "ldpi":
                DPIFactor = 0.7f;
                break;

            case "mdpi":
                DPIFactor = 1f;
                break;

            case "tvdpi":
                DPIFactor = 1.33f;
                break;

            case "hdpi":
                DPIFactor = 1.5f;
                break;

            case "xhdpi":
                DPIFactor = 2f;
                break;

            case "xxhdpi":
                DPIFactor = 3f;
                break;

            case "xxxhdpi":
                DPIFactor = 4f;
                break;
            }

            Group = scgroup;
            StatisticsPositioning = statsPos;
            StatisticsUsedPercent = usedPerc;
            enabled = false;

            if (res.x > res.y)
            {
                IsLandscape = true;
            }
            else
            {
                IsLandscape = false;
            }

            IsPortrait = !IsLandscape;
            IsBaseRes  = true;

            LongName = Name + " " + Diagonal + charInch + " " + DPILabel + " (" + AspectLabel + ") " +
                       Resolution.x + "x" + Resolution.y + "px (" + ResolutionLabel + ")";
        }
Пример #3
0
		public xARMScreenCap (string name, Vector2 res, string resLabel, string aspectLable, float diagonal, int dpi, string dpiLabel, 
			xARMScreenCapGroup scgroup, int statsPos, float usedPerc, string desc){
			
			if(name != ""){
				Name = name;
			} else {
				Name = scgroup.ToString ();
			}
			
			Description = desc;
			Resolution = res;
			ResolutionLabel = resLabel;
			Aspect = res.x / res.y;
			
			if(aspectLable != ""){
				AspectLabel = aspectLable;
			} else {
				if(Aspect.Equals (3/2f)){
					AspectLabel = "3:2";
				} else if(Aspect.Equals (5/3f)){
					AspectLabel = "5:3";
				} else if(Aspect.Equals (5/4f)){
					AspectLabel = "5:4";
				} else if(Aspect.Equals (4/3f)){
					AspectLabel = "4:3";
				} else if(Aspect.Equals (16/9f)){
					AspectLabel = "16:9";
				} else if(Aspect.Equals (16/10f)){
					AspectLabel = "16:10";
				} else {
					AspectLabel = "custom";
				}
			}
			
			Diagonal = diagonal;
			if(dpi == 0){
				DPI = Mathf.RoundToInt (Mathf.Sqrt (Mathf.Pow(res.x, 2) + Mathf.Pow(res.y, 2)) / Diagonal);
			} else{
				DPI = dpi;
			}
			
			if(dpiLabel != ""){
				DPILabel = dpiLabel;
			} else {
				if(scgroup == xARMScreenCapGroup.Android){
					if(DPI<140){				
						DPILabel = "ldpi";
					} else if(DPI<200){
						DPILabel = "mdpi";
					} else if(DPI > 210 && DPI < 220){
						DPILabel = "tvdpi"; // 213
					} else if(DPI<280){
						DPILabel = "hdpi";
					} else if(DPI<400){
						DPILabel = "xhdpi";
					} else if (DPI<560){
						DPILabel = "xxhdpi";
					} else {
						DPILabel = "xxxhdpi";
					}
					
				}
			}
			
			switch (DPILabel){
				case "ldpi":
					DPIFactor = 0.7f;
					break;
				case "mdpi":
					DPIFactor = 1f;
					break;
				case "tvdpi":
					DPIFactor = 1.33f;
					break;
				case "hdpi":
					DPIFactor = 1.5f;
					break;
				case "xhdpi":
					DPIFactor = 2f;
					break;
				case "xxhdpi":
					DPIFactor = 3f;
					break;
				case "xxxhdpi":
					DPIFactor = 4f;
					break;
			}
			
			Group = scgroup;
			StatisticsPositioning = statsPos;
			StatisticsUsedPercent = usedPerc;
			enabled = false;
			
			if(res.x > res.y){
				IsLandscape = true;
			} else {
				IsLandscape = false;
			}
			
			IsPortrait = !IsLandscape;
			IsBaseRes = true;

			LongName = Name + " " + Diagonal + charInch+ " " + DPILabel + " (" + AspectLabel + ") " + 
					Resolution.x + "x" + Resolution.y + "px (" + ResolutionLabel + ")";
		}
Пример #4
0
 // simple variant with only base information (used to remove existing SCs)
 public xARMScreenCap(Vector2 res, float diagonal, xARMScreenCapGroup scgroup)
 {
     Resolution = res;
     Diagonal   = diagonal;
     Group      = scgroup;
 }