Example #1
0
 private float CalcAspectRatio(ASPECT aspect)
 {
     switch (aspect)
     {
         case ASPECT._1x2:
             return 1.0f / 2;
         case ASPECT._9x16:
             return 9.0f / 16;
         case ASPECT._2x3:
             return 2.0f / 3;
         case ASPECT._3x4:
             return 3.0f / 4;
         case ASPECT._1x1:
             return 1;
         case ASPECT._4x3:
             return 4.0f / 3;
         case ASPECT._3x2:
             return 3.0f / 2;
         case ASPECT._16x9:
             return 16.0f / 9;
         case ASPECT._2x1:
             return 2.0f;
         default:
             return 1;
     }
 }
Example #2
0
    private float CalcAspectRatio(ASPECT aspect)
    {
        switch (aspect)
        {
        case ASPECT._1x2:
            return(1.0f / 2);

        case ASPECT._9x16:
            return(9.0f / 16);

        case ASPECT._2x3:
            return(2.0f / 3);

        case ASPECT._3x4:
            return(3.0f / 4);

        case ASPECT._1x1:
            return(1);

        case ASPECT._4x3:
            return(4.0f / 3);

        case ASPECT._3x2:
            return(3.0f / 2);

        case ASPECT._16x9:
            return(16.0f / 9);

        case ASPECT._2x1:
            return(2.0f);

        default:
            return(1);
        }
    }
Example #3
0
 public bool CheckAspect(ASPECT asp)
 {
     if (Aspect.Exists(x => x.Mask == asp.Mask))
     {
         TraceMethod.RecordInfo($"Error: {asp.Mask} is repeat in balise {name}-{id}");
         return(false);
     }
     return(true);
 }
        Rect currentRect;                               //現在の表示領域矩形


        /// <summary>
        /// 初期化。スクリプトから動的に生成する場合に
        /// </summary>
        public void InitOnCreate(int widthPx, int heightPx)
        {
            ASPECT aspect = ASPECT.Custom;

            defaultHeight = heightPx;
            float aspectValue = 1.0f * widthPx / heightPx;

            foreach (ASPECT item in System.Enum.GetValues(typeof(ASPECT)))
            {
                if (Mathf.Approximately(aspectValue, CalcAspectRatio(item, aspectValue)))
                {
                    aspect = item;
                    break;
                }
            }
            defaultAspect       = nallowAspect = wideAspect = aspect;
            customDefaultAspect = customNallowAspect = customWideAspect = aspectValue;
        }
		Rect currentRect;				//現在の表示領域矩形


		/// <summary>
		/// 初期化。スクリプトから動的に生成する場合に
		/// </summary>
		public void InitOnCreate(int widthPx, int heightPx)
		{
			ASPECT aspect = ASPECT.Custom;
			defaultHeight = heightPx;
			float aspectValue = 1.0f*widthPx / heightPx;
			foreach (ASPECT item in System.Enum.GetValues(typeof(ASPECT)))
			{
				if (Mathf.Approximately(aspectValue, CalcAspectRatio(item, aspectValue)))
				{
					aspect = item;
					break;
				}
			}
			defaultAspect = nallowAspect = wideAspect = aspect;
			customDefaultAspect = customNallowAspect = customWideAspect = aspectValue;
		}