Ejemplo n.º 1
0
        private void RespawnFrame()
        {
            transform.DestroyAllChildren();
            var prefab = frameDBEntry.LoadPrefab <UIFrame>();

            if (prefab == null)
            {
                Debug.LogError($"Prefab for UIFrameDBEntry {frameDBEntry} is null. This is {name}.", this);
                return;
            }
            _currentFrame = frameDBEntry.LoadPrefab <UIFrame>().Clone(transform);
#if UNITY_EDITOR
            if (EditorApplication.isPlaying)
            {
                ShowCurrent();
            }
#else
            ShowCurrent();
#endif

            if (stretch)
            {
                _currentFrame.rectTransform.Stretch();
            }

#if UNITY_EDITOR
            _currentFrame.gameObject.hideFlags = HideFlags.DontSave | HideFlags.DontSaveInEditor;
#endif
        }
 private void Close(UIFrame frame)
 {
     if (frame == _currentFrame)
     {
         Close(_currentFrameDBEntry);
     }
 }
        public override void Show(UIFrameDBEntry frame, params object[] args)
        {
            if (_currentFrameDBEntry == frame)
            {
                return;
            }
            var prevFrame = _currentFrame;

            _currentFrameDBEntry = frame;
            _currentFrame        = ShowFrame(frame, args);
            if (prevFrame != null)
            {
                Destroy(prevFrame.gameObject);
            }
        }
Ejemplo n.º 4
0
        public bool IsTopFrameInStack(UIFrame frame)
        {
            var layers = GetLayersOnTop(frame.layer, false);

            return(layers.Where(l => l.currentFrames.Count > 0).Count() == 0);
        }