Esempio n. 1
0
 public Transition(string name, long unid, bool showAnnotation, int priority, TransitionType transitionType, int delay)
     : base(name, unid, showAnnotation)
 {
     this.priority = priority;
     this.transitionType = transitionType;
     this.delay = delay;
 }
Esempio n. 2
0
 public FloatingMessage(String text, TransitionType transition = TransitionType.FIXED, Actor attachedMonster = null)
 {
     this.text = text;
     this.attachedMonster = attachedMonster;
     this.dialogSprite = new SpriteBatch(UI.getInstance().graphics);
     this.transitionType = transition;
 }
 /// <summary>
 /// Constructs a new background screen.
 /// </summary>
 public BackgroundScreen(string filename, TransitionType trans)
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.5);
     TransitionOffTime = TimeSpan.FromSeconds(0.5);
     this.filename = filename;
     transitionType = trans;
 }
Esempio n. 4
0
    public static void ChangeScene(string sceneName, TransitionType type)
    {
        if(sceneName.Length == 0){
            Debug.Log("SceneName is Null");
            return;
        }
        if (_nextSceneName.Length > 0){
            Debug.Log("Current Loading some other scene");
            return;
        }
        //ロード中
        if (_asyncOpp != null && !_asyncOpp.isDone){
            return;
        }

        string curScene = Application.loadedLevelName;  //_nextSeqName;

        _lastSceneName = curScene;
        _nextSceneName = sceneName;

        if (type == TransitionType.None)
        {
            SceneManager.LoadNextLevelCore();
        }
        else
        {
            _transitionFlag = false;
            // Commence Transition Effects
        //			_loadingTransition.ShowTransition(type, () => {
        //				SceneManager.LoadNextLevel();
        //			});
        }
    }
 public PopUpGraphicScreen(Texture2D _graphic, Vector2 _positionOffset, TransitionType _ttype, TimeSpan _transitionTime)
 {
     graphic = _graphic;
     ttype = _ttype;
     TransitionOnTime = _transitionTime;
     TransitionOffTime = _transitionTime;
     positionOffset = _positionOffset;
     position = Camera.Origin - new Vector2(graphic.Width * 0.5f, graphic.Height * 0.5f) + positionOffset;
 }
        private void FillList(ListBox list, TransitionType selection)
        {
            for (int i = 0; i < (int)TransitionType.EaseOutInBounce; i++) {
                list.Items.Add((TransitionType)i);

                if ((TransitionType)i == selection) {
                    list.SelectedIndex = i;
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <param name="type">Linear interpolation or cosine</param>
        /// <param name="frames">Number of frames until the picture completely changes to the second one, then goes back to the first one</param>
        public TransitioningImage(Texture first, Texture second, TransitionType type, int frames, bool animateFirstAlpha = true)
        {
            First = new TexturedRectangle(first);
            Second = new TexturedRectangle(second);
            Type = type;
            Frames = frames;
            AnimateFirstImageAlpha = animateFirstAlpha;

            AddChild(First);
            AddChild(Second);
        }
Esempio n. 8
0
 public TransitionEffect(Vector2 center,TransitionType type)
 {
     this.scale = 1;
     if (type == TransitionType.Translate)
         this.translation = new Vector2(-500, 0);
     else
         translation = Vector2.Zero;
     this.center = center;
     this.type = type;
     alpha = 1;
 }
	public void StartTransition (Color fromColor, Color toColor, float duration, TransitionType type) {
		if (transitState == TransitionState.TransitedIn || transitState == TransitionState.TransitedOut) {
			// Change the state to transiting in/out (according to the previous state)
			transitState = transitState == TransitionState.TransitedIn ? TransitionState.TransitingOut : TransitionState.TransitingIn;

			// Enable the transiter's Image
			transiters[type].EnableImage ();

			// Call the transition animation according to the given TransitionType
			transiters[type].StartTransition (fromColor, toColor, duration);
		}
	}
Esempio n. 10
0
 public StateMenu(LeGame g)
     : base(g)
 {
     Log("Creating state");
     background = new ScrollBackground(game, "menu/background");
     mouse = new MouseEntity(game);
     singleColor = multiColor = optionsColor = exitColor = TEXT_COLOR;
     isTransitioning = true;
     doChangeState = false;
     transitionCount = 0;
     targetState = StateManager.State.Single;
     currentTransition = TransitionType.FadeIn;
 }
Esempio n. 11
0
        protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler, AnimationFinishedEvaluator evaluatorHandler)
        {
            this.targetControl = control;
            this.transitionType = transitionType;
            this.actionHandler = actionHandler;
            this.evaluatorHandler = evaluatorHandler;

            this.counter = 0;
            this.startTime = 0;
            this.targetTime = duration;

            timer = DelayedCall.Start(DoAnimation, duration);
        }
Esempio n. 12
0
 /// <summary>
 /// NavigationEntry
 /// </summary>
 /// <param name="completionTime">completionTime</param>
 /// <param name="displayUrl">displayUrl</param>
 /// <param name="httpStatusCode">httpStatusCode</param>
 /// <param name="originalUrl">originalUrl</param>
 /// <param name="title">title</param>
 /// <param name="transitionType">transitionType</param>
 /// <param name="url">url</param>
 /// <param name="hasPostData">hasPostData</param>
 /// <param name="isValid">isValid</param>
 /// <param name="isCurrent">is the current entry</param>
 public NavigationEntry(bool isCurrent, DateTime completionTime, string displayUrl, int httpStatusCode, string originalUrl, string title, TransitionType transitionType, string url, bool hasPostData, bool isValid)
 {
     this.isCurrent = isCurrent;
     this.completionTime = completionTime;
     this.displayUrl = displayUrl;
     this.httpStatusCode = httpStatusCode;
     this.originalUrl = originalUrl;
     this.title = title;
     this.transitionType = transitionType;
     this.url = url;
     this.hasPostData = hasPostData;
     this.isValid = isValid;
 }
Esempio n. 13
0
        /// <summary>
        /// Show view onto the screen
        /// </summary>
        /// <param name="view">View to activate</param>
        /// <param name="type">Type of a transition</param>
        public static void ActivateView(IView view, TransitionType type)
        {
            if (_masterForm.InvokeRequired)
            {
                _masterForm.Invoke(new Action<IView>(ActivateView), new object[] { view, type });
                return;
            }

            var from = _currentView != null ? _currentView : view;
            var to = view;

            AddViewToForm(to);

            ViewTransitionManager.Execute(from, to, type);
        }
        /// <summary>
        /// Starts the specified control.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="targetSize">Size of the target.</param>
        /// <param name="transitionType">Type of the transition.</param>
        /// <param name="duration">The duration.</param>
        public void Start(Control control, Size targetSize, TransitionType transitionType, int duration)
        {
            base.Start(control, transitionType, duration,
                delegate
                {
                    int width = DoExpandAnimation(control.Width, targetSize.Width);
                    int height = DoExpandAnimation(control.Height, targetSize.Height);

                    control.Size = new Size(width, height);
                },
                delegate
                {
                    return (control.Size.Equals(targetSize));
                });
        }
Esempio n. 15
0
        public void Start(Control control, Point targetPoint, TransitionType transitionType, int duration)
        {
            base.Start(control, transitionType, duration,
                delegate
                {
                    int x = DoMoveAnimation(control.Location.X, targetPoint.X);
                    int y = DoMoveAnimation(control.Location.Y, targetPoint.Y);

                    control.Location = new Point(x, y);
                },
                delegate
                {
                    return (control.Location.Equals(targetPoint));
                });
        }
 public ExitableBackgroundScreen(string filename, TransitionType type)
     : base(filename, type)
 {
     exit = new InputAction(
         new Buttons[]
         {
             Buttons.A,
             Buttons.B,
             Buttons.Back
         },
         new Keys[]
         {
             Keys.Space,
             Keys.Escape
         },
         true);
 }
        public ListBoxVideoItem(int id, string timestart, string clipid, string display1, string display2, TimeSpan lengthofclip, TypeEnum type, WhatNextEnum whatnext, int inframes, int outframes, Image itemImage, VideoCatergoryEnum category, TransitionType segue, Int32 seglength, string clipfilename)
            : base(id, timestart)
        {
            this.clipID = clipid;
            this.display1 = display1;
            this.display2 = display2;
            this.lengthOfClip = lengthofclip;
            this.type = type;
            this._whatnext = whatnext;
            this.inFrames = inframes;
            this.outFrames = outframes;
            this.itemImage = itemImage;
            this.Catergory = category;
            this.Segue = segue;
            this.SegLength = seglength;

            this.ClipFilename = clipfilename;
        }
Esempio n. 18
0
    public void StartTransition(TransitionType transition)
    {
        if (transitionActive) return;

        switch(transition)
        {
            case TransitionType.GameToGlobe:
                StartCoroutine(GameToGlobeTransition());
                break;
            case TransitionType.GlobeToGame:
                StartCoroutine(GlobeToGameTransition());
                break;
            case TransitionType.GlobeGameToCam:
                StartCoroutine(GlobeGameToCam());
                break;
            case TransitionType.GlobeCamToGame:
                StartCoroutine(GlobeCamToGame());
                break;
        }
    }
Esempio n. 19
0
        internal static void Execute(IView from, IView to, TransitionType type)
        {
            _fromView = from;
            _toView = to;

            switch (type)
            {
                case TransitionType.Basic:
                    _currentTransition = _basicTransition;
                    break;

                case TransitionType.SlideLeft:
                    _slideTransition.SlideDirection = TransitionType.SlideLeft;
                    _currentTransition = _slideTransition;
                    break;

                case TransitionType.SlideRight:
                    _slideTransition.SlideDirection = TransitionType.SlideRight;
                    _currentTransition = _slideTransition;
                    break;

                case TransitionType.FlipLeft:
                    _flipTransition.FlipDirection = TransitionType.FlipLeft;
                    _currentTransition = _flipTransition;
                    break;

                case TransitionType.FlipRight:
                    _flipTransition.FlipDirection = TransitionType.FlipRight;
                    _currentTransition = _flipTransition;
                    break;
            }

            if (!_currentTransition.IsTransitionAvailable())
                _currentTransition = _basicTransition;

            _currentTransition.Execute();
        }
Esempio n. 20
0
        private static void FillAnimation(DoubleAnimationUsingKeyFrames animation, TransitionType type, double from, double to, TimeSpan duration, double fps)
        {
            Equation equation = (Equation)Delegate.CreateDelegate(typeof(Equation), typeof(Equations).GetMethod(type.ToString()));

            double total = duration.TotalMilliseconds;
            double step = 1000D / (double)fps;

            // clear animation
            animation.KeyFrames.Clear();

            for (double i = 0; i < total; i += step) {
                LinearDoubleKeyFrame frame = new LinearDoubleKeyFrame();
                frame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(i));
                frame.Value = equation(i, from, to - from, total);

                animation.KeyFrames.Add(frame);
            }

            // always add exact final key frame
            LinearDoubleKeyFrame finalFrame = new LinearDoubleKeyFrame();
            finalFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(total));
            finalFrame.Value = to;
            animation.KeyFrames.Add(finalFrame);
        }
