Beispiel #1
0
 private void HandleExistingGateCamp(GateCamp existingGateCampByLocation, KillResult kill, StargateLocation location)
 {
     existingGateCampByLocation.Kills.Add(kill);
     if (!existingGateCampByLocation.StargateLocations.Contains(location))
     {
         existingGateCampByLocation.StargateLocations.Add(location);
     }
     existingGateCampByLocation.GateCampIndex = CalculateGateCampIndex(existingGateCampByLocation.Kills);
 }
Beispiel #2
0
        private void BroadcastGatecampMessage(GateCamp gateCamp, GateCampMessageType gateCampMessageType)
        {
            var gateCampMessage = new GateCampMessage
            {
                GateCampMessageType = gateCampMessageType,
                GateCamp            = new GateCampMessageModel(gateCamp)
            };

            var gateCampMessageString = JsonConvert.SerializeObject(gateCampMessage);

            LOGGER.Debug("BroadcastGateCampMessage:\n" + gateCampMessageString);
            //TODO async
            GateCampsWebSocketHandler.Broadcast(gateCampMessageString);
        }
Beispiel #3
0
        private void CreateNewGateCamp(KillResult kill, StargateLocation location)
        {
            var killResults = new List <KillResult>
            {
                kill
            };
            var gateCampIndex = CalculateGateCampIndex(killResults);
            var gateCamp      = new GateCamp
            {
                GateCampIndex     = gateCampIndex,
                StargateLocations = new List <StargateLocation>

                {
                    location
                },
                Kills = killResults
            };

            _gateCamps.Add(gateCamp);
        }
Beispiel #4
0
 private void GateCampDifferenceDetectorOnGateCampAdded(GateCamp gateCamp)
 {
     //TODO index for gatecamps?
     BroadcastGatecampMessage(gateCamp, GateCampMessageType.ADD);
 }
Beispiel #5
0
 private void GateCampDifferenceDetectorOnGateCampRemoved(GateCamp gateCamp)
 {
     //TODO index for gatecamps?
     BroadcastGatecampMessage(gateCamp, GateCampMessageType.REMOVE);
 }
Beispiel #6
0
        private void GateCampDifferenceDetectorOnGateCampIndexChanged(GateCamp gateCamp)
        {
            //TODO index for gatecamps?

            BroadcastGatecampMessage(gateCamp, GateCampMessageType.CHANGE);
        }
 public GateCampMessageModel(GateCamp gateCamp)
 {
     GateCampIndex     = gateCamp.GateCampIndex;
     StargateLocations = gateCamp.StargateLocations;
 }
 private void OnGateCampIndexChanged(GateCamp gatecamp)
 {
     GateCampIndexChanged?.Invoke(gatecamp);
 }
 private void OnGateCampRemoved(GateCamp gatecamp)
 {
     GateCampRemoved?.Invoke(gatecamp);
 }
 private void OnGateCampAdded(GateCamp gatecamp)
 {
     GateCampAdded?.Invoke(gatecamp);
 }