예제 #1
0
파일: MapForm.cs 프로젝트: jamafyna/park
 public MapForm(GameRecords m, View2 view, byte playingWidth, byte playingHeight)
 {
     InitializeComponent();
     model = m;
     map = new MapCustomControl(model, view);
     map.Parent = this;
 }
예제 #2
0
파일: GameItems.cs 프로젝트: jamafyna/park
        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;
        }
예제 #3
0
 public AmusementsForm(GameRecords model, DockPanel parent, ToolStripMenuItem amusement)
 {
     InitializeComponent();
     dockP = parent;
     buyForm = new AmusementBuyForm(model,parent);
     this.amusItem = amusement;
 }
예제 #4
0
파일: MainForm.cs 프로젝트: jamafyna/park
        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();
        }
예제 #5
0
 public AmusementBuyForm(GameRecords m, DockPanel parent)
 {
     InitializeComponent();
     this.dockPanel = parent;
     model = m;
     color = Color.Yellow;
     this.Hide();
 }
예제 #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);
 }
예제 #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();
 }
예제 #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;
 }
예제 #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;
 }
예제 #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();
 }
예제 #11
0
파일: MainForm.cs 프로젝트: jamafyna/park
        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;
        }
예제 #12
0
파일: Path.cs 프로젝트: jamafyna/park
 public StonePath(GameRecords m, Coordinates c, int prize, string name, int typeId)
     : base(m, c, prize, name, typeId)
 {
 }
예제 #13
0
파일: Path.cs 프로젝트: jamafyna/park
 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;
 }
예제 #14
0
파일: Path.cs 프로젝트: jamafyna/park
 //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);
 }
예제 #15
0
파일: MapForm.cs 프로젝트: jamafyna/park
 public void InitializeAfterDeserialization(GameRecords m, View2 v)
 {
     model = m;
     ((MapCustomControl)map).InitializeAfterDeserialization(m, v);
 }
예제 #16
0
파일: Model.cs 프로젝트: jamafyna/park
        /// <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];
        }
예제 #17
0
파일: GameItems.cs 프로젝트: jamafyna/park
 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;
 }
예제 #18
0
파일: Path.cs 프로젝트: jamafyna/park
 public AmusementExitPath(GameRecords m, Coordinates c, Amusements a, bool tangible = true)
     : base(m, c, a, typeId: 2, tangible: tangible)
 {
     a.exit = this;
 }
예제 #19
0
파일: Model.cs 프로젝트: jamafyna/park
        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>();


        }
예제 #20
0
파일: GameItems.cs 프로젝트: jamafyna/park
 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;
 }
예제 #21
0
파일: GameItems.cs 프로젝트: jamafyna/park
        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);
        }
예제 #22
0
파일: GameItems.cs 프로젝트: jamafyna/park
 public abstract MapObjects Build(byte x, byte y, GameRecords model);
예제 #23
0
파일: GameItems.cs 프로젝트: jamafyna/park
 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;
 }
예제 #24
0
파일: GameItems.cs 프로젝트: jamafyna/park
 public MapObjects(GameRecords m,Coordinates coord, int prize, int typeID, bool tangible=true)
     : this(m, prize, typeID, tangible)
 {
     this.coord = coord;
     this.internTypeID = typeID;
 }
예제 #25
0
파일: Path.cs 프로젝트: jamafyna/park
 public override MapObjects Build(byte x, byte y, GameRecords model)
 {
     return new StonePath(model, new Coordinates(x, y), prize, name, internTypeId);
 }
예제 #26
0
파일: GameItems.cs 프로젝트: jamafyna/park
 public override bool CanBeBuild(byte x, byte y, GameRecords model)
 {
     return true;
 }
예제 #27
0
파일: Path.cs 프로젝트: jamafyna/park
 public override MapObjects Build(byte x, byte y, GameRecords model)
 {
     return new AmusementEnterPath(model, new Coordinates(x, y), a);
 }
예제 #28
0
파일: GameItems.cs 프로젝트: jamafyna/park
        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);
        }
예제 #29
0
파일: GameItems.cs 프로젝트: jamafyna/park
 /// <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);
예제 #30
0
 public AccessoriesForm(GameRecords m, ToolStripMenuItem accItem)
 {
     InitializeComponent();
     model = m;
     this.accItem = accItem;
 }