public static float Height(this MoPub.MaxAdSize adSize) { switch (adSize) { case MoPubBase.MaxAdSize.Width300Height50: case MoPubBase.MaxAdSize.Width320Height50: case MoPubBase.MaxAdSize.ScreenWidthHeight50: return(50); case MoPubBase.MaxAdSize.Width468Height60: return(60); case MoPubBase.MaxAdSize.Width728Height90: case MoPubBase.MaxAdSize.Width970Height90: case MoPubBase.MaxAdSize.ScreenWidthHeight90: return(90); case MoPubBase.MaxAdSize.Width300Height250: case MoPubBase.MaxAdSize.Width970Height250: case MoPubBase.MaxAdSize.ScreenWidthHeight250: return(250); case MoPubBase.MaxAdSize.Width336Height280: case MoPubBase.MaxAdSize.ScreenWidthHeight280: return(280); default: // fallback to default size: Width320Height50 return(50); } }
public static float Width(this MaxAdSize adSize) { switch (adSize) { case MaxAdSize.Width300Height50: case MaxAdSize.Width300Height250: return(300); case MaxAdSize.Width320Height50: return(320); case MaxAdSize.Width336Height280: return(336); case MaxAdSize.Width468Height60: return(468); case MaxAdSize.Width728Height90: return(728); case MaxAdSize.Width970Height90: case MaxAdSize.Width970Height250: return(970); case MaxAdSize.ScreenWidthHeight50: case MaxAdSize.ScreenWidthHeight90: case MaxAdSize.ScreenWidthHeight250: case MaxAdSize.ScreenWidthHeight280: var pixels = Screen.width; var dpi = Screen.dpi; var dips = pixels / (dpi / 160.0f); return(dips); default: // fallback to default size: Width320Height50 return(300); } }
public static float Width(this MaxAdSize adSize) { switch (adSize) { case MaxAdSize.Width300Height50: case MaxAdSize.Width300Height250: return(300); case MaxAdSize.Width320Height50: return(320); case MaxAdSize.Width336Height280: return(336); case MaxAdSize.Width468Height60: return(468); case MaxAdSize.Width728Height90: return(728); case MaxAdSize.Width970Height90: case MaxAdSize.Width970Height250: return(970); case MaxAdSize.ScreenWidthHeight50: case MaxAdSize.ScreenWidthHeight90: case MaxAdSize.ScreenWidthHeight250: case MaxAdSize.ScreenWidthHeight280: // This is the value for LinearLayout.LayoutParams.MATCH_PARENT on Android; iOS will rehydrate to an // explicit size before sending the ad request. return(-1); default: // fallback to default size: Width320Height50 return(300); } }