This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Kind { | |
public class Global : Kind {} | |
public class World : Kind { | |
public readonly int world; | |
public World(int world) { | |
this.world = world; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def getLeaderboardName(kind: Kind, lbKind: LeaderboardKind) = kind match { | |
case kg @ Kind.Global => | |
LeaderboardName(s"lb_${leaderboardKindToString(lbKind)}", lbKind) | |
case Kind.World(w) => | |
LeaderboardName(s"lb_w${w}_${leaderboardKindToString(lbKind)}", lbKind) | |
case Kind.Level(w, l, b) => | |
LeaderboardName( | |
s"lb_w${w}_l$l${if (b) "b" else "")}_${leaderboardKindToString(lbKind)}", | |
lbKind | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Utils.Match { | |
public interface IMatcher<in Base, Return> where Base : class { | |
IMatcher<Base, Return> when<T>(Func<T, Return> onMatch) | |
where T : class, Base; | |
Return get(); | |
Return getOrElse(Func<Return> elseFunc); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static LeaderboardName getLeaderboardName( | |
Kind kind, LeaderboardKind lbKind | |
) { | |
return new LeaderboardName( | |
kind.match().returning<string> | |
.when<Kind.Global>(_ => string.Format( | |
"lb_{0}", leaderboardKindToString(lbKind) | |
)) | |
.when<Kind.World>(kw => string.Format( | |
"lb_w{0}_{1}", kw.world, leaderboardKindToString(lbKind) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extractEither[ | |
Key, TLeft, TRight, M[_] <: TraversableOnce[_] | |
] | |
(monad: M[(Key, Either[TLeft, TRight])]) | |
(implicit cbf: CanBuildFrom[ | |
M[(Key, Either[TLeft, TRight])], | |
(Key, TRight), | |
M[(Key, TRight)] | |
]): Either[TLeft, M[(Key, TRight)]] = { | |
val builder = cbf(monad) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ChiShapeGenerator extends ChiShapeGenerator { | |
trait JavaConvertible[From, To] { def asJava(obj: From): To } | |
object JavaConvertible { | |
def apply[A, B](obj: A) = implicitly[JavaConvertible[A, B]].asJava(obj) | |
implicit object HoleParamsJC extends JavaConvertible[HoleParams, HP] { | |
def asJava(obj: HoleParams) = new HP(obj.holeEdgeLengthThreshold) | |
} | |
implicit object SmoothHoleParamsJC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tinylabproductions.quazibuild.server.actor.connection | |
import akka.actor.{Props, ActorRef, Actor} | |
import akka.io.Tcp._ | |
import java.net.InetSocketAddress | |
import akka.util.ByteString | |
import com.tinylabproductions.quazibuild.server.messaging._ | |
import com.tinylabproductions.quazibuild.server.actor.Logging | |
import com.tinylabproductions.quazibuild.messaging.Messages.{S2C, C2S} | |
import akka.io._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerator<Tuple2<T, Direction>> GetEnumerator() { | |
if (top != null) | |
yield return new Tuple2<T, Direction>(top, Direction.Top); | |
if (right != null) | |
yield return new Tuple2<T, Direction>(right, Direction.Right); | |
if (down != null) | |
yield return new Tuple2<T, Direction>(down, Direction.Down); | |
if (left != null) | |
yield return new Tuple2<T, Direction>(left, Direction.Left); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tinylabproductions.quazibuild.server.messaging | |
import com.tinylabproductions.quazibuild.{messaging => m} | |
import com.tinylabproductions.quazibuild.messaging.Messages.S2C | |
import com.google.protobuf.GeneratedMessage | |
import com.tinylabproductions.quazibuild.messaging.LiveGame._ | |
import com.tinylabproductions.quazibuild.server.model.{StoredResource, Resource} | |
import com.tinylabproductions.quazibuild.messaging.Base.User | |
import com.tinylabproductions.quazibuild.server.actor.live_game.model.Ship | |
import implicits._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packageConfiguration in packageBin in Compile <<= ( | |
packageConfiguration in packageBin in Compile, baseDirectory | |
) map { (c, b) => | |
val jar = b / "Plugins" / "Android" / "xclient.jar" | |
new Package.Configuration(c.sources, jar, c.options) | |
} |