/// <summary> /// 本地添加一条订单记录, 防止漏单 /// </summary> /// <param name="userID"></param> /// <param name="payLoad"></param> public void AddItemIAPTransaction(string userID, string transactionID, string payLoad, string price) { string logStr = ""; if (userID == null || userID == "" || transactionID == null || transactionID == "" || payLoad == null || payLoad == "" || price == null || price == "") { logStr = "数据错误,无法添加订单记录: 用户ID:" + userID + ", 订单ID:" + transactionID + ", 收据:" + payLoad + ", 价钱:" + price; //if (Manager) Manager.log(logStr); LogManager.Log(logStr); return; } IAPVerifyTempItem Transaction = new IAPVerifyTempItem(); Transaction.userID = userID; Transaction.transactionID = transactionID; Transaction.payLoad = payLoad; Transaction.price = price; TransactionTemp.Add(Transaction); SaveDataUtils.Save <IAPVerifyProxy>(); logStr = "本地添加一条订单记录, 防止漏单: 用户ID:" + userID + ", 订单ID:" + transactionID + ", 当前有" + TransactionTemp.Count + "条待处理订单(漏单)"; //if (Manager) Manager.log(logStr); LogManager.Log(logStr); }
/// <summary> /// 获取当前用户的所有关卡的状态信息 /// </summary> public static void GetCourseFormServer() { SaveDataUtils.Load <SelfPlayerRoleTitleData> (); JsonData data = new JsonData(); data["userID"] = SelfPlayerData.Uuid; DancingWordAPI.Instance.RequestCourseFromServer(data, (string result) => { LogManager.Log(result); JsonData resultData = JsonMapper.ToObject(result); JsonData courseData = resultData["data"]; List <CourseData> courseDatas = new List <CourseData> (); for (int i = 0; i < courseData.Count; i++) { courseDatas.Add(new CourseData() { m_CourseID = int.Parse(courseData[i].TryGetString("courseID")), m_Progress = int.Parse(courseData[i].TryGetString("progress")), m_IsPay = bool.Parse(courseData[i].TryGetString("isPay")) }); } SelfPlayerData.CourseData = courseDatas; SaveDataUtils.Save <SelfPlayerData> (); SelfPlayerData.LevelStatus = SelfPlayerData.Instance.CreateLevelStatusDic(); //测试 //LevelStatus dic = SelfPlayerData.Instance.GetLevelStatusByLevelId(1003); //print(dic.isPay + "=====" + dic.isLock); //SelfPlayerData.Instance.SetLevelStatus(1002); }, () => { ///print("GetCourse"); SaveDataUtils.Load <SelfPlayerData> (); SelfPlayerData.LevelStatus = SelfPlayerData.Instance.CreateLevelStatusDic(); }); }
/// <summary> /// 从服务器获取当前用户的所有称号数据并保存到本地 /// </summary> private void GetRoleTitleDataFromServer() { JsonData data = new JsonData(); data["userID"] = SelfPlayerData.Uuid; DancingWordAPI.Instance.RequestRoleTitleFromServer(data, (string result) => { //print(result); JsonData jsonResult = JsonMapper.ToObject(result)["data"]; roleTitleObjectList = new List <RoleTitleItemObject>(); for (int i = 0; i < jsonResult.Count; i++) { RoleTitleItemObject roleTitleItemObject = new RoleTitleItemObject(); roleTitleItemObject.roletitleId = int.Parse(jsonResult[i].TryGetString("titleID")); roleTitleItemObject.roletitleCount = int.Parse(jsonResult[i].TryGetString("progress")); roleTitleItemObject.roleTitleStatus = bool.Parse(jsonResult[i].TryGetString("isUsed")) != true ? RoleTitleStatus.NotWear : RoleTitleStatus.Weared; roleTitleObjectList.Add(roleTitleItemObject); } roleTitleObjectList.Sort(); SelfPlayerRoleTitleData.RoleTitleList = roleTitleObjectList; SaveDataUtils.Save <SelfPlayerRoleTitleData>(); CreateRoleTitleItem(); }, () => { SaveDataUtils.Load <SelfPlayerRoleTitleData>(); SelfPlayerRoleTitleData.RoleTitleList.Sort(); roleTitleObjectList = SelfPlayerRoleTitleData.RoleTitleList; if (roleTitleObjectList != null) { CreateRoleTitleItem(); } }); }
public static void SaveToLocal(int new_score, float accuracy, int combo, int life, float readAccuracy, float wordAccuracy, string processData) { new_score = Mathf.Clamp(new_score, 0, 999999999); ScoreIncrement = new_score - MaxScore; TempScore = new_score; TempAccuracy = accuracy; TempMaxCombo = combo; TempLeftLife = life; TempReadAccuracy = readAccuracy; TempWordAccuracy = wordAccuracy; TempSelfLevelProcessData = processData; if (ScoreIncrement <= 0 || life == -1) { ScoreIncrement = 0; //return; } // 解锁关卡 if (SelfPlayerData.Instance.GetLevelStatusByLevelId(StaticData.LevelID + 1).isPay&& !SelfPlayerData.Instance.GetLevelStatusByLevelId(StaticData.LevelID + 1).isUnLock) { SelfPlayerData.Instance.SetLevelStatus(StaticData.LevelID); LogManager.Log(" 解锁关卡 = ", StaticData.LevelID); } CurInfo.maxScore = new_score; CurInfo.accuracy = accuracy; CurInfo.maxCombo = combo; CurInfo.leftLife = life; CurInfo.readAccuracy = readAccuracy; CurInfo.wordAccuracy = wordAccuracy; CurInfo.rank = -1; SaveDataUtils.Save <SelfPlayerData> (); }
private void OnClickCloseCallBack() { //print("OK"); GetComponent <DOTweenAnimation>().DOPlayBackwards(); SaveDataUtils.Save <SelfPlayerRoleTitleData>(); DancingWordAPI.Instance.UpDateServerRoleTitleInfo(SelfPlayerRoleTitleData.RoleTitleList); }
public void RefreshDownloadStatus(int status, bool refreshVersion = false) { DownloadStatus = status; if (refreshVersion) { CurrentDownloadVersion = MiscUtils.GetVersion(); } SaveDataUtils.Save <AssetBundleSaveData>(); }
private void SaveRoleInforToLocal(string nickName, string modelId, string emotionId) { SelfPlayerData.Nickname = nickName; SelfPlayerData.ModelId = modelId; SelfPlayerData.EmotionId = emotionId; SaveDataUtils.Save <SelfPlayerData> (); //这时结束玩家第一次进游戏流程 PlayerPrefs.SetString("isFirst", "True"); AnalysisManager.Instance.OnEvent("enterTasteLevel", null); LoadSceneManager.Instance.LoadPlayScene(LevelConfig.AllLevelDic[1001]); }
void OnClickYes() { SelfPlayerData.Nickname = text_name.text; SelfPlayerData.AvatarUrl = image_self.sprite.name.Replace("(Clone)", ""); SelfPlayerLevelData.Instance.changeNameEvent.Invoke(); SaveDataUtils.Save <SelfPlayerData>(); if (MiscUtils.IsOnline() && !string.IsNullOrEmpty(SelfPlayerData.Uuid)) { HttpHandler.UploadUser(); } //node_scoreListNode.text_playerName.text = text_name.text; Close(); }
/// 存入 SelfPlayerLevelData public static void UploadScore(Action callback = null, bool successNeedCallback = true, bool failNeedCallback = true) { string uuid = SelfPlayerData.Uuid; if (SelfPlayerLevelData.MaxScore <= 0 || string.IsNullOrEmpty(uuid)) { return; } //string url = "api/game_app/v1/level_scores"; JsonData data = new JsonData(); int levelID = StaticData.LevelID; data["levelID"] = levelID; data["accuracy"] = SelfPlayerLevelData.TempAccuracy; data["score"] = SelfPlayerLevelData.TempScore; data["uid"] = uuid; data["maxCombo"] = SelfPlayerLevelData.TempMaxCombo; data["finalHP"] = SelfPlayerLevelData.TempLeftLife; data["readAccuracy"] = SelfPlayerLevelData.TempReadAccuracy; data["wordAccuracy"] = SelfPlayerLevelData.TempWordAccuracy; data["processData"] = SelfPlayerLevelData.TempSelfLevelProcessData; //byte[] Data = System.Text.Encoding.UTF8.GetBytes(data.ToJson()); SelfPlayerData.PlayerLevelData = SelfPlayerLevelData.Instance; SaveDataUtils.Save <SelfPlayerData>(); SelfPlayerLevelData.Reset(); SnapAppApi.UploadGameScores(data, (SnapRpcDataVO vo) => { //LogManager.Log("wangji",vo.ToString()); //LogManager.Log(" UploadScore.收到 = " , jsonString); JsonData json = vo.data; //JsonMapper.ToObject(jsonString); LogManager.Log("上传分数成功之后:", json.ToJson()); SelfPlayerLevelData.Instance.AddLevelData(levelID); SelfPlayerLevelData.LevelDic[levelID].rank = int.Parse(json.TryGetString("rank", "0")); SelfPlayerLevelData.TempHistoryId = json["enemy"].TryGetString("historyID"); SelfPlayerLevelData.TempOtherLevelProcessData = json["enemy"].TryGetString("TargetUsers"); SaveDataUtils.Save <SelfPlayerData>(); if (callback != null && successNeedCallback) { callback.Invoke(); } }); }
void CGFinishCallback() { if (m_Status == Status.FirstTimeCG || m_Status == Status.BossAppearCG) { if (!SelfPlayerData.FirstTimeBossCG) { SelfPlayerData.FirstTimeBossCG = true; SaveDataUtils.Save <SelfPlayerData>(); } m_SentenceCheckResult = RuntimeConst.BossWarLose; PlaySong(); StartCoungting(); //StartReadCurSentence(); } }
private void Skip(AudioObject audioObject) { obj_hand.SetActive(false); if (m_Tap != null) { m_Tap.Delete(); } SelfPlayerData.NewPlayer = false; VoiceController.instance.Restart(); SaveDataUtils.Save <SelfPlayerData>(); AudioController.StopCategory("Other"); XunFeiSRManager.Instance.StopListen(); MicManager.Instance.StopRecord(); Instance = null; Destroy(transform.gameObject); }
public void Refresh(string uuid, string nickname, int level = 0, int energy = 0, int experience = 0) { if (!string.IsNullOrEmpty(uuid)) { _uuid = uuid; } if (!string.IsNullOrEmpty(nickname)) { _nickname = nickname; } _level = level; _energy = energy; _experience = experience; SaveDataUtils.Save <SelfPlayerData> (); }
/// <summary> /// 订单(漏单)处理完成, 清除记录 /// </summary> /// <param name="userID"></param> /// <param name="payLoad"></param> public void RemoveItemIAPTransaction(string userID, string transactionID) { for (int i = 0; i < TransactionTemp.Count; i++) { if (TransactionTemp[i].userID == userID && TransactionTemp[i].transactionID == transactionID) { TransactionTemp.RemoveAt(i); } } SaveDataUtils.Save <IAPVerifyProxy>(); string logStr = "单条订单(漏单)处理完成, 清除记录: 用户ID:" + userID + ", 订单ID:" + transactionID; //if (Manager) Manager.log(logStr); LogManager.Log(logStr); }
/// <summary> /// 更新课程中关卡的状态 /// </summary> /// <param name="levelId">Level identifier.</param> public void SetLevelStatus(int levelId) { LogManager.Log("更新关卡的状态:", levelId, CourseConfig.Instance); int courseId = CourseConfig.Instance.GetCourseIdFromLevelId(levelId); List <CourseData> courses = SelfPlayerData.CourseData; for (int i = 0; i < courses.Count; i++) { if (courses[i].m_CourseID == courseId) { courses[i].m_Progress++; SaveDataUtils.Save <SelfPlayerData> (); UpdateCourse(courses[i]); break; } } }
/// <summary> /// 保存游戏数据到本地 /// </summary> /// <param name="user"></param> public static void SaveGameUser(JsonData user) { SelfPlayerData.PlayerLevelData = new SelfPlayerLevelData(); //首先加载UserData,判断缓存里面是否有数据 SaveDataUtils.Load <SelfPlayerData>(); SelfPlayerData.DeviceID = user["deviceID"].ToString(); SelfPlayerData.Uuid = user["id"].ToString(); SelfPlayerData.AppUID = user["appUID"].ToString(); SelfPlayerData.AvatarUrl = user["avatar"].ToString(); SelfPlayerData.Sex = int.Parse(user["sex"].ToString()); SelfPlayerData.Age = int.Parse(user["age"].ToString()); SelfPlayerData.Country = int.Parse(user["country"].ToString()); SelfPlayerData.Nickname = user["nickname"].ToString(); SelfPlayerData.Profile = user["profile"].ToString(); int server_lv = int.Parse(user["level"].ToString()); int server_energy = int.Parse(user["energy"].ToString()); int server_experience = int.Parse(user["experience"].ToString()); //暂时以本地的数据为基准 //SelfPlayerData.Level = server_lv; //SelfPlayerData.Energy = server_energy; //SelfPlayerData.Experience = server_experience; if (SelfPlayerData.Level <= server_lv) { SelfPlayerData.Level = server_lv; } if (SelfPlayerData.Energy <= server_energy) { SelfPlayerData.Energy = server_energy; } if (SelfPlayerData.Experience <= server_experience) { SelfPlayerData.Experience = server_experience; } SelfPlayerLevelData.Instance = SelfPlayerData.PlayerLevelData; SaveDataUtils.Save <SelfPlayerData>(); GlobalConst.Player_IDTemp = SelfPlayerData.Uuid; InitBuyly(); UploadUserScore(); }
void onClickLoginHandle() { Regex Reg_Phone = new Regex(@"^1[2|3|4|5|6|7|8|9][0-9]\d{4,8}$"); if (Input_pwd.text.Length < 11 || Reg_Phone.IsMatch(Input_pwd.text) == false) { ImgInputTelOK.transform.gameObject.SetActive(false); ImgInputTelError.transform.gameObject.SetActive(true); PromptManager.Instance.MessageBox(PromptManager.Type.FloatingTip, "手机号输入有误,请重新输入"); return; } SelfPlayerData.TelphoneNum = Input_pwd.text; SaveDataUtils.Save <SelfPlayerData>(); LoginRpcProxy.getInstance().ShareWeChatGameByLevelID(); PageManager.Instance.CurrentPage.GetNode <ShareActivityNode>().Close(false); PageManager.Instance.CurrentPage.GetNode <WinNode>().Open(); Close(true); }
public void Refresh(string uuid, string username, string nickname, string server, int level = 0, int energy = 0, int experience = 0) { bool save = false; if (!string.IsNullOrEmpty(uuid)) { Uuid = uuid; save = true; } if (!string.IsNullOrEmpty(nickname)) { Nickname = nickname; save = true; } if (save) { SaveDataUtils.Save <PlayerInfo>(); } }
/// <summary> /// 上传游戏用户信息 /// </summary> public void UploadGameUserInfo(Action action = null) { JsonData data = new JsonData(); data["uid"] = SelfPlayerData.Uuid; data["nickname"] = SelfPlayerData.Nickname; data["level"] = SelfPlayerData.Level; data["energy"] = SelfPlayerData.Energy; data["experience"] = SelfPlayerData.Experience; data["avatar"] = SelfPlayerData.AvatarUrl; //上传数据的时候做次缓存 SaveDataUtils.Save <SelfPlayerData> (); SnapAppApi.Request_SnapAppApi(SnapAppApiInterface.Request_UploadGameInfo, SnapHttpConfig.NET_REQUEST_PUT, data, (SnapRpcDataVO rpcData) => { if (action != null) { action.Invoke(); } }); }
public void save() { SaveDataUtils.Save <SelfPlayerData> (); }
public void SetSound(bool enabled) { Music = enabled; Sfx = enabled; SaveDataUtils.Save(this); }
public void save() { SaveDataUtils.Save <PlayerInfo>(); }
public void GameFinish() { m_Status = GameStatus.Finish; AudioController.Play("applause"); if (m_WrongNum == 0) { AudioController.Play("combo_perfect"); } if (m_Life > 0) { AnalysisManager.Instance.OnEvent("100002", null, StaticData.LevelID.ToString(), "完成游戏"); AnalysisManager.Instance.OnEvent("100001", null, StaticData.LevelID.ToString(), m_Life.ToString()); AnalysisManager.Instance.OnLevelCompleted(StaticData.LevelID.ToString()); } else { AnalysisManager.Instance.OnEvent("100002", null, StaticData.LevelID.ToString(), "完成游戏"); AnalysisManager.Instance.OnEvent("100001", null, StaticData.LevelID.ToString(), "空血通关"); AnalysisManager.Instance.OnLevelFailed(StaticData.LevelID.ToString(), "没血通关"); } // 记录成绩 SelfPlayerLevelData.TempRankIncrement = SelfPlayerLevelData.CurRank; Debug.LogWarning(" 记录成绩 = " + SelfPlayerLevelData.TempRankIncrement); Debug.Log("<======记录舞蹈数据 boss战舞蹈数据为空 ======>"); // 打开UI if (CorePlayData.BossLife > 0) { m_ProcessData = null; SelfPlayerRoleTitleData.Instance.UpdateRoleTitleCount(50002); } else { SelfPlayerRoleTitleData.Instance.UpdateRoleTitleCount(50001); PlayerOperationData operData = new PlayerOperationData(); operData.wholeScore = m_Score; operData.clickAccuracy = (float)m_CorrectNum / m_AllWordNum; operData.clickNumber = m_AllWordNum; operData.clickScore = m_Score - (int)(m_SumVoiceScore * CorePlaySettings.Instance.m_VoiceRightPoint); operData.wrongNumber = m_WrongNum; operData.rightNumber = m_CorrectNum; operData.m_ReadingData = CorePlayData.PlayerReadingData; //临时测试上传操作过程数据 m_ProcessData = operData.GetJson(); } SaveDataUtils.Save <SelfPlayerRoleTitleData>(); DancingWordAPI.Instance.UpDateServerRoleTitleInfo(SelfPlayerRoleTitleData.RoleTitleList); SaveResultToLocal(m_Life); int grade = SetLevel.setLevel(SelfPlayerLevelData.CurAccuracy); SelfPlayerData.Instance.AddExpAndSaveToLocal(grade); // 关录音 XunFeiSRManager.Instance.StopListen(); MicManager.Instance.StopRecord(); LoginRpcProxy.getInstance().SaveLevelVoices(MicManager.Instance.voiceDic); PageManager.Instance.CurrentPage.GetComponent <CorePlayPage>().HidePauseButton(); if (CorePlayData.BossLife > 0) { PageManager.Instance.CurrentPage.GetNode <WinNode>().Open(); } else { HttpHandler.UploadScore(ServerDataCallback, true); m_AlreadyRuning = false; LoadStage(); } }