1using System.Collections;
3using System.Runtime.Serialization;
13 internal string selectedScript;
14 internal bool autostart;
15 private bool deactivated;
16 private bool once =
true;
18 public override void Start()
21 StartCoroutine(WaitingStart());
24 private IEnumerator WaitingStart()
35 selector.onValueChanged.AddListener(OnDropdownChanged);
38 GetComponentInChildren<Toggle>().isOn =
true;
40 yield
return new WaitForSeconds(2f);
45 private void Instance_onLoadingFinished()
50 public void OnToggleChanged(
bool value)
55 private void FillDropdown()
59 foreach (var o
in soundList)
selector.options.Add(
new Dropdown.OptionData(o.text));
61 if (!
string.IsNullOrEmpty(selectedScript))
63 for (var i = 0; i <
selector.options.Count; i++)
64 if (
selector.options[i].text == selectedScript)
76 internal void FillScriptText()
78 if (!
string.IsNullOrEmpty(selectedScript))
80 for (var i = 0; i <
selector.options.Count; i++)
81 if (
selector.options[i].text == selectedScript)
92 public void OnDropdownChanged(
int value)
94 selectedScript =
selector.options[value].text;
96 var result =
new [] {
"/fileuploader/" + selectedScript};
98 var result =
Directory.GetFiles(Application.streamingAssetsPath,
selector.options[value].text,
99 SearchOption.AllDirectories);
101 if (result.Length == 1)
107 Debug.LogError(
"More than one script file found with the same name! (or zero)");
118 public override void Triggered(
string id)
132 public void TriggerNow()
137 public new void GetObjectData(SerializationInfo info, StreamingContext context)
139 base.GetObjectData(info, context);
140 info.AddValue(
"selectedScript", selectedScript, typeof(
string));
141 info.AddValue(
"autostart", autostart, typeof(
bool));
144 public ScriptAction(SerializationInfo info, StreamingContext context) : base(info, context)
146 selectedScript = (string) info.GetValue(
"selectedScript", typeof(
string));
147 autostart = info.GetBoolean(
"autostart");
virtual void Deactivate()
virtual void Triggered(string id)
virtual void GetObjectData(SerializationInfo info, StreamingContext context)
static pb_PrefabBrowser instance