예제 #1
0
 public void Deserialize(SaveStream input)
 {
     this.Name         = input.ReadString();
     this.Level        = input.ReadValueU32();
     this.Experience   = input.ReadValueU32();
     this.ArtifactMode = input.ReadValueS32();
 }
예제 #2
0
 public void Serialize(SaveStream output)
 {
     output.WriteString(this.Name);
     output.WriteValueU32(this.Level);
     output.WriteValueU32(this.Experience);
     output.WriteValueS32(this.ArtifactMode);
 }
 public void Serialize(SaveStream output)
 {
     output.WriteString(this.Name);
     output.WriteString(this.Pool);
     output.WriteValueF32(this.Quantity);
     output.WriteValueS32(this.UpgradeLevel);
 }
 public void Deserialize(SaveStream input)
 {
     this.Name         = input.ReadString();
     this.Pool         = input.ReadString();
     this.Quantity     = input.ReadValueF32();
     this.UpgradeLevel = input.ReadValueS32();
 }
예제 #5
0
    // 싱글톤 인스턴스 얻기
    public static SaveStream GetInstance()
    {
        if (instance == null)            // 없다면
        {
            instance = new SaveStream(); // 새로 생성
        }

        return(instance); // 반환
    }
예제 #6
0
파일: PastaStore.cs 프로젝트: ekicyou/pasta
 private void CloseSaveStream()
 {
     if (SaveStream == null)
     {
         return;
     }
     SaveStream.Close();
     SaveStream = null;
 }
예제 #7
0
    // 저장하기
    public void Save()
    {
        // SaveStream을 이용하여 저장하기
        SaveStream SS = SaveStream.GetInstance();    // 싱글톤 인스턴스 얻기

        SS.openWrite();                              // 쓰기 시작
        SS.Write("atk", Convert.ToString(cs.atk));   // atk 쓰기
        SS.Write("def", Convert.ToString(cs.def));   // def 쓰기
        SS.Write("hp", Convert.ToString(cs.hp));     // hp 쓰기
        SS.Write("gold", Convert.ToString(cs.gold)); // gold 쓰기
        SS.closeWrite();                             // 쓰기 종료
    }
예제 #8
0
    // 불러오기
    public void Load()
    {
        // SaveStream을 이용하여 불러오기
        SaveStream SS = SaveStream.GetInstance();   // 싱글톤 인스턴스 얻기

        SS.openRead();                              // 읽기 시작
        cs.atk  = Convert.ToInt32(SS.Read("atk"));  // atk 값 읽어오기
        cs.def  = Convert.ToInt32(SS.Read("def"));  // def 값 읽어오기
        cs.hp   = Convert.ToInt32(SS.Read("hp"));   // hp 값 읽어오기
        cs.gold = Convert.ToInt32(SS.Read("gold")); // gold 값 읽어오기
        SS.closeRead();                             // 읽기 끝
    }
        public void Serialize(SaveStream output)
        {
            output.WriteValueU32(this.Playthrough);

            // Echos
            {
                output.WriteValueS32(this.Echoes.Count);
                foreach (Echo echo in this.Echoes)
                {
                    echo.Serialize(output);
                }
            }
        }
        public void Serialize(SaveStream output)
        {
            output.WriteValueU32(this.Playthrough);
            output.WriteString(this.ActiveMission);

            // Missions
            {
                output.WriteValueS32(this.Missions.Count);
                foreach (Mission mission in this.Missions)
                {
                    mission.Serialize(output);
                }
            }
        }
예제 #11
0
 public void Serialize(SaveStream output)
 {
     output.WriteString(this.Grade);
     output.WriteString(this.Type);
     output.WriteString(this.Body);
     output.WriteString(this.LeftSide);
     output.WriteString(this.RightSide);
     output.WriteString(this.Material);
     output.WriteString(this.Manufacturer);
     output.WriteString(this.Prefix);
     output.WriteString(this.Title);
     output.WriteValueU32(this.Unknown09);
     output.WriteValueU32(this.Quality);
     output.WriteValueU32(this.Equipped);
 }
예제 #12
0
 public void Deserialize(SaveStream input)
 {
     this.Grade        = input.ReadString();
     this.Type         = input.ReadString();
     this.Body         = input.ReadString();
     this.LeftSide     = input.ReadString();
     this.RightSide    = input.ReadString();
     this.Material     = input.ReadString();
     this.Manufacturer = input.ReadString();
     this.Prefix       = input.ReadString();
     this.Title        = input.ReadString();
     this.Unknown09    = input.ReadValueU32();
     this.Quality      = input.ReadValueU32();
     this.Equipped     = input.ReadValueU32();
 }
