/// <summary> /// プレゼントを開く /// </summary> /// <param name="present_ids"></param> /// <param name="isAll">全部受け取りかどうか</param> private void presentOpen(long[] present_ids, bool isAll = false, bool isNoticeEnable = false) { var serverApi = ServerDataUtilSend.SendPacketAPI_PresentOpen(present_ids); // SendStartの成功時の振る舞い serverApi.setSuccessAction(_data => { UserDataAdmin.Instance.m_StructPlayer = _data.UpdateStructPlayer <RecvPresentOpen>(UserDataAdmin.Instance.m_StructPlayer); UserDataAdmin.Instance.ConvertPartyAssing(); // 開封結果を取得 var presentOpen = _data.GetResult <RecvPresentOpen>().result; // プレゼントリストを更新 UserDataAdmin.Instance.m_StructPresentList = UserDataAdmin.PresentListClipTimeLimit(presentOpen.present); // プレゼント開封個数 var presentOpenArray = presentOpen.open_serial_id; for (int i = 0; i < presentOpenArray.Length; ++i) { // レコードcontextを、DoneRecordsへ移動 moveRecord(presentOpenArray[i]); } updatePresentList(false); // レコード数の更新 RecordCount0 = Records0.Count; RecordCount1 = Records1.Count; RecordCount2 = Records0.Where(p => p.NoticeEnable == false).ToList().Count; //---------------------------------------------------- // 開封結果ダイアログの表示 //---------------------------------------------------- if (isAll) { PresentAllOpenResultMessage(presentOpen); } else { PresentOneOpenResultMessage(presentOpen, isNoticeEnable); } // ページ表示の更新 //StartCoroutine(PageUpdate()); }); // SendStartの失敗時の振る舞い serverApi.setErrorAction(_data => { #if BUILD_TYPE_DEBUG Debug.Log("MASTER_HASH_GET:Error"); #endif }); serverApi.SendStart(); }
/// <summary> /// プレゼントリストの更新 /// </summary> /// <param name="isUpdateLog">受け取り済みのリストの更新も行う</param> public void updatePresentList(bool isUpdateLog = true) { // プレゼント(受領前) Records0.Clear(); var present = UserDataAdmin.Instance.m_StructPresentList; if (present != null) { for (int i = 0; i < present.Length; i++) { // プレゼントリストの追加 AddRecord(0, present[i]); } // レコード数の更新 RecordCount0 = Records0.Count; RecordCount2 = Records0.Where(p => p.NoticeEnable == false).ToList().Count; } // プレゼント(受領済み) if (isUpdateLog) { StartCoroutine(WaitSentStart(() => { var serverApi = ServerDataUtilSend.SendPacketAPI_GetPresentOpenLog(); // SendStartの成功時の振る舞い serverApi.setSuccessAction(_data => { Records1.Clear(); RecvGetPresentOpenLogValue result = _data.GetResult <RecvGetPresentOpenLog>().result; if (result == null || result.present == null) { return; } for (int i = 0; i < result.present.Length; i++) { // プレゼントリストの追加 AddRecord(1, result.present[i]); } // レコード数の更新 RecordCount1 = Records1.Count; }); // SendStartの失敗時の振る舞い serverApi.setErrorAction(_date => { #if BUILD_TYPE_DEBUG Debug.Log("MASTER_HASH_GET:Error"); #endif }); serverApi.SendStart(); })); } }
private IEnumerator PageUpdate() { RecordCount0 = Records0.Count; RecordCount1 = Records1.Count; RecordCount2 = Records0.Where(p => p.NoticeEnable == false).ToList().Count; yield return(new WaitForSeconds(0.1f)); ViewPage = 0; UpdatePage(0); }
// 「すべて受領」ボタンのフィードバック public void OnClickdeTakeAllButton() { if (ServerApi.IsExists == true) { return; } if (GlobalMenuManager.Instance.IsPageClosing() == true) { return; } if (GlobalMenuManager.Instance.IsCangeTime()) { return; } long[] ids = Records0.Where(p => p.NoticeEnable == false).ToList().Select(p => p.FixId).ToArray(); presentOpen(ids, true); SoundUtil.PlaySE(SEID.SE_MENU_OK); }