當前位置: 首頁>>代碼示例>>C#>>正文


C# ParseUser.ContainsKey方法代碼示例

本文整理匯總了C#中Parse.ParseUser.ContainsKey方法的典型用法代碼示例。如果您正苦於以下問題:C# ParseUser.ContainsKey方法的具體用法?C# ParseUser.ContainsKey怎麽用?C# ParseUser.ContainsKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parse.ParseUser的用法示例。


在下文中一共展示了ParseUser.ContainsKey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SaveLocationToParseUser

        /// <summary>
        /// Save a new location data to the parse user.
        /// This method does not save the data to the server.
        /// Need to call SaveAsync on the user afterwards.
        /// </summary>
        /// <param name="user">the user whose location is to be saved</param>
        /// <param name="newData">the new location data</param>
        public static void SaveLocationToParseUser(ParseUser user, GeoPosition<GeoCoordinate> newData)
        {
            int lastLocationIndex = user.Get<int>(ParseContract.UserTable.LAST_LOCATION_INDEX);
            int newLocationIndex = lastLocationIndex + 1;
            newLocationIndex %= user.Get<int>(ParseContract.UserTable.LOCATION_DATA_SIZE);
            user[ParseContract.UserTable.LAST_LOCATION_INDEX] = newLocationIndex;


            if (!user.ContainsKey(ParseContract.UserTable.LOCATION(newLocationIndex)))//If the new slot was not filled.
            {
                user[ParseContract.UserTable.LOCATION(newLocationIndex)] = ParseContract.LocationTable.GeoPositionToParseObject(newData);
            }
            else//If the new slot contains a valid location
            {
                ParseObject newLocation = user.Get<ParseObject>(ParseContract.UserTable.LOCATION(newLocationIndex));
                //Change the location entry without creating a new one.
                ParseContract.LocationTable.GeoPositionSetParseObject(newData, newLocation);
            }
            user[ParseContract.UserTable.LAST_GEO_POINT] = new ParseGeoPoint(newData.Location.Latitude, newData.Location.Longitude);
        }
開發者ID:qtstc,項目名稱:weassist,代碼行數:27,代碼來源:Utilities.cs

示例2: ReadParseUser

 public static bool ReadParseUser(ParseUser user)
 {
     if (user.ContainsKey("Created"))
     {
         if (user.ContainsKey("MaxScore"))
         {
             var maxscore = (long)user["MaxScore"];
             _maxScore = (int)maxscore;
         }
         return true;
     }
     else
     {
         return false;
     }
 }
開發者ID:arahis,項目名稱:Swiper,代碼行數:16,代碼來源:PlayerManager.cs


注:本文中的Parse.ParseUser.ContainsKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。