예제 #13
0
        public void Serialize(SaveStream output)
        {
            output.WriteString(this.Name);
            output.WriteValueU32(this.Unknown1);
            output.WriteValueU32(this.Unknown2);
            output.WriteValueU32(this.Unknown3);

            // States
            {
                output.WriteValueS32(this.Unknown4s.Count);
                foreach (Unknown4 unknown3 in this.Unknown4s)
                {
                    unknown3.Serialize(output);
                }
            }
        }
        public void Deserialize(SaveStream input)
        {
            this.Playthrough = input.ReadValueU32();

            // Echos
            {
                uint count = input.ReadValueU32();
                this.Echoes.Clear();
                for (uint i = 0; i < count; i++)
                {
                    Echo echo = new Echo();
                    echo.Deserialize(input);
                    this.Echoes.Add(echo);
                }
            }
        }
        public void Deserialize(SaveStream input)
        {
            this.Playthrough   = input.ReadValueU32();
            this.ActiveMission = input.ReadString();

            // Missions
            {
                uint count = input.ReadValueU32();
                this.Missions.Clear();
                for (uint i = 0; i < count; i++)
                {
                    Mission mission = new Mission();
                    mission.Deserialize(input);
                    this.Missions.Add(mission);
                }
            }
        }
예제 #16
0
        public void Deserialize(SaveStream input)
        {
            this.Name     = input.ReadString();
            this.Unknown1 = input.ReadValueU32();
            this.Unknown2 = input.ReadValueU32();
            this.Unknown3 = input.ReadValueU32();

            // States
            {
                uint count = input.ReadValueU32();
                this.Unknown4s.Clear();
                for (uint i = 0; i < count; i++)
                {
                    Unknown4 unknown3 = new Unknown4();
                    unknown3.Deserialize(input);
                    this.Unknown4s.Add(unknown3);
                }
            }
        }
예제 #17
0
 public void Serialize(SaveStream output)
 {
     output.WriteString(this.Grade);
     output.WriteString(this.Manufacturer);
     output.WriteString(this.Type);
     output.WriteString(this.Body);
     output.WriteString(this.Grip);
     output.WriteString(this.Magazine);
     output.WriteString(this.Barrel);
     output.WriteString(this.Sight);
     output.WriteString(this.Stock);
     output.WriteString(this.Action);
     output.WriteString(this.Accessory);
     output.WriteString(this.Material);
     output.WriteString(this.Prefix);
     output.WriteString(this.Title);
     output.WriteValueU32(this.ClipSize);
     output.WriteValueU32(this.Quality);
     output.WriteValueU32(this.EquipSlot);
 }
예제 #18
0
 public void Deserialize(SaveStream input)
 {
     this.Grade        = input.ReadString();
     this.Manufacturer = input.ReadString();
     this.Type         = input.ReadString();
     this.Body         = input.ReadString();
     this.Grip         = input.ReadString();
     this.Magazine     = input.ReadString();
     this.Barrel       = input.ReadString();
     this.Sight        = input.ReadString();
     this.Stock        = input.ReadString();
     this.Action       = input.ReadString();
     this.Accessory    = input.ReadString();
     this.Material     = input.ReadString();
     this.Prefix       = input.ReadString();
     this.Title        = input.ReadString();
     this.ClipSize     = input.ReadValueU32();
     this.Quality      = input.ReadValueU32();
     this.EquipSlot    = input.ReadValueU32();
 }
