Example #1
0
 public static string UpdateTransFormHolder(string roomKey, string userGuid, TransFormHolder transformHolder, SceneAction action, string userPosStr, PostI post, int Timezone_Offset, List <ServerObjectTransform> sot)
 {
     lock (thisLock)
     {
         Dictionary <string, TransFormHolder> tList = null;
         if (!TransFormDict.TryGetValue(roomKey, out tList))
         {
             tList = new Dictionary <string, TransFormHolder>();
         }
         foreach (var item in tList.Where(kvp => kvp.Value.TimeStamp < DateTime.Now.AddSeconds(-4)).ToList())
         {
             tList.Remove(item.Key);
         }
         //check idlecount
         if (tList.ContainsKey(userGuid))
         {
             var lastTransform = tList[userGuid];
             if (lastTransform != null && lastTransform.Rotation == transformHolder.Rotation)
             {
                 transformHolder.IdleCount = lastTransform.IdleCount + 1;
             }
         }
         tList[userGuid]        = transformHolder;
         TransFormDict[roomKey] = tList;
         ActionHolder ah = null;
         ah = UpdateActionsHolder(roomKey, userGuid, action);
         List <ServerObjectTransform> sotRes  = HandleServerObjects(roomKey, userGuid, sot);
         SlmControls.Vector3          userPos = SlmControls.Vector3.FromString(userPosStr);
         return(MakeXml(tList, ah, userPos, post, Timezone_Offset, sotRes));
     }
 }
Example #2
0
        public static int GetRoomCount(string roomKey)
        {
            //lock (thisLock)
            //{
            Dictionary <string, TransFormHolder> tList = null;

            if (TransFormDict.TryGetValue(roomKey, out tList))
            {
                return(tList.Where(kvp => kvp.Value.TimeStamp > DateTime.Now.AddSeconds(-roomCountTimeLimit) && kvp.Value.IdleCount < idleCountLimit).ToList().Count);
            }
            return(0);
            //}
        }