You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1001 B
37 lines
1001 B
11 months ago
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
using UniRx;
|
||
|
|
||
|
public class DuplicateProperty : MonoBehaviour
|
||
|
{
|
||
|
public List<InputField> SourceInput;
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
transform.Find("DefaultPanel/CopyButton").GetComponent<Button>().OnClickAsObservable()
|
||
|
.Subscribe(_ => OnCopy());
|
||
|
transform.Find("EditorPanel/PasteButton").GetComponent<Button>().OnClickAsObservable()
|
||
|
.Subscribe(_ => OnPaste());
|
||
|
}
|
||
|
private void OnCopy()
|
||
|
{
|
||
|
AssetManager.SourceInfos.Clear();
|
||
|
foreach(InputField input in SourceInput)
|
||
|
{
|
||
|
AssetManager.SourceInfos.Add(input.text);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void OnPaste()
|
||
|
{
|
||
|
if(AssetManager.SourceInfos.Count>0&& AssetManager.SourceInfos.Count== SourceInput.Count)
|
||
|
{
|
||
|
for(int i = 0; i < SourceInput.Count; i++)
|
||
|
{
|
||
|
SourceInput[i].text = AssetManager.SourceInfos[i];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|