예제 #19
0
        public void Deserialize(SaveStream input)
        {
            if (input.ReadStaticString(4) != "PLYR")
            {
                throw new FormatException("not player data");
            }

            this.Version = input.ReadValueU32();
            if (this.Version != 35)
            {
                throw new FormatException("unsupported player data version (" + this.Version.ToString() + ")");
            }

            this.Character   = input.ReadString();
            this.Level       = input.ReadValueU32();
            this.Experience  = input.ReadValueU32();
            this.SkillPoints = input.ReadValueU32();
            this.Unknown03   = input.ReadValueU32();
            this.Money       = input.ReadValueU32();
            this.MaybePlaythroughUnlocked = input.ReadValueU32();

            // Skills
            {
                uint count = input.ReadValueU32();
                this.Skills.Clear();
                for (uint i = 0; i < count; i++)
                {
                    Skill skill = new Skill();
                    skill.Deserialize(input);
                    this.Skills.Add(skill);
                }
            }

            this.Unknown07 = input.ReadValueU32();
            this.Unknown08 = input.ReadValueU32();
            this.Unknown09 = input.ReadValueU32();
            this.Unknown10 = input.ReadValueU32();

            // Ammo Pools
            {
                uint count = input.ReadValueU32();
                this.AmmoPools.Clear();
                for (uint i = 0; i < count; i++)
                {
                    AmmoPool pool = new AmmoPool();
                    pool.Deserialize(input);
                    this.AmmoPools.Add(pool);
                }
            }

            // Items
            {
                uint count = input.ReadValueU32();
                this.Items.Clear();
                for (uint i = 0; i < count; i++)
                {
                    Item item = new Item();
                    item.Deserialize(input);
                    this.Items.Add(item);
                }
            }

            this.BackpackSlots = input.ReadValueU32();
            this.WeaponSlots   = input.ReadValueU32();

            // Weapons
            {
                uint count = input.ReadValueU32();
                this.Weapons.Clear();
                for (uint i = 0; i < count; i++)
                {
                    Weapon weapon = new Weapon();
                    weapon.Deserialize(input);
                    this.Weapons.Add(weapon);
                }
            }

            this.Stats = input.ReadBuffer();

            // Visited Zones
            {
                uint count = input.ReadValueU32();
                this.VisitedStations.Clear();
                for (uint i = 0; i < count; i++)
                {
                    this.VisitedStations.Add(input.ReadString());
                }
            }

            this.CurrentStation = input.ReadString();

            // Unknown19
            {
                uint count = input.ReadValueU32();
                if (count != 0)
                {
                    throw new Exception();
                }
            }

            // Unknown20
            {
                uint count = input.ReadValueU32();
                if (count != 0)
                {
                    throw new Exception();
                }
            }

            this.Unknown21        = input.ReadString();;
            this.Unknown22        = input.ReadValueU32();
            this.Unknown23        = input.ReadValueU32();
            this.SaveSlot         = input.ReadValueU32();
            this.ExtraDataVersion = input.ReadValueU32();

            if (this.ExtraDataVersion >= 27)
            {
                this.Unknown26 = input.ReadValueU32();
            }

            if (this.ExtraDataVersion >= 28 && this.ExtraDataVersion <= 31)
            {
                // junk
                input.ReadString();

                {
                    uint count = input.ReadValueU32();
                    for (uint i = 0; i < count; i++)
                    {
                        input.ReadString();
                    }
                }
            }

            if (this.ExtraDataVersion >= 29)
            {
                // Mission Zones
                {
                    uint count = input.ReadValueU32();
                    this.MissionPlaythroughs.Clear();
                    for (uint i = 0; i < count; i++)
                    {
                        MissionPlaythrough missionZone = new MissionPlaythrough();
                        missionZone.Deserialize(input);
                        this.MissionPlaythroughs.Add(missionZone);
                    }
                }
            }

            if (this.ExtraDataVersion >= 30)
            {
                this.PlayTime = input.ReadValueU32();
                this.SaveTime = input.ReadString();
            }

            if (this.ExtraDataVersion >= 31)
            {
                this.Name   = input.ReadString();
                this.Color1 = input.ReadValueU32();
                this.Color2 = input.ReadValueU32();
                this.Color3 = input.ReadValueU32();
            }

            if (this.ExtraDataVersion >= 32)
            {
                this.Unknown34 = input.ReadValueU32();

                // Unknown35
                {
                    uint count = input.ReadValueU32();
                    this.Unknown35.Clear();
                    for (uint i = 0; i < count; i++)
                    {
                        this.Unknown35.Add(input.ReadValueU32());
                    }
                }
            }

            if (this.ExtraDataVersion >= 33)
            {
                // Unknown36
                {
                    uint count = input.ReadValueU32();
                    this.Unknown36.Clear();
                    for (uint i = 0; i < count; i++)
                    {
                        this.Unknown36.Add(input.ReadValueU32());
                    }
                }
            }

            if (this.ExtraDataVersion >= 34)
            {
                // Echo Zones
                {
                    uint count = input.ReadValueU32();
                    this.EchoPlaythroughs.Clear();
                    for (uint i = 0; i < count; i++)
                    {
                        EchoPlaythrough echoZone = new EchoPlaythrough();
                        echoZone.Deserialize(input);
                        this.EchoPlaythroughs.Add(echoZone);
                    }
                }
            }

            if (this.ExtraDataVersion >= 35)
            {
                // Unknown38
                this.Unknown38 = input.ReadBuffer();
            }
        }
예제 #20
0
 public void Serialize(SaveStream output)
 {
     output.WriteString(this.Name);
     output.WriteValueU32(this.Unknown1);
     output.WriteValueU32(this.Unknown2);
 }
