Esempio n. 1
0
 public MapForm(GameRecords m, View2 view, byte playingWidth, byte playingHeight)
 {
     InitializeComponent();
     model = m;
     map = new MapCustomControl(model, view);
     map.Parent = this;
 }
Esempio n. 2
0
        public Amusements(Coordinates c, GameRecords m, int prize, int fee, int capacity, int runningTime, string name, bool hasEntranceExit, Color color, int typeId, int workingPrice, int attractiveness)
            : base(m, c, prize, typeId)
        {
            this.zIndex = 0;
            this.originalFee = fee;
            this.currFee = fee;
            this.capacity = capacity;
            this.WorkingCost = workingPrice;
            this.attractiveness = attractiveness;

            this.fixedRunningTime = runningTime;
            this.maxWaitingTime = (int)(runningTime*1.5);
            this.name = name;
            this.hasSeparatedEnterExit = hasEntranceExit;
            this.color = color;
            //this.typeId = typeId;
            peopleInList = new List<Person>(capacity);

               model.LastBuiltAmus = this;
            if(hasEntranceExit) model.mustBeEnter = true;
            this.Id = model.amusList.GetFreeID();
            model.amusList.Add(this);
            model.maps.AddAmus(this);
            model.CheckCheapestFee(this.CurrFee);

               // mimoProvoz = true;
               // zacatek = true;
        }
Esempio n. 3
0
 public AmusementsForm(GameRecords model, DockPanel parent, ToolStripMenuItem amusement)
 {
     InitializeComponent();
     dockP = parent;
     buyForm = new AmusementBuyForm(model,parent);
     this.amusItem = amusement;
 }
Esempio n. 4
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();
        }
Esempio n. 5
0
 public AmusementBuyForm(GameRecords m, DockPanel parent)
 {
     InitializeComponent();
     this.dockPanel = parent;
     model = m;
     color = Color.Yellow;
     this.Hide();
 }
Esempio n. 6
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);
 }
Esempio n. 7
0
 // GameRecords model;
 public GateDetailForm(GameRecords model, Gate gate, Image im)
 {
     InitializeComponent();
     this.a = gate;
     this.gate = gate;
     this.model = model;
     this.pictureBox.BackgroundImage = im;
     this.Text = gate.name;
     gate.isClicked = true;
     MyUpdate();
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
 public SpecialEffects(GameRecords model, List<LaterShownItem> laterRevealedObjectsList)
 {
     this.model = model;
     propagateOn = false;
     researchOn = false;
     contentmentAward = false;
     propagation = 0;
     this.laterRevealedObjects = new ConcurrentQueue<LaterShownItem>(laterRevealedObjectsList);
     LaterShownItem l;
     this.laterRevealedObjects.TryDequeue(out l);
     timeToShowNewItem = l.timeToShow;
     followingItemToReveal = l.item;
 }
Esempio n. 10
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();
 }
Esempio n. 11
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;
        }
Esempio n. 12
0
 public StonePath(GameRecords m, Coordinates c, int prize, string name, int typeId)
     : base(m, c, prize, name, typeId)
 {
 }
Esempio n. 13
0
 public AmusementEnterPath(GameRecords m, Coordinates c, Amusements a, bool tangible = true)
     : base(m, c, a, typeId: 1, tangible: tangible)
 {
     model.mustBeEnter = false;
         a.entrance = this;
 }
Esempio n. 14
0
 //not call base(m,c) because dont want to add to maps
 public AmusementPath(GameRecords m, Coordinates c, Amusements a, int typeId, bool tangible = true)
     : base(m, prize: 0, typeId: typeId, tangible: tangible)
 {
     this.coord = c;
     this.amusement = a;
     model.maps.AddEntranceExit(this);
 }
Esempio n. 15
0
 public void InitializeAfterDeserialization(GameRecords m, View2 v)
 {
     model = m;
     ((MapCustomControl)map).InitializeAfterDeserialization(m, v);
 }
Esempio n. 16
0
        /// <summary>
        /// Represents the current playing map, includes maps of paths and amusements, provides algorithms for navigation.
        /// </summary>
        /// <param name="width">The internal width of the map.</param>
        /// <param name="height">The internal height of the map.</param>
        /// <param name="m"></param>
        public Map(byte width, byte height, GameRecords m) {
            this.internalWidthMap = width;
            this.internalHeightMap = height;
            this.gameRec = m;


            //---initialize helpPath
            auxPathMap = new DirectionItem[width][];
            for (int i = 0; i < width; i++) {
                auxPathMap[i] = new DirectionItem[height];
            }

            //---initialize pathMap
            pathMap = new Path[width][];
            for (int i = 0; i < width; i++) pathMap[i] = new Path[height];

            //---initialize amusementMap
            amusementMap = new Amusements[width][];
            for (int i = 0; i < width; i++) amusementMap[i] = new Amusements[height];
        }
