public override EffectLayer Render(IGameState state)
        {
            EffectLayer kills_indicator_layer = new EffectLayer("CSGO - Kills Indicator");

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                if (lastCountedKill != csgostate.Player.State.RoundKills)
                {
                    if (csgostate.Player.State.RoundKills == 0 ||
                        (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined) ||
                        (csgostate.Player.State.Health == 100 && ((csgostate.Previously.Player.State.Health > -1 && csgostate.Previously.Player.State.Health < 100) || (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined)) && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID))
                        )
                    {
                        roundKills.Clear();
                    }
                    if (csgostate.Previously.Player.State.RoundKills != -1 && csgostate.Player.State.RoundKills != -1 && csgostate.Previously.Player.State.RoundKills < csgostate.Player.State.RoundKills && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID))
                    {
                        if (csgostate.Previously.Player.State.RoundKillHS != -1 && csgostate.Player.State.RoundKillHS != -1 && csgostate.Previously.Player.State.RoundKillHS < csgostate.Player.State.RoundKillHS)
                        {
                            roundKills.Add(RoundKillType.Headshot);
                        }
                        else
                        {
                            roundKills.Add(RoundKillType.Regular);
                        }
                    }

                    lastCountedKill = csgostate.Player.State.RoundKills;
                }

                if (csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID))
                {
                    for (int pos = 0; pos < Properties.Sequence.keys.Count(); pos++)
                    {
                        if (pos < roundKills.Count)
                        {
                            switch (roundKills[pos])
                            {
                            case (RoundKillType.Regular):
                                kills_indicator_layer.Set(Properties.Sequence.keys[pos], Properties.RegularKillColor);
                                break;

                            case (RoundKillType.Headshot):
                                kills_indicator_layer.Set(Properties.Sequence.keys[pos], Properties.HeadshotKillColor);
                                break;
                            }
                        }
                    }
                }
            }

            return(kills_indicator_layer);
        }
        public override EffectLayer Render(IGameState state)
        {
            EffectLayer bg_layer = new EffectLayer("CSGO - Background");

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                if (csgostate.Player.State.Health == 100 && ((csgostate.Previously.Player.State.Health > -1 && csgostate.Previously.Player.State.Health < 100) || (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined)) && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID))
                {
                    isDimming = false;
                    dim_bg_at = Utils.Time.GetMillisecondsSinceEpoch() + (Application.Profile as CSGOProfile).bg_dim_after * 1000L;
                    dim_value = 1.0;
                }


                Color bg_color = this.Properties.DefaultColor;

                switch (csgostate.Player.Team)
                {
                case PlayerTeam.T:
                    bg_color = this.Properties.TColor;
                    break;

                case PlayerTeam.CT:
                    bg_color = this.Properties.CTColor;
                    break;

                default:
                    break;
                }

                if (csgostate.Player.Team == PlayerTeam.CT || csgostate.Player.Team == PlayerTeam.T)
                {
                    if (dim_bg_at <= Utils.Time.GetMillisecondsSinceEpoch() || csgostate.Player.State.Health == 0)
                    {
                        isDimming = true;
                        bg_color  = Utils.ColorUtils.MultiplyColorByScalar(bg_color, getDimmingValue());
                    }
                    else
                    {
                        isDimming = false;
                        dim_value = 1.0;
                    }
                }

                bg_layer.Fill(bg_color);
            }

            return(bg_layer);
        }
示例#3
0
        public override EffectLayer Render(IGameState state)
        {
            EffectLayer effectLayer = new EffectLayer("CSGO - Death Effect");

            if (state is GameState_CSGO)
            {
                GameState_CSGO gameState  = state as GameState_CSGO;
                Color          deathColor = this.Properties.DeathColor;

                // Confirm if CS:GO Player is correct
                if (gameState.Provider.SteamID.Equals(gameState.Player.SteamID))
                {
                    // Are they dead?
                    if (!isDead && gameState.Player.State.Health <= 0 && gameState.Previously.Player.State.Health > 0)
                    {
                        isDead = true;

                        fadeAlpha   = 255;
                        fadeStartAt = Utils.Time.GetMillisecondsSinceEpoch() + (long)(this.Properties.FadeOutAfter * 1000D);
                    }
                    else if (gameState.Player.State.Health > 0)
                    {
                        isDead = false;
                        return(effectLayer);
                    }

                    // If so...
                    if (isDead)
                    {
                        Global.logger.Info("IsDead");
                        if (fadeStartAt <= Utils.Time.GetMillisecondsSinceEpoch())
                        {
                            int fadeAlpha = getFadeAlpha();
                            Global.logger.Info(fadeAlpha);

                            deathColor = Color.FromArgb(fadeAlpha, deathColor.R, deathColor.G, deathColor.B);

                            if (fadeAlpha == 0)
                            {
                                isDead = false;
                            }
                        }

                        effectLayer.Fill(deathColor);
                    }
                }
            }

            return(effectLayer);
        }
示例#4
0
        public override EffectLayer Render(IGameState state)
        {
            EffectLayer typing_keys_layer = new EffectLayer("CSGO - Typing Keys");

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                //Update Typing Keys
                if (csgostate.Player.Activity == PlayerActivity.TextInput)
                {
                    typing_keys_layer.Set(Properties.Sequence, Properties.TypingKeysColor);
                }
            }

            return(typing_keys_layer);
        }
示例#5
0
        public override EffectLayer Render(IGameState state)
        {
            EffectLayer flashed_layer = new EffectLayer("CSGO - Flashed");

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                //Update Flashed
                if (csgostate.Player.State.Flashed > 0)
                {
                    Color flash_color = Color.FromArgb(csgostate.Player.State.Flashed, Properties.FlashbangColor);

                    flashed_layer.Fill(flash_color);
                }
            }

            return(flashed_layer);
        }
示例#6
0
        public override void UpdateLights(EffectFrame frame, IGameState new_game_state)
        {
            if (new_game_state is GameState_CSGO)
            {
                _game_state = new_game_state;

                GameState_CSGO gs = (new_game_state as GameState_CSGO);

                try
                {
                    UpdateLights(frame);
                }
                catch (Exception e)
                {
                    Global.logger.LogLine("Exception during OnNewGameState. Error: " + e, Logging_Level.Error);
                    Global.logger.LogLine(gs.ToString(), Logging_Level.None);
                }
            }
        }
