コード例 #1
0
        static void ShowUI(GameObject uiObject, UIElementHolder uiObjectC, bool needsInput, bool tryRepeat)
        {
            //set active so we can call coroutines on it
            // instance.gameObject.SetActive(true);

            instance.StartCoroutine(_ShowUI(uiObject, uiObjectC, needsInput, tryRepeat));
        }
コード例 #2
0
        // public static event System.Action<UIElementHolder> onUIShow;


        static IEnumerator _ShowUI(GameObject uiObject, UIElementHolder uiObjectC, bool needsInput, bool tryRepeat)
        {
            if (needsInput)
            {
                inputModule.gameObject.SetActive(true);
            }

            uiObject.SetActive(true);

            // for some reason, layout groups need to be enabled and disabled a few times
            // to show correctly
            if (needsInput)
            {
                instance.shownUIsWithInput.Add(uiObject);

                // inputModule.gameObject.SetActive(true);
            }

            if (tryRepeat)
            {
                yield return(null);

                uiObject.SetActive(false);
                yield return(null);

                uiObject.SetActive(true);
                yield return(null);

                uiObject.SetActive(false);
                yield return(null);

                uiObject.SetActive(true);
            }


            // else {
            //     instance.gameObject.SetActive(false);
            // }

            //  Debug.LogError("adding callbacks");
            // foreach (var d in gameManager.GetUISelectInvocations()) {
            if (onUISelect != null)
            {
                foreach (var d in GetUISelectInvocations())
                {
                    uiObjectC.onSelectEvent += (System.Action <GameObject[], object[]>)d;
                }
            }
            // foreach (var d in gameManager.GetUISubmitInvocations()) {
            if (onUISubmit != null)
            {
                foreach (var d in GetUISubmitInvocations())
                {
                    uiObjectC.onSubmitEvent += (System.Action <GameObject[], object[], Vector2Int>)d;
                }
            }
        }
コード例 #3
0
        public static void ShowUI(UIElementHolder uiObject, bool needsInput, bool tryRepeat)
        {
            ShowUI(GetUIObj(uiObject), uiObject, needsInput, tryRepeat);

            // Debug.LogError("adding callbacks");
            // foreach (var d in gameManager.GetUISelectInvocations()) {
            //     uiObject.onSelectEvent += (System.Action<GameObject[], object[]>)d;
            // }
            // foreach (var d in gameManager.GetUISubmitInvocations()) {
            //     uiObject.onSubmitEvent += (System.Action<GameObject[], object[]>)d;
            // }

            // if (onUIShow != null) {
            //     onUIShow(uiObject);
            // }
        }
コード例 #4
0
 public static void HideUI(UIElementHolder uiObject)
 {
     // GameObject objToUse = GetUIObj(uiObject);
     HideUI(GetUIObj(uiObject));
     uiObject.RemoveAllEvents();
 }
コード例 #5
0
 static GameObject GetUIObj(UIElementHolder uiObject)
 {
     return(uiObject.baseObject != null ? uiObject.baseObject : uiObject.gameObject);
 }