Toggle navigation
Toggle navigation
This project
Loading...
Sign in
范川铭
/
UnityFrameWork
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
王琪诚
2025-06-23 16:25:23 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5998121e19e430df52e316700cf85aa932992bcd
5998121e
1 parent
bb7e0022
【任务】TAPD#
功能详情 配置文件 否 提交作者 QiCheng.Wang 评审人员
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
29 deletions
Assets/Scripts/FriendCircle/ImageViewerManager.cs
Assets/Scripts/FriendCircle/ImageViewerManager.cs
View file @
5998121
...
...
@@ -32,11 +32,7 @@ public class ImageViewerManager : MonoBehaviour
Instance
=
this
;
panel
.
SetActive
(
false
);
var
panelBtn
=
panel
.
GetComponent
<
Button
>();
panelBtn
.
onClick
.
AddListener
(()
=>
{
fullImage
.
sprite
=
null
;
panel
.
SetActive
(
false
);
});
panelBtn
.
onClick
.
AddListener
(
Hide
);
}
public
void
ShowImage
(
string
url
,
string
content
,
string
logo
,
string
time
)
...
...
@@ -61,9 +57,9 @@ public class ImageViewerManager : MonoBehaviour
//清空
fullImage
.
sprite
=
null
;
panel
.
SetActive
(
true
);
StartCoroutine
(
ImageLoader
.
LoadImage
(
url
,
fullImage
,
(
width
,
height
)
=>
{
...
...
@@ -75,29 +71,21 @@ public class ImageViewerManager : MonoBehaviour
imageContainer
.
rectTransform
.
sizeDelta
=
new
Vector2
(
width
,
height
);
StartCoroutine
(
ImageLoader
.
LoadImage
(
logo
,
logoImage
));
//时间
foreach
(
Transform
child
in
timeGrid
)
{
Destroy
(
child
.
gameObject
);
}
time
=
time
.
Replace
(
"年"
,
"p"
).
Replace
(
"月"
,
"p"
).
Replace
(
"日"
,
""
);
foreach
(
char
c
in
time
)
{
GameObject
timeObj
=
Instantiate
(
timePrefab
,
timeGrid
);
var
timeTextMeshPro
=
timeObj
.
GetComponent
<
TextMeshProUGUI
>();
timeTextMeshPro
.
text
=
"<sprite name=\""
+
c
+
"\">"
;
}
}));
//时间
foreach
(
Transform
child
in
timeGrid
)
{
Destroy
(
child
.
gameObject
);
}
time
=
time
.
Replace
(
"年"
,
"p"
).
Replace
(
"月"
,
"p"
).
Replace
(
"日"
,
""
);
foreach
(
char
c
in
time
)
{
GameObject
timeObj
=
Instantiate
(
timePrefab
,
timeGrid
);
var
timeTextMeshPro
=
timeObj
.
GetComponent
<
TextMeshProUGUI
>();
timeTextMeshPro
.
text
=
"<sprite name=\""
+
c
+
"\">"
;
}
...
...
@@ -105,6 +93,12 @@ public class ImageViewerManager : MonoBehaviour
public
void
Hide
()
{
fullImage
.
sprite
=
null
;
panel
.
SetActive
(
false
);
//清空原来的时间
foreach
(
Transform
child
in
timeGrid
)
{
Destroy
(
child
.
gameObject
);
}
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment