Example #1
0
        public Button(string caption, bool hideCaption, Vector2 relativeCenterPosition)
        {
            ParentPosition = Vector2.Zero;

            _caption = caption;
            _translatedCaption = "";
            _hideCaption = hideCaption;
            _relativeCenterPosition = relativeCenterPosition;
            _currentState = State.Inactive;

            IconBackgroundTint = Color.Blue;
            Icon = Button.ButtonIcon.None;
            _scale = Default_Scale;

            _highlightTimer = new Timer("button-fade-timer", HandleTimerCompletion);
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_highlightTimer.Tick);

            _highlightTextureName = hideCaption ? No_Caption_Highlight_Texture_Name : Highlight_Texture_Name;

            CalculateRenderAndSelectionMetrics();

            CaptionOfButtonActivatedByMovingUp = "";
            CaptionOfButtonActivatedByMovingDown = "";
            CaptionOfButtonActivatedByMovingLeft = "";
            CaptionOfButtonActivatedByMovingRight = "";

            Disabled = false;
        }
Example #2
0
        public Scene(int bufferWidth, int bufferHeight)
            : base(GameBase.Instance)
        {
            DeactivationHandler = null;
            DoNotUseBackBuffer = true;

            _spriteBatch = null;
            _renderController = new RenderController();

            _status = Status.Inactive;
            _transitionTimer = new Timer("scene.transitiontimer", HandleTransitionCompletion);

            _nextSceneType = null;

            _backBuffer = null;
            _bufferDimensions = new Point(bufferWidth, bufferHeight);
            _clearColour = Color.Black;
            _bufferTint = Color.Transparent;
            _crossfadeDuration = Default_Crossfade_Duration;
            CrossFadeTextureName = "";

            _gameObjects = new List<IGameObject>();
            _temporaryObjects = new List<ITemporary>();

            GameBase.Instance.Components.Add(this);
            Enabled = false;
            Visible = false;

            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_transitionTimer.Tick);
        }
        public BombBlock()
            : base()
        {
            _actionTimer = null;

            BlastCollider = new BombBlockBlastCollider();
        }
Example #4
0
        public Emitter()
        {
            EmissionPointOffsets = new List<Vector2>();
            Tints = new List<Color>();
            RenderDepth = 0.5f;

            TickCallback = null;
            ParticleRegistrationCallback = null;

            WorldPositionIsFixed = true;

            _fadePoints = null;
            _sortedFadePoints = new List<Vector2>();

            _burstTimer = null;
            _burstCount = 1;
            _particlesPerBurst = 0;
            _burstIntervalInMilliseconds = 0;
            _timerRegistered = false;

            Direction = 0.0f;
            Spread = MathHelper.Pi;

            _lifespanRange = Range.Empty;

            _gravity = Vector2.Zero;
            _gravityAccelerator = 1.0f;

            SetSpeedMetrics(Range.Empty, Range.One, Range.One);
            SetSpinMetrics(new Range(0.0f, 360.0f), Range.Empty, Range.One);
            SetScaleMetrics(Range.One, Range.One, Range.One);
        }
        public StorePurchaseDialog(Scene.ObjectRegistrationHandler registrationHandler, Scene.ObjectUnregistrationHandler unregistrationHandler)
            : base(registrationHandler, unregistrationHandler)
        {
            Height = Purchase_Dialog_Height;
            TopYWhenActive = Definitions.Back_Buffer_Height - (Purchase_Dialog_Height + Bopscotch.Scenes.NonGame.StoreScene.Dialog_Margin);
            CarouselCenter = new Vector2(Definitions.Back_Buffer_Center.X, Carousel_Center_Y);
            CarouselRadii = new Vector2(Carousel_Horizontal_Radius, Carousel_Vertical_Radius);
            _itemRenderDepths = new Range(Minimum_Item_Render_Depth, Maximum_Item_Render_Depth);
            _itemScales = new Range(Minimum_Item_Scale, Maximum_Item_Scale);

            AddIconButton("previous", new Vector2(Definitions.Back_Buffer_Center.X - 450, 175), Button.ButtonIcon.Previous, Color.DodgerBlue);
            AddIconButton("next", new Vector2(Definitions.Back_Buffer_Center.X + 450, 175), Button.ButtonIcon.Next, Color.DodgerBlue);

            AddButton("Back", new Vector2(Definitions.Left_Button_Column_X, 400), Button.ButtonIcon.Back, Color.DodgerBlue, 0.7f);
            AddButton("Buy", new Vector2(Definitions.Right_Button_Column_X, 400), Button.ButtonIcon.Tick, Color.Orange, 0.7f);

            _nonSpinButtonCaptions.Add("Buy");

            ActionButtonPressHandler = HandleActionButtonPress;
            TopYWhenInactive = Definitions.Back_Buffer_Height;

            SetupButtonLinkagesAndDefaultValues();

            registrationHandler(this);

            _textTransitionTimer = new Timer("");
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_textTransitionTimer.Tick);
            _textTransitionTimer.NextActionDuration = 1;
            _textTint = Color.White;

            _font = Game1.Instance.Content.Load<SpriteFont>("Fonts\\arial");
        }