Esempio n. 21
0
    public void SettingTransitionType(TransitionType _transitionType)
    {
        transitionType = _transitionType;
        switch (_transitionType)
        {
        //Fade
        case TransitionType.Fade:
            transImage.fillAmount = 1.0f;
            break;

        //Horizontal
        case TransitionType.Horizontal_Right:
            transImage.fillMethod = Image.FillMethod.Horizontal;
            transImage.fillOrigin = (int)Image.OriginHorizontal.Right;
            break;

        case TransitionType.Horizontal_Left:
            transImage.fillMethod = Image.FillMethod.Horizontal;
            transImage.fillOrigin = (int)Image.OriginHorizontal.Left;
            break;

        //Vertical
        case TransitionType.Vertical_Top:
            transImage.fillMethod = Image.FillMethod.Vertical;
            transImage.fillOrigin = (int)Image.OriginVertical.Top;
            break;

        case TransitionType.Vertical_Bottom:
            transImage.fillMethod = Image.FillMethod.Vertical;
            transImage.fillOrigin = (int)Image.OriginVertical.Bottom;
            break;

        //Radial90
        case TransitionType.Radial90_TopRight:
            transImage.fillMethod = Image.FillMethod.Radial90;
            transImage.fillOrigin = (int)Image.Origin90.TopRight;
            break;

        case TransitionType.Radial90_TopLeft:
            transImage.fillMethod = Image.FillMethod.Radial90;
            transImage.fillOrigin = (int)Image.Origin90.TopLeft;
            break;

        case TransitionType.Radial90_BottomRight:
            transImage.fillMethod = Image.FillMethod.Radial90;
            transImage.fillOrigin = (int)Image.Origin90.BottomRight;
            break;

        case TransitionType.Radial90_BottomLeft:
            transImage.fillMethod = Image.FillMethod.Radial90;
            transImage.fillOrigin = (int)Image.Origin90.BottomLeft;
            break;

        //Radial180
        case TransitionType.Radial180_Right:
            transImage.fillMethod = Image.FillMethod.Radial180;
            transImage.fillOrigin = (int)Image.Origin180.Right;
            break;

        case TransitionType.Radial180_Left:
            transImage.fillMethod = Image.FillMethod.Radial180;
            transImage.fillOrigin = (int)Image.Origin180.Left;
            break;

        case TransitionType.Radial180_Top:
            transImage.fillMethod = Image.FillMethod.Radial180;
            transImage.fillOrigin = (int)Image.Origin180.Top;
            break;

        case TransitionType.Radial180_Bottom:
            transImage.fillMethod = Image.FillMethod.Radial180;
            transImage.fillOrigin = (int)Image.Origin180.Bottom;
            break;

        //Radial360
        case TransitionType.Radial360_Right:
            transImage.fillMethod = Image.FillMethod.Radial360;
            transImage.fillOrigin = (int)Image.Origin360.Right;
            break;

        case TransitionType.Radial360_Left:
            transImage.fillMethod = Image.FillMethod.Radial360;
            transImage.fillOrigin = (int)Image.Origin360.Left;
            break;

        case TransitionType.Radial360_Top:
            transImage.fillMethod = Image.FillMethod.Radial360;
            transImage.fillOrigin = (int)Image.Origin360.Top;
            break;

        case TransitionType.Radial360_Bottom:
            transImage.fillMethod = Image.FillMethod.Radial360;
            transImage.fillOrigin = (int)Image.Origin360.Bottom;
            break;
        }
    }
Esempio n. 22
0
 public static void StartTransition(TransitionType type, System.Action act)
 {
     if (type == TransitionType.None)
     {
         act();
     }
     else
     {
         _transitionFlag = false;
     }
 }
Esempio n. 23
0
 /// <summary>
 /// Sets the light a custom pattern.
 /// Use a List of Color objects to assign a list of colors the light will cycle through.
 /// </summary>
 /// <param name="colors"> The list of colors that the light will cycle through. </param>
 /// <param name="transition"> The transition type (Gradual, Strobe, Jump). </param>
 /// <param name="speed"> How quick the light will cycle through the pattern, from 0 to 100. </param>
 public async Task SetCustomPatternAsync(List <Color> colors, TransitionType transition, byte speed)
 => await SetCustomPatternAsync(colors.ToArray(), transition, speed);
