예제 #1
0
 public void HideOverlay()
 {
     if (m_CurrentOverlayState == OverlayState.Visible)
     {
         m_CurrentOverlayState = OverlayState.Exiting;
     }
 }
예제 #2
0
        void _createTipMenu(BuildContext context, ArrowDirection arrowDirection, Offset position, Size size)
        {
            dismiss();
            float triangleY = arrowDirection == ArrowDirection.up
                ? position.dy
                : position.dy - CustomTextSelectionControlsUtils._kToolbarTriangleSize.height
                              - this._getTipMenuHeight(context: context);

            _overlayState = Overlay.of(context: context);
            _overlayEntry = new OverlayEntry(
                _context => Positioned.fill(
                    new GestureDetector(
                        onTap: dismiss,
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Stack(
                                children: new List <Widget> {
                new Positioned(
                    top: triangleY,
                    left: size.width / 2.0f + position.dx - 25 * this.tipMenuItems.Count,
                    child: new _TipMenuContent(
                        tipMenuItems: this.tipMenuItems,
                        arrowDirection: arrowDirection
                        )
                    )
            }
                                )
                            )
                        )
                    )
                );
            _isVisible = true;
            _overlayState.insert(entry: _overlayEntry);
        }
예제 #3
0
        public void SetState(OverlayState state)
        {
            switch (state)
            {
            case OverlayState.normal:
                AdjustShroud(normalSettings);
                break;

            case OverlayState.injured:
                AdjustShroud(injuredSettings);
                break;

            case OverlayState.unconscious:
                AdjustShroud(unconsciousSettings);
                break;

            case OverlayState.crit:
                AdjustShroud(critcalSettings);
                break;

            case OverlayState.death:
                AdjustShroud(normalSettings);
                break;
            }
            currentState = state;
        }
예제 #4
0
 public static void createView(CustomToastItem toastItem)
 {
     _overlayState = Overlay.of(context: toastItem.context);
     _overlayEntry = new OverlayEntry(
         _context => new CustomToastWidget(
             gravity: toastItem.gravity,
             new Container(
                 width: MediaQuery.of(context: _context).size.width,
                 alignment: Alignment.center,
                 child: new Container(
                     decoration: new BoxDecoration(
                         color: toastItem.backgroundColor,
                         borderRadius: BorderRadius.circular(radius: toastItem.radius)
                         ),
                     margin: EdgeInsets.symmetric(horizontal: 20),
                     padding: EdgeInsets.fromLTRB(16, 10, 16, 10),
                     child: new Text(
                         data: toastItem.message,
                         style: CTextStyle.PLargeTitle.copyWith(color: toastItem.textColor)
                         )
                     )
                 )
             )
         );
     _isVisible = true;
     _overlayState.insert(entry: _overlayEntry);
     _timer = Window.instance.run((TimeSpan)toastItem.duration, callback: dismiss);
 }
예제 #5
0
    public void SetState(OverlayState state)
    {
        switch (state)
        {
        case OverlayState.normal:
            SetState(1f);
            break;

        case OverlayState.injured:
            SetState(0.50f);
            break;

        case OverlayState.unconscious:
            SetState(-0.25f);
            break;

        case OverlayState.crit:
            SetState(-0.75f);
            break;

        case OverlayState.death:
            SetState(-1.1f);
            break;
        }
        currentState = state;
    }
예제 #6
0
 void Awake()
 {
     m_Instance = this;
     m_progress = new Progress <double>();
     m_progress.ProgressChanged   += OnProgressChanged;
     m_CurrentOverlayState         = OverlayState.Hidden;
     m_OverlayStateTransitionValue = 0.0f;
     m_GUILogo = new RenderTexture(m_Size, m_Size, 0);
     SetText("");
     RenderLogo(0.45f);
 }
예제 #7
0
        public void SetOverlayTransitionRatio(float fRatio)
        {
            m_OverlayStateTransitionValue = m_OverlayStateTransitionDuration * fRatio;
            bool overlayWasActive = App.VrSdk.OverlayEnabled;

            App.VrSdk.SetOverlayAlpha(fRatio);
            if (!overlayWasActive && App.VrSdk.OverlayEnabled)
            {
                App.VrSdk.PositionOverlay(m_OverlayOffsetDistance, m_OverlayHeight);
            }
            m_CurrentOverlayState = OverlayState.Visible;
        }
