2using System.Collections;
3using System.Collections.Generic;
5using System.Runtime.Serialization;
14 private List<GameObject> inputs;
15 private Dictionary<string, bool> inputStatus;
16 internal int savedInputCount;
17 List<GameObject> inputsList;
26 List<String> GameObjectConnectionList =
new List<String>();
27 List<String> ActionConnectionList =
new List<String>();
33 internal bool Welding;
47 private GameObject weldedGO;
48 private List<Transform> originalParents;
58 inputStatus =
new Dictionary<string, bool>();
59 originalParents =
new List<Transform>();
61 inputsList =
new List<GameObject>();
62 firstTriggered =
true;
67 public void Order(
bool newValue)
71 public void Weld(
bool newWeldValue)
73 Welding = newWeldValue;
79 childCount = CountChildWithComponent();
82 StartCoroutine(LateReparent());
92 inputsList.Add(a.GetComponentInChildren<
ActionObject>().gameObject);
107 firstTriggered =
false;
114 inputStatus[id] =
true;
116 if (i == inputsList.Count)
131 firstTriggered =
false;
132 foreach (var b
in ActionSlotChildren)
137 inputStatus[id] =
true;
139 if (i == inputsList.Count)
152 IEnumerator LateReparent()
154 yield
return new WaitForEndOfFrame();
159 internal void Reparent()
162 if (list !=
null && list.Length > 1)
164 var parent = list[0].transform;
166 for (var i = 1; i < list.Length; i++)
168 if (list[i] ==
null)
continue;
169 originalParents.Add(list[i].transform.parent);
170 list[i].transform.SetParent(parent,
true);
174 GameObject[] GetGOs()
178 var list =
new List<string>();
180 foreach (var obj
in ObjectList)
185 var retval =
new List<GameObject>();
186 foreach (var s
in ObjectList)
188 var goname =
"UNKNOWN";
190 retval.Add(s.GetGameObject());
191 goname = s.GetGameObject().name;
196 return retval.ToArray();
203 int CountChildWithComponent()
207 foreach (var a
in ActionSlotChildren)
209 if (!a.action.Contains(
"GameObject"))
220 foreach (var key
in inputStatus.Keys.ToList())
221 inputStatus[key] =
false;
228 Debug.Log(gameObject.name);
231 StartCoroutine(LoadChildren());
237 collector = gameObject.GetComponentInParent<
CollectorAction>().gameObject;
238 rt = (RectTransform)collector.transform;
239 width = rt.rect.width;
240 height = rt.rect.height;
244 StartCoroutine(Parenting(j));
248 IEnumerator LoadChildren()
255 IEnumerator Parenting(
int Value)
257 for (
int i = 0; i < 5; i++)
270 GameObject gameAction;
271 GameObject gameGameObject;
272 GameObject connectionAction;
273 GameObject connectionGameObject;
280 ActionDrop.Drop(ActionDrag);
282 connectionAction = gameAction.transform.parent.Find(ActionConnectionList[0]).gameObject;
283 ActionDrag.transform.parent = ActionDrop.transform.parent;
284 connectionAction.transform.parent = ActionDrop.transform.parent;
285 ActionDrop.gameObject.AddComponent<
Reserved>();
287 gameAction.transform.localPosition =
new Vector3(0,-125,0);
288 gameAction.transform.localScale =
Vector3.one;
292 Acopy.transform.Find(
"ExtendGO").gameObject.SetActive(
true);
294 GameObjectConnectionList =
new List<String>();
296 connectionGameObject = gameGameObject.transform.parent.Find(GameObjectConnectionList[0]).gameObject;
298 DropArea GameObjectDrop = Gcopy.Reference.GetComponentInChildren<
DropArea>();
299 GameObjectDrop.
Drop(GameObjectDrag);
301 GameObjectDrag.transform.parent = GameObjectDrop.transform.parent;
302 GameObjectDrag.transform.localScale =
Vector3.one;
303 GameObjectDrag.transform.localPosition =
Vector3.zero;
304 connectionGameObject.transform.parent = GameObjectDrop.transform.parent;
305 GameObjectDrop.gameObject.AddComponent<
Reserved>();
313 rt.sizeDelta =
new Vector2(200,200);
317 foreach (var a
in ActionSlotChildren)
328 toggle.GetComponent<Toggle>().isOn =
true;
332 toggle.GetComponent<Toggle>().isOn =
false;
336 weldToggle.GetComponent<Toggle>().isOn =
true;
340 weldToggle.GetComponent<Toggle>().isOn =
false;
347 base.OutputAdded(
id);
367 Sprite
FullCircle = Resources.Load<Sprite>(
"T_ReticleClosed");
369 rsgo.
Reference.transform.Find(
"ExtendGO").transform.Find(
"ExtendButton").gameObject.GetComponent<
Image>().sprite =
FullCircle;
372 public CollectorAction(SerializationInfo info, StreamingContext context) : base(info, context)
375 ActionChildrenList = (List<string>)info.GetValue(
"actionchildren", typeof(List<string>));
377 isSmall = info.GetBoolean(
"size");
378 OriginalSize = (Vector2)info.GetValue(
"sizedelta", typeof(Vector2));
379 inOrder = info.GetBoolean(
"inorder");
380 Welding = info.GetBoolean(
"welding");
383 public new void GetObjectData(SerializationInfo info, StreamingContext context)
385 collector = gameObject.GetComponentInParent<
CollectorAction>().gameObject;
386 rt = (RectTransform)collector.transform;
387 width = rt.rect.width;
388 height = rt.rect.height;
401 base.GetObjectData(info, context);
425 info.AddValue(
"size",
isSmall, typeof(
bool));
428 info.AddValue(
"sizedelta",
OriginalSize, typeof(Vector2));
429 info.AddValue(
"inorder",
inOrder, typeof(
bool));
430 info.AddValue(
"welding", Welding, typeof(
bool));
System.Drawing.Image Image
void TriggerOutput(string id)
virtual void Triggered(string id)
List< GameObject > inPuts
List< GameObject > outPuts
override void Triggered(string id)
override void InputAdded(string id)
List< string > ActionChildrenList
override void OutputAdded(string id)
new void GetObjectData(SerializationInfo info, StreamingContext context)
void Order(bool newValue)
void FullCircle(DropArea dropArea)
GameObject GameObjectSlot
static CollectorAction _Instance
void Weld(bool newWeldValue)
List< string > GameObjectChildrenList
CollectorAction(SerializationInfo info, StreamingContext context)
List< string > GetOutputConnectionsToObject(string id)
void DirektTrigger(string id)
ActionObject GetActionById(string id)
static Controller Instance
void Drop(MouseDragBehaviour draggable)
Credit Erdener Gonenc - @PixelEnvision.