示例#1
0
        public void Show(string oldState, Action shownCallback = null)
        {
            Init();
            if (_animateShow != null && _animateShow.Length > 0)
            {
                gameObject.SetActive(true);
                if (_activatable != null)
                {
                    _activatable.DeactivateImmediately();
                }

                var finished = new bool[_animateShow.Length];
                for (var i = 0; i < _animateShow.Length; i++)
                {
                    var i1 = i;
                    _animateShow[i].AnimateShowing(() =>
                    {
                        finished[i1] = true;
                        if (!finished.All(f => f))
                        {
                            return;
                        }
                        if (_activatable != null)
                        {
                            _activatable.ActivateImmediately();
                            shownCallback?.Invoke();
                        }
                        else if (_focusable != null)
                        {
                            // It is assumed that IActivatable will focus
                            _focusable.Focus();
                            shownCallback?.Invoke();
                        }
                    }, oldState);
                }
            }
            else
            {
                ShowImmediately();
                shownCallback?.Invoke();
            }
        }