Exemplo n.º 1
0
    private void changeBtnSize()
    {
        MButtonData data = ButtonFormatDefine.GetFormat(btnSize);

        gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(data.width, data.height);
        EditorUtility.SetDirty(gameObject);
    }
Exemplo n.º 2
0
    public static MButtonData GetFormat(string strFormat)
    {
        MButtonData data = new MButtonData();

        string[] arr = strFormat.Split(',');
        if (arr.Length == 2 && arr[0] != "" && arr[1] != "")
        {
            data.width  = int.Parse(arr[0]);
            data.height = int.Parse(arr[1]);
        }
        else
        {
            data.width  = 220;
            data.height = 100;
        }
        return(data);
    }