public saveCharaValueClass getSaveCharaValue(Dictionary <string, object> saveData, int argsCharaNo) { saveCharaValueClass retDat = new saveCharaValueClass(argsCharaNo); string dicKey = ""; //saveCharaValue_Key + argsCharaNo + "_Number"; dicKey = saveCharaValue_Key + argsCharaNo + "_enable"; //Debug.Log (dicKey); retDat.enable = (bool)saveData [dicKey]; dicKey = saveCharaValue_Key + argsCharaNo + "_level"; retDat.level = (long)saveData [dicKey]; dicKey = saveCharaValue_Key + argsCharaNo + "_exp"; retDat.exp = float.Parse(saveData [dicKey].ToString()); dicKey = saveCharaValue_Key + argsCharaNo + "_equipment"; retDat.equipment = (long)saveData [dicKey]; dicKey = saveCharaValue_Key + argsCharaNo + "_battleLimiter"; retDat.battleLimiter = (long)saveData [dicKey]; dicKey = saveCharaValue_Key + argsCharaNo + "_sanity"; retDat.battleLimiter = (long)saveData [dicKey]; return(retDat); }
/// <summary> /// 非省略形 /// </summary> /// <param name="saveData">Save data.</param> /// <param name="srgsCharaVal">Srgs chara value.</param> public void setSaveCharaValue(Dictionary <string, object> saveData, saveCharaValueClass srgsCharaVal) { //tmpSelectedDic.Add(saveCharaValue_Key + indexI.ToString("0"), tmpVal); string tmpKey = saveCharaValue_Key + srgsCharaVal.Number.ToString("0"); try{ //該当キーは全て削除し入れなおし saveData.Remove(tmpKey + "_Number"); saveData.Remove(tmpKey + "_enable"); saveData.Remove(tmpKey + "_level"); saveData.Remove(tmpKey + "_exp"); saveData.Remove(tmpKey + "_equipment"); saveData.Remove(tmpKey + "_battleLimiter"); saveData.Remove(tmpKey + "_sanity"); } catch (UnityException e) { } saveData.Add(tmpKey + "_Number", srgsCharaVal.Number); saveData.Add(tmpKey + "_enable", srgsCharaVal.enable); saveData.Add(tmpKey + "_level", srgsCharaVal.level); saveData.Add(tmpKey + "_exp", srgsCharaVal.exp); saveData.Add(tmpKey + "_equipment", srgsCharaVal.equipment); saveData.Add(tmpKey + "_battleLimiter", srgsCharaVal.battleLimiter); saveData.Add(tmpKey + "_sanity", srgsCharaVal.sanity); }
public void createNewGameData() { //new Game //selectedUserSaveDat Dictionary <string, object> tmpDc = new Dictionary <string, object> (); tmpDc.Add("thisSaveName", System.DateTime.Now.ToString("yyyy/MM/dd HH:mm")); tmpDc.Add("playCnt", 0); tmpDc.Add("StoryRoute", 0); tmpDc.Add("StoryProgress", 0); tmpDc.Add("StoryStage", 0); tmpDc.Add("StoryStep", 0); tmpDc.Add("StoryMode", "nomal"); //キャラの枠だけ作成 for (int indexI = 0; indexI < 9; indexI++) { saveCharaValueClass tmpVal = new saveCharaValueClass(indexI); this.setSaveCharaValue(tmpDc, tmpVal); } selectedUserSaveDat = tmpDc; }
/// <summary> /// 全ての出撃キャラを共通データに設定しなおす /// </summary> public void saveBattleResultValues() { // foreach (gameStartingVariable_Single tmpV in this.loadedCharaList.charalist) { int tmpL = (int)tmpV.CharaNumber; saveCharaValueClass beforeSCVC = sVMS.getSaveCharaValue(tmpL); beforeSCVC.exp = tmpV.charaScript.thisChara.totalExp; beforeSCVC.level = tmpV.charaScript.thisChara.nowLv; // beforeSCVC.sanity = argsSAN; sVMS.setSaveCharaValue(beforeSCVC); } }
public void showSelectedCharaInfo(int argsInt) { //表示情報の変更 //選択情報の移動も同時に行う selectedIconIndex = argsInt; saveCharaValueClass tmpChara = sVMS.getSaveCharaValue(selectedIconIndex); expLevelInfo tmpExpInfo = characterLevelManagerGetter.getManager().calcLv(tmpChara.exp); string tmpCap = "Level " + tmpChara.level + "\n\n"; tmpCap += tmpChara.getCharaName() + "\n"; tmpCap += "Next Level\n" + tmpExpInfo.nextExp + "\n"; tmpCap += "\n"; tmpCap += "Equipment:\n"; _charaInfoText.text = tmpCap; }
void battleStageStarter( ) { loadedCharaList = new gameStartingVariable(); //charaStartBattleInfo cSBI = new charaStartBattleInfo (sVMS.getNowSceneChangeValue ()); //sVMS.getNowSceneChangeValue ().sceneFileName = "0-3-0-0"; charaStartBattleInfo cSBI = new charaStartBattleInfo(sVMS.getNowSceneChangeValue()); if (_forDebug) { //for debug //インスペクター上で設定する } else { _sortieCharas = sVMS.getSortieCharaNo(); } for (int loopI = 0; loopI < 9; loopI++) { enumCharaNum tmpC = (enumCharaNum)loopI; //すべてのキャラを作成 if (_sortieCharas[loopI]) { saveCharaValueClass tmpCVC = sVMS.getSaveCharaValue((int)tmpC); //Debug.Log (tmpCVC.exp); loadedCharaList.setData(tmpC, tmpCVC.exp, 0); } } //Prefabsからロード //loadedCharaList.setData (enumCharaNum.syusuran_02, 1, 0); //chataList.setData (enumCharaNum.suzusiro_03, 1, 0); //chataList.setData (enumCharaNum.gyokuran_04, 1, 0); for (int i = 0; i < loadedCharaList.charalist.Count; i++) { gameStartingVariable_Single tmpChara = loadedCharaList.charalist[i]; //charaMain tmpChara.charaBase = Instantiate(tmpChara.Prefab_charaGrh) as GameObject; tmpChara.charaBase.transform.name = "charaBase_" + tmpChara.CharaNumber.ToString(); //キャラクターの初期位置 tmpChara.charaBase.transform.position = cSBI.getCharaPosition(i); //charaAnime Animator tmpAnime = tmpChara.charaBase.transform.FindChild("charaAnime").GetComponent <Animator>(); tmpAnime.runtimeAnimatorController = this.getCharaAnimator(tmpChara.CharaNumber); //charaSprite SpriteRenderer tmpSprite = tmpChara.charaBase.transform.FindChild("charaAnime").GetComponent <SpriteRenderer>(); tmpSprite.sprite = this.getCharaSprite(tmpChara.CharaNumber); tmpChara.charaScript = tmpChara.charaBase.GetComponentInParent <allCharaBase>(); tmpChara.charaScript.thisChara = new charaUserStatus(tmpChara.CharaNumber, tmpChara.totalExp); //経験値の大本もここで渡す tmpChara.charaScript.calcdExp = characterLevelManagerGetter.getManager().calcLv(tmpChara.totalExp); //次への経験値などの経験値情報 tmpChara.charaFlag = Instantiate(tmpChara.Prefab_charaFlag, cSBI.getFlagPosition(i), Quaternion.identity) as GameObject; tmpChara.charaScript.thisCharaIndex = i; tmpChara.charaScript.thisCharaFlag = tmpChara.charaFlag; tmpChara.charaScript.movingStopFlag = false; } //キャラアイコンの1ページ目の作成 this.createCharaIconSet(1); }
private void createSaveDataNode(int argsSaveIndx) { int tmpStoryProgress; staticValueManagerS sVMS = staticValueManagerGetter.getManager(); //ストーリー進捗の取得 tmpStoryProgress = sVMS.getStoryProgress_pinpoint(argsSaveIndx); //最大レベルキャラの取得 saveCharaValueClass retCharaData = sVMS.getSaveChara_MaxLevel(argsSaveIndx); string charaName = ""; switch (retCharaData.Number) { case 0: charaName = "エンジュ"; break; case 1: charaName = "シュスラン"; break; case 2: charaName = "スズシロ"; break; case 3: charaName = "アカネ"; break; case 4: charaName = "ホオズキ"; break; case 5: charaName = "モクレン"; break; case 6: charaName = "サクラ"; break; case 7: charaName = "シオン"; break; case 8: charaName = "ヒイラギ"; break; } string setTxt = "SaveDate" + (argsSaveIndx + 1) + "\n Chapter " + (long)tmpStoryProgress + "\n " + charaName + " Level " + retCharaData.level.ToString("0"); if (tmpStoryProgress == 0) { //newGameの場合は上書き setTxt = "SaveDate" + (argsSaveIndx + 1) + "\n 始めから"; } switch (argsSaveIndx) { case 0: _nodeTxt01.text = setTxt; break; case 1: _nodeTxt02.text = setTxt; break; default: _nodeTxt03.text = setTxt; break; } }
/// <summary> /// キャラの追加削除フラグ /// </summary> /// <param name="argsCharaNum">Arguments chara number.</param> /// <param name="argsFlag">If set to <c>true</c> arguments flag.</param> public void setSaveCharaEnableFlag(enumCharaNum argsCharaNum, bool argsFlag, enumCharactorJoinType argsExpType) { int tmpL = (int)argsCharaNum; saveCharaValueClass beforeSCVC = this.getSaveCharaValue(tmpL); //フラグセット beforeSCVC.enable = argsFlag; switch (argsExpType) { case enumCharactorJoinType.dontTouchExp: //何もしない break; case enumCharactorJoinType.maxExp: float maxVal = 0; for (int loopI = 0; loopI < 9; loopI++) { saveCharaValueClass tmpC = this.getSaveCharaValue(loopI); Debug.Log(tmpC.exp); if (maxVal < tmpC.exp) { maxVal = tmpC.exp; } } beforeSCVC.exp = maxVal; break; case enumCharactorJoinType.avarageExp: float Allexp = 0; for (int loopI = 0; loopI < 9; loopI++) { saveCharaValueClass tmpC = this.getSaveCharaValue(loopI); Allexp += tmpC.exp; } beforeSCVC.exp = Allexp / 9f; break; case enumCharactorJoinType.sameEnju: int enjuNum = (int)enumCharaNum.enju_01; beforeSCVC.exp = this.getSaveCharaValue(enjuNum).exp * 0.9f; Debug.Log(beforeSCVC.exp); break; } //レベルを計算してセット beforeSCVC.level = characterLevelManagerGetter.getManager().calcLv(beforeSCVC.exp).Lv; this.setSaveCharaValue(beforeSCVC); }
/// <summary> /// 省略形の場合、selectedUserSaveDataに保存する /// </summary> /// <param name="srgsCharaVal">Srgs chara value.</param> public void setSaveCharaValue(saveCharaValueClass argsCharaVal) { setSaveCharaValue(selectedUserSaveDat, argsCharaVal); }
private void initSaveData(int argsInt) { //データ呼び出し //新規作成の場合は、キャラクターデータまで作成してしまう string playerPrefskeyString = ""; switch (argsInt) { case 0: playerPrefskeyString = jsonSaveKey01; break; case 1: playerPrefskeyString = jsonSaveKey02; break; default: playerPrefskeyString = jsonSaveKey03; break; } //Data Check string tmpStr = PlayerPrefs.GetString(playerPrefskeyString); //Debug.Log (tmpStr); if (tmpStr == "") { //作ってセーブ Dictionary <string, object> tmpDc = new Dictionary <string, object> (); tmpDc.Add("thisSaveName", System.DateTime.Now.ToString("yyyy/MM/dd HH:mm")); tmpDc.Add("playCnt", 0); tmpDc.Add("StoryRoute", 0); tmpDc.Add("StoryProgress", 0); tmpDc.Add("StoryStage", 0); tmpDc.Add("StoryStep", 0); tmpDc.Add("StoryMode", "nomal"); //キャラの枠だけ作成 for (int indexI = 0; indexI < 9; indexI++) { saveCharaValueClass tmpVal = new saveCharaValueClass(indexI); this.setSaveCharaValue(tmpDc, tmpVal); } PlayerPrefs.SetString(playerPrefskeyString, Json.Serialize(tmpDc)); //Debug.Log (Json.Serialize (tmpDc)); } string tmpPP = PlayerPrefs.GetString(playerPrefskeyString); switch (argsInt) { case 0: saveDataJSON01 = Json.Deserialize(tmpPP) as Dictionary <string, object>; break; case 1: saveDataJSON02 = Json.Deserialize(tmpPP) as Dictionary <string, object>; break; default: saveDataJSON03 = Json.Deserialize(tmpPP) as Dictionary <string, object>; break; } }