public override void Render() { if (base.Scene.OnInterval(5)) { this.flash = !this.flash; } if (this.pad.OwnerIndex != -1) { Subtexture subtexture = TFGame.Atlas ["chaliceBlood"]; int num = (int)MathHelper.Lerp(0f, (float)subtexture.Height, this.pad.FillPercent); if (num > 0) { Color color; if (base.Level.Session.MatchSettings.TeamMode) { TeamData teamData = ArcherData.Get(base.Level.Session.MatchSettings.Teams [this.pad.OwnerIndex]); color = (this.flash ? teamData.ColorB : teamData.ColorA); } else { ArcherData archerData = ArcherData.Get(TFGame.Characters [this.pad.OwnerIndex], ArcherData.ArcherTypes.Normal); color = (this.flash ? archerData.ColorB : archerData.ColorA); } Draw.Texture(subtexture, new Rectangle(0, subtexture.Height - num, subtexture.Width, num), this.Position + new Vector2(-8f, (float)(-40 + subtexture.Height - num)), color); } } this.image.DrawOutline(1); base.Render(); }
// // Constructors // public MyTeamReviver(PlayerCorpse corpse, TeamReviver.Modes mode, bool ghostRevives = false) : base(corpse.BottomCenter) { this.ghostRevives = ghostRevives; this.Mode = mode; this.Corpse = corpse; this.ScreenWrap = true; base.Tag(new GameTags[] { GameTags.LightSource, GameTags.Dummy // Using this tag because it doesn't appear in 8-player }); this.LightRadius = 60f; this.LightAlpha = 1f; base.Collider = (this.normalHitbox = new WrapHitbox(24f, 25f, -12f, -20f)); this.revivingHitbox = new WrapHitbox(40f, 46f, -20f, -30f); this.playerNomralHitbox = new WrapHitbox(8f, 14f, -4f, -6f); this.reviveCounter = (float)this.ReviveTime; base.Add(this.sine = new SineWave(90)); base.Add(this.arrowSine = new SineWave(20)); switch (this.Mode) { case TeamReviver.Modes.TeamDeathmatch: this.arrowColor = (this.colorA = ArcherData.Get(corpse.TeamColor).ColorA); this.colorB = ArcherData.Get(corpse.TeamColor).ColorB; this.PlayerCanRevive = true; break; case TeamReviver.Modes.DarkWorld: { ArcherData archerData = ArcherData.Get(TFGame.Characters [corpse.PlayerIndex], TFGame.AltSelect [corpse.PlayerIndex]); this.arrowColor = (this.colorA = archerData.ColorA); this.colorB = archerData.ColorB; this.PlayerCanRevive = true; break; } case TeamReviver.Modes.Quest: { ArcherData archerData = ArcherData.Get(TFGame.Characters [corpse.PlayerIndex], TFGame.AltSelect [corpse.PlayerIndex]); this.arrowColor = (this.colorA = archerData.ColorA); this.colorB = archerData.ColorB; this.PlayerCanRevive = false; break; } } Alarm.Set(this, 60, delegate { this.canRevive = true; }, Alarm.AlarmMode.Oneshot); this.targetLightAlpha = 1f; }
// // Methods // public override void Added() { base.Added(); if (base.Level.Session.MatchSettings.TeamMode) { this.team = base.Level.Session.MatchSettings.Teams [this.ownerIndex]; this.colorA = ArcherData.Get(this.team).ColorA; this.colorB = ArcherData.Get(this.team).ColorB; } else { this.team = Allegiance.Neutral; this.colorA = ArcherData.Get(TFGame.Characters [this.ownerIndex], ArcherData.ArcherTypes.Normal).ColorA; this.colorB = ArcherData.Get(TFGame.Characters [this.ownerIndex], ArcherData.ArcherTypes.Normal).ColorB; } this.cloak.Color = this.colorB * 0.75f; }
public MyVersusPlayerMatchResults(Session session, VersusMatchResults matchResults, int playerIndex, Vector2 tweenFrom, Vector2 tweenTo, List <AwardInfo> awards) : base(session, matchResults, playerIndex, tweenFrom, tweenTo, awards) { this.session = session; this.matchResults = matchResults; this.playerIndex = playerIndex; this.tweenFrom = base.Position = tweenFrom; this.tweenTo = tweenTo; this.awards = awards; this.characterIndex = TFGame.Characters[playerIndex]; this.won = session.MatchStats[playerIndex].Won; this.bg = new Image(TFGame.MenuAtlas[this.won ? "versusResults/winnerbg" : "versusResults/bg"], null); this.bg.CenterOrigin(); this.bg.Zoom = 0.5f; base.Add(this.bg); ArcherData data = ArcherData.Get(TFGame.Characters[playerIndex], TFGame.AltSelect[playerIndex]); if (this.won) { this.portrait = new Image(data.Portraits.Win, null); } else { this.portrait = new Image(data.Portraits.Lose, null); } this.portrait.CenterOrigin(); this.portrait.Zoom = 0.5f; this.portrait.Position = this.bg.Position + ((Vector2)(Vector2.UnitY * (((-this.bg.Height / 2f) + (this.portrait.Height / 2f)) + 15f))); DrawRectangle component = new DrawRectangle((this.portrait.X - (this.portrait.Width / 4f)) - 1f, (this.portrait.Y - (this.portrait.Height / 4f)) - 1f, (this.portrait.Width / 2f) + 2f, (this.portrait.Height / 2f) + 2f, this.won ? WinBorder : LoseBorder); base.Add(component); base.Add(this.portrait); this.gem = TFGame.MenuSpriteData.GetSpriteString(data.Gems.Menu); if (this.won) { this.gem.Play("on", false); } else { this.gem.Play("off", false); } this.gem.Position = (Vector2)((-Vector2.UnitY * this.bg.Height) / 2f); this.gem.Visible = false; this.gem.Zoom = 0.5f; base.Add(this.gem); if (this.won) { switch (this.characterIndex) { case 0: this.particlesAt = new Vector2(21f, 11f); this.particlesRange = new Vector2(11f, 7f); return; case 1: this.particlesAt = new Vector2(29f, 8f); this.particlesRange = new Vector2(14f, 6f); return; case 2: this.particlesAt = new Vector2(29f, 10f); this.particlesRange = new Vector2(10f, 8f); return; case 3: this.particlesAt = new Vector2(25f, 14f); this.particlesRange = new Vector2(15f, 6f); break; default: return; } } }
public override int NotJoinedUpdate() { if (this.input != null) { if (this.input.MenuBack && !base.MainMenu.Transitioning) { for (int i = 0; i < 8; i++) { TFGame.Players[i] = false; } Sounds.ui_clickBack.Play(160f, 1f); if ((MainMenu.RollcallMode == MainMenu.RollcallModes.Versus) || (MainMenu.RollcallMode == MainMenu.RollcallModes.Trials)) { base.MainMenu.State = MainMenu.MenuState.Main; } else { base.MainMenu.State = MainMenu.MenuState.CoOp; } } else if (this.input.MenuLeft && this.CanChangeSelection) { this.drawDarkWorldLock = false; this.ChangeSelectionLeft(); Sounds.ui_move2.Play(160f, 1f); this.arrowWiggle.Start(); this.rightArrowWiggle = false; } else if (this.input.MenuRight && this.CanChangeSelection) { this.drawDarkWorldLock = false; this.ChangeSelectionRight(); Sounds.ui_move2.Play(160f, 1f); this.arrowWiggle.Start(); this.rightArrowWiggle = true; } else if (this.input.MenuAlt && GameData.DarkWorldDLC) { this.drawDarkWorldLock = false; this.altWiggle.Start(); Sounds.ui_altCostumeShift.Play(base.X, 1f); if (this.archerType == ArcherData.ArcherTypes.Normal) { this.archerType = ArcherData.ArcherTypes.Alt; } else { this.archerType = ArcherData.ArcherTypes.Normal; } this.portrait.SetCharacter(this.CharacterIndex, this.archerType, 1); } else if ((this.input.MenuConfirmOrStart && !TFGame.CharacterTaken(this.CharacterIndex)) && (TFGame.PlayerAmount < this.MaxPlayers)) { if (ArcherData.Get(this.CharacterIndex, this.archerType).RequiresDarkWorldDLC&& !GameData.DarkWorldDLC) { this.drawDarkWorldLock = true; if ((this.darkWorldLockEase < 1f) || !TFGame.OpenStoreDarkWorldDLC()) { this.portrait.Shake(); this.shakeTimer = 30f; Sounds.ui_invalid.Play(base.X, 1f); if (TFGame.PlayerInputs[this.playerIndex] != null) { TFGame.PlayerInputs[this.playerIndex].Rumble(1f, 20); } } return(0); } if ((this.input.MenuAlt2Check && (this.archerType == ArcherData.ArcherTypes.Normal)) && (ArcherData.SecretArchers[this.CharacterIndex] != null)) { this.archerType = ArcherData.ArcherTypes.Secret; this.portrait.SetCharacter(this.CharacterIndex, this.archerType, 1); } this.portrait.Join(false); TFGame.Players[this.playerIndex] = true; TFGame.AltSelect[this.playerIndex] = this.archerType; if (TFGame.PlayerInputs[this.playerIndex] != null) { TFGame.PlayerInputs[this.playerIndex].Rumble(1f, 20); } this.shakeTimer = 20f; if (TFGame.PlayerAmount == this.MaxPlayers) { this.ForceStart(); } return(1); } } return(0); }
public override void Update() { base.Update(); if (base.Scene.OnInterval(5)) { this.flash = !this.flash; } int num = -1; bool flag = false; if (this.finished) { num = this.OwnerIndex; } else if (this.IsOwnerOnPad()) { num = this.OwnerIndex; flag = this.IsContestorOnPad(); } else { int friendlyOnPad = this.GetFriendlyOnPad(); if (friendlyOnPad != -1) { num = friendlyOnPad; flag = this.IsContestorOnPad(); } else { this.GetContestorOnPad(ref num); } } Allegiance allegiance; if (num == -1) { allegiance = Allegiance.Neutral; } else { allegiance = base.Level.Session.MatchSettings.Teams [num]; } float num3; if (base.Level.Session.MatchSettings.TeamMode) { int num2 = base.Level.Session.MatchSettings.GetTeamMismatch((Allegiance)this.OwnerIndex); num2 = Math.Sign(num2); num3 = 1f / (float)(120 + 15 * num2); } else { num3 = 1f / (float)(120 - 15 * (TFGame.PlayerAmount - 2)); } float num4 = MathHelper.Lerp(0.00148148148f, 0.0148148146f, this.drainLerp); if (flag) { this.SetSFXState(-1); } else if (num == -1) { this.SetSFXState(-1); this.FillPercent = Calc.Approach(this.FillPercent, 0f, num4 * Engine.TimeMult); this.drainLerp = Calc.Approach(this.drainLerp, 1f, 0.0166666675f * Engine.TimeMult); if (this.FillPercent == 0f) { this.OwnerIndex = -1; this.OwnerTeam = Allegiance.Neutral; } } else { if (num != this.OwnerIndex && allegiance == this.OwnerTeam && base.Level.Session.MatchSettings.TeamMode) { this.OwnerIndex = num; } if (num == this.OwnerIndex) { this.SetSFXState(1); this.FillPercent = Calc.Approach(this.FillPercent, 1f, num3 * Engine.TimeMult); this.drainLerp = 0f; if (this.FillPercent >= 1f && !this.finished) { this.Finish(); } } else { this.SetSFXState(-1); this.FillPercent = Calc.Approach(this.FillPercent, 0f, num4 * Engine.TimeMult); this.drainLerp = Calc.Approach(this.drainLerp, 1f, 0.0166666675f * Engine.TimeMult); if (this.FillPercent == 0f) { this.OwnerIndex = num; this.OwnerTeam = allegiance; } } } if (num == -1) { this.LightAlpha = Math.Max(this.LightAlpha - 0.1f * Engine.TimeMult, 0f); } else { this.LightAlpha = Math.Min(this.LightAlpha + 0.1f * Engine.TimeMult, 1f); } int num5 = num; if (flag) { num5 = this.OwnerIndex; } Allegiance team = allegiance; if (flag) { team = this.OwnerTeam; } if (num5 == -1) { this.LightColor = Color.Black; Image[] array = this.images; for (int i = 0; i < array.Length; i++) { Image image = array [i]; image.Color = Color.Gray; } } else { if (base.Level.Session.MatchSettings.TeamMode) { this.colorA = ArcherData.Get(team).ColorA; this.colorB = ArcherData.Get(team).ColorB; } else { this.colorA = ArcherData.Get(TFGame.Characters [num5], ArcherData.ArcherTypes.Normal).ColorA; this.colorB = ArcherData.Get(TFGame.Characters [num5], ArcherData.ArcherTypes.Normal).ColorB; } Image[] array = this.images; for (int i = 0; i < array.Length; i++) { Image image = array [i]; image.Color = (this.flash ? this.colorA : this.colorB); } this.LightColor = this.colorB.Invert(); } }