Esempio n. 24
0
        /// <summary>
        /// Setups the transition.
        /// </summary>
        /// <param name="next">The next.</param>
        /// <param name="type">The type.</param>
        /// <param name="name">The name.</param>
        /// <param name="time">The time.</param>
        /// <exception cref="System.Exception">
        /// Cannot pop the only scene on the stack.
        /// or
        /// Invalid transition name:  + name
        /// </exception>
        internal void SetupTransition(Scene next, TransitionType type, string name, float time)
        {
            if (name == null)
            {
                switch (type)
                {
                case TransitionType.Switch:
                    this.nextScene = next;
                    this.TransitionSwitchComplete();
                    break;

                case TransitionType.Push:
                    this.nextScene = next;
                    this.TransitionPushComplete();
                    break;

                case TransitionType.Pop:
                    this.TransitionPopComplete();
                    break;

                default:
                    // do the defalut action
                    break;
                }
            }
            else
            {
                Transition trans = null;
                if (this.transitions.TryGetValue(name, out trans))
                {
                    this.nextScene = next;

                    Scene scene = null;
                    if (this.current.Count > 0)
                    {
                        scene = this.current.Peek();
                        scene.SetTransitioning();
                        scene.Deactivate();
                    }

                    if (type != TransitionType.Pop)
                    {
                        scene = this.nextScene;
                    }
                    else
                    {
                        if (this.current.Count >= 2)
                        {
                            var scenes = this.current.ToArray();
                            scene = scenes[scenes.Length - 2];
                        }
                        else
                        {
                            throw new InvalidOperationException("Cannot pop the only scene on the stack.");
                        }
                    }

                    if (scene != null)
                    {
                        scene.Enter();
                        scene.SetTransitioning();
                    }

                    this.transition = trans;
                    this.transition.Start();

                    this.transitionType = type;

                    this.transitionTween = new ValueTweener(0, 1);
                    if (type == TransitionType.Switch)
                    {
                        this.transitionTween.Forward(time);
                        this.transitionTween.Action(new Action(this.TransitionSwitchComplete));
                        this.transitionTween.Start();
                    }
                    else if (type == TransitionType.Push)
                    {
                        this.transitionTween.Forward(time);
                        this.transitionTween.Action(new Action(this.TransitionPushComplete));
                        this.transitionTween.Start();
                    }
                    else if (type == TransitionType.Pop)
                    {
                        this.transitionTween.Forward(time);
                        this.transitionTween.Action(new Action(this.TransitionPopComplete));
                        this.transitionTween.Start();
                    }
                }
                else
                {
                    throw new InvalidOperationException("Invalid transition name: " + name);
                }
            }
        }
Esempio n. 25
0
 public TransitionData(Node node, TransitionType transition, int cost)
 {
     Node       = node;
     Transition = transition;
     Cost       = cost;
 }
Esempio n. 26
0
 public void Intro()
 {
     transitionType  = TransitionType.IntroSetup;
     isTransitioning = true;
 }
Esempio n. 27
0
    // Update is called once per frame
    void Update()
    {
        Vector3 cameraPosition = camera.transform.position;
        Vector3 newCameraPosition;
        Vector3 ballPosition = ball.transform.position;

        if (isTransitioning)
        {
            switch (transitionType)
            {
            case TransitionType.IntroSetup:
                checkError              = true;
                ballPosition.y          = cameraSettings.position.y + 10f;
                ball.transform.position = ballPosition;

                cameraPosition            = ballPosition;
                cameraPosition.y         += 3f;
                camera.transform.position = cameraPosition;

                transitionType = TransitionType.IntroDialogue;

                camera.GetComponent <Camera>().farClipPlane = cameraSettings.position.y + 7;

                break;

            case TransitionType.IntroDialogue:
                if (!dialogue.noDialogue && !dialogue.dialogueStarted)
                {
                    dialogue.startIntroDialogue();
                }
                else if (dialogue.noDialogue || dialogue.isComplete)
                {
                    transitionType      = TransitionType.Intro;
                    dialogue.noDialogue = false;
                }
                else
                {
                    freezeBall();
                }
                break;

            case TransitionType.Intro:
                if (!hitGround && ballPosition.y < 3f)
                {
                    windSource.Stop();
                    hitSource.Play();
                    hitGround = true;
                }
                if ((camera.transform.position - cameraSettings.position).magnitude < 0.1f)
                {
                    isTransitioning = false;
                }
                else if (camera.transform.position.y < cameraSettings.position.y + 5f)
                {
                    camera.GetComponent <Camera>().farClipPlane = 1000;
                    cameraPosition            = camera.transform.position;
                    newCameraPosition         = cameraSettings.position;
                    camera.transform.position = Vector3.Lerp(cameraPosition, newCameraPosition, cameraSettings.introSpeed * Time.deltaTime);

                    if (camera.transform.rotation.eulerAngles.x > cameraSettings.rotation.x)
                    {
                        camera.transform.rotation = Quaternion.Lerp(camera.transform.rotation, Quaternion.Euler(cameraSettings.rotation), cameraSettings.introSpeed * Time.deltaTime);
                    }
                }
                else
                {
                    cameraPosition            = ball.transform.position;
                    cameraPosition.y         += 3f;
                    camera.transform.position = cameraPosition;
                }

                break;

            case TransitionType.OutroSetup:
                ball.transform.rotation = Quaternion.identity;
                ball.transform.position = new Vector3(ball.ballX, ball.transform.position.y, ballZ);

                transitionType = TransitionType.Outro;

                break;

            case TransitionType.Outro:
                rollSource.Stop();
                if (ballPosition.y < -15f)
                {
                    ballPosition.y = -15f;
                }
                ball.transform.rotation = Quaternion.identity;
                ballPosition.x          = ball.ballX;
                ballPosition.z          = ball.ballZ;
                ball.transform.position = ballPosition;
                if (Mathf.Abs(cameraPosition.x - ball.ballX) > 0.15 || Mathf.Abs(cameraPosition.z - ball.ballZ) > 0.15)
                {
                    newCameraPosition         = ball.transform.position;
                    newCameraPosition.y       = 5f;
                    camera.transform.position = Vector3.Lerp(cameraPosition, newCameraPosition, cameraSettings.outroSpeed * Time.deltaTime);
                }
                else if (cameraPosition.y - ball.transform.position.y > 3.05f)
                {
                    newCameraPosition         = ball.transform.position;
                    newCameraPosition.y      += 3f;
                    camera.transform.position = Vector3.Lerp(cameraPosition, newCameraPosition, cameraSettings.outroSpeed * Time.deltaTime);
                }
                else
                {
                    transitionType = TransitionType.OutroDialogue;
                }

                if (camera.transform.rotation.eulerAngles.x < 89.9f)
                {
                    camera.transform.rotation = Quaternion.Lerp(camera.transform.rotation, Quaternion.Euler(90f, 0f, 0f), cameraSettings.outroSpeed * Time.deltaTime);
                }
                else
                {
                    camera.transform.rotation = Quaternion.Euler(90f, 0, 0);
                }
                break;

            case TransitionType.OutroDialogue:
                if (!dialogue.dialogueStarted)
                {
                    if (lost)
                    {
                        dialogue.startFailDialogue();
                    }
                    else
                    {
                        dialogue.startOutroDialogue();
                    }
                }
                else if (dialogue.isComplete)
                {
                    timer          = 0;
                    transitionType = TransitionType.OutroCleanup;
                }
                else
                {
                    freezeBall();
                }
                break;

            case TransitionType.OutroCleanup:
                freezeBall();
                timer += Time.deltaTime;
                if (timer >= 0.5f)
                {
                    if (lost)
                    {
                        BallController.sanity--;
                        dialogue.setSanityText(BallController.sanity);
                        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
                    }
                    else
                    {
                        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
                    }
                }
                break;
            }
        }
        else
        {
            if (ball.GetComponent <Rigidbody>().velocity.magnitude > 0.5f)
            {
                var speed          = ball.GetComponent <Rigidbody>().velocity.magnitude;
                var scaledVelocity = Remap(Mathf.Clamp(speed, 0, maxSpeed), 0, maxSpeed, 0, 1);
                rollSource.volume = volumeCurve.Evaluate(scaledVelocity);
                rollSource.pitch  = pitchCurve.Evaluate(scaledVelocity);
                rollSource.pitch  = Mathf.Max(rollSource.pitch, 0.5f);
                rollSource.pitch  = Mathf.Min(rollSource.pitch, 1.5f);
                if (!rollPlaying)
                {
                    rollPlaying = true;
                    rollSource.Play();
                }
            }
            else if (rollPlaying)
            {
                rollPlaying = false;
                rollSource.Stop();
            }
        }
        previousBallPosition = ball.transform.position;
    }
