public bool IsFind(string tganame) { bool tem = false; /// 循环查询 foreach (plistcom_tomax i in GetPlistSetUvValues) { plistcom_tomax t = (plistcom_tomax)i; if (t.name == tganame) { tem = true; break; } } return(tem); }
}// end public plistcom_tomax Find_UV(string tganame) { if (GetPlistSetUvValues.Length < 1) { // 防止查询没有制作数据 dependListarrayMakeUvValue(); } plistcom_tomax tem = poly_tem; /// 循环查询 foreach (plistcom_tomax i in GetPlistSetUvValues) { plistcom_tomax t = (plistcom_tomax)i; if (t.name == tganame) { tem = i; break; } } return(tem); }
/// <summary> /// 依赖查loadxmltolistarray 中循环每张图片的需要图片缩放后 宽和高 和处理后偏移竖直,还有就是是否进行旋转的处理 /// </summary> /// <returns></returns> public void dependListarrayMakeUvValue() { // 最后社会吃uv com GetPlistSetUvValues = new plistcom_tomax[] { }; uv_com.Clear(); Array getlistarray = loadxmltolistarray(); foreach (var i in getlistarray) { plistcom_tomax tem = new plistcom_tomax(); plistcom obj = (plistcom)i; tem.name = obj.tagname; tem.is_rotate = obj.rotated; int imagewidth = obj.pakesize.X; int imageheight = obj.pakesize.Y; int image_st_x = obj.frame.X; int image_st_y = obj.frame.Y; int image_en_x = obj.frame.Width; int image_en_y = obj.frame.Height; /// 计算的uv 缩小比例 tem.uv_width = image_en_x / (float)imagewidth; tem.uv_height = image_en_y / (float)imageheight; /// 计算的uv 偏移数 tem.uv_x_offset = image_st_x / (float)imagewidth; tem.uv_y_offset = image_st_y / (float)imageheight; uv_com.Add(tem); } /// 不做返回, 处理完成数据给到一点, 后续通过查询的方法和方式处理 /// GetPlistSetUvValues = uv_com.ToArray(); }// end