public void SaveGraveInfo(string deathMessage, GraveInfo.CurseType curseType) { string userName = UserAuth.Instance.CurrentPlayerName(); Vector3 deathPosition = player.gameObject.transform.position; DataStoreManager.Instance.SaveGraveInfo(userName, deathMessage, curseType, deathPosition); }
public void SaveGraveInfo(string userName, string deathMessage, GraveInfo.CurseType curseType, Vector3 position) { //ユーザー名が空の場合"Unknown"に// userName = string.IsNullOrEmpty(userName) ? "Unknown" : userName; //プレイヤーが死んだ位置を加工// position = new Vector3(position.x, 0f, position.z); double[] positionDoubleArray = Utility.Vector3toDoubleArray(position); //データストアにGraveクラスを定義// NCMBObject ncmbObject = new NCMBObject("Grave"); //Message・UserName・Position・CurseTypeをKeyに、それぞれValueを設定// ncmbObject.Add("Message", deathMessage); ncmbObject.Add("UserName", userName); ncmbObject.Add("Position", positionDoubleArray); ncmbObject.Add("CurseType", (int)curseType); //非同期でデータを保存する// ncmbObject.SaveAsync((NCMBException e) => { if (e != null) { //エラー処理 } else { Main.Instance.OnInGame(); } }); }
void SaveGraveData(GraveInfo.CurseType curseType) //Call from contine Button { string deathMessage = deathMessageField.text; if (string.IsNullOrEmpty(deathMessage)) { deathMessage = "何も刻まれていない"; } state_InGame.SaveGraveInfo(deathMessage, curseType); deathMessageField.text = string.Empty; }