本文整理汇总了C#中JSONObject.GetNumber方法的典型用法代码示例。如果您正苦于以下问题:C# JSONObject.GetNumber方法的具体用法?C# JSONObject.GetNumber怎么用?C# JSONObject.GetNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONObject
的用法示例。
在下文中一共展示了JSONObject.GetNumber方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public override void Deserialize(JSONObject obj)
{
Ranks = (int)obj.GetNumber(cRanks);
MiscModifier = (int)obj.GetNumber(cModifier);
CanBeUsedUntrained = obj.GetBoolean(cUntrained);
ClassSkill = obj.GetBoolean(cClassSkill);
KeyAbility = (DnDAbilities)(int)obj.GetNumber(cAbility);
}
示例2: from_json
public static SPBulletObject from_json(JSONObject jso)
{
SPBulletObject rtv = new SPBulletObject();
rtv._id = (int)jso.GetNumber(SN.ID);
rtv._playerid = (int)jso.GetNumber(SN.PLAYER_ID);
rtv._pos = SPVector.from_json(jso.GetObject(SN.POS));
rtv._vel = SPVector.from_json(jso.GetObject(SN.VEL));
rtv._rot = SPVector.from_json(jso.GetObject(SN.ROT));
return rtv;
}
示例3: Player
public Player(JSONObject json)
{
this.ducat = -1;
this.player_name = json.GetString("name");
this.team_id = 0;
this.uid = json.GetString("uid");
this.type = (PlayerType)Enum.Parse(typeof(PlayerType), json.GetString("type"));
this.price = (int)json.GetNumber("price");
this.proba = (int)json.GetNumber("proba");
var stats = json.GetObject("stats");
this.DEFAULTSTATS.Esquive = (int)stats.GetNumber("esquive");
this.DEFAULTSTATS.Tacle = (int)stats.GetNumber("tacle");
this.DEFAULTSTATS.Passe = (int)stats.GetNumber("passe");
this.DEFAULTSTATS.Course = (int)stats.GetNumber("course");
initialize_finaleStats();
}
示例4: update
public void update(JSONObject json, bool all = false)
{
is_connected = true;
id = (int)json.GetNumber("id");
username = json.GetString("username");
email = json.GetString("email");
score = (int)json.GetNumber("score");
room = json.GetString("room");
if (!json.ContainsKey("friends"))
{
this.friends = new Friends();
return;
} // Info private
phi = (int)json.GetNumber("phi");
if (all)
ProcessSwungMens(json.GetArray("swungmens"));
// -- Friends
JSONArray friends = json.GetArray("friends");
this.friends = new Friends(friends);
}
示例5: getPlayer
private static Player getPlayer(JSONObject obj)
{
JSONArray array = obj.GetArray ("levels");
Dictionary<string,LevelData> levels = new Dictionary<string, LevelData> ();
for (int i =0; i < array.Length; i++) {
JSONObject lvl = array [i].Obj;
LevelData lData = getLevelData (lvl);
levels.Add (lData.Id, lData);
}
return new Player ((int)obj.GetNumber("id"), obj.GetString("name"), levels);
}
示例6: getLevelData
private static LevelData getLevelData(JSONObject level)
{
return new LevelData (
level.GetString ("id"),
(int)level.GetNumber ("stepCount")
);
}
示例7: Deserialize
public override void Deserialize(JSONObject obj)
{
Name = obj.GetString(NAME);
AlternativeNames = new List<string>();
JSONArray tempArray = obj.GetArray(cAltNames);
foreach (var val in tempArray)
{
AlternativeNames.Add(val.Str);
}
Alignment = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
WorshippingRaces = new List<DnDRace>();
tempArray = obj.GetArray(cRaces);
foreach (var val in tempArray)
{
WorshippingRaces.Add((DnDRace)(int)val.Number);
}
WorshippingClasses = new List<DnDCharClass>();
tempArray = obj.GetArray(cClasses);
foreach (var val in tempArray)
{
WorshippingClasses.Add((DnDCharClass)(int)val.Number);
}
Domains = new List<DnDClericDomain>();
tempArray = obj.GetArray(cDomains);
foreach (var val in tempArray)
{
Domains.Add((DnDClericDomain)(int)val.Number);
}
}
示例8: Deserialize
public override void Deserialize(JSONObject obj)
{
mClassLevel = (int)obj.GetNumber(LEVEL);
DeserializeKnownSpells(obj);
DeserializeMainSpells(obj);
DeserializeExtraSpells(obj);
mSkills = new DnDSkillModel();
mSkills.Deserialize(obj.GetObject(SKILLS));
// spec:
JSONArray tempArray = obj.GetArray(SPECIALIZATION);
for (int i = 0; i < tempArray.Length; ++i)
{
if (i == 0) // first item is the specialization
{
mSpecialization = (DnDMagicSchool)((int)tempArray[i].Number);
}
else // the other items are the forbidden schools
{
mForbiddenSchools.Add((DnDMagicSchool)((int)tempArray[i].Number));
}
}
}
示例9: Deserialize
public override void Deserialize(JSONObject obj)
{
mName = obj.GetString(NAME);
mGender = (CharacterGender)(int)obj.GetNumber(GENDER);
mExperience = (int)obj.GetNumber(EXPERIENCE);
mAvatar = obj.GetString(AVATAR);
mAlignment = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
mRace = (DnDRace)(int)obj.GetNumber(RACE);
mAge = (int)obj.GetNumber(AGE);
if (obj.ContainsKey(DEITY))
{
mDeity = new DnDDeity();
mDeity.Deserialize(obj.GetObject(DEITY));
}
mSize = (DnDCharacterSize)(int)obj.GetNumber(SIZE);
// souls:
JSONObject jSouls = obj.GetObject(CLASS_SOULS);
var classes = Enum.GetValues(typeof(DnDCharClass)).Cast<DnDCharClass>();
foreach (DnDCharClass charClass in classes)
{
if (jSouls.ContainsKey(charClass.ToString()))
{
if (!string.IsNullOrEmpty(jSouls.GetObject(charClass.ToString()).ToString()))
{
DnDClassSoul newSoul = null;
switch (charClass)
{
case DnDCharClass.Wizard:
newSoul = new DnDWizard(this);
break;
default:
break;
}
if (newSoul != null)
{
newSoul.Deserialize(jSouls.GetObject(charClass.ToString()));
mClasses.Add(newSoul);
}
}
}
}
// abilities:
JSONArray tempArray = obj.GetArray(ABILITIES);
foreach (var val in tempArray)
{
mAbilities[(DnDAbilities)((int)val.Array[0].Number)] = (int)val.Array[1].Number;
}
}
示例10: init
public void init(JSONObject json)
{
if(json.GetValue("Id") != null ){this.Id = json.GetString("Id");}
if(json.GetValue("Account") != null ){this.Account = json.GetString("Account");}
if(json.GetValue("ActivatedBy") != null ){this.ActivatedBy = json.GetString("ActivatedBy");}
if(json.GetValue("BillingAddress") != null ){this.BillingAddress = json.GetString("BillingAddress");}
if(json.GetValue("CompanySigned") != null ){this.CompanySigned = json.GetString("CompanySigned");}
if(json.GetValue("CompanySignedDate") != null ){this.CompanySignedDate = json.GetString("CompanySignedDate");}
if(json.GetValue("StartDate") != null ){this.StartDate = json.GetString("StartDate");}
if(json.GetValue("EndDate") != null ){this.EndDate = json.GetString("EndDate");}
if(json.GetValue("Name") != null ){this.Name = json.GetString("Name");}
if(json.GetValue("ContractTerm") != null ){this.ContractTerm = json.GetNumber("ContractTerm");}
if(json.GetValue("ContractNumber") != null ){this.ContractNumber = json.GetString("ContractNumber");}
if(json.GetValue("CreatedBy") != null ){this.CreatedBy = json.GetString("CreatedBy");}
if(json.GetValue("CustomerSigned") != null ){this.CustomerSigned = json.GetString("CustomerSigned");}
if(json.GetValue("CustomerSignedDate") != null ){this.CustomerSignedDate = json.GetString("CustomerSignedDate");}
if(json.GetValue("CustoemrSignedTitle") != null ){this.CustomerSignedTitle = json.GetString("CustomerSignedTitle");}
if(json.GetValue("Description") != null ){this.Description = json.GetString("Description");}
if(json.GetValue("LastModifiedBy") != null ){this.LastModifiedBy = json.GetString("LastModifiedBy");}
if(json.GetValue("OwnerExpirationNotice") != null ){this.OwnerExpirationNotice = json.GetString("OwnerExpirationNotice");}
if(json.GetValue("Pricebook2") != null ){this.Pricebook2 = json.GetString("Pricebook2");}
if(json.GetValue("ShippingAddress") != null ){this.ShippingAddress = json.GetString("ShippingAddress");}
if(json.GetValue("SpecialTerms") != null ){this.SpecialTerms = json.GetString("SpecialTerms");}
if(json.GetValue("Status") != null ){this.Status = json.GetString("Status");}
if(json.GetValue("Priority__c") != null ){this.Priority = (float)json.GetNumber("Priority__c");}
Debug.Log("This is priority on contract " + this.Priority + "" );
}
示例11: init
public void init(JSONObject json)
{
if(json.GetValue("Id") != null ){this.Id = json.GetString("Id");}
if(json.GetValue("IsActive") != null ){this.IsActive = json.GetString("IsActive");}
if(json.GetValue("ActualCost") != null ){this.ActualCost = json.GetString("ActualCost");}
if(json.GetValue("BudgetedCost") != null ){this.BudgetedCost = json.GetString("BudgetedCost");}
if(json.GetValue("CampaignMemberRecordType") != null ){this.CampaignMemberRecordType = json.GetString("CampaignMemberRecordType");}
if(json.GetValue("Name") != null ){this.Name = json.GetString("Name");}
if(json.GetValue("Owner") != null ){this.Owner = json.GetString("Owner");}
if(json.GetValue("NumberOfConvertedLeads") != null ){this.NumberOfConvertedLeads = json.GetNumber("NumberOfConvertedLeads");}
if(json.GetValue("CreatedBy") != null ){this.CreatedBy = json.GetString("CreatedBy");}
if(json.GetValue("Description") != null ){this.Description = json.GetString("Description");}
if(json.GetValue("EndDate") != null ){this.EndDate = json.GetString("EndDate");}
if(json.GetValue("ExpectedResponse") != null ){this.ExpectedResponse = json.GetString("ExpectedResponse");}
if(json.GetValue("ExpectedRevenue") != null ){this.ExpectedRevenue = json.GetString("ExpectedRevenue");}
if(json.GetValue("LastModifiedBy") != null ){this.LastModifiedBy = json.GetString("LastModifiedBy");}
if(json.GetValue("NumberSent") != null ){this.NumberSent = json.GetNumber("NumberSent");}
if(json.GetValue("NumberOfOpportunities") != null ){this.NumberOfOpportunities = json.GetNumber("NumberOfOpportunities");}
if(json.GetValue("NumberOfWonOpportunities") != null ){this.NumberOfWonOpportunities = json.GetNumber("NumberOfWonOpportunities");}
if(json.GetValue("Parent") != null ){this.Parent = json.GetString("Parent");}
if(json.GetValue("StartDate") != null ){this.StartDate = json.GetString("StartDate");}
if(json.GetValue("Status") != null ){this.Status = json.GetString("Status");}
if(json.GetValue("HierarchyActualCost") != null ){this.HierarchyActualCost = json.GetString("HierarchyActualCost");}
if(json.GetValue("HierarchyBudgetedCost") != null ){this.HierarchyBudgetedCost = json.GetString("HierarchyBudgetedCost");}
if(json.GetValue("NumberOfContacts") != null ){this.NumberOfContacts = json.GetNumber("NumberOfContacts");}
if(json.GetValue("HierarchyNumberOfContacts") != null ){this.HierarchyNumberOfContacts = json.GetNumber("HierarchyNumberOfContacts");}
if(json.GetValue("HierarchyNumberOfConvertedLeads") != null ){this.HierarchyNumberOfConvertedLeads = json.GetNumber("HierarchyNumberOfConvertedLeads");}
if(json.GetValue("HierarchyExpectedRevenue") != null ){this.HierarchyExpectedRevenue = json.GetString("HierarchyExpectedRevenue");}
if(json.GetValue("NumberOfLeads") != null ){this.NumberOfLeads = json.GetNumber("NumberOfLeads");}
if(json.GetValue("HierarchyNumberOfLeads") != null ){this.HierarchyNumberOfLeads = json.GetNumber("HierarchNumberOfLeads");}
if(json.GetValue("HierarchyNumberSent") != null ){this.HierarchyNumberSent = json.GetNumber("HierarchyNumberSent");}
if(json.GetValue("HierarchyNumberOfOpportunities") != null ){this.HierarchyNumberOfOpportunities = json.GetNumber("HierarchyNumberOfOpportunities");}
if(json.GetValue("NumberOfResponses") != null ){this.NumberOfResponses = json.GetNumber("NumberOfResponses");}
if(json.GetValue("HierarchyNumberOfResponses") != null ){this.HierarchyNumberOfResponses = json.GetNumber("HierArchyNumberOfResponses");}
if(json.GetValue("AmountAllOpportunities") != null ){this.AmountAllOpportunities = json.GetString("AmountAllOpportunities");}
if(json.GetValue("HierarchyAmountAllOpportunities") != null ){this.HierarchyAmountAllOpportunities = json.GetString("HierarchyAmountAllOpportunities");}
if(json.GetValue("AmountWonOpportunities") != null ){this.AmountWonOpportunities = json.GetString("AmountWonOpportunities");}
if(json.GetValue("HierarchyNumberOfWonOpportunities") != null ){this.HierarchyNumberOfWonOpportunities = json.GetString("HierarchyNumberOfWonOpportunities");}
if(json.GetValue("Type") != null ){this.Type = json.GetString("Type");}
if(json.GetValue("Priority__c") != null ){this.Priority = (float)json.GetNumber("Priority__c");}
}
示例12: init
public void init(JSONObject json)
{
if(json.GetValue("Id") != null ){this.Id = json.GetString("Id");}
if(json.GetValue("Acount") != null ){this.accountName = json.GetString("Acount");}
if(json.GetValue("Amount") != null ){this.amount = json.GetString("Amount");}
if(json.GetValue("CloseDate") != null ) {this.closeDate = json.GetString("CloseDate");}
//if(json.GetValue("Contract") != null ) {this.contract = json.GetString("Contract");}
if(json.GetValue("CreatedBy") != null ) {this.createdBy = json.GetString("CreatedBy");}
if(json.GetValue("Description") != null ) {this.description = json.GetString("Description");}
if(json.GetValue("ExpectedRevenue") != null ) {this.expectedRevenue = json.GetNumber("ExpectedRevenue");}
if(json.GetValue("ForecastCategoryName") != null ) {this.forecastCategoryName = json.GetString("ForecastCategoryName");}
if(json.GetValue("LastModifiedBy") != null ) {this.lastModifiedBy = json.GetString("LastModifiedBy");}
if(json.GetValue("LeadSource") != null ) {this.leadSource = json.GetString("LeadSource");}
if(json.GetValue("NextStep") != null ) {this.nextStep = json.GetString("NextStep");}
if(json.GetValue("Name") != null ) {this.oppName = json.GetString("Name");}
if(json.GetValue("Owner") != null ) {this.owner = json.GetString("Owner");}
if(json.GetValue("Pricebook2") != null ) {this.pricebook2 = json.GetString("Pricebook2");}
if(json.GetValue("IsPrivate") != null ) {this.isPrivate = json.GetBoolean("IsPrivate");}
if(json.GetValue("Probability") != null ) {this.probability = json.GetNumber("Probability");}
if(json.GetValue("TotalOpportunityQuantity") != null ) {this.quantity = json.GetNumber("TotalOpportunityQuantity");}
if(json.GetValue("StageName") != null ) {this.stageName = json.GetString("StageName");}
if(json.GetValue("Type") != null ) {this.type = json.GetString("Type");}
if(json.GetValue("Urgent__c") != null ) {this.urgent = (float)json.GetNumber("Urgent__c");}
if(json.GetValue("Urgent__c") != null ) {this.urgent = (float)json.GetNumber("Urgent__c");}
//create and add account.
if(json.GetObject("Account") != null){
Account account = Account.CreateInstance("Account") as Account;
account.init(json.GetObject("Account"));
this.account = account;
}
//create and add opportunitylineitems/oppProducts
if(json.GetObject("OpportunityLineItems") != null){
JSONArray rowRecords = json.GetObject("OpportunityLineItems").GetArray ("records");
List <OpportunityProduct> oppProducts = new List<OpportunityProduct>();
foreach (JSONValue row in rowRecords) {
OpportunityProduct oppProduct = OpportunityProduct.CreateInstance("OpportunityProduct") as OpportunityProduct;
Debug.Log("opp product" + row.ToString());
JSONObject rec = JSONObject.Parse(row.ToString());
oppProduct.init(rec);
oppProducts.Add(oppProduct);
}
this.oppProducts = oppProducts;
}
//create and add campaign.
if(json.GetObject("Campaign") != null){
Campaign campaign = Campaign.CreateInstance("Campaign") as Campaign;
campaign.init(json.GetObject("Campaign"));
this.campaign = campaign;
}
//create and add account.
if(json.GetObject("Contract") != null){
Contract contract = Contract.CreateInstance("Contract") as Contract;
contract.init(json.GetObject("Contract"));
this.contract = contract;
}
}
示例13: init
public void init(JSONObject json)
{
if(json.GetValue("Id") != null ){this.Id = json.GetString("Id");}
if(json.GetValue("Name") != null ){this.Name = json.GetString("Name");}
if(json.GetValue("AccountNumber") != null ){this.AccountNumber = json.GetString("AccountNumber");}
if(json.GetValue("Owner") != null ){this.Owner = json.GetString("Owner");}
if(json.GetValue("Site") != null ){this.Site = json.GetString("Site");}
if(json.GetValue("AcountSource") != null ){this.AccountSource = json.GetString("AcountSource");}
if(json.GetValue("AnnualRevenue") != null ){this.AnnualRevenue = json.GetString("AnnualRevenue");}
if(json.GetValue("BillingAddress") != null ){this.BillingAddress = json.GetString("BillingAddress");}
if(json.GetValue("CreatedBy") != null ){this.CreatedBy = json.GetString("CreatedBy");}
if(json.GetValue("DandbCompany") != null ){this.DandbCompany = json.GetString("DandbCompany");}
if(json.GetValue("NumberOfEmployees") != null ){this.NumberOfEmployees = json.GetNumber("NumberOfEmployees");}
if(json.GetValue("Fax") != null ){this.Fax = json.GetString("Fax");}
if(json.GetValue("Industry") != null ){this.Industry = json.GetString("Industry");}
if(json.GetValue("LastModifiedBy") != null ){this.LastModifiedBy = json.GetString("LastModifiedBy");}
if(json.GetValue("NaicsCode") != null ){this.NaicsCode = json.GetString("NaicsCode");}
if(json.GetValue("NaicsDesc") != null ){this.NaicsDesc = json.GetString("NacisDesc");}
if(json.GetValue("Ownership") != null ){this.Ownership = json.GetString("Ownership");}
if(json.GetValue("Parent") != null ){this.Parent = json.GetString("Parent");}
if(json.GetValue("Phone") != null ){this.Phone = json.GetString("Phone");}
if(json.GetValue("Rating") != null ){this.Rating = json.GetString("Rating");}
if(json.GetValue("ShippingAddress") != null ){this.ShippingAddress = json.GetString("ShippingAddress");}
if(json.GetValue("Sic") != null ){this.Sic = json.GetString("Sic");}
if(json.GetValue("SicDesc") != null ){this.SicDesc = json.GetString("SicDesc");}
if(json.GetValue("TickerSymbol") != null ){this.TickerSymbol = json.GetString("TickerSymbol");}
if(json.GetValue("Tradestyle") != null ){this.Tradestyle = json.GetString("Tradestyle");}
if(json.GetValue("Type") != null ){this.Type = json.GetString("Type");}
if(json.GetValue("Website") != null ){this.Website = json.GetString("Website");}
if(json.GetValue("YearStarted") != null ){this.YearStarted = json.GetString("YearStarted");}
if(json.GetValue("Description") != null ){this.Description = json.GetString("Description");}
if(json.GetValue("CustomerPriority__c") != null ){this.CustomerPriority = json.GetString("CustomerPriority__c");}
if(json.GetValue("UpsellOpportunity__c") != null ){this.UpsellOpportunity = json.GetString("UpsellOpportunity__c");}
if(json.GetValue("Priority__c") != null ){this.Priority = (float)json.GetNumber("Priority__c");}
}