public void CreateCharacter(string name, int metaClass, int race) { CharacterVO vo = new CharacterVO { Name = name, Class = metaClass, Race = race, Level = 1, }; Character = vo; CharacterList.Add(vo); SaveCharacter(); User.CurrentCharacterName = vo.Name; User.CharacterNameList.Add(vo.Name); User.Save(); }
/// <summary> /// 读取角色 /// </summary> public static CharacterVO Load(string name) { //如果name不合法, 那就取一个 if (string.IsNullOrEmpty(name)) { return(null); } var slot = GetCharacterSlot(name); CharacterVO vo = null; if (ES3.KeyExists(slot)) { vo = ES3.Load <CharacterVO>(slot); } return(vo); }