Esempio n. 28
0
 public void registerPage(string pageName, Type windowClass, Page page, TransitionType transitionType = TransitionType.Default)
 {
     pages.Add(pageName, new myPage(windowClass.Name, pageName, page, transitionType));
 }
Esempio n. 29
0
        protected override IEnumerable <object> DoLevelTransition(TransitionType transitionType, LevelData newLevel, Submarine leavingSub, bool mirror, List <TraitorMissionResult> traitorResults = null)
        {
            NextLevel = newLevel;
            bool success = CrewManager.GetCharacters().Any(c => !c.IsDead);

            SoundPlayer.OverrideMusicType     = success ? "endround" : "crewdead";
            SoundPlayer.OverrideMusicDuration = 18.0f;
            crewDead = false;

            GameMain.GameSession.EndRound("", traitorResults, transitionType);
            var          continueButton = GameMain.GameSession.RoundSummary?.ContinueButton;
            RoundSummary roundSummary   = null;

            if (GUIMessageBox.VisibleBox?.UserData is RoundSummary)
            {
                roundSummary = GUIMessageBox.VisibleBox?.UserData as RoundSummary;
            }
            if (continueButton != null)
            {
                continueButton.Visible = false;
            }

            lastControlledCharacter = Character.Controlled;
            Character.Controlled    = null;

            switch (transitionType)
            {
            case TransitionType.None:
                throw new InvalidOperationException("Level transition failed (no transitions available).");

            case TransitionType.ReturnToPreviousLocation:
                //deselect destination on map
                map.SelectLocation(-1);
                break;

            case TransitionType.ProgressToNextLocation:
                Map.MoveToNextLocation();
                Map.ProgressWorld();
                break;
            }

            var endTransition = new CameraTransition(Submarine.MainSub, GameMain.GameScreen.Cam, null,
                                                     transitionType == TransitionType.LeaveLocation ? Alignment.BottomCenter : Alignment.Center,
                                                     fadeOut: false,
                                                     duration: EndTransitionDuration);

            GUI.ClearMessages();

            Location portraitLocation = Map.SelectedLocation ?? Map.CurrentLocation;

            overlaySprite = portraitLocation.Type.GetPortrait(portraitLocation.PortraitId);
            float fadeOutDuration = endTransition.Duration;
            float t = 0.0f;

            while (t < fadeOutDuration || endTransition.Running)
            {
                t           += CoroutineManager.UnscaledDeltaTime;
                overlayColor = Color.Lerp(Color.Transparent, Color.White, t / fadeOutDuration);
                yield return(CoroutineStatus.Running);
            }
            overlayColor = Color.White;
            yield return(CoroutineStatus.Running);

            //--------------------------------------

            if (success)
            {
                if (leavingSub != Submarine.MainSub && !leavingSub.DockedTo.Contains(Submarine.MainSub))
                {
                    Submarine.MainSub = leavingSub;
                    GameMain.GameSession.Submarine = leavingSub;
                    var subsToLeaveBehind = GetSubsToLeaveBehind(leavingSub);
                    foreach (Submarine sub in subsToLeaveBehind)
                    {
                        MapEntity.mapEntityList.RemoveAll(e => e.Submarine == sub && e is LinkedSubmarine);
                        LinkedSubmarine.CreateDummy(leavingSub, sub);
                    }
                }

                GameMain.GameSession.SubmarineInfo = new SubmarineInfo(GameMain.GameSession.Submarine);
                SaveUtil.SaveGame(GameMain.GameSession.SavePath);
            }
            else
            {
                EnableRoundSummaryGameOverState();
            }

            //--------------------------------------

            if (PendingSubmarineSwitch != null)
            {
                GameMain.GameSession.SubmarineInfo = PendingSubmarineSwitch;
                PendingSubmarineSwitch             = null;
            }

            SelectSummaryScreen(roundSummary, newLevel, mirror, () =>
            {
                GameMain.GameScreen.Select();
                if (continueButton != null)
                {
                    continueButton.Visible = true;
                }

                GUI.DisableHUD = false;
                GUI.ClearCursorWait();
                overlayColor = Color.Transparent;
            });

            yield return(CoroutineStatus.Success);
        }
Esempio n. 30
0
 public Transition(int numb, Production prod)
 {
     Type             = TransitionType.REDUCE;
     Production       = prod;
     ProductionNumber = numb;
 }
Esempio n. 31
0
 // ACCEPT, REJECT
 public Transition(TransitionType type)
 {
     Type = type;
 }
Esempio n. 32
0
 public Transition(TransitionType type, int next)
 {
     Type      = type;
     NextState = next;
 }
 public CustomNavigationPage(Xamarin.Forms.Page root, TransitionType type) : base(root)
 {
     TransitionType = type;
     InitializeComponent();
 }
Esempio n. 34
0
        public RGGTransition(RGGNode from, RGGNode to, TransitionType transitionType, params object[] args)
        {
            From = from;
            From.AddTransition(this);
            To             = to;
            TransitionType = transitionType;
            switch (transitionType)
            {
            case TransitionType.PatternStart:
            case TransitionType.PatternEnd:
                break;

            case TransitionType.NonTerminalNonRecursive:
            case TransitionType.NonTerminalRecursive:
                if (args.Count() > 0 && args[0] is string)
                {
                    NonTerminal = args[0] as string;
                }
                else
                {
                    throw new Exception("NonTerminalNonRecursive/NonTerminalRecursive expect args of one string");
                }
                break;

            case TransitionType.Terminal:
                if (args.Count() > 0 && args[0] is TerminalPattern)
                {
                    Terminal = args[0] as TerminalPattern;
                }
                else
                {
                    throw new Exception("Terminal expect args of one TerminalPattern");
                }
                break;

            case TransitionType.GroupStart:
                if (args.Count() == 1 && args[0] is string)
                {
                    Internal = args[0] as string;
                }
                else
                {
                    throw new Exception("GroupStart expect args of one string");
                }
                break;

            case TransitionType.GroupEnd:
                if (args.Count() == 1 && args[0] is string)
                {
                    Internal = args[0] as string;
                }
                else
                {
                    throw new Exception("GroupEnd expect args of one string and one start Node name");
                }
                break;

            case TransitionType.Pop:
                if (args.Count() > 0)
                {
                    for (int counter = 0; counter < args.Count(); counter += 1)
                    {
                        if (args[counter] is string)
                        {
                            PopList.Add(args[counter] as string);
                        }
                        else
                        {
                            throw new Exception(string.Format("{0} value of args expected to be string: was {1}", counter, args[counter].GetType().Name));
                        }
                    }
                }
                break;

            case TransitionType.Push:
                if (args.Count() > 0)
                {
                    if (args[0] is TerminalPattern)
                    {
                        Terminal = args[0] as TerminalPattern;
                    }
                    else
                    {
                        throw new Exception(string.Format("First value of args expected to be char: was {0}", args[0]));
                    }
                    for (int counter = 1; counter < args.Count(); counter += 1)
                    {
                        if (args[counter] is string)
                        {
                            PushList.Add(args[counter] as string);
                        }
                        else
                        {
                            throw new Exception(string.Format("{0} value of args expected to be string: was {1}", counter, args[counter].GetType().Name));
                        }
                    }
                }
                else
                {
                    throw new Exception(string.Format("Push transition from node {0} to {1} missing arguments", From.Name, To.Name));
                }
                break;
            }
        }
 public void SetTransitionType(TransitionType transitionType)
 {
 }
