コード例 #1
0
ファイル: Form1.cs プロジェクト: Yefimov/Zamki
        public void LoadFromFile()
        {
            this.BackgroundImage = Zamki.Properties.Resources.grass;
            BinaryFormatter formatter = new BinaryFormatter();

            using (FileStream fs = new FileStream("save.bin", FileMode.OpenOrCreate))
            {
                List <GameElements.Stuff>          stuff = (List <GameElements.Stuff>)formatter.Deserialize(fs);
                GameElements.Stuff.BeautifulSquare z     = new GameElements.Stuff.BeautifulSquare(0, 0, 0, 0, picInvisible);
                GameElements.Stuff.ScenicObject    y     = new GameElements.Stuff.ScenicObject(0, 0, true, 0, 0, picInvisible);
                GameElements.Stuff.Player          x     = new GameElements.Stuff.Player(25, 200, picPlayer);
                GameElements.Stuff.GameProgress    w     = new GameElements.Stuff.GameProgress();

                foreach (GameElements.Stuff s in stuff)
                {
                    if (Object.ReferenceEquals(s.GetType(), z.GetType()))
                    {
                        object zs = s;
                        GameElements.Stuff.BeautifulSquare sz = (GameElements.Stuff.BeautifulSquare)zs;
                        allRooms.Add(sz);
                    }
                    else
                    if (Object.ReferenceEquals(s.GetType(), y.GetType()))
                    {
                        object ys = s;
                        GameElements.Stuff.ScenicObject sy = (GameElements.Stuff.ScenicObject)ys;
                        if (sy.noclip)
                        {
                            allDoors.Add(sy);
                        }
                        allObjects.Add(sy);
                    }
                    else
                    if (Object.ReferenceEquals(s.GetType(), x.GetType()))
                    {
                        object xs = s;
                        GameElements.Stuff.Player sx = (GameElements.Stuff.Player)xs;
                        hero = sx;
                    }
                    else
                    if (Object.ReferenceEquals(s.GetType(), w.GetType()))
                    {
                        object ws = s;
                        GameElements.Stuff.GameProgress sw = (GameElements.Stuff.GameProgress)ws;
                        allGP.Add(sw);
                    }
                }
            }
            currentRoom         = new GameElements.Stuff.BeautifulSquare(0, 0, 0, 0, null);
            previousRoom        = new GameElements.Stuff.BeautifulSquare(0, 0, 0, 0, null);
            picNextPage.Visible = false;

            hideMenuButtons();
            Invalidate();
        }
コード例 #2
0
 public winGame(bool isOk, GameElements.Stuff.GameProgress GP)
 {
     InitializeComponent();
 }