Showing
1 changed file
with
23 additions
and
29 deletions
@@ -32,11 +32,7 @@ public class ImageViewerManager : MonoBehaviour | @@ -32,11 +32,7 @@ public class ImageViewerManager : MonoBehaviour | ||
32 | Instance = this; | 32 | Instance = this; |
33 | panel.SetActive(false); | 33 | panel.SetActive(false); |
34 | var panelBtn = panel.GetComponent<Button>(); | 34 | var panelBtn = panel.GetComponent<Button>(); |
35 | - panelBtn.onClick.AddListener(() => | ||
36 | - { | ||
37 | - fullImage.sprite = null; | ||
38 | - panel.SetActive(false); | ||
39 | - }); | 35 | + panelBtn.onClick.AddListener(Hide); |
40 | } | 36 | } |
41 | 37 | ||
42 | public void ShowImage(string url,string content,string logo,string time) | 38 | public void ShowImage(string url,string content,string logo,string time) |
@@ -61,9 +57,9 @@ public class ImageViewerManager : MonoBehaviour | @@ -61,9 +57,9 @@ public class ImageViewerManager : MonoBehaviour | ||
61 | 57 | ||
62 | //清空 | 58 | //清空 |
63 | fullImage.sprite = null; | 59 | fullImage.sprite = null; |
64 | - | ||
65 | - | ||
66 | - | 60 | + |
61 | + | ||
62 | + | ||
67 | panel.SetActive(true); | 63 | panel.SetActive(true); |
68 | 64 | ||
69 | StartCoroutine(ImageLoader.LoadImage(url, fullImage, (width, height) => { | 65 | StartCoroutine(ImageLoader.LoadImage(url, fullImage, (width, height) => { |
@@ -75,29 +71,21 @@ public class ImageViewerManager : MonoBehaviour | @@ -75,29 +71,21 @@ public class ImageViewerManager : MonoBehaviour | ||
75 | imageContainer.rectTransform.sizeDelta = new Vector2(width, height); | 71 | imageContainer.rectTransform.sizeDelta = new Vector2(width, height); |
76 | 72 | ||
77 | StartCoroutine(ImageLoader.LoadImage(logo, logoImage)); | 73 | StartCoroutine(ImageLoader.LoadImage(logo, logoImage)); |
78 | - | ||
79 | - | ||
80 | - //时间 | ||
81 | - foreach (Transform child in timeGrid) | ||
82 | - { | ||
83 | - Destroy(child.gameObject); | ||
84 | - } | ||
85 | - time = time.Replace("年", "p").Replace("月", "p").Replace("日", ""); | ||
86 | - foreach (char c in time) | ||
87 | - { | ||
88 | - GameObject timeObj = Instantiate(timePrefab, timeGrid); | ||
89 | - var timeTextMeshPro = timeObj.GetComponent<TextMeshProUGUI>(); | ||
90 | - | ||
91 | - timeTextMeshPro.text = "<sprite name=\""+c+"\">"; | ||
92 | - } | ||
93 | - | ||
94 | - | ||
95 | - | ||
96 | - | ||
97 | - | ||
98 | })); | 74 | })); |
99 | 75 | ||
100 | - | 76 | + //时间 |
77 | + foreach (Transform child in timeGrid) | ||
78 | + { | ||
79 | + Destroy(child.gameObject); | ||
80 | + } | ||
81 | + time = time.Replace("年", "p").Replace("月", "p").Replace("日", ""); | ||
82 | + foreach (char c in time) | ||
83 | + { | ||
84 | + GameObject timeObj = Instantiate(timePrefab, timeGrid); | ||
85 | + var timeTextMeshPro = timeObj.GetComponent<TextMeshProUGUI>(); | ||
86 | + | ||
87 | + timeTextMeshPro.text = "<sprite name=\""+c+"\">"; | ||
88 | + } | ||
101 | 89 | ||
102 | 90 | ||
103 | 91 | ||
@@ -105,6 +93,12 @@ public class ImageViewerManager : MonoBehaviour | @@ -105,6 +93,12 @@ public class ImageViewerManager : MonoBehaviour | ||
105 | 93 | ||
106 | public void Hide() | 94 | public void Hide() |
107 | { | 95 | { |
96 | + fullImage.sprite = null; | ||
108 | panel.SetActive(false); | 97 | panel.SetActive(false); |
98 | + //清空原来的时间 | ||
99 | + foreach (Transform child in timeGrid) | ||
100 | + { | ||
101 | + Destroy(child.gameObject); | ||
102 | + } | ||
109 | } | 103 | } |
110 | } | 104 | } |
-
Please register or login to post a comment