コード例 #1
0
ファイル: HandleData.cs プロジェクト: Azurebeats/EclipseSharp
        internal static void HandleCreateCharacterData(DataBuffer buffer)
        {
            // get amount of classes.
            var classes = buffer.ReadInt32();

            for (var i = 1; i < classes + 1; i++) {
                var c = new Class();
                c.Name = buffer.ReadString();
                c.MaleSprite = buffer.ReadInt32();
                c.FemaleSprite = buffer.ReadInt32();
                Data.Classes.Add(i, c);
            }

            Interface.ChangeUI(Interface.Windows.CharacterCreate);
        }
コード例 #2
0
ファイル: Data.cs プロジェクト: Azurebeats/EclipseSharp
        public static void LoadClass(Int32 id)
        {
            var filename = String.Format("{0}data files\\classes\\{1}.xml", Data.AppPath, id);
            // Make sure we created this class before moving on.
            if (!Data.Classes.ContainsKey(id)) {
                var c = new Class();
                Data.Classes.Add(id, c);
            }

            // load our data.
            if (File.Exists(filename)) {
                var ser = new System.Xml.Serialization.XmlSerializer(Data.Classes[id].GetType());
                using (var fs = File.OpenRead(filename)) {
                    Data.Classes[id] = (Class)ser.Deserialize(fs);
                }
                if (Data.Classes[id].Name.Length > 0) Logger.Write(String.Format("Loaded Class: {0}", Data.Classes[id].Name));
            } else {
                Data.SaveClass(id);
            }
        }