|
@@ -239,22 +239,34 @@ public class ModelItem : System.ICloneable
|
|
|
{
|
|
|
case ModelType.Image:
|
|
|
Texture2D texture = new Texture2D(1, 1);
|
|
|
- texture.LoadImage(data);
|
|
|
- Debug.Log(" LoadManager " + texture.width+"_"+ texture.height);
|
|
|
- Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.one * 0.5f);
|
|
|
- TemplateImage tlimg = prefabModel.GetComponent<TemplateImage>();
|
|
|
- Texture2D tex = texture;
|
|
|
- if (tex.height > tex.width)
|
|
|
+ OpenCVForUnity.CoreModule.Mat _mat = null;
|
|
|
+ GameManager.Instance.AddThead(() =>
|
|
|
{
|
|
|
- float bl =((float)tex.height / (float)tex.width);
|
|
|
- tlimg.transform.Find("Canvas").GetComponent<RectTransform>().sizeDelta = new Vector2(500 / bl, 500);
|
|
|
- }
|
|
|
- else
|
|
|
+ Debug.Log("加載完成222222222222222222");
|
|
|
+ _mat = GameManager.zoomByteByOpenCV(data);
|
|
|
+
|
|
|
+ }, () =>
|
|
|
{
|
|
|
- float bl = ((float)tex.width / (float)tex.height);
|
|
|
- tlimg.transform.Find("Canvas").GetComponent<RectTransform>().sizeDelta = new Vector2(500, 500 / bl);
|
|
|
- }
|
|
|
- tlimg.M_Image.sprite = sprite;
|
|
|
+ Debug.Log("加載完成111111111111");
|
|
|
+ texture = GameManager.TextureByMat(_mat);
|
|
|
+
|
|
|
+ Debug.Log(" LoadManager " + texture.width + "_" + texture.height);
|
|
|
+ Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.one * 0.5f);
|
|
|
+ TemplateImage tlimg = prefabModel.GetComponent<TemplateImage>();
|
|
|
+ Texture2D tex = texture;
|
|
|
+ if (tex.height > tex.width)
|
|
|
+ {
|
|
|
+ float bl = ((float)tex.height / (float)tex.width);
|
|
|
+ tlimg.transform.Find("Canvas").GetComponent<RectTransform>().sizeDelta = new Vector2(500 / bl, 500);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ float bl = ((float)tex.width / (float)tex.height);
|
|
|
+ tlimg.transform.Find("Canvas").GetComponent<RectTransform>().sizeDelta = new Vector2(500, 500 / bl);
|
|
|
+ }
|
|
|
+ tlimg.M_Image.sprite = sprite;
|
|
|
+ });
|
|
|
+
|
|
|
break;
|
|
|
case ModelType.Video:
|
|
|
Debug.Log(" DownloadPath " + DownloadPath);
|
|
@@ -302,19 +314,27 @@ public class ModelItem : System.ICloneable
|
|
|
{
|
|
|
case ModelType.Text:
|
|
|
prefabModel.GetComponent<TemplateText>().SetData(textContent, TextBJ);
|
|
|
+ YangShiTextItem ysi = prefabModel.GetComponent<YangShiTextItem>();
|
|
|
+ float topf = 0.4f;
|
|
|
+ float buttomf = -0.4f;
|
|
|
+ if (ysi!=null)
|
|
|
+ {
|
|
|
+ topf = ysi.topf;
|
|
|
+ buttomf = ysi.buttomf;
|
|
|
+ }
|
|
|
|
|
|
if (textPosition == "top")
|
|
|
{
|
|
|
- if (objectTransform.nowPos == Vector3.zero && prefabModel.transform.localPosition!= new Vector3(0, 0.4f, 0))
|
|
|
+ if (objectTransform.nowPos == Vector3.zero && prefabModel.transform.localPosition!= new Vector3(0, topf, 0))
|
|
|
{
|
|
|
- prefabModel.transform.localPosition = new Vector3(0, 0.4f, 0);
|
|
|
+ prefabModel.transform.localPosition = new Vector3(0, topf, 0);
|
|
|
}
|
|
|
}
|
|
|
else if (textPosition == "bottom")
|
|
|
{
|
|
|
- if (objectTransform.nowPos == Vector3.zero && prefabModel.transform.localPosition != new Vector3(0, 0.4f, 0))
|
|
|
+ if (objectTransform.nowPos == Vector3.zero && prefabModel.transform.localPosition != new Vector3(0, buttomf, 0))
|
|
|
{
|
|
|
- prefabModel.transform.localPosition = new Vector3(0, -0.4f, 0);
|
|
|
+ prefabModel.transform.localPosition = new Vector3(0, buttomf, 0);
|
|
|
}
|
|
|
}
|
|
|
else if (textPosition == "left")
|