Esempio n. 36
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (overlayColor.A > 0)
            {
                if (overlaySprite != null)
                {
                    GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * (overlayColor.A / 255.0f), isFilled: true);
                    float scale = Math.Max(GameMain.GraphicsWidth / overlaySprite.size.X, GameMain.GraphicsHeight / overlaySprite.size.Y);
                    overlaySprite.Draw(spriteBatch, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) / 2, overlayColor, overlaySprite.size / 2, scale: scale);
                }
                else
                {
                    GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), overlayColor, isFilled: true);
                }
                if (!string.IsNullOrEmpty(overlayText) && overlayTextColor.A > 0)
                {
                    var     backgroundSprite = GUI.Style.GetComponentStyle("CommandBackground").GetDefaultSprite();
                    Vector2 centerPos        = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) / 2;
                    string  wrappedText      = ToolBox.WrapText(overlayText, GameMain.GraphicsWidth / 3, GUI.Font);
                    Vector2 textSize         = GUI.Font.MeasureString(wrappedText);
                    Vector2 textPos          = centerPos - textSize / 2;
                    backgroundSprite.Draw(spriteBatch,
                                          centerPos,
                                          Color.White * (overlayTextColor.A / 255.0f),
                                          origin: backgroundSprite.size / 2,
                                          rotate: 0.0f,
                                          scale: new Vector2(GameMain.GraphicsWidth / 2 / backgroundSprite.size.X, textSize.Y / backgroundSprite.size.Y * 1.5f));

                    GUI.DrawString(spriteBatch, textPos + Vector2.One, wrappedText, Color.Black * (overlayTextColor.A / 255.0f));
                    GUI.DrawString(spriteBatch, textPos, wrappedText, overlayTextColor);

                    if (!string.IsNullOrEmpty(overlayTextBottom))
                    {
                        Vector2 bottomTextPos = centerPos + new Vector2(0.0f, textSize.Y / 2 + 40 * GUI.Scale) - GUI.Font.MeasureString(overlayTextBottom) / 2;
                        GUI.DrawString(spriteBatch, bottomTextPos + Vector2.One, overlayTextBottom, Color.Black * (overlayTextColor.A / 255.0f));
                        GUI.DrawString(spriteBatch, bottomTextPos, overlayTextBottom, overlayTextColor);
                    }
                }
            }

            if (GUI.DisableHUD || GUI.DisableUpperHUD || ForceMapUI || CoroutineManager.IsCoroutineRunning("LevelTransition"))
            {
                endRoundButton.Visible = false;
                if (ReadyCheckButton != null)
                {
                    ReadyCheckButton.Visible = false;
                }
                return;
            }
            if (Submarine.MainSub == null || Level.Loaded == null)
            {
                return;
            }

            endRoundButton.Visible = false;
            var    availableTransition = GetAvailableTransition(out _, out Submarine leavingSub);
            string buttonText          = "";

            switch (availableTransition)
            {
            case TransitionType.ProgressToNextLocation:
            case TransitionType.ProgressToNextEmptyLocation:
                if (Level.Loaded.EndOutpost == null || !Level.Loaded.EndOutpost.DockedTo.Contains(leavingSub))
                {
                    string textTag = availableTransition == TransitionType.ProgressToNextLocation ? "EnterLocation" : "EnterEmptyLocation";
                    buttonText             = TextManager.GetWithVariable(textTag, "[locationname]", Level.Loaded.EndLocation?.Name ?? "[ERROR]");
                    endRoundButton.Visible = !ForceMapUI && !ShowCampaignUI;
                }
                break;

            case TransitionType.LeaveLocation:
                buttonText             = TextManager.GetWithVariable("LeaveLocation", "[locationname]", Level.Loaded.StartLocation?.Name ?? "[ERROR]");
                endRoundButton.Visible = !ForceMapUI && !ShowCampaignUI;
                break;

            case TransitionType.ReturnToPreviousLocation:
            case TransitionType.ReturnToPreviousEmptyLocation:
                if (Level.Loaded.StartOutpost == null || !Level.Loaded.StartOutpost.DockedTo.Contains(leavingSub))
                {
                    string textTag = availableTransition == TransitionType.ReturnToPreviousLocation ? "EnterLocation" : "EnterEmptyLocation";
                    buttonText             = TextManager.GetWithVariable(textTag, "[locationname]", Level.Loaded.StartLocation?.Name ?? "[ERROR]");
                    endRoundButton.Visible = !ForceMapUI && !ShowCampaignUI;
                }

                break;

            case TransitionType.None:
            default:
                if (Level.Loaded.Type == LevelData.LevelType.Outpost &&
                    (Character.Controlled?.Submarine?.Info.Type == SubmarineType.Player || (Character.Controlled?.CurrentHull?.OutpostModuleTags.Contains("airlock") ?? false)))
                {
                    buttonText             = TextManager.GetWithVariable("LeaveLocation", "[locationname]", Level.Loaded.StartLocation?.Name ?? "[ERROR]");
                    endRoundButton.Visible = !ForceMapUI && !ShowCampaignUI;
                }
                else
                {
                    endRoundButton.Visible = false;
                }
                break;
            }

            if (ReadyCheckButton != null)
            {
                ReadyCheckButton.Visible = endRoundButton.Visible;
            }

            if (endRoundButton.Visible)
            {
                if (!AllowedToEndRound())
                {
                    buttonText = TextManager.Get("map");
                }
                else if (prevCampaignUIAutoOpenType != availableTransition &&
                         (availableTransition == TransitionType.ProgressToNextEmptyLocation || availableTransition == TransitionType.ReturnToPreviousEmptyLocation))
                {
                    HintManager.OnAvailableTransition(availableTransition);
                    //opening the campaign map pauses the game and prevents HintManager from running -> update it manually to get the hint to show up immediately
                    HintManager.Update();
                    Map.SelectLocation(-1);
                    endRoundButton.OnClicked(EndRoundButton, null);
                    prevCampaignUIAutoOpenType = availableTransition;
                }
                endRoundButton.Text = ToolBox.LimitString(buttonText, endRoundButton.Font, endRoundButton.Rect.Width - 5);
                if (endRoundButton.Text != buttonText)
                {
                    endRoundButton.ToolTip = buttonText;
                }
                if (Character.Controlled?.ViewTarget is Item item)
                {
                    Turret turret = item.GetComponent <Turret>();
                    endRoundButton.RectTransform.ScreenSpaceOffset = turret == null ? Point.Zero : new Point(0, (int)(turret.UIElementHeight * 1.25f));
                }
                else if (Character.Controlled?.CharacterHealth?.SuicideButton?.Visible ?? false)
                {
                    endRoundButton.RectTransform.ScreenSpaceOffset = new Point(0, Character.Controlled.CharacterHealth.SuicideButton.Rect.Height);
                }
                else if (GameMain.Client != null && GameMain.Client.IsFollowSubTickBoxVisible)
                {
                    endRoundButton.RectTransform.ScreenSpaceOffset = new Point(0, HUDLayoutSettings.Padding + GameMain.Client.FollowSubTickBox.Rect.Height);
                }
                else
                {
                    endRoundButton.RectTransform.ScreenSpaceOffset = Point.Zero;
                }
            }
            endRoundButton.DrawManually(spriteBatch);
            if (this is MultiPlayerCampaign && ReadyCheckButton != null)
            {
                ReadyCheckButton.RectTransform.ScreenSpaceOffset = endRoundButton.RectTransform.ScreenSpaceOffset;
                ReadyCheckButton.DrawManually(spriteBatch);
            }
        }
Esempio n. 37
0
 public static void SetTransition(DependencyObject obj, TransitionType value)
 {
     obj.SetValue(TransitionProperty, value);
 }
