From 3af4c218c0e70167db23a6303d2af30aff37d2fe Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 20 Aug 2020 23:40:50 -0400 Subject: Removed a bunch of stuff; Changes --- .../Scripts/Util/G_ExtensionMethods.cs | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs (limited to 'Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs') diff --git a/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs new file mode 100644 index 0000000..4580cc1 --- /dev/null +++ b/Assets/Thirdparty/Tayx/Graphy - Ultimate Stats Monitor/Scripts/Util/G_ExtensionMethods.cs @@ -0,0 +1,67 @@ +/* --------------------------------------- + * Author: Martin Pane (martintayx@gmail.com) (@tayx94) + * Collaborators: Lars Aalbertsen (@Rockylars) + * Project: Graphy - Ultimate Stats Monitor + * Date: 04-Jan-18 + * Studio: Tayx + * + * This project is released under the MIT license. + * Attribution is not required, but it is always welcomed! + * -------------------------------------*/ + +using UnityEngine; +using System.Collections.Generic; +using UnityEngine.UI; + +namespace Tayx.Graphy.Utils +{ + public static class G_ExtensionMethods + { + /* ----- TODO: ---------------------------- + * Add summaries to the functions. + * --------------------------------------*/ + + #region Methods -> Extension Methods + + /// + /// Functions as the SetActive function in the GameObject class, but for a list of them. + /// + /// + /// List of GameObjects. + /// + /// + /// Wether to turn them on or off. + /// + public static List SetAllActive(this List gameObjects, bool active) + { + foreach (var gameObj in gameObjects) + { + gameObj.SetActive(active); + } + + return gameObjects; + } + + public static List SetOneActive(this List images, int active) + { + for (int i = 0; i < images.Count; i++) + { + images[i].gameObject.SetActive(i == active); + } + + return images; + } + + public static List SetAllActive(this List images, bool active) + { + foreach (var image in images) + { + image.gameObject.SetActive(active); + } + + return images; + } + + #endregion + } +} -- cgit v1.2.3