예제 #21
0
 public void Deserialize(SaveStream input)
 {
     this.Name     = input.ReadString();
     this.Unknown1 = input.ReadValueU32();
     this.Unknown2 = input.ReadValueU32();
 }
예제 #22
0
 public abstract void Stream(SaveStream stream);
예제 #23
0
        public void Serialize(SaveStream output)
        {
            output.WriteStaticString("PLYR");
            output.WriteValueU32(this.Version);
            output.WriteString(this.Character);
            output.WriteValueU32(this.Level);
            output.WriteValueU32(this.Experience);
            output.WriteValueU32(this.SkillPoints);
            output.WriteValueU32(this.Unknown03);
            output.WriteValueU32(this.Money);
            output.WriteValueU32(this.MaybePlaythroughUnlocked);

            // Skills
            {
                output.WriteValueS32(this.Skills.Count);
                foreach (Skill skill in this.Skills)
                {
                    skill.Serialize(output);
                }
            }

            output.WriteValueU32(this.Unknown07);
            output.WriteValueU32(this.Unknown08);
            output.WriteValueU32(this.Unknown09);
            output.WriteValueU32(this.Unknown10);

            // Ammo Pools
            {
                output.WriteValueS32(this.AmmoPools.Count);
                foreach (AmmoPool pool in this.AmmoPools)
                {
                    pool.Serialize(output);
                }
            }

            // Items
            {
                output.WriteValueS32(this.Items.Count);
                foreach (Item item in this.Items)
                {
                    item.Serialize(output);
                }
            }

            output.WriteValueU32(this.BackpackSlots);
            output.WriteValueU32(this.WeaponSlots);

            // Weapons
            {
                output.WriteValueS32(this.Weapons.Count);
                foreach (Weapon weapon in this.Weapons)
                {
                    weapon.Serialize(output);
                }
            }

            // Unknown16
            {
                output.WriteBuffer(this.Stats);
            }

            // Visited Zones
            {
                output.WriteValueS32(this.VisitedStations.Count);
                foreach (string visitedZone in this.VisitedStations)
                {
                    output.WriteString(visitedZone);
                }
            }

            output.WriteString(this.CurrentStation);

            // Unknown19
            {
                // FIXME
                output.WriteValueS32(0);
            }

            // Unknown20
            {
                // FIXME
                output.WriteValueS32(0);
            }

            output.WriteString(this.Unknown21);
            output.WriteValueU32(this.Unknown22);
            output.WriteValueU32(this.Unknown23);
            output.WriteValueU32(this.SaveSlot);
            output.WriteValueU32(this.ExtraDataVersion);

            if (this.ExtraDataVersion >= 27)
            {
                output.WriteValueU32(this.Unknown26);
            }

            if (this.ExtraDataVersion >= 28 && this.ExtraDataVersion <= 31)
            {
                // junk
                output.WriteString("");
                output.WriteValueU32(0);
            }

            if (this.ExtraDataVersion >= 29)
            {
                // Mission Zones
                {
                    output.WriteValueS32(this.MissionPlaythroughs.Count);
                    foreach (MissionPlaythrough missionZone in this.MissionPlaythroughs)
                    {
                        missionZone.Serialize(output);
                    }
                }
            }

            if (this.ExtraDataVersion >= 30)
            {
                output.WriteValueU32(this.PlayTime);
                output.WriteString(this.SaveTime);
            }

            if (this.ExtraDataVersion >= 31)
            {
                output.WriteString(this.Name);
                output.WriteValueU32(this.Color1);
                output.WriteValueU32(this.Color2);
                output.WriteValueU32(this.Color3);
            }

            if (this.ExtraDataVersion >= 32)
            {
                output.WriteValueU32(this.Unknown34);

                // Unknown35
                {
                    output.WriteValueS32(this.Unknown35.Count);
                    foreach (UInt32 value in this.Unknown35)
                    {
                        output.WriteValueU32(value);
                    }
                }
            }

            if (this.ExtraDataVersion >= 33)
            {
                // Unknown36
                {
                    output.WriteValueS32(this.Unknown36.Count);
                    foreach (UInt32 value in this.Unknown36)
                    {
                        output.WriteValueU32(value);
                    }
                }
            }

            if (this.ExtraDataVersion >= 34)
            {
                // Echo Zones
                {
                    output.WriteValueS32(this.EchoPlaythroughs.Count);
                    foreach (EchoPlaythrough echoZone in this.EchoPlaythroughs)
                    {
                        echoZone.Serialize(output);
                    }
                }
            }

            if (this.ExtraDataVersion >= 35)
            {
                output.WriteBuffer(this.Unknown38);
            }
        }
예제 #24
0
 public override void Stream(SaveStream stream)
 {
     // Nothing
 }