Replace text components in the main browser with TMP.

This commit is contained in:
2023-02-05 15:56:56 +08:00
parent 1711fbadf7
commit 404a36f9b8
7 changed files with 13 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
using UnityEngine; using TMPro;
using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
namespace Cryville.Crtr.Browsing { namespace Cryville.Crtr.Browsing {
@@ -10,14 +11,14 @@ namespace Cryville.Crtr.Browsing {
private bool _dir; private bool _dir;
private Image _icon; private Image _icon;
private Text _title; private TMP_Text _title;
private Text _desc; private TMP_Text _desc;
#pragma warning disable IDE0051 #pragma warning disable IDE0051
void Awake() { void Awake() {
_icon = transform.Find("__content__/Icon").GetComponent<Image>(); _icon = transform.Find("__content__/Icon").GetComponent<Image>();
_title = transform.Find("__content__/Texts/Title/__text__").GetComponent<Text>(); _title = transform.Find("__content__/Texts/Title/__text__").GetComponent<TMP_Text>();
_desc = transform.Find("__content__/Texts/Description/__text__").GetComponent<Text>(); _desc = transform.Find("__content__/Texts/Description/__text__").GetComponent<TMP_Text>();
} }
void OnDestroy() { void OnDestroy() {
if (meta.Icon != null) meta.Icon.Cancel(); if (meta.Icon != null) meta.Icon.Cancel();

View File

@@ -1,6 +1,7 @@
using Cryville.Common; using Cryville.Common;
using Cryville.Common.Unity.UI; using Cryville.Common.Unity.UI;
using System; using System;
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@@ -18,8 +19,8 @@ namespace Cryville.Crtr.Browsing {
DockOccupiedRatioLayoutGroup _outerContentGroup; DockOccupiedRatioLayoutGroup _outerContentGroup;
Transform _content; Transform _content;
Image _cover; Image _cover;
Text _title; TMP_Text _title;
Text _desc; TMP_Text _desc;
protected override void Awake() { protected override void Awake() {
base.Awake(); base.Awake();
@@ -28,8 +29,8 @@ namespace Cryville.Crtr.Browsing {
_outerContentGroup = _outerContent.GetComponent<DockOccupiedRatioLayoutGroup>(); _outerContentGroup = _outerContent.GetComponent<DockOccupiedRatioLayoutGroup>();
_content = _outerContent.transform.Find("__content__"); _content = _outerContent.transform.Find("__content__");
_cover = _content.Find("Cover").GetComponent<Image>(); _cover = _content.Find("Cover").GetComponent<Image>();
_title = _content.Find("Texts/Title").GetComponent<Text>(); _title = _content.Find("Texts/Title").GetComponent<TMP_Text>();
_desc = _content.Find("Texts/Description").GetComponent<Text>(); _desc = _content.Find("Texts/Description").GetComponent<TMP_Text>();
} }
void OnDestroy() { void OnDestroy() {
if (_data.Cover != null) _data.Cover.Cancel(); if (_data.Cover != null) _data.Cover.Cancel();

View File

@@ -1,11 +1,10 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ceefede648e4d6d40839f2dda9019066 guid: ceefede648e4d6d40839f2dda9019066
timeCreated: 1637222453
licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {}
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []
executionOrder: 0 executionOrder: -500
icon: {instanceID: 0} icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:

Binary file not shown.

Binary file not shown.

Binary file not shown.