Esempio n. 38
0
 /// <summary>
 /// Creates a tween animation with a default number of frames per second..
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="from">From.</param>
 /// <param name="to">To.</param>
 /// <param name="duration">The duration.</param>
 /// <returns></returns>
 public static DoubleAnimationUsingKeyFrames CreateAnimation(TransitionType type, double from, double to, TimeSpan duration)
 {
     return CreateAnimation(type, from, to, duration, DefaultFps);
 }
Esempio n. 39
0
 public void Outro(bool lost)
 {
     this.lost       = lost;
     transitionType  = TransitionType.OutroSetup;
     isTransitioning = true;
 }
Esempio n. 40
0
        protected internal virtual Transition EdgeFactory(ATN atn, TransitionType type, int src, int trg, int arg1, int arg2, int arg3, IList<IntervalSet> sets)
        {
            ATNState target = atn.states[trg];
            switch (type)
            {
                case TransitionType.EPSILON:
                {
                    return new EpsilonTransition(target);
                }

                case TransitionType.RANGE:
                {
                    if (arg3 != 0)
                    {
                        return new RangeTransition(target, TokenConstants.EOF, arg2);
                    }
                    else
                    {
                        return new RangeTransition(target, arg1, arg2);
                    }
                }

                case TransitionType.RULE:
                {
                    RuleTransition rt = new RuleTransition((RuleStartState)atn.states[arg1], arg2, arg3, target);
                    return rt;
                }

                case TransitionType.PREDICATE:
                {
                    PredicateTransition pt = new PredicateTransition(target, arg1, arg2, arg3 != 0);
                    return pt;
                }

                case TransitionType.PRECEDENCE:
                {
                    return new PrecedencePredicateTransition(target, arg1);
                }

                case TransitionType.ATOM:
                {
                    if (arg3 != 0)
                    {
                        return new AtomTransition(target, TokenConstants.EOF);
                    }
                    else
                    {
                        return new AtomTransition(target, arg1);
                    }
                }

                case TransitionType.ACTION:
                {
                    ActionTransition a = new ActionTransition(target, arg1, arg2, arg3 != 0);
                    return a;
                }

                case TransitionType.SET:
                {
                    return new SetTransition(target, sets[arg1]);
                }

                case TransitionType.NOT_SET:
                {
                    return new NotSetTransition(target, sets[arg1]);
                }

                case TransitionType.WILDCARD:
                {
                    return new WildcardTransition(target);
                }
            }
            throw new ArgumentException("The specified transition type is not valid.");
        }
Esempio n. 41
0
 IEnumerator SquishWipe(Camera cam1, Camera cam2, float time, TransitionType transitionType)
 {
     yield return(SquishWipe(cam1, cam2, time, transitionType, null));
 }
Esempio n. 42
0
 /// <summary>
 /// Sets the tween transition type.
 /// </summary>
 /// <param name="o">The o.</param>
 /// <param name="value">The value.</param>
 public static void SetTransitionType(DependencyObject o, TransitionType value)
 {
     o.SetValue(TransitionTypeProperty, value);
 }
Esempio n. 43
0
 /// <summary>
 /// SceneTransition
 /// </summary>
 /// <param name="_sceneName">Scene name.</param>
 /// <param name="_transitionTime">Transition time.</param>
 /// <param name="_transitionType">Transition type.</param>
 /// <param name="_transitionColor">Transition color.</param>
 public void LoadLevel(string _sceneName, float _transitionTime, TransitionType _transitionType, Color _transitionColor)
 {
     Init();
     StartCoroutine(SceneChange(_sceneName, _transitionTime, _transitionType, _transitionColor));
 }
Esempio n. 44
0
        /// <summary>
        /// Checks if the player is at the edge and the screen should transition to another screen
        /// </summary>
        private void CheckTransitionBoundaries()
        {
            // If we're trying to move in a direction but there's no level there, we need to stop
            if (player.Position.X + SettingsManager.PLAYER_WIDTH >= SettingsManager.GAME_WIDTH
                && !LevelManager.Instance.CanMoveRight())
            {
                player.moveTo( SettingsManager.GAME_WIDTH - SettingsManager.PLAYER_WIDTH );
                return;
            }
            else if (player.Position.X < 0
                     && !LevelManager.Instance.CanMoveLeft())
            {
                player.moveTo( 0 );
                return;
            }

            // if player moves outside the right boundary
            if (player.Position.X > SettingsManager.GAME_WIDTH)
            {
                SoundManager.StopFootsteps();
                // is it final room?
                if (LevelManager.Instance.CurrentLevel.rightScreenName == "final_room")
                {
                    // let player go through whole
                    if (StateManager.Instance.GetState("progress") >= 95)
                    {
                        StateManager.Instance.SetState("progress", 100);
                        StateManager.Instance.AdvanceDay();
                        LoadingScreen.Load(ScreenManager, true,
                            new TextOnBlackScreen("Congratulations!", "You solved all puzzles and brought color back to the game world.",
                                new GameScreen[] { new AutoTransitionFinalScreen() }, true, 4000));

                    }
                    else
                    {
                        // start a new day
                        StateManager.Instance.AdvanceDay();
                        LoadingScreen.Load(ScreenManager, false, new PlayScreen());
                    }

                }
                else
                {
                    if (LevelManager.Instance.CurrentLevel.name == "kitchen")
                        StateManager.Instance.SetState("just_went_out", 100);

                    // transition to the right
                    LevelManager.Instance.MoveRight();
                    LoadingScreen.Load(ScreenManager, false, new PlayScreen());
                }
                transition = TransitionType.Room;
            }
            // if player moves outside left boundary
            else if (player.Position.X < -SettingsManager.PLAYER_WIDTH)
            {
                SoundManager.StopFootsteps();
                // transition to the left
                LevelManager.Instance.MoveLeft();
                LoadingScreen.Load(ScreenManager, false, new PlayScreen());
                transition = TransitionType.Room;
            }
        }
Esempio n. 45
0
 /// <summary>
 /// Creates a tween animation with a default number of frames per second..
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="from">From.</param>
 /// <param name="to">To.</param>
 /// <param name="duration">The duration.</param>
 /// <returns></returns>
 public static DoubleAnimationUsingKeyFrames CreateAnimation(TransitionType type, double from, double to, TimeSpan duration)
 {
     return(CreateAnimation(type, from, to, duration, DefaultFps));
 }
Esempio n. 46
0
 protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler)
 {
     Start(control, transitionType, duration, actionHandler, null);
 }
Esempio n. 47
0
 /// <summary>
 /// Sets the tween transition type.
 /// </summary>
 /// <param name="o">The o.</param>
 /// <param name="value">The value.</param>
 public static void SetTransitionType(DependencyObject o, TransitionType value)
 {
     o.SetValue(TransitionTypeProperty, value);
 }
        private void UpdateTransitionType()
        {
            var transitionNavigationPage = (TransitionNavigationPage)Element;

            _transitionType = transitionNavigationPage.TransitionType;
        }
