IEnumerator InitializeManager() { query.Where("id", "=", UniqueID); yield return(query.FindAsync()); var result = query.Result.FirstOrDefault(); if (result == null) { result = new SpreadSheetObject("Ranking"); result["id"] = UniqueID; result["Rank"] = 0; rankText.text = "高く積み上げて点数を稼ごう!"; yield return(result.SaveAsync()); } else { Debug.Log("result[\"Rank\"].ToString()=>" + result["Rank"].ToString()); currentRank = int.Parse(result["Rank"].ToString()); rankText.text = "最高点は" + currentRank + "点です。"; query.Where("Rank", ">", currentRank); yield return(query.CountAsync()); orders = (query.Count < 1 ? 1 : query.Count); rankText.text += "\n順位は" + orders + "位 です。"; } }
/// <summary> /// /// </summary> /// <returns></returns> private IEnumerator ChatLogGetIterator() { SpreadSheetQuery query; try { query = new SpreadSheetQuery("Kimsan"); } catch (Exception e) { exceptionOccurredFlag = true; Debug.Log(e); yield break; } query.Limit(1); // 1つだけ取得 yield return(query.FindAsync()); foreach (var so in query.Result) { serializedTextFromServer = so["name"].ToString(); } completeGetTextFromServer = true; yield break; }
/// <summary> /// /// </summary> /// <returns></returns> private IEnumerator ChatLogSetIterator() { SpreadSheetQuery query; try { query = new SpreadSheetQuery("Kimsan"); } catch (Exception e) { exceptionOccurredFlag = true; completeSetTextToServer = true; Debug.Log(e); yield break; } query.Where("rank", "=", "1"); yield return(query.FindAsync()); var so = query.Result.FirstOrDefault(); if (so != null) { so["name"] = serializedTextToServer; yield return(so.SaveAsync()); } completeSetTextToServer = true; yield break; }
private IEnumerator GetChatLogIterator() { while (true) { var query = new SpreadSheetQuery("Chat"); query.OrderByDescending("createTime").Where("createTime", ">", lastGetTime).Limit(20); yield return(query.FindAsync()); if (query.Count > 0) { foreach (var so in query.Result.Reverse()) { chatLogList.Insert(0, so["name"] + ">" + so["message"]); if (chatLogList.Count > 17) { chatLogList.Remove(chatLogList.Last()); } } logText.text = string.Join("\n", chatLogList.ToArray()); lastGetTime = (long)query.Result.First()["createTime"]; } yield return(new WaitForSeconds(5.0f)); } }