Example #6
0
        public Blackout()
            : base()
        {
            _renderDepth = Render_Depth;
            _timer = new Timer("blackout-timer", HandleTimerActionComplete);

            CalculateBackgroundTargetArea();
            Reset();
        }
Example #7
0
        public Blackout()
            : base()
        {
            _renderDepth = Render_Depth;
            _timer = new Timer("blackout-timer", HandleTimerActionComplete);

            TextureReference = Texture_Reference;
            RenderLayer = Render_Layer;

            Reset();
        }
 public RaceModePowerUpSmashBlock()
     : base()
 {
     _regenerationTimer = null;
     RegenerationParticleEffect = null;
     _powerUpTextureNames = new List<string>();
     foreach (KeyValuePair<string, Texture2D> kvp in TextureManager.Textures)
     {
         if (kvp.Key.StartsWith("power")) { _powerUpTextureNames.Add(kvp.Key); }
     }
 }
        public RaceProgressCoordinator()
            : base()
        {
            _sequenceTimer = new Timer("sequence-timer", HandleTimedSequenceCompletion);
            _activated = false;

            _lastLapStartTime = 0;
            _ownCheckpointTimes = new Dictionary<string, int>();
            _opponentCheckpointTimes = new Dictionary<string, int>();

            LapsToComplete = 0;
        }
        public RankingScene()
            : base()
        {
            _selectedArea = "Hilltops";
            _faderTimer = new Timer("", CompleteFadeTransition);

            Overlay.Tint = Color.Black;
            Overlay.TintFraction = 0.0f;
            Overlay.RenderLayer = 4;
            Overlay.RenderDepth = 0.99999f;

            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_faderTimer.Tick);
        }
        public SmashBlockItem()
            : base()
        {
            RenderLayer = Render_Layer;
            RenderDepth = Render_Depth;

            Visible = true;
            ReadyForDisposal = false;

            _motionEngine = new SmashBlockItemMotionEngine();

            _lifeTimer = new Timer("", HandleLifeTimeComplete);
            _lifeTimer.NextActionDuration = Random.Generator.Next(Minimum_Duration_In_Milliseconds, Maximum_Duration_In_Milliseconds);
        }
        public SurvivalAreaCompleteScene()
            : base()
        {
            _animationController = new AnimationController();

            _textFadeTimer = new Timer("");
            _textFadeTimer.ActionCompletionHandler = HandleTimerActionComplete;
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_textFadeTimer.Tick);

            _congratulationsPopup = new Effects.Popups.PopupRequiringDismissal();
            _congratulationsPopup.DisplayPosition = new Vector2(Definitions.Back_Buffer_Center.X, 150.0f);
            _congratulationsPopup.AnimationCompletionHandler = HandlePopupAnimationComplete;

            _contentFactory = new SurvivalAreaCompleteContentFactory(RegisterGameObject);
        }
        public PlayerMotionEngine()
        {
            ID = "player-motion-engine";

            _horizontalMovementDirection = 0;
            _verticalMovementDirection = 0;
            _delta = Vector2.Zero;

            _fixedSpeedTimer = new Timer("fix-speed-timer");
            _forceMaximumSpeed = false;
            _speedChangeLockoutTimer = new Timer("input-lock-timer");

            InputProcessor = null;

            DifficultySpeedBoosterUnit = 0;
        }
        public RaceOpponentListDialog(float displayLeftLimit, float totalDisplayWidth)
            : base()
        {
            Height = Dialog_Height;
            TopYWhenActive = Top_Y_When_Active;

            _displayLeftLimit = displayLeftLimit;
            _totalDisplayWidth = totalDisplayWidth;

            _opponents = new Dictionary<string, OpponentSelector>();

            _defaultButtonCaption = "";

            _timer = new Timer("", HandleTimerExpiration);
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_timer.Tick);
        }
        public AreaSelectionCarouselDialog(Scene.ObjectRegistrationHandler registrationHandler, Scene.ObjectUnregistrationHandler unregistrationHandler)
            : base(registrationHandler, unregistrationHandler)
        {
            RotationSpeedInDegrees = Rotation_Speed_In_Degrees;
            _itemRenderDepths = new Range(Minimum_Item_Render_Depth, Maximum_Item_Render_Depth);
            _itemScales = new Range(Minimum_Item_Scale, Maximum_Item_Scale);

            CreateButtons();

            ActionButtonPressHandler = HandleNonSpinButtonAction;

            _textTransitionTimer = new Timer("");
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_textTransitionTimer.Tick);
            _textTransitionTimer.NextActionDuration = 1;

            _textTint = Color.White;
        }
        public ResultsDialog(Scene.ObjectRegistrationHandler objectRegistrationHandler)
            : base()
        {
            _registerObject = objectRegistrationHandler;

            _boxCaption = Translator.Translation("Race Results");

            Height = Dialog_Height;
            TopYWhenActive = Top_Y_When_Active;

            AddButton("Exit", new Vector2(Definitions.Left_Button_Column_X, 625), Button.ButtonIcon.Play, Color.Red, 0.7f);

            _defaultButtonCaption = "Exit";
            _cancelButtonCaption = "Exit";

            _resultsAnnouncementTimer = new Timer("", AnnounceResults);
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_resultsAnnouncementTimer.Tick);
        }
        public RaceGameplayScene()
            : base("race-gameplay")
        {
            StatusDisplay = new RaceDataDisplay();

            _countdownPopup = new CountdownPopup();
            _quitRaceButton = new QuitRaceButton();
            _powerUpButton = new PowerUpButton();
            _playerEventPopup.AnimationCompletionHandler = HandlePlayerEventAnimationComplete;

            _powerUpDisplayTimer = new PowerUpTimer();
            _powerUpDisplayTimer.TickCallback = _timerController.RegisterUpdateCallback;
            _powerUpHelper = new PowerUpHelper();
            _blackout = new Blackout();
            _blackout.TickCallback = _timerController.RegisterUpdateCallback;

            _positionStatusPopup = new RaceInfoPopup();
            _raceEventPopup = new RaceInfoPopup();
            _waitingMessage = new WaitingMessage();

            _exitTimer = new Timer("", HandleExitTimerActionComplete);
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_exitTimer.Tick);

            _startSequenceTimer = new Timer("", HandleStartCountdownStep);
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_startSequenceTimer.Tick);

            _quitTimer = new Timer("", HandleQuitTimerActionComplete);
            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_quitTimer.Tick);

            _quitRaceDialog = new QuitRaceDialog();
            _quitRaceDialog.CancellationTimer = _quitTimer;
            _quitRaceDialog.InputSources.Add(_inputProcessor);

            _disconnectedDialog = new DisconnectedDialog();
            _disconnectedDialog.SelectionCallback = HandleDisconnectAcknowledge;
            _disconnectedDialog.InputSources.Add(_inputProcessor);
        }