Esempio n. 49
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(Managers.InputManager input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            KeyboardState keyboardState = input.CurrentKeyboardState;
            GamePadState gamePadState = input.CurrentGamePadState;

            // The game pauses either if the user presses the pause button, or if
            // they unplug the active gamepad. This requires us to keep track of
            // whether a gamepad was ever plugged in, because we don't want to pause
            // on PC if they are playing with a keyboard and have no gamepad at all!
            bool gamePadDisconnected = !gamePadState.IsConnected &&
                                       input.GamePadWasConnected;

            if (input.IsPauseGame() || gamePadDisconnected)
            {
                ScreenManager.AddScreen(new PauseScreen());
            }
            else if (this.IsActive && player.IsReady && this.TransitionPosition == 0)
            {
                #region Tutorial Popups
                // grey
                if (StateManager.Instance.GetState("tutorial_grey") < 100 && StateManager.Instance.GetState(StateManager.STATE_PLAYERSTATUS) == 50)
                {
                    StateManager.Instance.SetState("tutorial_grey", 100);
                    ShowTutorial("Oh no! When you do not take care of the environment\nin your house, you become grey. You lose the ability to\ntime travel until you solve a problem in your house the next\nday.");
                }
                // square
                else if (StateManager.Instance.GetState("tutorial_square") < 100 && StateManager.Instance.GetState(StateManager.STATE_PLAYERSTATUS) == 0)
                {
                    StateManager.Instance.SetState("tutorial_square", 100);
                    ShowTutorial("You are a square head! You are not caring about\nthe environment. You'll have a hard time convincing other people\nnow. Press D to start a new day and improve yourself.");
                }
                #endregion

                // check for action button, only if player is over interactive object, and if player is either dropping an object or has no object in hand
                if (interactingObject != null)
                {
                    #region Action Button
                    if (input.IsMenuSelect()
                        && (StateManager.Instance.GetState(StateManager.STATE_PLAYERSTATUS) > 0 || LevelManager.Instance.CurrentLevel.name.Equals("bedroom") || LevelManager.Instance.CurrentLevel.name.Equals("kitchen"))
                        && (StateManager.Instance.GetState("progress") != 100 || (interactingObject.interaction.callback == "news" && StateManager.Instance.GetState("progress") == 100)))
                    {
                        // play sound if available
                        if (interactingObject.interaction.sound != null)
                            SoundManager.PlaySound(interactingObject.interaction.sound.name, interactingObject.interaction.sound.looping);

                        if (interactingObject.interaction.thought != null)
                            player.Thought = interactingObject.interaction.thought;

                        // Handling callbacks (aka special interactions)
                        if (!String.IsNullOrEmpty(interactingObject.interaction.callback))
                        {
                            switch (interactingObject.interaction.callback)
                            {
                                case "news":
                                    StateManager.Instance.tutorialNewsSeen = true;
                                    StateManager.Instance.SetState("tutorial_computer", 100);   // do not show computer tutorial if already interacted with
                                    ScreenManager.AddScreen(new ComputerScreen());
                                    break;
                                case "map":
                                    ScreenManager.AddScreen(new MapScreen());
                                    break;
                            }
                        }

                        // Handling talking
                        if ( interactingObject.interaction.chat != null && pickedObject == null)
                        {
                            // flip NPC to face player
                            if ( interactingObject.sprite != null)
                                interactingObject.sprite.flipped = interactingObject.sprite.flippable && (interactingObject.sprite.position.X < player.Position.X);

                            player.Thought = null;
                            ScreenManager.AddScreen(new ChatScreen(interactingObject.interaction.chat, true, interactingObject.interaction.mouth, interactingObject.interaction.startChatIndex));
                        }

                        // Pick up the object
                        if (pickedObject == null && !String.IsNullOrEmpty(interactingObject.interaction.pickUpName))
                        {
                            SoundManager.PlaySound(SoundManager.SOUND_PICK);
                            PickupObject(interactingObject);
                        }

                        // This prevents the player from picking up more than one object at a time
                        if (pickedObject == null || String.IsNullOrEmpty(interactingObject.interaction.pickUpName))
                        {
                            // Handling affected states
                            if (interactingObject.interaction.affectedStates != null)
                            {
                                StateManager.Instance.ModifyStates(interactingObject.interaction.affectedStates);
                                LoadGameObjects();
                            }
                        }

                        // Drop the picked up item into this object
                        if (pickedObject != null && interactingObject.interaction.dropper != null) {
                            if (interactingObject.interaction.sound == null)
                                SoundManager.PlaySound(SoundManager.SOUND_DROP);
                            else
                                SoundManager.PlaySound(interactingObject.interaction.sound.name, interactingObject.interaction.sound.looping);
                            DropObject(interactingObject);
                            LoadGameObjects();
                        }
                    }
                    #endregion

                    #region Time Warp Button
                    else if (input.IsReverseTime() && StateManager.Instance.CanTimeTravel())
                    {
                        // transition into past; an extra condition is added below to check if the interacting object can be picked up, then it is not picked up currently (prevents going to the past with garbage bag picked up)
                        if (!String.IsNullOrEmpty(interactingObject.interaction.transition) && !( !String.IsNullOrEmpty(interactingObject.interaction.pickUpName) && StateManager.Instance.GetState("item_picked") == 100 ) )
                        {
                            LevelManager.Instance.MovePast(interactingObject.interaction.transition);
                            LoadingScreen.Load(ScreenManager, false, new PlayScreen(TransitionType.FromPresent));
                            this.transition = TransitionType.ToPast;
                            ScreenManager.timeTravelInterval = 0f;
                            TransitionOffTime = TimeSpan.FromSeconds(2.0f);
                        }
                    }
                    #endregion
                }

                // TEST CODE: D key advances the day
                #region Advance Day
                if (keyboardState.IsKeyDown(Keys.D))
                {
                    if (StateManager.Instance.IsInPast())
                    {
                        StateManager.Instance.SetState(StateManager.STATE_BACKTOPRESENT, 100);
                    }
                    else
                    {
                        StateManager.Instance.AdvanceDay();
                        LoadingScreen.Load(ScreenManager, false, new PlayScreen());
                    }
                }
                #endregion

                // Check movement keys and move the player
                #region Movement
                float movement = 0.0f;

                if (keyboardState.IsKeyDown(Keys.Left))     --movement;
                if (keyboardState.IsKeyDown(Keys.Right))    ++movement;

                if (movement == 0.0f)
                    SoundManager.StopFootsteps();
                else
                    SoundManager.PlayFootsteps();

                // Checking gamepad controls only if we have one
                if (input.GamePadWasConnected) {
                    movement += gamePadState.ThumbSticks.Left.X;
                    if (movement != 0)
                        movement /= Math.Abs(movement);
                }

                /*
                // uncomment this if you wanna be shufflin'
                if (keyboardState.IsKeyDown(Keys.Space))
                    movement = 0;

                player.move( movement * -2 );
                */

                // Update movement if we have any
                if (movement != 0.0f) {
                    player.move(movement * 6);
                    player.walk();
                }
                else /* if ( !keyboardState.IsKeyDown(Keys.Space) )  // more shufflin' */
                    player.idle();
                #endregion
            }
            else
            {
                player.Sprite.Play( FrameSet.IDLE );
            }
        }
Esempio n. 50
0
 public void SetTransitionType(TransitionType e)
 {
     m_eTransType = e;
 }
Esempio n. 51
0
 /// <summary>
 /// Creates a tween animation.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="from">From.</param>
 /// <param name="to">To.</param>
 /// <param name="duration">The duration.</param>
 /// <param name="fps">The number of keyframes to generate per second.</param>
 /// <returns></returns>
 public static DoubleAnimationUsingKeyFrames CreateAnimation(TransitionType type, double from, double to, TimeSpan duration, double fps)
 {
     DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames();
     FillAnimation(animation, type, from, to, duration, fps);
     return animation;
 }
Esempio n. 52
0
 protected abstract IEnumerable <object> DoLevelTransition(TransitionType transitionType, LevelData newLevel, Submarine leavingSub, bool mirror, List <TraitorMissionResult> traitorResults = null);
Esempio n. 53
0
 // Token: 0x0600000F RID: 15 RVA: 0x0000219E File Offset: 0x0000039E
 protected void Start(Control control, TransitionType transitionType, int duration, AnimationAction actionHandler)
 {
     this.Start(control, transitionType, duration, actionHandler, null);
 }
