public static void Load() { string savePath = Path.Combine(Application.dataPath, "GameData.json"); if (File.Exists(savePath)) { StreamReader read = File.OpenText(savePath); string text = read.ReadToEnd(); JObject root = JObject.Parse(text); JObject option = root["SaveData"] as JObject; string strLevel = option["Level"].ToString(); string strExp = option["Exp"].ToString(); string strHP = option["HP"].ToString(); string strMP = option["MP"].ToString(); string strDSpell = option["D_Spell"].ToString(); string strDSpellTime = option["D_SpellTime"].ToString(); string strFSpell = option["F_Spell"].ToString(); string strFSpellTime = option["F_SpellTime"].ToString(); if (option["Money"] != null) { string strMoney = option["Money"].ToString(); Money = int.Parse(strMoney); } else { Money = 50; } myquestNum.Clear(); JArray questnum = option["questnum"] as JArray; for (int i = 0; i < questnum.Count; i++) { string strnum = questnum[i].ToString(); myquestNum.Add(int.Parse(strnum)); } playerLevel = int.Parse(strLevel); playerExp = int.Parse(strExp); playerHP = int.Parse(strHP); playerMP = int.Parse(strMP); D_Spell = int.Parse(strDSpell); D_SpellTime = float.Parse(strDSpellTime); F_Spell = int.Parse(strFSpell); F_SpellTime = float.Parse(strFSpellTime); LevelUpData.levels = LevelUpData.ReadCsv(); statSetting(); spellSetting(); read.Close(); } }
public LevelUpPacket(CCharacter instance, bool sendToSelf = true) : base(ClientEventCode.ServerPacket, MessageSubCode.LevelUp, sendToSelf) { var data = new LevelUpData() { NewLevel = (byte)instance.Stats.GetStat <Level>(), NewNextLevelExperience = instance.GetCharData <GeneralStats>().NextLevelExperience, CurrentGold = instance.GetCharData <GeneralStats>().Gold, StatPoints = (byte)instance.Stats.GetStat <StatPoints>() }; AddSerializedParameter(data, ClientParameterCode.Object); }
public void SetAllyStatus(AllyStatus charaStatus) { if (!partyMembers.Contains(charaStatus)) { partyMembers.Add(charaStatus); //プレイヤーのレベルを取得 int playerLevel = this.GetAllyStatus()[0].GetLevel(); //加入するキャラのステータスを初期化 charaStatus.StatusInit(); // 変数を初期化 int raisedAgility = 0; int raisedPower = 0; int raisedStrikingStrength = 0; int raisedMagicPower = 0; //ステータスアップのテーブル LevelUpData levelUpData = charaStatus.GetLevelUpData(); List <int> agilityRisingTable = levelUpData.GetAgilityRisingTable(); List <int> powerRisingTable = levelUpData.GetPowerRisingTable(); List <int> strikingStrengthRisingTable = levelUpData.GetStrikingStrengthRisingTable(); List <int> magicPowerRisingTable = levelUpData.GetMagicPowerRisingTable(); // プレイヤーとのレベル差分、ステータスアップを計算し反映する for (int i = 1; i < playerLevel; i++) { // レベルを反映 charaStatus.SetLevel(charaStatus.GetLevel() + 1); raisedAgility += agilityRisingTable[charaStatus.GetLevel() % agilityRisingTable.Count()]; raisedPower += powerRisingTable[charaStatus.GetLevel() % powerRisingTable.Count()]; raisedStrikingStrength += strikingStrengthRisingTable[charaStatus.GetLevel() % strikingStrengthRisingTable.Count()]; raisedMagicPower += magicPowerRisingTable[charaStatus.GetLevel() % strikingStrengthRisingTable.Count]; } charaStatus.StatusUpdate(raisedPower, raisedAgility, raisedStrikingStrength, raisedMagicPower); //HP、MPを満タンに charaStatus.SetHp(charaStatus.GetMaxHp()); charaStatus.SetMp(charaStatus.GetMaxMp()); } }
public override void OnExecute() { base.OnExecute(); SCPlayerUpLevel levelData = new SCPlayerUpLevel(); levelData.OldLevel = this.oldLevel; levelData.NewLevel = this.newLevel; //MessageHandler.Call(MessageDefine.SCPlayerUpLevel, levelData); LevelUpData data = new LevelUpData() { msg = levelData, m_click_act = null, }; FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_LEVEL_UP); param.Param = data; EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param); GlobalInfo.MY_PLAYER_INFO.SetLevel(newLevel); OnDestory(); }
private void TeachNewMoves() { var lvlUpData = new LevelUpData(Pkmn.Species, Pkmn.Form); PBEMove[] newMoves = lvlUpData.GetNewMoves(Pkmn.Level).Reverse().Take(PkmnConstants.NumMoves).ToArray(); BoxMoveset moveset = Pkmn.Moveset; for (int i = 0; i < newMoves.Length; i++) { int firstEmpty = moveset.GetFirstEmptySlot(); BoxMoveset.BoxMovesetSlot slot; if (firstEmpty != -1) { slot = moveset[firstEmpty]; } else { moveset.ShiftMovesUp(); slot = moveset[PkmnConstants.NumMoves - 1]; } slot.Move = newMoves[i]; slot.PPUps = 0; } }
// 스탯세팅 static PlayerData() { LevelUpData.levels = LevelUpData.ReadCsv(); //IEnumerable<LevelUpData.LevelUp> levels = LevelUpData.ReadCsv(); statSetting(); }