public static Task TypedBroadcast(this IConnection connection, object value) { return connection.Broadcast(new TypedMessage { Type = GetMessageType(value), Message = value }); }
//public static void BroadcastUsedSkill(this ISceneHost scene, ushort shipId, ushort target, bool success, string weaponId, long timestamp) //{ // scene.Broadcast("ship.usedSkill", new UsedSkillMsg { shipId = target, origin = shipId, success = success, weaponId = weaponId, timestamp = timestamp }); //} public static void BrodcastUsedSkill(this ISceneHost scene, IEnumerable<UsedSkillMsg> skills) { scene.Broadcast("ship.usedSkill", skills.ToArray()); }
public static void BroadcastPvUpdate(this ISceneHost scene, ushort shipId, int diff) { scene.Broadcast("ship.pv", s => { using (var writer = new BinaryWriter(s, Encoding.UTF8, true)) { writer.Write(shipId); writer.Write(diff); } }); }
public static void BroadcastStatusChanged(this ISceneHost scene, ushort shipId, ShipStatus status) { scene.Broadcast("ship.statusChanged", new StatusChangedMsg { shipId = shipId, status = status }); }