本文整理汇总了C#中JSONObject.GetObject方法的典型用法代码示例。如果您正苦于以下问题:C# JSONObject.GetObject方法的具体用法?C# JSONObject.GetObject怎么用?C# JSONObject.GetObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONObject
的用法示例。
在下文中一共展示了JSONObject.GetObject方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateRowData
public void UpdateRowData(JSONObject data) {
rowData = data;
leftUserData = data.GetObject("left");
if (data.ContainsKey("right")) {
rightUserData = data.GetObject("right");
} else {
rightUserData = null;
}
if (leftUserData != null) {
Utils.SetActive(leftUser, true);
leftUsernameLabel.text = leftUserData.GetString("displayName");
leftCheckbox.value = leftCheckboxState;
EventDelegate.Set(leftCheckboxListener.onClick, delegate() { EventCheckboxChanged(true); });
} else {
Utils.SetActive(leftUser, false);
}
if (rightUserData != null) {
Utils.SetActive(rightUser, true);
rightUsernameLabel.text = rightUserData.GetString("displayName");
rightCheckbox.value = rightCheckboxState;
EventDelegate.Set(rightCheckboxListener.onClick, delegate() { EventCheckboxChanged(false); });
} else {
Utils.SetActive(rightUser, false);
}
}
示例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: LoadUserInfoSuccess
void LoadUserInfoSuccess(JSONObject data) {
PopupManager.Instance.HideLoadingIndicator();
JSONObject user = data.GetObject("user");
if (user.ContainsKey("errorCode")) {
ErrorCode.USER errorCode = (ErrorCode.USER)user.GetInt("errorCode");
HUDManager.Instance.AddFlyText(errorCode.ToString(), Vector3.zero, 40, Color.red);
} else {
if (PopupManager.Instance.PopupUserInfo != null) {
PopupManager.Instance.PopupUserInfo.DisplayUserInfo(user);
} else {
PopupUserInfo.SetUser(user);
}
}
}
示例4: initMain
public void initMain(JSONObject rec, WindowHandler inHandler)
{
JSONObject actor = rec.GetObject("actor");
string name = actor.GetString ("displayName");
nameText.text = name;
JSONObject feedBody = rec.GetObject ("body");
string body = feedBody.GetString ("text");
if (body == null) {
JSONObject header = rec.GetObject ("header");
body = header.GetString ("text");
}
bodyText.text = body;
JSONObject photo = actor.GetObject ("photo");
photoUrl = photo.GetString ("largePhotoUrl");
JSONObject capabilities = rec.GetObject ("capabilities");
JSONValue approval = capabilities.GetValue ("approval");
if (approval != null) {
string id = approval.Obj.GetString ("id");
if (id != null) {
enableApproval(approval.Obj.GetString ("id"));
}
}
if (!isApproval) {
approveButton.enabled = false;
approveButton.GetComponent<CanvasRenderer>().SetAlpha(0);
rejectButton.enabled = false;
rejectButton.GetComponent<CanvasRenderer>().SetAlpha(0);
}
handler = inHandler;
photoRetrieved = false;
}
示例5: Init
public void Init(JSONObject jsonData) {
roomId = jsonData.GetString("roomId");
userGames.Clear();
JSONArray userGameArray = jsonData.GetArray("userGames");
for (int i = 0; i < userGameArray.Length; i++) {
userGames.Add(new TLMBGame(userGameArray[i].Obj));
}
droppedCards = new TLMBCombination(jsonData.GetString("droppedCards"));
roundDroppedCards = new TLMBCombination(jsonData.GetString("roundDroppedCards"));
activeUserSeatIndex = jsonData.GetInt("activeUserSeatIndex");
state = (State)jsonData.GetInt("state");
gameConfig = new TLMBGameConfig(jsonData.GetObject("gameConfig"));
remainingSeconds = jsonData.GetInt("remainingSeconds");
}
示例6: 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();
}
示例7: Awake
private JSONObject difficultySettings; //time, dimensions, nodeCount, errorMargin
#endregion Fields
#region Methods
private void Awake()
{
current = new string[difficulties.Length, data.Length];
TextAsset config = Resources.Load("configuration") as TextAsset;
difficultySettings = JSONObject.Parse(config.text);
for (int i = 0; i < difficulties.Length; i++)
{
JSONObject difficulty = difficultySettings.GetObject(difficulties[i].ToString());
current[(int)difficulties[i], (int)Data.NodeCount] = ((int)difficulty.GetNumber(nodeCount)).ToString();
current[(int)difficulties[i], (int)Data.Time] = ((float)difficulty.GetNumber(time)).ToString();
current[(int)difficulties[i], (int)Data.ErrorMargin] = ((float)difficulty.GetNumber(errorMargin)).ToString();
JSONObject vector = difficulty.GetObject(dimensions);
current[(int)difficulties[i], (int)Data.DimensionX] = ((int)vector.GetNumber("x")).ToString();
current[(int)difficulties[i], (int)Data.DimensionY] = ((int)vector.GetNumber("y")).ToString();
}
}
示例8: UpdateSeats
public override void UpdateSeats(JSONObject jsonData) {
JSONArray userList = jsonData.GetObject("gameRoom").GetArray("userGames");
users = new JSONObject();
for (int i = 0 ; i < userList.Length; i++) {
users.Add(userList[i].Obj.GetInt("seatIndex").ToString(), userList[i].Obj);
}
// FAKE user joined
for (int i = 0; i < 4; i++) {
GameObject tempUser;
PlayerSlotScript playerScript = playerHolder[i];
JSONObject user = users.ContainsKey(i.ToString()) ? users.GetObject(i.ToString()) : null;
if (user != null) {
playerScript.Init(user.GetString("userId"), "Dan Choi" + (i + 1), (i + 1) * 200000, string.Empty);
} else {
playerScript.InitEmpty();
}
}
}
示例9: SpinData
public SpinData(string username, JSONObject jsonData, bool isYou) {
Debug.Log("SpinData: " + jsonData.ToString());
this.isYou = isYou;
this.username = username;
JSONArray resultsData = jsonData.GetArray("items");
JSONObject extraData = SlotCombination.CalculateCombination(resultsData, jsonData.GetInt("nL"));
JSONArray winningCount = extraData.GetArray("wCount");
JSONArray winningType = extraData.GetArray("wType");
JSONArray winningGold = jsonData.GetArray("wGold");
for (int i = 0; i < winningGold.Length; i++) {
totalDamage += (int)winningGold[i].Number;
}
if (jsonData.ContainsKey("newBoss")) {
newBossData = jsonData.GetObject("newBoss");
JSONArray bossDrops = jsonData.GetArray("dropItems");
dropCash = (int)bossDrops[0].Number;
dropGem = (int)bossDrops[1].Number;
bossDrops = null;
AccountManager.Instance.bossKilled++;
}
for (int i = 0; i < winningCount.Length; i++) {
if (winningCount[i].Number >= 3 || ((int)winningType[i].Number == (int)SlotItem.Type.TILE_1 && winningCount[i].Number >= 2)) {
spawnSkills.Add(new SpawnableSkill((int)winningType[i].Number, (int)winningCount[i].Number, (int)winningGold[i].Number, isYou));
}
}
extraData = null;
resultsData = null;
winningCount = null;
winningType = null;
winningGold = null;
}
示例10: Deserialize
public override void Deserialize(JSONObject obj)
{
JSONObject tempObj = obj.GetObject(cAppraise);
DnDSkillField tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Appraise = tempField;
tempObj = obj.GetObject(cBalance);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Balance = tempField;
tempObj = obj.GetObject(cBluff);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Bluff = tempField;
tempObj = obj.GetObject(cClimb);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Climb = tempField;
tempObj = obj.GetObject(cConcentration);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Concentration = tempField;
tempObj = obj.GetObject(cDecipherScript);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
DecipherScript = tempField;
tempObj = obj.GetObject(cDiplomacy);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Diplomacy = tempField;
tempObj = obj.GetObject(cDisableDevice);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
DisableDevice = tempField;
tempObj = obj.GetObject(cDisguise);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Disguise = tempField;
tempObj = obj.GetObject(cEscapeArtist);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
EscapeArtist = tempField;
tempObj = obj.GetObject(cForgery);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Forgery = tempField;
tempObj = obj.GetObject(cGatherInformation);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
GatherInformation = tempField;
tempObj = obj.GetObject(cHandleAnimal);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
HandleAnimal = tempField;
tempObj = obj.GetObject(cHeal);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Heal = tempField;
tempObj = obj.GetObject(cHide);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Hide = tempField;
tempObj = obj.GetObject(cIntimidate);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Intimidate = tempField;
tempObj = obj.GetObject(cJump);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Jump = tempField;
tempObj = obj.GetObject(cListen);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Listen = tempField;
tempObj = obj.GetObject(cMoveSilently);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
MoveSilently = tempField;
tempObj = obj.GetObject(cOpenLock);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
OpenLock = tempField;
tempObj = obj.GetObject(cRide);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Ride = tempField;
tempObj = obj.GetObject(cSearch);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
Search = tempField;
tempObj = obj.GetObject(cSenseMotive);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
SenseMotive = tempField;
tempObj = obj.GetObject(cSleightOfHand);
tempField = new DnDSkillField();
tempField.Deserialize(tempObj);
SleightOfHand = tempField;
tempObj = obj.GetObject(cSpellCraft);
tempField = new DnDSkillField();
//.........这里部分代码省略.........
示例11: Awake
private void Awake()
{
current = new string[difficulties.Length, data.Length];
if (!PlayerPrefs.HasKey("difficultySettings"))
{
createNonExistentSettings();
}
difficultySettings = JSONObject.Parse(PlayerPrefs.GetString("difficultySettings"));
for (int i = 0; i < difficulties.Length; i++)
{
JSONObject difficulty = difficultySettings.GetObject(difficulties[i].ToString());
current[(int)difficulties[i], (int)Data.NodeCount] = ((int)difficulty.GetNumber(nodeCount)).ToString();
current[(int)difficulties[i], (int)Data.Time] = ((float)difficulty.GetNumber(time)).ToString();
current[(int)difficulties[i], (int)Data.ErrorMargin] = ((float)difficulty.GetNumber(errorMargin)).ToString();
JSONObject vector = difficulty.GetObject(dimensions);
current[(int)difficulties[i], (int)Data.DimensionX] = ((int)vector.GetNumber("x")).ToString();
current[(int)difficulties[i], (int)Data.DimensionY] = ((int)vector.GetNumber("y")).ToString();
}
}
示例12: 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));
}
}
}
示例13: 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;
}
}
示例14: 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;
}
}