示例#7
0
        public override EffectLayer Render(IGameState state)
        {
            previoustime = currenttime;
            currenttime  = Utils.Time.GetMillisecondsSinceEpoch();

            EffectLayer  effectLayer  = new EffectLayer("CSGO - Winning Team Effect");
            AnimationMix animationMix = new AnimationMix();

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                // Block animations after end of round
                if (csgostate.Map.Phase == MapPhase.Undefined || csgostate.Round.Phase != RoundPhase.Over)
                {
                    return(effectLayer);
                }

                Color color = Color.White;

                // Triggers directly after a team wins a round
                if (csgostate.Round.WinTeam != RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam == RoundWinTeam.Undefined)
                {
                    // Determine round or game winner
                    if (csgostate.Map.Phase == MapPhase.GameOver)
                    {
                        // End of match
                        int tScore  = csgostate.Map.TeamT.Score;
                        int ctScore = csgostate.Map.TeamCT.Score;

                        if (tScore > ctScore)
                        {
                            color = Properties.TColor;
                        }
                        else if (ctScore > tScore)
                        {
                            color = Properties.CTColor;
                        }
                    }
                    else
                    {
                        // End of round
                        if (csgostate.Round.WinTeam == RoundWinTeam.T)
                        {
                            color = Properties.TColor;
                        }
                        if (csgostate.Round.WinTeam == RoundWinTeam.CT)
                        {
                            color = Properties.CTColor;
                        }
                    }

                    this.SetTracks(color);
                    animationMix.Clear();
                    showAnimation = true;
                }

                if (showAnimation)
                {
                    animationMix = new AnimationMix(tracks);

                    effectLayer.Fill(color);
                    animationMix.Draw(effectLayer.GetGraphics(), winningTeamEffect_Keyframe);
                    winningTeamEffect_Keyframe += (currenttime - previoustime) / 1000.0f;

                    if (winningTeamEffect_Keyframe >= winningTeamEffect_AnimationTime)
                    {
                        showAnimation = false;
                        winningTeamEffect_Keyframe = 0;
                    }
                }
            }

            return(effectLayer);
        }
        public override EffectLayer Render(IGameState state)
        {
            EffectLayer bomb_effect_layer = new EffectLayer("CSGO - Bomb Effect");

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                if (csgostate.Round.Bomb == BombState.Planted)
                {
                    if (!bombtimer.IsRunning)
                    {
                        bombtimer.Restart();
                        bombflashcount = 0;
                        bombflashtime  = 0;
                        bombflashedat  = 0;
                    }

                    double bombflashamount = 1.0;
                    bool   isCritical      = false;


                    if (bombtimer.ElapsedMilliseconds < 38000)
                    {
                        if (bombtimer.ElapsedMilliseconds >= bombflashtime)
                        {
                            bombflash     = true;
                            bombflashedat = bombtimer.ElapsedMilliseconds;
                            bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ *13));
                        }

                        bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0);
                    }
                    else if (bombtimer.ElapsedMilliseconds >= 38000)
                    {
                        isCritical      = true;
                        bombflashamount = (double)bombtimer.ElapsedMilliseconds / 40000.0;
                    }
                    else if (bombtimer.ElapsedMilliseconds >= 45000)
                    {
                        bombtimer.Stop();
                        csgostate.Round.Bomb = BombState.Undefined;
                    }

                    if (!isCritical)
                    {
                        if (bombflashamount <= 0.05 && bombflash)
                        {
                            bombflash = false;
                        }

                        if (!bombflash)
                        {
                            bombflashamount = 0.0;
                        }
                    }

                    if (!Properties.GradualEffect)
                    {
                        bombflashamount = Math.Round(bombflashamount);
                    }

                    Color bombcolor = Properties.FlashColor;

                    if (isCritical)
                    {
                        bombcolor = Utils.ColorUtils.MultiplyColorByScalar(Properties.PrimedColor, Math.Min(bombflashamount, 1.0));
                    }
                    else
                    {
                        bombcolor = Utils.ColorUtils.MultiplyColorByScalar(Properties.FlashColor, Math.Min(bombflashamount, 1.0));
                    }

                    bomb_effect_layer.Set(Properties.Sequence, bombcolor);

                    if (Properties.PeripheralUse)
                    {
                        bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor);
                    }
                }
                else if (csgostate.Round.Bomb == BombState.Defused)
                {
                    bombtimer.Stop();
                    if (Properties.DisplayWinningTeamColor)
                    {
                        bomb_effect_layer.Set(Properties.Sequence, Properties.CTColor);

                        if (Properties.PeripheralUse)
                        {
                            bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, Properties.CTColor);
                        }
                    }
                }
                else if (csgostate.Round.Bomb == BombState.Exploded)
                {
                    bombtimer.Stop();
                    if (Properties.DisplayWinningTeamColor)
                    {
                        bomb_effect_layer.Set(Properties.Sequence, Properties.TColor);

                        if (Properties.PeripheralUse)
                        {
                            bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, Properties.TColor);
                        }
                    }
                }
                else
                {
                    bombtimer.Stop();
                }
            }

            return(bomb_effect_layer);
        }
