using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UIHelper  {

	static public Rect ConvertRect(Rect rect) {
		Rect drawRect = new Rect();
		drawRect.x = (rect.x / 100) * Screen.width;
		drawRect.y = (rect.y / 100) * Screen.height;
		drawRect.width = (rect.width / 100) * Screen.width;
		drawRect.height = (rect.height / 100) * Screen.height;
		return(drawRect);
	}

	static public Rect ConvertRectHorizontal(Rect rect) {
		Rect drawRect = new Rect();
		drawRect.x = (rect.x / 100) * Screen.width;
		drawRect.y = (rect.y / 100) * Screen.width;
		drawRect.width = (rect.width / 100) * Screen.width;
		drawRect.height = (rect.height / 100) * Screen.width;
		return(drawRect);
	}

	static public Rect ConvertRectCenter(Rect rect) {
		Rect result = new Rect(Screen.width / 2, Screen.height / 2, 0, 0);
		result.x += (rect.x / 100) * Screen.width;
		result.y += (rect.y / 100) * Screen.width;
		result.width = (rect.width / 100) * Screen.width;
		result.height = (rect.height / 100) * Screen.width;

		return(result);
	}

	static public Rect UnConvertRect(Rect rect) {
		Rect drawRect = new Rect();
		drawRect.x = (rect.x / Screen.width) * 100;
		drawRect.y = (rect.y / Screen.height) * 100;
		drawRect.width = (rect.width / Screen.width) * 100;
		drawRect.height = (rect.height / Screen.height) * 100;
		return(drawRect);
	}

}
