Ejemplo n.º 1
0
        public void SaveCharacter()
        {
            var filePath = D4Data.Instance.CharacterFiles[Character.Name];

            CharacterSerializer.ToFile(Character, filePath);
            UnityEngine.Debug.Log("Character saved!");
        }
Ejemplo n.º 2
0
        void SubmitForm()
        {
            var characterClass = _classDropdown.options[_classDropdown.value].text;
            var characterName  = _nameInput.text;

            if (D4Data.Instance.CharacterFiles.ContainsKey(characterName))
            {
                Debug.Log("Character name exists");
                return;
            }

            var character = new Character()
            {
                Class = characterClass,
                Name  = characterName
            };

            CharacterSerializer.ToFile(character, D4Data.Instance.CharacterFolderPath + "\\" + characterName + ".d4c");

            D4Data.Instance.RefreshCharacterList();
            GameObject.FindObjectOfType <CharacterSelection>().PopulateCharacterList();

            _nameInput.text      = string.Empty;
            _classDropdown.value = 0;
            gameObject.SetActive(false);
        }