示例#9
0
        public override void UpdateLights(EffectFrame frame, GameState new_game_state)
        {
            if (new_game_state is GameState_CSGO)
            {
                _game_state = new_game_state;

                GameState_CSGO gs = (new_game_state as GameState_CSGO);

                try
                {
                    if (!IsPlanted &&
                        gs.Round.Phase == RoundPhase.Live &&
                        gs.Round.Bomb == BombState.Planted &&
                        gs.Previously.Round.Bomb == BombState.Undefined)
                    {
                        IsPlanted = true;
                        SetBombState(BombState.Planted);
                    }
                    else if (IsPlanted && gs.Round.Phase == RoundPhase.FreezeTime)
                    {
                        IsPlanted = false;
                        SetBombState(BombState.Undefined);
                    }
                    else if (IsPlanted && gs.Round.Bomb == BombState.Defused)
                    {
                        SetBombState(BombState.Defused);
                    }
                    else if (IsPlanted && gs.Round.Bomb == BombState.Exploded)
                    {
                        SetBombState(BombState.Exploded);
                    }

                    SetTeam(gs.Player.Team);
                    SetHealth(gs.Player.State.Health);
                    SetFlashAmount(gs.Player.State.Flashed);
                    SetBurnAmount(gs.Player.State.Burning);
                    SetClip(gs.Player.Weapons.ActiveWeapon.AmmoClip);
                    SetClipMax(gs.Player.Weapons.ActiveWeapon.AmmoClipMax);
                    SetPlayerActivity(gs.Player.Activity);
                    SetIsLocalPlayer(gs.Provider.SteamID.Equals(gs.Player.SteamID));
                    if (gs.Round.WinTeam == RoundWinTeam.Undefined && gs.Previously.Round.WinTeam != RoundWinTeam.Undefined)
                    {
                        RoundStart();
                    }
                    if (gs.Previously.Player.State.RoundKills != -1 && gs.Player.State.RoundKills != -1 && gs.Previously.Player.State.RoundKills < gs.Player.State.RoundKills && gs.Provider.SteamID.Equals(gs.Player.SteamID))
                    {
                        GotAKill(gs.Previously.Player.State.RoundKillHS != -1 && gs.Player.State.RoundKillHS != -1 && gs.Previously.Player.State.RoundKillHS < gs.Player.State.RoundKillHS);
                    }
                    if (gs.Player.State.Health == 100 && ((gs.Previously.Player.State.Health > -1 && gs.Previously.Player.State.Health < 100) || (gs.Round.WinTeam == RoundWinTeam.Undefined && gs.Previously.Round.WinTeam != RoundWinTeam.Undefined)) && gs.Provider.SteamID.Equals(gs.Player.SteamID))
                    {
                        Respawned();
                    }

                    UpdateLights(frame);
                }
                catch (Exception e)
                {
                    Global.logger.LogLine("Exception during OnNewGameState. Error: " + e, Logging_Level.Error);
                    Global.logger.LogLine(gs.ToString(), Logging_Level.None);
                }
            }
        }
        public override EffectLayer Render(IGameState state)
        {
            EffectLayer burning_layer = new EffectLayer("CSGO - Burning");

            if (state is GameState_CSGO)
            {
                GameState_CSGO csgostate = state as GameState_CSGO;

                //Update Burning

                if (csgostate.Player.State.Burning > 0)
                {
                    double burning_percent = (double)csgostate.Player.State.Burning / 255.0;
                    Color  burncolor       = Properties.BurningColor;

                    if (Properties.Animated)
                    {
                        int  red_adjusted = (int)(burncolor.R + (Math.Cos((Utils.Time.GetMillisecondsSinceEpoch() + randomizer.Next(75)) / 75.0) * 0.15 * 255));
                        byte red          = 0;

                        if (red_adjusted > 255)
                        {
                            red = 255;
                        }
                        else if (red_adjusted < 0)
                        {
                            red = 0;
                        }
                        else
                        {
                            red = (byte)red_adjusted;
                        }

                        int  green_adjusted = (int)(burncolor.G + (Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() + randomizer.Next(150)) / 75.0) * 0.15 * 255));
                        byte green          = 0;

                        if (green_adjusted > 255)
                        {
                            green = 255;
                        }
                        else if (green_adjusted < 0)
                        {
                            green = 0;
                        }
                        else
                        {
                            green = (byte)green_adjusted;
                        }

                        int  blue_adjusted = (int)(burncolor.B + (Math.Cos((Utils.Time.GetMillisecondsSinceEpoch() + randomizer.Next(225)) / 75.0) * 0.15 * 255));
                        byte blue          = 0;

                        if (blue_adjusted > 255)
                        {
                            blue = 255;
                        }
                        else if (blue_adjusted < 0)
                        {
                            blue = 0;
                        }
                        else
                        {
                            blue = (byte)blue_adjusted;
                        }

                        burncolor = Color.FromArgb(csgostate.Player.State.Burning, red, green, blue);
                    }

                    burning_layer.Fill(burncolor);
                }
            }

            return(burning_layer);
        }
示例#11
0
 public override void ResetGameState()
 {
     _game_state = new GameState_CSGO();
 }