예제 #8
0
 void ShowLog()
 {
     if (state == OverlayState.OPENED_LOG)
     {
         state            = OverlayState.CLOSED;
         logFrame.enabled = false;
     }
     else if (state == OverlayState.CLOSED)
     {
         state            = OverlayState.OPENED_LOG;
         logFrame.enabled = true;
     }
     else
     {
         ShowCapturedGuys();
         ShowLog();
     }
 }
예제 #9
0
 void ShowCapturedGuys()
 {
     if (state == OverlayState.OPENED_PIECE_LIST)
     {
         state = OverlayState.CLOSED;
         pieceListFrame.enabled = false;
     }
     else if (state == OverlayState.CLOSED)
     {
         state = OverlayState.OPENED_PIECE_LIST;
         pieceListFrame.enabled = true;
     }
     else
     {
         ShowLog();
         ShowCapturedGuys();
     }
 }
예제 #10
0
        private void SetOverlayState(OverlayState state)
        {
            foreach (var pair in _overlays)
            {
                pair.Value.Visible = pair.Key == state;
            }

            var loadingOverlay = (_overlays[OverlayState.Recording] as RecordingOverlay);

            if (state == OverlayState.Recording)
            {
                loadingOverlay.StartTimer();
            }
            else
            {
                loadingOverlay.StopTimer();
            }

            this.Refresh();
        }
예제 #11
0
        void Update()
        {
            switch (m_CurrentOverlayState)
            {
            case OverlayState.Exiting:
                m_OverlayStateTransitionValue -= Time.deltaTime;
                App.VrSdk.SetOverlayAlpha(
                    Mathf.Max(m_OverlayStateTransitionValue, 0.0f) / m_OverlayStateTransitionDuration);
                if (m_OverlayStateTransitionValue <= 0.0f)
                {
                    m_OverlayStateTransitionValue = 0.0f;
                    m_CurrentOverlayState         = OverlayState.Hidden;
                    App.VrSdk.OverlayEnabled      = false;
                }
                break;

            case OverlayState.Hidden:
            case OverlayState.Visible:
            default: break;
            }
        }
 //Triggers the fading in
 public void FadeIn()
 {
     state = overlay.GetPixel(1, 1).a < 1 ? OverlayState.FadingIn : OverlayState.FullyShown;
 }
예제 #13
0
 private void FadeToBlack()
 {
     fadeStartTime = Time.time;
     SetBlackSlateEnabled(true);
     overlayState = OverlayState.FadingHiddenToBlack;
 }
예제 #14
0
 private void FadeToVisible()
 {
     fadeStartTime = Time.time;
     SetOverlayVisible(true);
     overlayState = OverlayState.FadingBlackToVisible;
 }
예제 #15
0
 private void FadeOut()
 {
     fadeStartTime = Time.time;
     overlayState  = OverlayState.FadingVisibleToHidden;
     FadeOutCallback?.Invoke();
 }
예제 #16
0
 internal ImageOverlay(IPresentationImage image, OverlayState state)
 {
     _image   = image;
     _manager = OverlayManagers.First(m => m.Name == state.Name);
     _state   = state;
 }
예제 #17
0
 private void Start()
 {
     SetOverlayVisible(false);
     SetBlackSlateVisible(true);
     overlayState = OverlayState.Black;
 }
예제 #18
0
파일: Overlay.cs 프로젝트: jwhee/DBG48
 public Overlay(GameInstance game)
 {
     this.game = game;
     this.state = OverlayState.FLY_IN;
     this.currentFrame = 0;
 }
