Ejemplo n.º 1
0
        public MainForm(SerializationInfo si, StreamingContext sc)
        {
            //todo: odstranit button1
            model = (GameRecords)si.GetValue("model", typeof(GameRecords));
            view = (View2)si.GetValue("view", typeof(View2));
            view.form = this;
            playingHeight = si.GetByte("height");
            playingWidth = si.GetByte("width");
            InitializeComponent();
            InitializeTasks();
            timerTicks = 0;
            IsMdiContainer = true;
            accessoriesToolStripMenuItem.Checked = false;
            amusform = new AmusementsForm(model, mainDockPanel, amusementsToolStripMenuItem);
            pathform = new PathForm(model, pathToolStripMenuItem);
            accform = new AccessoriesForm(model, accessoriesToolStripMenuItem);
            mapform = new MapForm(model, view, playingWidth, playingHeight);
            PrepareFormsStartAppearance(model.currOfferedAmus, model.currOfferedPaths, model.currOfferedOthers, model.images);
            amusform.Show(mainDockPanel);
            pathform.Show(mainDockPanel);

            view.form = this;
            mapform.InitializeAfterDeserialization(model, view);

            timer.Enabled = true;
            MyUpdate();
            this.Refresh();
        }
Ejemplo n.º 2
0
 public MapForm(GameRecords m, View2 view, byte playingWidth, byte playingHeight)
 {
     InitializeComponent();
     model = m;
     map = new MapCustomControl(model, view);
     map.Parent = this;
 }
Ejemplo n.º 3
0
 public void InitializeAfterDeserialization(GameRecords m, View2 v)
 {
     this.model = m;
     this.view = v;
     this.Width = (model.playingWidth + 2) * MainForm.sizeOfSquare + 1;
     this.Height = (model.playingHeight + 2) * MainForm.sizeOfSquare + 1;
     borderRects = InitializeBorderRects(model.playingWidth + 2, model.playingHeight + 2);
 }
Ejemplo n.º 4
0
 public MapCustomControl(GameRecords model, View2 view)
 {
     InitializeComponent();
     borderRects = InitializeBorderRects(model.playingWidth + 2, model.playingHeight + 2);
     this.Width = (model.playingWidth + 2) * MainForm.sizeOfSquare + 1;
     this.Height = (model.playingHeight + 2) * MainForm.sizeOfSquare + 1;
     SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
     SetStyle(ControlStyles.UserPaint, true);
     SetStyle(ControlStyles.ResizeRedraw, true);
     this.model = model;
     this.view = view;
 }
Ejemplo n.º 5
0
 public AmusementDetailForm(GameRecords model, Amusements a, Image im, View2 view)
 {
     InitializeComponent();
     exit_button.Parent = panel1;
     entrance_button.Parent = panel1;
     exit_button.Tag = new AmusementExitPathFactory(a);
     entrance_button.Tag = new AmusementEnterPathFactory(a);
     this.model = model;
     this.view = view;
     this.pictureBox.BackgroundImage = im;
     this.a = a;
     this.Text = a.name;
     a.isClicked = true;
     MyUpdate();
 }
Ejemplo n.º 6
0
        public MainForm(byte playingWidth, byte playingHeight, StartForm startForm)
        {
            InitializeComponent();
            InitializeTasks();
            IsMdiContainer = true;
            this.playingHeight = playingHeight;
            this.playingWidth = playingWidth;
            this.startForm = startForm;

            model = new GameRecords(playingHeight, playingWidth, startForm.initialAmusementsFilename, startForm.initialPathsFilename, startForm.initialAccessoriesFilename, startForm.revealingRulesFilename);

            amusform = new AmusementsForm(model, mainDockPanel, amusementsToolStripMenuItem);
            pathform = new PathForm(model, pathToolStripMenuItem);
            accform = new AccessoriesForm(model, accessoriesToolStripMenuItem);
            view = new View2(model, this);
            mapform = new MapForm(model, view, playingWidth, playingHeight);

            amusform.Show(mainDockPanel);
            pathform.Show(mainDockPanel);
            accessoriesToolStripMenuItem.Checked = false;
            mapform.Show(mainDockPanel);
            timer.Enabled = true;
        }
Ejemplo n.º 7
0
 public void InitializeAfterDeserialization(GameRecords m, View2 v)
 {
     model = m;
     ((MapCustomControl)map).InitializeAfterDeserialization(m, v);
 }
Ejemplo n.º 8
0
 private void loadToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if(MessageBox.Show("Do you really want to leave this game?","Warning", MessageBoxButtons.YesNo) == DialogResult.No) return;
     view.CallBeforeDeserialization();
     Task.WaitAll(tasks);
     view = (View2) startForm.LoadGame();
     ChangeAfterDeserialization(view);
     /* view = Program.LoadFromFile(new System.IO.FileStream("zkouskaUkladani.txt", System.IO.FileMode.Open));
     view.form = this;
     model = view.model;
     ChangeAfterDeserialization(model, view);*/
 }
Ejemplo n.º 9
0
        public void ChangeAfterDeserialization(View2 view)
        {
            view.form = this;
            this.model = view.model;
            this.view = view;
            this.playingHeight = model.playingHeight;
            this.playingWidth = model.playingWidth;
               // InitializeComponent();
            InitializeTasks();
            timerTicks = 0;
            IsMdiContainer = true;
            accessoriesToolStripMenuItem.Checked = false;
            amusform.Dispose();
            pathform.Dispose();
            accform.Dispose();
            amusform = new AmusementsForm(model, mainDockPanel, amusementsToolStripMenuItem);
            pathform = new PathForm(model, pathToolStripMenuItem);
            accform = new AccessoriesForm(model, accessoriesToolStripMenuItem);

            PrepareFormsStartAppearance(model.currOfferedAmus, model.currOfferedPaths, model.currOfferedOthers, model.images);
            amusform.Show(mainDockPanel);
            pathform.Show(mainDockPanel);
            mapform.InitializeAfterDeserialization(model, view);

            timer.Enabled = true;
            MyUpdate();
            this.Refresh();
        }