using Manager; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MessageBox : UIWindow { public InputField playerName; public Text infoText; CharInfo info; string path; public void Init(string dataName,string datePath) { infoText.text = dataName + " 是一个空白存档,需要创建你的存档嘛?"; path = datePath; } public override void OnYesClick() { base.OnYesClick(); Debug.Log("创建存档"); //创建新存档 //初始化玩家数据 info = new CharInfo(); info.DatePath = path; info.playerName = playerName.text; //名字 info.Level = 1;//等级 info.exp = 0;//经验值 info.attack = 50;//攻击力 info.maxHp = 400;//最大生命值 info.currentHp = info.maxHp;//本局血量 info.testAttack = info.attack;//本局攻击力 info.currentMap = 1; //背包数据 info.BagKey = new List { 0};//道具Id info.BagValue = new List { 6 };//道具数量 //升级数据 info.UpKey = new List { 0, 1, 2, 3, 4, 5, 6,7,8 };//升级节点 info.UpValue = new List { false, false, false, false, false, false, false,false,false };//是否升级 SaveSystem.SaveDate(path, info); //存档赋值 PlayerInfo.Instance.Init(info); SenceManager.Instance.LoadScene(info.currentMap); SoundManager.Instance.PlayMusic(SoundDefine.Map_1Music); } }