Пример #1
0
        public void SaveCharacter()
        {
            var filePath = D4Data.Instance.CharacterFiles[Character.Name];

            CharacterSerializer.ToFile(Character, filePath);
            UnityEngine.Debug.Log("Character saved!");
        }
Пример #2
0
    // 송신용 byte[] 형 데이터 획득
    public byte[] GetData()
    {
        CharacterSerializer serializer = new CharacterSerializer();

        serializer.Serialize(packet);
        return(serializer.GetSerializedData());
    }
Пример #3
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);
        }
Пример #4
0
    // 바이너리 데이터를 패킷 데이터로 역직렬화하는 생성자
    public CharacterPacket(byte[] data)
    {
        CharacterSerializer serializer = new CharacterSerializer();

        serializer.SetDeserializedData(data);
        serializer.Deserialize(ref packet);
    }
Пример #5
0
        public static VocalIndexObject Deseralize(string Folder)
        {
            VocalIndexObject ret = null;

            if (System.IO.File.Exists(Folder + "\\voicedbi.dat"))
            {
                ret = SerializeFrom(Folder + "\\voicedbi.dat");
                if (ret != null)
                {
                    string NewHash = CalcHash(ret.HashFiles, Folder);
                    if (NewHash != ret.HashValue)
                    {
                        ret = null;
                    }
                }
            }
            if (ret == null)
            {
                ret = new VocalIndexObject();
                ret.BasicData.IntroduceText = "Chorista Voice Index Cache File";
                ret.HashFiles.Add("character.txt");
                ret.CharacertData = CharacterSerializer.DeSerialize(Folder + "\\character.txt");
                ret.SndAtomList   = OtoSerializer.DeSerialize(Folder, ret.HashFiles);
                ret.HashFiles.Add("prefix.map");
                if (System.IO.File.Exists(Folder + "\\prefix.map"))
                {
                    ret.PrefixAtomList = PrefixMapSerialzier.DeSerialize(Folder + "\\prefix.map");
                }
                SplitDictionary sdlib = null;
                if (System.IO.File.Exists(Folder + "\\splitdic.json"))
                {
                    sdlib = SplitDictionary.SerializeFrom(Folder + "\\splitdic.json");
                    if (ret != null)
                    {
                        ret.HashFiles.Add("splitdic.json");
                    }
                }
                if (sdlib == null && System.IO.File.Exists(Folder + "\\presamp.ini"))
                {
                    sdlib = Presamp2DictSerializer.DeSerialize(Folder + "\\presamp.ini");
                    if (sdlib != null)
                    {
                        ret.HashFiles.Add("presamp.ini");
                    }
                }
                if (sdlib != null)
                {
                    ret.SplitDictionary = sdlib;
                }
                else
                {
                    ret.SplitDictionary = new SplitDictionary();
                }
                ret.SplitDictionary.MapSndList(ret.SndAtomList, ret.PrefixAtomList);
                ret.HashValue = CalcHash(ret.HashFiles, Folder);
                SerializeTo(ret, Folder + "\\voicedbi.dat");
            }
            return(ret);
        }
Пример #6
0
        private async void LoadPage()
        {
            await CharacterSerializer.Deserialize();

            textName.Text     = MainPage.CHARACTERcurrent.CharName;
            textPlayer.Text   = MainPage.CHARACTERcurrent.Player;
            textCampaign.Text = MainPage.CHARACTERcurrent.Campaign;
        }
Пример #7
0
        private void buttonAddMember_Click(object sender, RoutedEventArgs e)
        {
            MainPage.CHARACTERcurrent.Party.Add(new Character(MainPage.CHARACTERloaded.ID));

            CharacterSerializer.Serialize();

            LoadMembers();
        }
Пример #8
0
        public void EnterWorld(string characterName)
        {
            var characterFilePath = D4Data.Instance.CharacterFiles[characterName];

            Character = CharacterSerializer.FromFile(characterFilePath);
            Character.Initialize(D4Data.Instance.Hellforge, new D4Hero());

            SceneManager.LoadScene("GameWorld");

            LoadLevel("TestLevel");
        }
Пример #9
0
        private async Task <bool> LoadCharacters()
        {
            CharacterSerializer.CharFolder = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync("Appstate", Windows.Storage.CreationCollisionOption.OpenIfExists);

            await CharacterSerializer.Deserialize();

            UpdateLoadGrid();

            await CharacterSerializer.Serialize();

            return(true);
        }
Пример #10
0
        public void SwitchCharacter(Character character)
        {
            gridView.Visibility  = Visibility.Collapsed;
            gridFiles.Visibility = Visibility.Collapsed;


            CHARACTERloaded  = character;
            CHARACTERcurrent = CHARACTERloaded;

            CharacterSerializer.CURRENTindex = CharacterSerializer.FindCharacterIndex(CHARACTERloaded);

            ChangePage(NavCharacter);
        }
Пример #11
0
        private async void Create()
        {
            Character character = new Character();

            character.ID = CharacterSerializer.GenerateID();

            CharacterSerializer.AddCharacterToSerializationList(character);
            await CharacterSerializer.Serialize();

            MainPage.MAINPAGE.SwitchCharacter(character);

            //System.Diagnostics.Debug.WriteLine("Created!");
        }
Пример #12
0
        public async Task <bool> LoadMenu()
        {
            gridView.Visibility  = Visibility.Visible;
            gridFiles.Visibility = Visibility.Visible;

            await LoadCharacters();

            NavigationButton blank = new NavigationButton();

            blank.SetPageType(PageType.BLANK);
            ChangePage(blank);

            await CharacterSerializer.Serialize();

            return(true);
        }
Пример #13
0
        public void DeleteChar()
        {
            if (gridView.SelectedItem != null)
            {
                //Select by Character Indicated
                Character c = CharacterSerializer.FindCharacterByID(((LoadItem)gridView.SelectedItem).ID);

                CharacterSerializer.RemoveCharacterFromSerializationList(c);

                UpdateLoadGrid();
            }
            else
            {
                MessageDialog dialog = new MessageDialog("Select a character to delete.");
                dialog.ShowAsync();
            }
        }
Пример #14
0
        public void SwitchCharacter()
        {
            if (gridView.SelectedItem != null)
            {
                gridView.Visibility  = Visibility.Collapsed;
                gridFiles.Visibility = Visibility.Collapsed;

                //Select by Index
                //CHARACTER = CharacterSerializer.characters.Values.ElementAt(gridView.SelectedIndex);

                //Select by Character Indicated
                CHARACTERcurrent = CharacterSerializer.FindCharacterByID(((LoadItem)gridView.SelectedItem).ID);
                CHARACTERloaded  = CharacterSerializer.FindCharacterByID(((LoadItem)gridView.SelectedItem).ID);

                CharacterSerializer.CURRENTindex = CharacterSerializer.FindCharacterIndex(CHARACTERloaded);

                ChangePage(NavCharacter);
            }
        }
    void Awake()
    {
        #region Enforces Singleton Pattern.
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }
        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a MyNetworkManager.
            Destroy(gameObject);
        }
        #endregion

        UpdateCharacters();
        UpdateLookable();
    }
Пример #16
0
 private void textCampaign_LostFocus(object sender, RoutedEventArgs e)
 {
     MainPage.CHARACTERcurrent.Campaign = textCampaign.Text;
     CharacterSerializer.Serialize();
 }
Пример #17
0
 private void textPlayer_LostFocus(object sender, RoutedEventArgs e)
 {
     MainPage.CHARACTERcurrent.Player = textPlayer.Text;
     CharacterSerializer.Serialize();
 }