예제 #19
0
        private void Update()
        {
            // Animate overlay by interpolating alpha values, manage fade states
            float fadeProgress;

            switch (overlayState)
            {
            case OverlayState.FadingHiddenToBlack:
                fadeProgress = (Time.time - fadeStartTime) / _fadeDuration;
                if (fadeProgress > 1.0f)
                {
                    SetBlackSlateAlpha(1.0f);
                    overlayState = OverlayState.Black;
                    FadeToVisible();
                }
                else
                {
                    SetBlackSlateAlpha(Mathf.Clamp01(fadeProgress));
                }
                break;

            case OverlayState.FadingBlackToVisible:
                fadeProgress = (Time.time - fadeStartTime) / _fadeDuration;
                if (fadeProgress > 1.0f)
                {
                    SetBlackSlateVisible(false);
                    overlayState = OverlayState.Visible;
                    DelayForSeconds(FadeOut, overlayTimeout);
                    rewindStartTime      = Time.time;
                    rewindingDaysCounter = true;
                }
                else
                {
                    SetBlackSlateAlpha(Mathf.Clamp01(1.0f - fadeProgress));
                }
                break;

            case OverlayState.Visible:
                if (rewindingDaysCounter)
                {
                    float rewindProgress = (Time.time - rewindStartTime) / dayCounterRewindDuration;
                    if (rewindProgress > 1.0f)
                    {
                        rewindingDaysCounter = false;
                        ProgressDisplay.SetDaysSurvived(0);
                    }
                    else
                    {
                        ProgressDisplay.SetDaysSurvived((int)Mathf.Lerp(rewindStartDays, 0.0f, rewindProgress));
                    }
                }
                break;

            case OverlayState.FadingVisibleToHidden:
                fadeProgress = (Time.time - fadeStartTime) / _fadeDuration;
                if (fadeProgress > 1.0f)
                {
                    SetOverlayVisible(false);
                    overlayState = OverlayState.Hidden;
                }
                else
                {
                    SetOverlayAlpha(Mathf.Clamp01(1.0f - fadeProgress));
                }
                break;
            }
        }
 //Triggers the fading in
 public void FadeOut()
 {
     state = overlay.GetPixel(1, 1).a > 0 ? OverlayState.FadingOut : OverlayState.FullyFaded;
 }
예제 #21
0
        void _createTipMenu(BuildContext context, ArrowDirection arrowDirection, Offset position, Size size)
        {
            dismiss();
            var   width         = MediaQuery.of(context: context).size.width - 32 * this.tipMenuItems.Count;
            float tipMenuHeight = this._getTipMenuHeight(context: context);
            float triangleY     = arrowDirection == ArrowDirection.up
                ? position.dy
                : position.dy - CustomTextSelectionControlsUtils._kToolbarTriangleSize.height
                                  - tipMenuHeight;
            float left;
            float childCenterX = size.width / 2.0f + position.dx;

            if (childCenterX >= width)
            {
                left = width - 32 * this.tipMenuItems.Count - 16;
            }
            else
            {
                left = childCenterX - 32 * this.tipMenuItems.Count;
            }

            List <Widget> children;

            if (arrowDirection == ArrowDirection.down)
            {
                children = new List <Widget> {
                    new Positioned(
                        top: triangleY,
                        left: left,
                        child: new _TipMenuContent(
                            tipMenuItems: this.tipMenuItems
                            )
                        ),
                    new Positioned(
                        top: triangleY + tipMenuHeight,
                        left: childCenterX,
                        child: new _TipMenuTriangle(
                            arrowDirection: arrowDirection
                            )
                        )
                };
            }
            else
            {
                children = new List <Widget> {
                    new Positioned(
                        top: triangleY,
                        left: childCenterX,
                        child: new _TipMenuTriangle(
                            arrowDirection: arrowDirection
                            )
                        ),
                    new Positioned(
                        top: triangleY + CustomTextSelectionControlsUtils._kToolbarTriangleSize.height,
                        left: left,
                        child: new _TipMenuContent(
                            tipMenuItems: this.tipMenuItems
                            )
                        )
                };
            }

            _overlayState = Overlay.of(context: context);
            _overlayEntry = new OverlayEntry(
                _context => Positioned.fill(
                    new GestureDetector(
                        onTap: dismiss,
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Stack(
                                children: children
                                )
                            )
                        )
                    )
                );
            _isVisible = true;
            _overlayState.insert(entry: _overlayEntry);
        }