Exemplo n.º 1
0
        //public State getWhiskeyLevelState()
        //{

        //}


        public static string serialize(EditorLevel lvl, string fileName)
        {
            FileStream   fs     = new FileStream(fileName, FileMode.Create);
            StreamWriter writer = new StreamWriter(fs);

            // Construct a BinaryFormatter and use it to serialize the data to the stream.
            BinaryFormatter formatter = new BinaryFormatter();

            try
            {
                formatter.Serialize(fs, lvl);
            }
            catch (SerializationException e)
            {
                Console.WriteLine("Failed to serialize. Reason: " + e.Message);

                throw;
            }
            finally
            {
                fs.Close();
            }

            return(fileName);
        }
Exemplo n.º 2
0
        public override void inspectFile()
        {
            Level        = EditorLevel.deserialize(FilePath);
            Level.Camera = new Camera();
            //Level.setInstanceLevelState(State.deserialize(FilePath));

            //colorProperty.TypeVal.Value = Level.BackgroundColor;
            Level.BackgroundColor = Color;

            //State.serialize(Level.getInstanceLevelState(), FilePath);

            //state = State.deserialize(FilePath);
        }
Exemplo n.º 3
0
        //private State state;

        //public State State { get { return state; } }

        public LevelDescriptor(string basePath, string name)
            : base(basePath, name)
        {
            Level = new EditorLevel(name);
            Color = Level.BackgroundColor;

            if (ProjectManager.Instance.ActiveProject.GameStartScene.Equals("default"))
            {
                ProjectManager.Instance.ActiveProject.GameStartScene = name;
            }

            FileManager.Instance.addFileDescriptor(this);
        }
Exemplo n.º 4
0
        //private void addPropertyDescriptor(PropertyDescriptor prop)
        //{
        //    propDescs.Add(prop);
        //}

        //public List<PropertyDescriptor> getPropertySet()
        //{
        //    return propDescs;
        //}

        public override void save()
        {
            EditorLevel.serialize(Level, FilePath);
        }