public static HuntInstance CreateDummyHuntInstance() { var theObjective = new Objective() { Id = new Guid("{81573EBA-C5AA-4423-B308-BCB3026AE771}"), Name = "Find a fountain!", Description = "It must be green.", Score = 100 }; var theAdmin = new Account() { Id = new Guid("{714DC8D9-42EA-43F2-8148-DDFAC1E585C5}"), Name = "SuperTom" }; var britAccount = new Account() { Id = new Guid("{614DC8D9-42EA-43F2-8148-DDFAC1E585C6}"), Name = "Brit" }; var theHunt = new Hunt() { Id = new Guid("{741BB781-531D-4354-A840-777E267A809E}"), Name = "DummyHunt", Description = "A dummy hunt!", Creator = theAdmin, }; var theInstance = new HuntInstance() { Id = new Guid("{E41BB781-531D-4354-A840-777E267A809E}"), Admin = theAdmin, StartTime = new DateTime(2012, 12, 1, 12, 0, 0, 0), EndTime = new DateTime(2012, 12, 2, 12, 0, 0, 0), Hunt = theHunt }; var britHunter = new Hunter() { Id = new Guid("{F41BB781-531D-4354-A840-777E267A809E}"), Account = britAccount, HuntInstance = theInstance }; theInstance.Hunters.Add(britHunter); theHunt.Objectives.Add(theObjective); theObjective.Hunt = theHunt; return theInstance; }
public void Init() { _notifier = new HuntNotifier(new PusherProvider("31452", "04af48f0bd881f9f9737", "0bbb6f45596775fa5d2d")); _dummyHuntInstance = DummyHuntFactory.CreateDummyHuntInstance(); }
public void JoinHunt(Account user, HuntInstance instance) { if (instance.EndTime < DateTime.Now) throw new HuntEndedException(); if (instance.Hunters.Any(x => x.Account == user)) throw new HuntAlreadyJoinedException(); var hunter = new Hunter() { Account = user, Score = 0 }; instance.Hunters.Add(hunter); _container.SaveChanges(); _notifier.NotifyHunterJoined(hunter); }
public void LeaveHunt(Account user, HuntInstance instance) { }
/// <summary> /// Deprecated Method for adding a new object to the HuntInstances EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToHuntInstances(HuntInstance huntInstance) { base.AddObject("HuntInstances", huntInstance); }
/// <summary> /// Create a new HuntInstance object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="huntId">Initial value of the HuntId property.</param> /// <param name="startTime">Initial value of the StartTime property.</param> /// <param name="endTime">Initial value of the EndTime property.</param> public static HuntInstance CreateHuntInstance(global::System.Guid id, global::System.Guid huntId, global::System.DateTime startTime, global::System.DateTime endTime) { HuntInstance huntInstance = new HuntInstance(); huntInstance.Id = id; huntInstance.HuntId = huntId; huntInstance.StartTime = startTime; huntInstance.EndTime = endTime; return huntInstance; }
public void NotifyHuntEnding(HuntInstance instance) { // TODO: use pusher to notify // TODO: instance.Hunters // TODO: instance.Admin }
public void SendHuntMessage(HuntInstance instance) { // TODO: use pusher to notify // TODO: instance.Hunters // TODO: instance.Admin }