2using System.Collections;
3using System.Collections.Generic;
4using System.Runtime.Serialization;
25 Stack<GameObject> goStackA =
new Stack<GameObject>();
26 Stack<GameObject> goStackGO =
new Stack<GameObject>();
30 GameObject RemoveTheButton;
33 GameObject ItemActionFind;
38 Transform[] GameObjectSlotChildren;
45 collector = GetComponentInParent<CollectorAction>().gameObject;
46 RemoveTheButton = GameObject.Find(
"RemoveItem");
47 rt = (RectTransform)collector.transform;
48 width = rt.rect.width;
49 height = rt.rect.height;
50 actionGO = GameObject.Find(
"Actions");
51 ItemActionFind = GameObject.Find(
"ItemAction");
57 collector = GetComponentInParent<CollectorAction>().gameObject;
58 rt = (RectTransform)collector.transform;
59 width = rt.rect.width;
60 height = rt.rect.height;
63 Acopy.transform.localScale =
new Vector3(1, 1, 1);
64 GOcopy = Instantiate(
ItemGO);
66 rt.sizeDelta =
new Vector2(width, height += 350);
72 goStackGO.Push(GOcopy);
76 collector = GetComponentInParent<CollectorAction>().gameObject;
77 rt = (RectTransform)collector.transform;
78 width = rt.rect.width;
79 height = rt.rect.height;
82 Acopy.transform.localScale =
new Vector3(1, 1, 1);
83 GOcopy = Instantiate(
ItemGO);
85 rt.sizeDelta =
new Vector2(width, height += 350);
91 goStackGO.Push(GOcopy);
99 width = rt.rect.width;
100 height = rt.rect.height;
101 rt.sizeDelta =
new Vector2(width, height -= 350);
102 GameObject destroyA = goStackA.Pop();
103 GameObject destroyGO = goStackGO.Pop();
110 IEnumerator Minimalize(Vector2 startSize, Vector2 endSize, Action action)
113 float duration = 0.75f;
115 while (time <= duration)
117 time += Time.deltaTime;
118 rt.sizeDelta = Vector2.Lerp(startSize, endSize, time / duration);
132 if (
ActionSlot.transform.localScale ==
new Vector3(1, 1, 1))
140 ActionSlot.transform.localScale =
new Vector3(0, 0, 0);
143 AddNewButton.transform.localScale =
new Vector3(0, 0, 0);
145 StartCoroutine(Minimalize(
new Vector2(width, height),
new Vector2(200, 200),
actionMinimalize));
154 Count.SetActive(
false);
160 Count.SetActive(
true);
165 ActionSlot.transform.localScale =
new Vector3(1, 1, 1);
168 AddNewButton.transform.localScale =
new Vector3(1, 1, 1);
180 width = rt.rect.width;
181 height = rt.rect.height;
186 StartCoroutine(AppearGameObject(
new Vector3(0, 0, 0),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector2(width = 520, height),
new Vector2(width = 700, height), 0, 0.5f));
190 StartCoroutine(AppearGameObject(
new Vector3(0, 0, 0),
new Vector3(0.5f, 0.5f, 0.5f),
new Vector2(width = 800, height),
new Vector2(width = 800, height), 0, 0.5f));
199 if (rsp.
Reference.transform.localScale !=
new Vector3(0, 0, 0) && rsp.
Reference.GetComponentInChildren<
ActionObject>().action.Contains(
"GameObject"))
201 width = rt.rect.width;
202 height = rt.rect.height;
207 StartCoroutine(AppearGameObject(
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(0, 0, 0),
new Vector2(width = 700, height),
new Vector2(width = 520, height), 0.5f, 0));
211 StartCoroutine(AppearGameObject(
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(0, 0, 0),
new Vector2(width = 800, height),
new Vector2(width = 800, height), 0.5f, 0));
215 IEnumerator WaitUntilEnd(Vector3 EndScale)
217 while (rsp.
Reference.transform.localScale == EndScale);
226 var eventTrigger = value.GetComponentInChildren<
ItemAction>();
227 width = rt.rect.width;
228 height = rt.rect.height;
231 if (rsp.
Reference.transform.localScale ==
new Vector3(0.5f, 0.5f, 0.5f))
234 eventTrigger.enabled =
false;
237 StartCoroutine(AppearGameObject(
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(1, 1, 1),
new Vector2(width = 700, height),
new Vector2(width = 800, height), 0, 1));
241 StartCoroutine(AppearGameObject(
new Vector3(0.5f, 0.5f, 0.5f),
new Vector3(1, 1, 1),
new Vector2(width = 800, height),
new Vector2(width = 800, height), 0, 1));
245 if (rsp.
Reference.transform.localScale ==
new Vector3(0, 0, 0))
248 eventTrigger.enabled =
false;
251 StartCoroutine(AppearGameObject(
new Vector3(0, 0, 0),
new Vector3(1, 1, 1),
new Vector2(width = 520, height),
new Vector2(width = 800, height), 0, 1));
255 StartCoroutine(AppearGameObject(
new Vector3(0, 0, 0),
new Vector3(1, 1, 1),
new Vector2(width = 800, height),
new Vector2(width = 800, height), 0, 1));
259 if (rsp.
Reference.transform.localScale ==
new Vector3(1, 1, 1))
262 eventTrigger.enabled =
true;
265 StartCoroutine(AppearGameObject(
new Vector3(1, 1, 1),
new Vector3(0, 0, 0),
new Vector2(width = 800, height),
new Vector2(width = 520, height), 1, 0));
269 StartCoroutine(AppearGameObject(
new Vector3(1, 1, 1),
new Vector3(0, 0, 0),
new Vector2(width = 800, height),
new Vector2(width = 800, height), 1, 0));
279 IEnumerator AppearGameObject(Vector3 startScale, Vector3 endScale, Vector2 startSize, Vector2 endSize,
float startAlpha,
float endAlpha)
282 float duration = 0.75f;
283 x = rsp.
Reference.transform.localScale.x;
284 cggo = rsp.
Reference.GetComponent<CanvasGroup>();
286 while (time <= duration)
288 time += Time.deltaTime;
289 rsp.
Reference.transform.localScale = Vector3.Lerp(startScale, endScale, time / duration);
290 cggo.alpha = Mathf.Lerp(startAlpha, endAlpha, time / duration);
293 rt.sizeDelta = Vector2.Lerp(startSize, endSize, time / duration);
301 if (rsp.
Reference.transform.localScale.x > 0)
313 GameObjectSlotChildren =
GameObjectSlot.GetComponentsInChildren<Transform>();
315 foreach (var a
in GameObjectSlotChildren)
317 if (a.name.Contains(
"ItemGO"))
319 if (a.transform.localScale ==
new Vector3(1, 1, 1))
330 var diff =
new Vector2(0, 0);
331 var rect = ConnectedGO.GetComponent<RectTransform>();
332 var newPosition = rect.position +
new Vector3(diff.x, diff.y, transform.position.z);
333 var oldPos = rect.position;
334 rect.position = newPosition;
342 Console.WriteLine(e);
350 foreach (var a
in ActionSlotChildren)
void showFullGameObject(GameObject value)
void showPreviewGameObject(GameObject value)
GameObject GameObjectSlot
void hidePreviewGameObject(GameObject value)
void refreshConnectionPos(GameObject ConnectedGO)
static LineDrawer Instance