Example #1
0
        public void AbilityChanged2_0(HasContactInfo player, Car car, ref List <string> notifyMsgs, string pType)
        {
            string fromUrl;
            int    webSocketID;

            player.GetUrlAndWebsocket(out fromUrl, out webSocketID);
            var  carIndexStr = car.IndexString;
            long costValue   = 0;
            long sumValue    = 1;

            switch (pType)
            {
            case "mile":
            {
                costValue = car.ability.costMiles;
                sumValue  = car.ability.mile;
            }; break;

            case "business":
            {
                costValue = car.ability.costBusiness;
                sumValue  = car.ability.Business;
            }; break;

            case "volume":
            {
                costValue = car.ability.costVolume;
                sumValue  = car.ability.Volume;
            }; break;

            case "speed":
            {
                sumValue  = car.ability.Speed;
                costValue = car.ability.Speed;
            }; break;
            }
            var obj = new BradCastAbility
            {
                c           = "BradCastAbility",
                WebSocketID = webSocketID,
                pType       = pType,
                carIndexStr = carIndexStr,
                costValue   = costValue,
                sumValue    = sumValue
            };
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

            notifyMsgs.Add(fromUrl);
            notifyMsgs.Add(json);
            //throw new NotImplementedException();
        }
Example #2
0
 public void SendPromoteCountOfPlayer(string pType, int count, HasContactInfo player, ref List <string> notifyMsgs)
 {
     if (!(pType == "mile" || pType == "business" || pType == "volume" || pType == "speed"))
     {
     }
     else
     {
         //var count = player.PromoteDiamondCount[pType];
         string fromUrl;
         int    websocketID;
         player.GetUrlAndWebsocket(out fromUrl, out websocketID);
         var obj = new BradCastPromoteDiamondCount
         {
             c           = "BradCastPromoteDiamondCount",
             count       = count,
             WebSocketID = websocketID,
             pType       = pType
         };
         var json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
         notifyMsgs.Add(fromUrl);
         notifyMsgs.Add(json);
     }
 }