Esempio n. 17
0
 protected static bool CheckFreeLocation(byte x, byte y, GameRecords model, byte width, byte height, bool hasSeparatedEntranceAndExit = true)
 {
     if (x + width > model.playingWidth + 1 || y + height > model.playingHeight + 1) return false;
     for (byte i = x; i < x + width; i++) {
         for (byte j = y; j < y + height; j++) {
             if (!model.maps.isFree(i, j)) return false;
         }
     }
     #warning overit, ze to opravdu overuje spravne
     if (hasSeparatedEntranceAndExit) {
         bool free = false;
         if (x - 1 > 0) for (byte i = y; i < y + height; i++)
                 if (model.maps.isFree((byte)(x - 1), i)) { if (free) return free; else free = true; }
         if (x < model.playingWidth) for (byte i = y; i < y + height; i++)
                 if (model.maps.isFree((byte)(x + 1), i)) { if (free) return free; else free = true; }
         if (y - 1 > 0) for (byte i = x; i < x + width; i++)
                 if (model.maps.isFree(i, (byte)(y - 1))) { if (free) return free; else free = true; }
         if (y < model.playingWidth) for (byte i = y; i < y + height; i++)
                 if (model.maps.isFree(i, (byte)(y + 1))) { if (free) return free; else free = true; }
         return free;
     }
     return true;
 }
Esempio n. 18
0
 public AmusementExitPath(GameRecords m, Coordinates c, Amusements a, bool tangible = true)
     : base(m, c, a, typeId: 2, tangible: tangible)
 {
     a.exit = this;
 }
Esempio n. 19
0
        public Map(SerializationInfo si, StreamingContext sc) {
            gameRec = (GameRecords)si.GetValue("gameRec", typeof(GameRecords));
            amusementMap = (Amusements[][])si.GetValue("amusementMap", typeof(Amusements[][]));
            pathMap = (Path[][])si.GetValue("pathMap", typeof(Path[][])); //todo: Bylo by rychlejsi, kdybych si vytvorila seznam a teprve ten pak prochazela?
            internalWidthMap = gameRec.internalWidth;
            internalHeightMap = gameRec.internalHeight;

            auxPathMap = new DirectionItem[internalWidthMap][];
            for (int i = 0; i < internalWidthMap; i++) {
                auxPathMap[i] = new DirectionItem[internalHeightMap];
            }
            lastAddedAmusLock = new object();
            pathRWLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
            amusRWLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
            pathChanged = true; // due to calling UpdateDirection()
            lastAddedAmus = new ConcurrentQueue<Amusements>();


        }
Esempio n. 20
0
 protected Path(GameRecords m, int prize, int typeId, bool tangible = true)
     : base(m, prize, typeId, tangible)
 {
     this.zIndex = 10;
     signpostAmus = new Direction[m.maxAmusementsCount];
     for (int i = 0; i < signpostAmus.Length; i++) signpostAmus[i] = Direction.no;
 }
Esempio n. 21
0
        public Direction[] signpostAmus; //rozcestnik

        #endregion Fields

        #region Constructors

        public Path(GameRecords m, Coordinates c, int prize, string name, int typeId)
            : base(m, c, prize, typeId)
        {
            this.name = name;
            this.typeId = typeId;
            signpostAmus = new Direction[m.maxAmusementsCount];
               for (int i = 0; i < signpostAmus.Length; i++) signpostAmus[i] = Direction.no;

            model.maps.AddPath(this);
        }
Esempio n. 22
0
 public abstract MapObjects Build(byte x, byte y, GameRecords model);
Esempio n. 23
0
 protected MapObjects(GameRecords m, int prize, int typeID, bool tangible=true)
 {
     this.model = m;
     this.prize = prize;
     this.tangible = tangible;
     model.MoneyAdd(-this.prize);
     this.internTypeID = typeID;
 }
Esempio n. 24
0
 public MapObjects(GameRecords m,Coordinates coord, int prize, int typeID, bool tangible=true)
     : this(m, prize, typeID, tangible)
 {
     this.coord = coord;
     this.internTypeID = typeID;
 }
Esempio n. 25
0
 public override MapObjects Build(byte x, byte y, GameRecords model)
 {
     return new StonePath(model, new Coordinates(x, y), prize, name, internTypeId);
 }
Esempio n. 26
0
 public override bool CanBeBuild(byte x, byte y, GameRecords model)
 {
     return true;
 }
Esempio n. 27
0
 public override MapObjects Build(byte x, byte y, GameRecords model)
 {
     return new AmusementEnterPath(model, new Coordinates(x, y), a);
 }
Esempio n. 28
0
        public Person(GameRecords m, int x, int y)
            : base(m, prize: 0, typeID: -1)
        {
            this.contentment = 100;
            this.zIndex = 1;
            this.id = m.persList.GetFreeId();
            this.status = Status.initialWalking;
            this.money = rand.Next(Person.minMoney,Person.maxMoney);
            this.patience = rand.Next(Person.minPatience, Person.maxPatience);
            this.maxAcceptablePriceCoef = rand.Next(1000,3000) / 1000.0;
            this.realX = x;
            this.realY = y;
            this.visible = true;
            this.color = System.Drawing.Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255));

            m.persList.Add(this);
        }
Esempio n. 29
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="x">The intern x-coordinate of the playing map.</param>
 /// <param name="y">The intern x-coordinate of the playing map.</param>
 /// <returns>true if all conditions of building are satisfied, otherwise false.</returns>
 public abstract bool CanBeBuild(byte x, byte y, GameRecords model);
Esempio n. 30
0
 public AccessoriesForm(GameRecords m, ToolStripMenuItem accItem)
 {
     InitializeComponent();
     model = m;
     this.accItem = accItem;
 }