当前位置: 首页>>代码示例>>C#>>正文


C# JsonObject.GetDouble方法代码示例

本文整理汇总了C#中JsonObject.GetDouble方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.GetDouble方法的具体用法?C# JsonObject.GetDouble怎么用?C# JsonObject.GetDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonObject的用法示例。


在下文中一共展示了JsonObject.GetDouble方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

 public static InstagramPosition Parse(JsonObject obj) {
     if (obj == null) return null;
     return new InstagramPosition(obj) {
         X = obj.GetDouble("x"),
         Y = obj.GetDouble("y")
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:7,代码来源:InstagramPosition.cs

示例2: Parse

 /// <summary>
 /// Gets a location from the specified <var>JsonObject</var>.
 /// </summary>
 /// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
 public static InstagramLocation Parse(JsonObject obj) {
     if (obj == null) return null;
     return new InstagramLocation(obj) {
         Id = obj.GetInt32("id"),
         Name = obj.GetString("name"),
         Latitude = obj.GetDouble("latitude"),
         Longitude = obj.GetDouble("longitude")
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:13,代码来源:InstagramLocation.cs

示例3: Parse

        public static FacebookLocation Parse(JsonObject obj) {
            if (obj == null) return null;
            return new FacebookLocation(obj) {
                Country = obj.GetString("country"),
                City = obj.GetString("city"),
                Latitude = obj.GetDouble("latitude"),
                Longitude = obj.GetDouble("longitude"),
                Zip = obj.GetString("zip"),
                State = obj.GetString("state"),
                Street = obj.GetString("street")
            };

        }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:13,代码来源:FacebookLocation.cs

示例4: Parse

 public static VimeoTestLoginResponse Parse(JsonObject obj) {
     if (obj == null) return null;
     JsonObject user = obj.GetObject("user");
     if (user == null) return null;
     return new VimeoTestLoginResponse {
         GeneratedIn = obj.GetDouble("generated_in"),
         Id = user.GetInt("id"),
         Username = user.GetString("username")
     };
 }
开发者ID:jesperordrup,项目名称:Skybrud.Social,代码行数:10,代码来源:VimeoTestLoginResponse.cs

示例5: ParseResponse

        /// <summary>
        /// All responses received from the Vimeo Advanced API has some meta
        /// data telling whether the request was successful or failed. This
        /// method will parse these meta data and throw an exception if an
        /// error has occured.
        /// </summary>
        protected void ParseResponse(JsonObject obj) {

            GeneratedIn = obj.GetDouble("generated_in");
            Stat = obj.GetString("stat");

            if (Stat == "ok") return;

            if (Stat == "fail") {
                JsonObject err = obj.GetObject("err");
                if (err != null) {
                    int code = err.GetInt32("code");
                    string expl = err.GetString("expl");
                    string msg = err.GetString("msg");
                    throw new VimeoException(code, expl, msg);
                }
            }

            // TODO: Any other scenarios?

        }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:26,代码来源:VimeoApiResponse.cs

示例6: Parse

 /// <summary>
 /// Gets an instance of <code>SlackUser</code> from the specified <code>JsonObject</code>.
 /// </summary>
 /// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
 public static SlackUser Parse(JsonObject obj) {
     if (obj == null) return null;
     return new SlackUser(obj) {
         Id = obj.GetString("id"),
         Name = obj.GetString("name"),
         IsDeleted = obj.GetBoolean("deleted"),
         Color = obj.GetString("color"),
         RealName = obj.GetString("real_name"),
         TimeZone = obj.GetString("tz"),
         TimeZoneLabel = obj.GetString("tz_label"),
         TimeZoneOffset = obj.GetDouble("tz_offset", TimeSpan.FromSeconds),
         Profile = obj.GetObject("profile", SlackUserProfile.Parse),
         IsAdmin = obj.GetBoolean("is_admin"),
         IsOwner = obj.GetBoolean("is_owner"),
         IsPrimaryOwner = obj.GetBoolean("is_primary_owner"),
         IsRestricted = obj.GetBoolean("is_restricted"),
         IsUltraRestricted = obj.GetBoolean("is_ultra_restricted"),
         IsBot = obj.GetBoolean("is_bot"),
         HasFiles = obj.GetBoolean("has_files"),
         Has2Fa = obj.GetBoolean("has_2fa"),
         Presence = obj.GetEnum("presence", SlackPresence.Unspecified)
     };
 }
开发者ID:EmilMoe,项目名称:Skybrud.Social,代码行数:27,代码来源:SlackUser.cs

示例7: PlaceVillage

    void PlaceVillage(JsonObject villageJson)
    {
        float x = (float) villageJson.GetDouble("x");
        float y = (float) villageJson.GetDouble("y");
        float z = (float) villageJson.GetDouble("z");

        GameObject village = Instantiate<GameObject>(villagePrefab);
        village.transform.position = new Vector3(x, y, z);
        spawnedObjects.Add(village);
    }
开发者ID:ChrisLHall,项目名称:SeaweedFace,代码行数:10,代码来源:LevelGen.cs

示例8: PlaceSign

    void PlaceSign(JsonObject signJson)
    {
        float x = (float) signJson.GetDouble("x");
        float y = (float) signJson.GetDouble("y");
        float z = (float) signJson.GetDouble("z");
        string owner = signJson.GetString("owner");
        string message = signJson.GetString("message");

        GameObject sign = Instantiate<GameObject>(signPrefab);
        sign.transform.position = new Vector3(x, y, z);
        Sign signComp = sign.GetComponent<Sign>();
        signComp.owner = owner;
        signComp.message = message;
        spawnedObjects.Add(sign);
    }
开发者ID:ChrisLHall,项目名称:SeaweedFace,代码行数:15,代码来源:LevelGen.cs

示例9: PlaceItem

    void PlaceItem(JsonObject itemJson)
    {
        string type = itemJson.GetString("itemType");
        float x = (float) itemJson.GetDouble("x");
        float y = (float) itemJson.GetDouble("y");
        float z = (float) itemJson.GetDouble("z");
        int initValue = itemJson.GetInt("initValue");
        int level = itemJson.GetInt("level");

        GameObject item = Instantiate<GameObject>(itemPrefab);
        item.transform.position = new Vector3(x, y, z);
        Item itemComp = item.GetComponent<Item>();
        itemComp.itemName = type;
        itemComp.initValue = initValue;
        itemComp.level = level;
        spawnedObjects.Add(item);
    }
开发者ID:ChrisLHall,项目名称:SeaweedFace,代码行数:17,代码来源:LevelGen.cs

示例10: PlaceIsland

    void PlaceIsland(JsonObject islandJson)
    {
        float size = (float) islandJson.GetDouble("size");
        float height = (float) islandJson.GetDouble("height");
        float xPos = (float) islandJson.GetDouble("xPos");
        float zPos = (float) islandJson.GetDouble("zPos");

        GameObject island = Instantiate<GameObject>(islandPrefab);
        island.transform.position = new Vector3(xPos, 0f, zPos);
        island.transform.localScale = new Vector3(size, height * 2f, size);
        spawnedObjects.Add(island);
    }
开发者ID:ChrisLHall,项目名称:SeaweedFace,代码行数:12,代码来源:LevelGen.cs

示例11: AddObjectRefreshSave

    void AddObjectRefreshSave(JsonObject newObj, bool tryReplace = false)
    {
        World.Refresh();
        JsonArray ja = World.GetJsonArray("objects");
        JsonArray newJA = new JsonArray();
        if (tryReplace) {
            Vector3 currentPos = new Vector3((float) newObj.GetDouble("x"),
                                             (float) newObj.GetDouble("y"),
                                             (float) newObj.GetDouble("z"));
            for (int i = 0; i < ja.Length(); i++) {
                JsonObject o = ja.GetJsonObject(i);
                if (o.GetString("type") != "item"
                        && o.GetString("type") != "sign") {
                    newJA.Put(o);
                    continue;
                }
                Vector3 pos = new Vector3((float) o.GetDouble("x"),
                                          (float) o.GetDouble("y"),
                                          (float) o.GetDouble("z"));
                if ((pos - currentPos).sqrMagnitude < EPSILON
                        && newObj.GetString("type") == o.GetString("type")) {
                    // Skip if position and type are equal
                    continue;
                }
                newJA.Put(o);
            }
        } else {
            newJA = ja;
        }
        newJA.Put(newObj);
        World["objects"] = newJA;
        ClearSpawnedObjects();
        PopulateWorld(World.GetJsonArray("objects"));

        Village.RecalculateAll();
        World["worldPrestige"] = CountWorldPrestige();
        World.Save();
        RecalcPlayerPrestige();
    }
开发者ID:ChrisLHall,项目名称:SeaweedFace,代码行数:39,代码来源:LevelGen.cs


注:本文中的JsonObject.GetDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。