本文整理汇总了C#中JSONArray.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# JSONArray.ToString方法的具体用法?C# JSONArray.ToString怎么用?C# JSONArray.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONArray
的用法示例。
在下文中一共展示了JSONArray.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public override void Init(object[] data) {
gameType = (BaseGameScreen.GameType)data[0];
EventDelegate.Set(btnBack.onClick, BackToSelectGame);
EventDelegate.Set(btnCreateRoom.onClick, OpenPopupCreateRoom);
// fake room list
// roomList = new JSONArray();
roomList = ((JSONObject)data[1]).GetArray("rooms");
Debug.Log(roomList.ToString());
// fake room min bet
// int[] roomBet = new int[] { 10000, 100000, 520000, 2000000};
// for (int i = 0; i < roomList.Length; i++) {
// JSONObject room = roomList[i].Obj;
// room.Add("id", i);
// room.Add("name", "room " + i);
// room.Add("minBet", roomBet[i % 4]);
// // roomList.Add(room);
// }
InitScrollViewData();
// Set Bet Filter
for (int i = 0; i < betFilterList.Length; i++) {
betFilterPopupList.items.Add(betFilterList[i]);
}
EventDelegate.Set(betFilterPopupList.onChange, EventFilterBet);
crtBetFilter = betFilterList[0];
}
示例2: EventSendInvite
void EventSendInvite() {
if (listInviteUsers.Count > 0) {
JSONArray arr = new JSONArray();
for (int i = 0; i < listInviteUsers.Count; i++) {
arr.Add(listInviteUsers[i]);
}
Debug.Log("EventSendInvite " + arr.ToString());
UserExtensionRequest.Instance.InviteToGame(arr, ScreenManager.Instance.CurrentSlotScreen.GetCrtGameType(), ScreenManager.Instance.CurrentSlotScreen.GetRoomId());
Close();
}
}
示例3: LoadInboxCallback
public void LoadInboxCallback(JSONArray messages) {
isLoading = false;
if (messages != null && messages.Length > 0) {
Debug.Log("LoadInboxCallback " + messages.ToString());
messageList = messages;
Utils.SetActive(noMessageLabel, false);
Utils.SetActive(scrollview.gameObject, true);
InitScrollViewData();
// Hide notice and update lastReadInboxMes
AccountManager.Instance.lastInboxTime = AccountManager.Instance.lastReadInboxTime = messages[messages.Length - 1].Obj.GetLong("createdAt");
if (ScreenManager.Instance.SelectGameScreen != null) {
ScreenManager.Instance.SelectGameScreen.ShowOrHideMailNotice();
}
} else {
Utils.SetActive(noMessageLabel, true);
Utils.SetActive(scrollview.gameObject, false);
}
}
示例4: SavePlayerData
public void SavePlayerData()
{
JSONArray array = new JSONArray ();
foreach (Player p in players) {
JSONObject player = new JSONObject ();
player.Add ("id", p.Id);
player.Add ("name", p.Name);
JSONArray levels = new JSONArray ();
foreach (LevelData l in p.Levels.Values) {
JSONObject jLevel = new JSONObject ();
jLevel.Add ("id", l.Id);
jLevel.Add ("stepCount", l.StepCount);
levels.Add (jLevel);
}
player.Add ("levels", levels);
array.Add (player);
}
PlayerPrefs.SetString ("players", array.ToString ());
PlayerPrefs.Save ();
}
示例5: HandleChange
public static JSONObject HandleChange(JSONArray request)
{
var provider = new LinqIt.UmbracoCustomFieldTypes.UmbracoTreeModuleProvider(HttpContext.Current.Request.QueryString["itemId"]);
var placeholderData = provider.GetPlaceholderData();
var layout = provider.GetLayout().Rows.SelectMany(r => r.Cells).ToArray();
var result = layout.ToDictionary(cell => cell.Key, cell => new GridPlaceholderData(cell.Key, cell.ColumnSpan));
var response = new JSONObject();
var messages = new JSONArray();
response.AddValue("messages", messages);
foreach (JSONObject replacement in request.Values)
{
var from = (string) replacement["from"];
var id = (string) replacement["id"];
var to = (string) replacement["to"];
var message = new JSONObject();
message.AddValue("ph", from);
message.AddValue("id", id);
if (string.IsNullOrEmpty(to))
{
message.AddValue("type", "alert");
message.AddValue("text", _removedMessage);
}
else
{
var oldItem = placeholderData[from].Items.Where(i => i.Id == id).FirstOrDefault();
var newItem = provider.GetItem(id);
newItem.ColumnSpan = oldItem.ColumnSpan;
var cell = result[to];
if (cell.Items.Where(i => i.Id == newItem.Id).Any())
{
message.AddValue("type", "alert");
message.AddValue("text", _duplicateMessage);
}
else
{
if (cell.Span < newItem.ColumnSpan)
{
newItem.ColumnSpan = provider.GetItemColumnOptions(id).Where(o => o <= cell.Span).Max();
message.AddValue("type", "info");
message.AddValue("text", string.Format(_resizedMessage, newItem.ColumnSpan));
}
else
{
message.AddValue("type", "ok");
}
cell.AddItem(newItem);
}
}
messages.AddValue(message);
}
response.AddValue("hiddenId", HttpContext.Current.Request.QueryString["hiddenId"]);
var values = new JSONArray();
values.AddRange(result.Values.Select(v => v.ToJSON()).ToArray());
response.AddValue("value", values.ToString());
return response;
}
示例6: Update
void Update()
{
if (dummyMessageTimer >= 0) {
if(Mathf.Abs(dummyMessageTimer - Time.time) >= 0.3f) {
string msgJson = "MESG{\"channel_id\": \"0\", \"message\": \"Dummy Text on Editor Mode - " + Time.time + "\", \"user\": {\"image\": \"http://url\", \"name\": \"Sender\"}, \"ts\": 1418979273365, \"scrap_id\": \"\"}";
_OnMessageReceived(msgJson);
dummyMessageTimer = Time.time;
}
}
if (dummyChannelListFlag) {
dummyChannelListFlag = false;
JSONArray channels = new JSONArray();
JSONClass channel = new JSONClass();
channel.Add ("id", new JSONData(1));
channel.Add ("channel_url", new JSONData("app_prefix.channel_url"));
channel.Add ("name", new JSONData("Sample"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(2));
channel.Add ("channel_url", new JSONData("app_prefix.Unity3d"));
channel.Add ("name", new JSONData("Unity3d"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(3));
channel.Add ("channel_url", new JSONData("app_prefix.Lobby"));
channel.Add ("name", new JSONData("Lobby"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(4));
channel.Add ("channel_url", new JSONData("app_prefix.Cocos2d"));
channel.Add ("name", new JSONData("Cocos2d"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(5));
channel.Add ("channel_url", new JSONData("app_prefix.GameInsight"));
channel.Add ("name", new JSONData("GameInsight"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(6));
channel.Add ("channel_url", new JSONData("app_prefix.iOS"));
channel.Add ("name", new JSONData("iOS"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(7));
channel.Add ("channel_url", new JSONData("app_prefix.Android"));
channel.Add ("name", new JSONData("Android"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(8));
channel.Add ("channel_url", new JSONData("app_prefix.News"));
channel.Add ("name", new JSONData("News"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(9));
channel.Add ("channel_url", new JSONData("app_prefix.Lobby"));
channel.Add ("name", new JSONData("Lobby"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
channel.Add ("id", new JSONData(10));
channel.Add ("channel_url", new JSONData("app_prefix.iPad"));
channel.Add ("name", new JSONData("iPad"));
channel.Add ("cover_img_url", new JSONData("http://localhost/image.jpg"));
channel.Add ("member_count", new JSONData(999));
channels.Add(channel.ToString());
_OnQueryChannelList(channels.ToString());
}
}