Skip to content

Commit

Permalink
Brag Counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha committed Apr 4, 2015
1 parent 30b0391 commit 9836c3b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 27 deletions.
59 changes: 32 additions & 27 deletions Mod/Other.cs
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
using TowerFall;
using Monocle;
using Microsoft.Xna.Framework;
using Patcher;
using System.Collections.Generic;


namespace Mod
{
// FIXME: still needs spawn points for 3rd and 4th player etc.
//[Patch]
[Patch]
public class MyRollcallElement : RollcallElement
{
public MyRollcallElement(int playerIndex)
: base(playerIndex)
public MyRollcallElement(int playerIndex) : base(playerIndex) { }

public override void ForceStart()
{
MyVersusPlayerMatchResults.PlayerWins = new int[4];
base.ForceStart();
}

public override int MaxPlayers {
get {
return (MainMenu.RollcallMode == MainMenu.RollcallModes.Trials) ? 1 : 4;
}
public override void StartVersus()
{
MyVersusPlayerMatchResults.PlayerWins = new int[4];
base.StartVersus();
}
}

[Patch]
public class MyQuestRoundLogic : QuestRoundLogic
public class MyVersusPlayerMatchResults : VersusPlayerMatchResults
{
public MyQuestRoundLogic(Session session)
: base(session)
public static int[] PlayerWins;

OutlineText winsText;

public MyVersusPlayerMatchResults(Session session, VersusMatchResults matchResults, int playerIndex, Vector2 tweenFrom, Vector2 tweenTo, List<AwardInfo> awards) : base(session, matchResults, playerIndex, tweenFrom, tweenTo, awards)
{
if (session.MatchStats[playerIndex].Won)
PlayerWins[playerIndex]++;

if (PlayerWins[playerIndex] > 0) {
winsText = new OutlineText(TFGame.Font, PlayerWins[playerIndex].ToString(), this.gem.Position);
winsText.Color = Color.White;
winsText.OutlineColor = Color.Black;
this.Add(winsText);
}
}

public override void OnLevelLoadFinish()
public override void Render()
{
base.OnLevelLoadFinish();

base.Players = 0;
for (int i = 0; i < 4; i++) {
if (TFGame.Players[i]) {
base.Players++;
if (base.Players <= 2) {
// the first two players are already taken care of by base.
continue;
}
// This patch doesn't work with the injector because it doesn't yet support generics
//base.Session.CurrentLevel.Add<QuestPlayerHUD>(this.PlayerHUDs[i] = new QuestPlayerHUD(this, (base.Players % 2 == 0) ? Facing.Left : Facing.Right, i));
this.SpawnPlayer(i, false);
}
}
base.Render();
if (winsText != null)
winsText.Render();
}
}
}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A mod framework for [TowerFall Ascension](http://www.towerfall-game.com/) (copyr
* [Included Mods](#included-mods)
* [Game Modes](#game-modes)
* [Variants](#variants)
* [UI Enhancements](#ui-enhancements)
* [Dev Mods](#dev-mods)
* [Installation](#installation)
* [Hacking](#hacking)
Expand Down Expand Up @@ -72,6 +73,13 @@ Koala hunters no more.

![](img/gottagofast.gif?raw=true)

## UI Enhancements

### Win Counter
![](img/winCounter.png?raw=true)

Resets when you return to the Player Select screen.

## Dev Mods

These mods are intended for development or are simply unfinished and only available if you compile Bartizan from source. If enough people want to see one of these included in the official releases, we may flesh them out and include them.
Expand Down
Binary file added img/winCounter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9836c3b

Please sign in to comment.