本文整理汇总了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")
};
}
示例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")
};
}
示例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")
};
}
示例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")
};
}
示例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?
}
示例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)
};
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}