Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit a25017d

Browse files
committed
Add wider Texture2DWidget support
1 parent a1fab0c commit a25017d

File tree

4 files changed

+450
-77
lines changed

4 files changed

+450
-77
lines changed

src/UI/Widgets/UnityObjects/AudioClipWidget.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ public class AudioClipWidget : UnityObjectWidget
2222
static Coroutine CurrentlyPlayingCoroutine;
2323
static readonly string zeroLengthString = GetLengthString(0f);
2424

25-
public AudioClip RefAudioClip;
26-
private string fullLengthText;
25+
public AudioClip audioClip;
26+
string fullLengthText;
2727

28-
private ButtonRef toggleButton;
29-
private bool audioPlayerWanted;
28+
ButtonRef toggleButton;
29+
bool audioPlayerWanted;
3030

31-
private GameObject audioPlayerRoot;
32-
private ButtonRef playStopButton;
33-
private Text progressLabel;
34-
private GameObject saveObjectRow;
35-
private InputFieldRef savePathInput;
36-
private GameObject cantSaveRow;
31+
GameObject audioPlayerRoot;
32+
ButtonRef playStopButton;
33+
Text progressLabel;
34+
GameObject saveObjectRow;
35+
InputFieldRef savePathInput;
36+
GameObject cantSaveRow;
3737

3838
public override void OnBorrowed(object target, Type targetType, ReflectionInspector inspector)
3939
{
@@ -42,10 +42,10 @@ public override void OnBorrowed(object target, Type targetType, ReflectionInspec
4242
this.audioPlayerRoot.transform.SetParent(inspector.UIRoot.transform);
4343
this.audioPlayerRoot.transform.SetSiblingIndex(inspector.UIRoot.transform.childCount - 2);
4444

45-
RefAudioClip = target.TryCast<AudioClip>();
46-
this.fullLengthText = GetLengthString(RefAudioClip.length);
45+
audioClip = target.TryCast<AudioClip>();
46+
this.fullLengthText = GetLengthString(audioClip.length);
4747

48-
if (RefAudioClip.loadType == AudioClipLoadType.DecompressOnLoad)
48+
if (audioClip.loadType == AudioClipLoadType.DecompressOnLoad)
4949
{
5050
cantSaveRow.SetActive(false);
5151
saveObjectRow.SetActive(true);
@@ -62,7 +62,7 @@ public override void OnBorrowed(object target, Type targetType, ReflectionInspec
6262

6363
public override void OnReturnToPool()
6464
{
65-
RefAudioClip = null;
65+
audioClip = null;
6666

6767
if (audioPlayerWanted)
6868
ToggleAudioWidget();
@@ -95,7 +95,7 @@ private void ToggleAudioWidget()
9595

9696
void SetDefaultSavePath()
9797
{
98-
string name = RefAudioClip.name;
98+
string name = audioClip.name;
9999
if (string.IsNullOrEmpty(name))
100100
name = "untitled";
101101
savePathInput.Text = Path.Combine(ConfigManager.Default_Output_Path.Value, $"{name}.wav");
@@ -163,7 +163,7 @@ private IEnumerator PlayClipCoroutine()
163163
{
164164
playStopButton.ButtonText.text = "Stop Clip";
165165
CurrentlyPlaying = this;
166-
Source.clip = this.RefAudioClip;
166+
Source.clip = this.audioClip;
167167
Source.Play();
168168

169169
while (Source.isPlaying)
@@ -191,7 +191,7 @@ private void StopClip()
191191

192192
public void OnSaveClipClicked()
193193
{
194-
if (!RefAudioClip)
194+
if (!audioClip)
195195
{
196196
ExplorerCore.LogWarning("AudioClip is null, maybe it was destroyed?");
197197
return;
@@ -212,7 +212,7 @@ public void OnSaveClipClicked()
212212
if (File.Exists(path))
213213
File.Delete(path);
214214

215-
SavWav.Save(RefAudioClip, path);
215+
SavWav.Save(audioClip, path);
216216
}
217217

218218
public override GameObject CreateContent(GameObject uiRoot)

0 commit comments

Comments
 (0)