示例#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));
     }
 }
示例#2
0
        public static void AppendUser(StringBuilder sb, string key, TransFormHolder th)
        {
            if (th.IdleCount < idleCountLimit)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("avatar shown {0}, {1}", th.IdleCount, th.Rotation));
                //       TransFormHolder th = i.Value;
                sb.Append("<u>");
                sb.Append("<i>");
                sb.Append(key);
                sb.Append("</i>");

                sb.Append("<p>");
                sb.Append(th.Position);
                sb.Append("</p>");
                sb.Append("<r>");
                sb.Append(th.Rotation);
                sb.Append("</r>");
                sb.Append("<n>");
                sb.Append(th.NickName);
                sb.Append("</n>");
                sb.Append("<a>");
                sb.Append(th.AvatarNo);
                sb.Append("</a>");
                sb.Append("<d>");
                sb.Append(th.DissonanceGuid);
                sb.Append("</d>");
                AppendIfNotNull(sb, "lhp", th.LHPosition);
                AppendIfNotNull(sb, "lhr", th.LHRotation);
                AppendIfNotNull(sb, "rhp", th.RHPosition);
                AppendIfNotNull(sb, "rhr", th.RHRotation);
                string legacyAvatarUrl = null;
                if (HasLegacyAvatar(key, out legacyAvatarUrl))
                {
                    sb.Append("<l>");
                    sb.Append(legacyAvatarUrl);
                    sb.Append("</l>");
                }
                sb.Append("</u>");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(string.Format("avatar not shown {0}, {1}", th.IdleCount, th.Rotation));
            }
        }