Example #18
0
        public Scene()
            : base(GameBase.Instance)
        {
            DeactivationHandler = null;

            SpriteBatch = null;
            Renderer = new RenderController();
            CurrentState = Status.Inactive;
            ClearColour = Color.Black;
            CrossfadeDuration = Default_Crossfade_Duration;
            CrossFadeTextureName = "";

            _transitionTimer = new Timer("scene.transitiontimer", HandleTransitionCompletion);
            _nextSceneType = null;

            _gameObjects = new List<IGameObject>();
            _temporaryObjects = new List<ITemporary>();

            GameBase.Instance.Components.Add(this);
            Enabled = false;
            Visible = false;

            GlobalTimerController.GlobalTimer.RegisterUpdateCallback(_transitionTimer.Tick);
        }
        public void Deserialize(XElement serializedData)
        {
            Serializer serializer = new Serializer(serializedData);
            serializer.KnownSerializedObjects.Add(_speedChangeLockoutTimer);

            Speed = serializer.GetDataItem<float>("speed");
            _gravity = serializer.GetDataItem<float>("gravity");
            _verticalVelocity = serializer.GetDataItem<float>("vertical-velocity");
            _horizontalMovementDirection = serializer.GetDataItem<int>("horizontal-movement-direction");
            _verticalMovementDirection = serializer.GetDataItem<int>("vertical-movement-direction");
            _delta = serializer.GetDataItem<Vector2>("delta");
            _jumpTriggered = serializer.GetDataItem<bool>("jump-triggered");
            _jumpInProgress = serializer.GetDataItem<bool>("jump-in-progress");
            PlayerIsOnGround = serializer.GetDataItem<bool>("is-on-ground");
            CanMoveHorizontally = serializer.GetDataItem<bool>("can-move-horizontally");
            CanTriggerJump = serializer.GetDataItem<bool>("can-trigger-jump");
            VerticalMovementIsEnabled = serializer.GetDataItem<bool>("vertical-move-enabled");
            IsMovingLeft = serializer.GetDataItem<bool>("moving-left");
            _availableSpeedSteps = serializer.GetDataItem<Range>("speed-step-range");
            DifficultySpeedBoosterUnit = serializer.GetDataItem<int>("difficulty-booster");
            _speedChangeLockoutTimer = serializer.GetDataItem<Timer>("lockout-timer");
        }
Example #20
0
        public void SetBurstMetrics(int burstCount, int burstIntervalInMilliseconds, int particlesPerBurst)
        {
            if ((_burstTimer == null) && (burstCount != 1)) { _burstTimer = new Timer("bursttimer", CreateBurst); }

            _burstCount = burstCount;
            _particlesPerBurst = particlesPerBurst;
            _burstIntervalInMilliseconds = burstIntervalInMilliseconds;
        }