1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-10-28 18:20:04 +00:00

Lots of stuff

This commit is contained in:
Deukhoofd
2016-02-01 23:19:30 +01:00
commit d7316d5799
6681 changed files with 527969 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
class @BattleCollection extends Backbone.Collection
model: Battle
isPlaying: ->
@find((battle) -> battle.isPlaying())?
playingBattles: ->
@filter((battle) -> battle.isPlaying())

View File

@@ -0,0 +1,2 @@
class @PrivateMessages extends Backbone.Collection
model: PrivateMessage

View File

@@ -0,0 +1,9 @@
class @Rooms extends Backbone.Collection
model: Room
# Delegate room events to every single room in this collection.
for eventName in Room::EVENTS
do (eventName) =>
this::[eventName] = (args...) ->
@each (room) ->
room[eventName].apply(room, args)

View File

@@ -0,0 +1,15 @@
class @UserList extends Backbone.Collection
model: User
comparator: (a, b) =>
aAuthority = a.get('authority')
bAuthority = b.get('authority')
aName = "#{a.id}".toLowerCase()
bName = "#{b.id}".toLowerCase()
if aAuthority < bAuthority then 1
else if aAuthority > bAuthority then -1
else if aName < bName then -1
else if aName > bName then 1
else 0
initialize: =>

View File

@@ -0,0 +1,2 @@
class @Replays extends Backbone.Collection
model: Replay