Esempio n. 54
0
        protected internal virtual Transition EdgeFactory(ATN atn, TransitionType type, int src, int trg, int arg1, int arg2, int arg3, IList <IntervalSet> sets)
        {
            ATNState target = atn.states[trg];

            switch (type)
            {
            case TransitionType.EPSILON:
            {
                return(new EpsilonTransition(target));
            }

            case TransitionType.RANGE:
            {
                if (arg3 != 0)
                {
                    return(new RangeTransition(target, TokenConstants.EOF, arg2));
                }
                else
                {
                    return(new RangeTransition(target, arg1, arg2));
                }
            }

            case TransitionType.RULE:
            {
                RuleTransition rt = new RuleTransition((RuleStartState)atn.states[arg1], arg2, arg3, target);
                return(rt);
            }

            case TransitionType.PREDICATE:
            {
                PredicateTransition pt = new PredicateTransition(target, arg1, arg2, arg3 != 0);
                return(pt);
            }

            case TransitionType.PRECEDENCE:
            {
                return(new PrecedencePredicateTransition(target, arg1));
            }

            case TransitionType.ATOM:
            {
                if (arg3 != 0)
                {
                    return(new AtomTransition(target, TokenConstants.EOF));
                }
                else
                {
                    return(new AtomTransition(target, arg1));
                }
            }

            case TransitionType.ACTION:
            {
                ActionTransition a = new ActionTransition(target, arg1, arg2, arg3 != 0);
                return(a);
            }

            case TransitionType.SET:
            {
                return(new SetTransition(target, sets[arg1]));
            }

            case TransitionType.NOT_SET:
            {
                return(new NotSetTransition(target, sets[arg1]));
            }

            case TransitionType.WILDCARD:
            {
                return(new WildcardTransition(target));
            }
            }
            throw new ArgumentException("The specified transition type is not valid.");
        }
Esempio n. 55
0
 /// <summary>
 /// Checks to see if the screen should transition to the present
 /// </summary>
 private void CheckPastPresentState()
 {
     if ( StateManager.Instance.IsInPast() && StateManager.Instance.ShouldReturnToPresent() && LevelManager.Instance.LastPresentLevel != null)
     {
         LevelManager.Instance.MovePresent();
         LoadingScreen.Load(ScreenManager, false, new PlayScreen(TransitionType.FromPast));
         this.transition = TransitionType.ToPresent;
         ScreenManager.timeTravelInterval = 0f;
         TransitionOffTime = TimeSpan.FromSeconds(2.0f);
     }
     else if (StateManager.Instance.ShouldAdvanceDay())
     {
         StateManager.Instance.AdvanceDay();
         LoadingScreen.Load(ScreenManager, false, new PlayScreen());
     }
 }
Esempio n. 56
0
        protected internal virtual void ReadEdges(ATN atn, IList <IntervalSet> sets)
        {
            //
            // EDGES
            //
            int nedges = ReadInt();

            for (int i_9 = 0; i_9 < nedges; i_9++)
            {
                int            src      = ReadInt();
                int            trg      = ReadInt();
                TransitionType ttype    = (TransitionType)ReadInt();
                int            arg1     = ReadInt();
                int            arg2     = ReadInt();
                int            arg3     = ReadInt();
                Transition     trans    = EdgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
                ATNState       srcState = atn.states[src];
                srcState.AddTransition(trans);
            }
            // edges for rule stop states can be derived, so they aren't serialized
            foreach (ATNState state_1 in atn.states)
            {
                for (int i_10 = 0; i_10 < state_1.NumberOfTransitions; i_10++)
                {
                    Transition t = state_1.Transition(i_10);
                    if (!(t is RuleTransition))
                    {
                        continue;
                    }
                    RuleTransition ruleTransition            = (RuleTransition)t;
                    int            outermostPrecedenceReturn = -1;
                    if (atn.ruleToStartState[ruleTransition.target.ruleIndex].isPrecedenceRule)
                    {
                        if (ruleTransition.precedence == 0)
                        {
                            outermostPrecedenceReturn = ruleTransition.target.ruleIndex;
                        }
                    }
                    EpsilonTransition returnTransition = new EpsilonTransition(ruleTransition.followState, outermostPrecedenceReturn);
                    atn.ruleToStopState[ruleTransition.target.ruleIndex].AddTransition(returnTransition);
                }
            }
            foreach (ATNState state_2 in atn.states)
            {
                if (state_2 is BlockStartState)
                {
                    // we need to know the end state to set its start state
                    if (((BlockStartState)state_2).endState == null)
                    {
                        throw new InvalidOperationException();
                    }
                    // block end states can only be associated to a single block start state
                    if (((BlockStartState)state_2).endState.startState != null)
                    {
                        throw new InvalidOperationException();
                    }
                    ((BlockStartState)state_2).endState.startState = (BlockStartState)state_2;
                }
                else if (state_2 is PlusLoopbackState)
                {
                    PlusLoopbackState loopbackState = (PlusLoopbackState)state_2;
                    for (int i_10 = 0; i_10 < loopbackState.NumberOfTransitions; i_10++)
                    {
                        ATNState target = loopbackState.Transition(i_10).target;
                        if (target is PlusBlockStartState)
                        {
                            ((PlusBlockStartState)target).loopBackState = loopbackState;
                        }
                    }
                }
                else if (state_2 is StarLoopbackState)
                {
                    StarLoopbackState loopbackState = (StarLoopbackState)state_2;
                    for (int i_10 = 0; i_10 < loopbackState.NumberOfTransitions; i_10++)
                    {
                        ATNState target = loopbackState.Transition(i_10).target;
                        if (target is StarLoopEntryState)
                        {
                            ((StarLoopEntryState)target).loopBackState = loopbackState;
                        }
                    }
                }
            }
        }
Esempio n. 57
0
        /// <summary>
        /// Constructor
        /// </summary>
        public PlayScreen(TransitionType transitionFrom = TransitionType.Room)
        {
            // Handle the different transition values
            transition = transitionFrom;
            switch (transition)
            {
                case TransitionType.Room:
                    TransitionOnTime = TimeSpan.FromSeconds(0.5);
                    break;

                case TransitionType.FromPast:
                    StateManager.Instance.GoToPast();
                    TransitionOnTime = TimeSpan.FromSeconds(0.5);
                    break;
                case TransitionType.FromPresent:
                    TransitionOnTime = TimeSpan.FromSeconds(0.5);
                    break;

                case TransitionType.ToPast:
                case TransitionType.ToPresent:
                    TransitionOnTime = TimeSpan.FromSeconds(2.0);
                    break;
            }
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            player = LevelManager.Instance.Player;

            // play game music
            SoundManager.PlayMusic();
        }
Esempio n. 58
0
        private void UpdateTransitionType()
        {
            var transitionNavigationPage = (TransitionNavigationPage.Views.LoginPage.SupportFiles.TransitionNavigationPage)Element;

            _transitionType = transitionNavigationPage.TransitionType;
        }
 /// <summary>
 /// NavigationEntry
 /// </summary>
 /// <param name="completionTime">completionTime</param>
 /// <param name="displayUrl">displayUrl</param>
 /// <param name="httpStatusCode">httpStatusCode</param>
 /// <param name="originalUrl">originalUrl</param>
 /// <param name="title">title</param>
 /// <param name="transitionType">transitionType</param>
 /// <param name="url">url</param>
 /// <param name="hasPostData">hasPostData</param>
 /// <param name="isValid">isValid</param>
 /// <param name="isCurrent">is the current entry</param>
 /// <param name="sslStatus">the ssl status</param>
 public NavigationEntry(bool isCurrent, DateTime completionTime, string displayUrl, int httpStatusCode, string originalUrl, string title, TransitionType transitionType, string url, bool hasPostData, bool isValid, SslStatus sslStatus)
 {
     IsCurrent      = isCurrent;
     CompletionTime = completionTime;
     DisplayUrl     = displayUrl;
     HttpStatusCode = httpStatusCode;
     OriginalUrl    = originalUrl;
     Title          = title;
     TransitionType = transitionType;
     Url            = url;
     HasPostData    = hasPostData;
     IsValid        = isValid;
     SslStatus      = sslStatus;
 }
Esempio n. 60
0
        private void UpdateTransitionType()
        {
            var transitionNavigationPage = (PrismLearning.Controls.TransitionNavigationPage)Element;

            _transitionType = transitionNavigationPage.TransitionType;
        }