Пример #1
0
        /// <summary>
        /// 일정라벨 삭제
        /// </summary>
        /// <param name="boardForm"></param>
        public static void DeleteLabel(BoardForm boardForm)
        {
            Label tmp = boardForm.CBoardForm.CurrentLabel;

            boardForm.TabControl.Controls.Remove(tmp);
            tmp.Dispose();
        }
Пример #2
0
        /// <summary>
        /// 프로그램 최초 실행 시 일정 라벨 초기화
        /// </summary>
        /// <param name="boardForm"></param>
        /// <param name="workData"></param>
        /// <param name="i"></param>
        public void InitWorkLabel(BoardForm boardForm, WorkData workData, int i)
        {
            int     tabIndex = boardForm.TabControl.SelectedIndex;
            TabPage tabPage  = boardForm.TabControl.TabPages[tabIndex];

            tabPage.AutoScroll = true;

            Label newWork = new Label
            {
                Name        = "Work" + workData.MyID,
                Text        = workData.WorkName,
                BackColor   = workData.Color,
                Size        = new Size(tabPage.Size.Width - 10, 50),
                Location    = new Point(5, 50 + (70 * i)),
                BorderStyle = BorderStyle.FixedSingle,
                TextAlign   = ContentAlignment.MiddleCenter
            };

            newWork.Click += (s, e) =>
            {
                boardForm.CBoardForm.LabelClick((Label)s);
            };

            tabPage.Controls.Add(newWork);
        }
Пример #3
0
        protected void ListForm_btnBackClick(object sender, EventArgs e)
        {
            BoardForm bf = new BoardForm();

            bf.BoardClick += new EventHandler <BoardEventArgs>(BoardClick);
            OpenChildForm(bf);
        }
Пример #4
0
        /// <summary>
        /// 일정 라벨의 텍스트 변경
        /// </summary>
        /// <param name="boardForm"></param>
        public void UpdateLabelText(BoardForm boardForm)
        {
            Label label = boardForm.CBoardForm.CurrentLabel;

            label.Text      = this.WorkName;
            label.BackColor = this.Color;
        }
Пример #5
0
        private void iconButton1_Click(object sender, EventArgs e)
        {
            ActivateButton(sender, RGBColors.color1);
            BoardForm bf = new BoardForm();

            bf.BoardClick += new EventHandler <BoardEventArgs>(BoardClick);
            OpenChildForm(bf);
        }
Пример #6
0
 public override void UpdateLaser(BoardForm board, Laser laser, Point point)
 {
     if (laser.CurrentDirection == InputDirection &&
         laser.CurrentColour == InputColour)
         Activated = true;
     laser.SetSegmentEnd(Center);
     laser.Kill();
 }
Пример #7
0
 /// <summary>
 /// 생성자 컨트롤러 생성 시 보드 폼, 일정 폼을 컨트롤러와 연결
 /// </summary>
 /// <param name="_boardForm"></param>
 /// <param name="_workForm"></param>
 public BoardFormController(BoardForm _boardForm, WorkForm _workForm)
 {
     boardForm   = _boardForm;
     workForm    = _workForm;
     BoardData   = new BoardData("New Board");
     CurrentWork = new WorkData();
     isLabel     = false;
 }
Пример #8
0
        /// <summary>
        /// 탭 데이터 추가 시 보드 폼에도 탭 추가
        /// </summary>
        /// <param name="boardForm"></param>
        /// <param name="name"></param>
        public void AddTab(BoardForm boardForm, string name = "New Tab")
        {
            TabPage tabPage = new TabPage(name)
            {
                UseVisualStyleBackColor = true
            };

            tabPage.Controls.Add(boardForm.CreateWorkBtn);
            boardForm.TabControl.TabPages.Add(tabPage);
            boardForm.TabControl.SelectedTab = boardForm.TabControl.TabPages[boardForm.TabControl.TabCount - 1];
        }
Пример #9
0
        /// <summary>
        /// 보드 폼에서 탭 삭제
        /// </summary>
        /// <param name="boardForm"></param>
        public void DelTab(BoardForm boardForm)
        {
            int idx = boardForm.TabControl.SelectedIndex - 1;

            boardForm.TabControl.TabPages.Remove(boardForm.TabControl.SelectedTab);

            if (idx < 0)
            {
                idx = 0;
            }

            boardForm.TabControl.SelectTab(idx);
        }
        public override void UpdateLaser(BoardForm board, Laser laser, Point point)
        {
            laser.SetSegmentEnd(Center);

            if (InUse || !ValidInputDir(laser))
            {
                laser.Kill();
                return;
            }

            InUse = true;
            laser.SetSegmentStart(Center);
            laser.SetDirection(OutputDirection);
        }
Пример #11
0
        /// <summary>
        /// 일정 삭제 시 기존 일정의 위치 업데이트
        /// </summary>
        /// <param name="boardForm"></param>
        public static void UpdateLabelLocation(BoardForm boardForm)
        {
            TabPage tab = boardForm.TabControl.SelectedTab;

            int i = 0;

            foreach (var item in tab.Controls)
            {
                if (item is Label tmp)
                {
                    tmp.Location = new Point(5, 50 + (70 * i));
                    i++;
                }
            }
        }
Пример #12
0
        /// <summary>
        /// 처음 실행 시 불러온 데이터에 맞게 탭, 일정 생성
        /// </summary>
        /// <param name="BoardForm"></param>
        public void Init(BoardForm BoardForm)
        {
            BoardData board = BoardForm.CBoardForm.BoardData;

            int i = 0, j = 0;

            foreach (var tab in board.Tabs)
            {
                BoardForm.CBoardForm.BoardData.AddTab(BoardForm, tab.TabName);
                foreach (var item in tab.Works)
                {
                    BoardForm.CBoardForm.BoardData.Tabs[i].InitWorkLabel(BoardForm, item, j);
                    j++;
                }
                j = 0;
                i++;
            }
            BoardForm.TabControl.SelectedTab = BoardForm.TabControl.TabPages[0];
        }
Пример #13
0
        /// <summary>
        /// Trace the path of this laser from the given position on the board.
        /// </summary>
        public void TracePath(BoardForm boardForm, Point point)
        {
            var initialTile = boardForm.Board[point.Y, point.X];
            CurrentSegmentStart = initialTile.Center;

            while (true)
            {
                point += CurrentDirection;
                if (!IsValidPosition(boardForm, point))
                {
                    Segments.Add(
                        new LaserSegment(
                            CurrentSegmentStart,
                            CurrentSegmentStart + 2000 * new Vector2(CurrentDirection.X, -CurrentDirection.Y),
                            // 2000 should be enough to make the laser go offscreen
                            // from anywhere on the board.
                            // Also, we have to invert the direction's Y value because
                            // the screen is flipped on the y-axis and these directions
                            // refer to how the laser traverses the array of tiles, instead
                            // of the actual physical space.
                            CurrentColour.Color
                            )
                        );
                    break;
                }

                var nextTile = boardForm.Board[point.Y, point.X];
                nextTile.UpdateLaser(boardForm, this, point);

                if (Killed)
                    return;
            }
        }
        public override void UpdateLaser(BoardForm board, Laser laser, Point point)
        {
            var dir = laser.CurrentDirection;
            if (PassThrough.Contains(dir))
            {
                return;
            }

            laser.SetSegmentEnd(Center);

            if (!InUse_Left && InputOutputMappingLeft.ContainsKey(dir))
            {
                laser.SetSegmentStart(Center);
                laser.SetDirection(InputOutputMappingLeft[dir]);
                InUse_Left = true;
            }
            else if (!InUse_Right && InputOutputMappingRight.ContainsKey(dir))
            {
                laser.SetSegmentStart(Center);
                laser.SetDirection(InputOutputMappingRight[dir]);
                InUse_Right = true;
            }
            else
            {
                laser.Kill();
            }
        }
Пример #15
0
 public override void UpdateLaser(BoardForm board, Laser laser, Point point)
 {
 }
Пример #16
0
 /// <summary>
 /// 탭 이름 변경
 /// </summary>
 /// <param name="boardForm"></param>
 /// <param name="_name"></param>
 public void UpdateTabName(BoardForm boardForm, string _name)
 {
     boardForm.TabControl.SelectedTab.Text = _name;
 }
Пример #17
0
 /// <summary>
 /// 컨트롤러 생성시 폼 연결
 /// </summary>
 /// <param name="_boardForm"></param>
 /// <param name="_workForm"></param>
 public WorkFormController(BoardForm _boardForm, WorkForm _workForm)
 {
     boardForm = _boardForm;
     workForm  = _workForm;
 }
        /// <summary>
        /// Post-construct gets called after the form is added to a multiform
        /// (i.e. Parent != null).
        /// </summary>
        public override void PostConstruct()
        {
            base.PostConstruct();

            Board = Parent.GetForm<BoardForm>(LevelMultiform.BoardFormName);
            Inventory = Parent.GetForm<InventoryForm>(LevelMultiform.InventoryFormName);

            TOP_MESSAGE_Y_VALUE = (float)Board.BoardCollider.Y / 2f;

            // Set up the various sequential updaters.

            var Updater_001          = new DefaultUpdater();
            Updater_001.form         = this;
            Updater_001.InitialFrame = 70;
            Updater_001.Predicate    = () => Board.TileAdded;
            Updater_001.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 70,
                    Message  = "Click on one of the <<Image | 1>>'s to place a refractor.",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, TOP_MESSAGE_Y_VALUE),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = new List<Sprite>() { new Sprite(Assets.Level.Images.EmptyTile) },
                }
            };

            var Updater_002          = new DefaultUpdater();
            Updater_002.form         = this;
            Updater_002.InitialFrame = 20;
            Updater_002.Predicate = () => Board.TileRemoved;
            Updater_002.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "You can right click to remove a refractor.",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, TOP_MESSAGE_Y_VALUE),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = null
                }
            };

            var Updater_003          = new DefaultUpdater();
            Updater_003.form         = this;
            Updater_003.InitialFrame = 20;
            Updater_003.Predicate = () => Inventory.SelectionChanged;
            var y                    = ((RectCollider)Inventory.InventoryButtons[TileType.RF_UxR_UR].Collider).Center.Y;
            Updater_003.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "Select a different refractor.",
                    Position = new Vector2(DisplayManager.WindowWidth - 170, y),
                    Font     = Assets.Level.Fonts.TutorialMessage_Small,
                    Sprites  = null
                }
            };

            var Updater_004          = new DefaultUpdater();
            Updater_004.form         = this;
            Updater_004.InitialFrame = 20;
            Updater_004.Predicate    = () => Board.IsReceiverActivated(LaserColours.Red);
            var red_receiver         = new Sprite(Assets.Level.Images.Receiver);
            red_receiver.Tint        = LaserColours.Red.Color;
            Updater_004.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "Light up <<Image | 1>>",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, TOP_MESSAGE_Y_VALUE),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = new List<Sprite>() { red_receiver }
                }
            };

            var Updater_005          = new DefaultUpdater();
            Updater_005.form         = this;
            Updater_005.InitialFrame = 20;
            Updater_005.Predicate    = () => Board.IsReceiverActivated(LaserColours.Blue);
            var blue_receiver        = new Sprite(Assets.Level.Images.Receiver);
            blue_receiver.Tint       = LaserColours.Blue.Color;
            Updater_005.Messages     = new List<MessageInfo>() {
                new MessageInfo {
                    Frame    = 20,
                    Message  = "Good! Now light up <<Image | 1>>",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, (float)Board.BoardCollider.Y / 3f),
                    Font     = Assets.Level.Fonts.TutorialMessage_Large,
                    Sprites  = new List<Sprite>() { blue_receiver }
                },
                new MessageInfo {
                    Frame    = 300,
                    Message  = "(Hint: Use a different refractor)",
                    Position = new Vector2(DisplayManager.WindowWidth / 2f, (float)Board.BoardCollider.Y / 3f * 2f),
                    Font     = Assets.Level.Fonts.TutorialMessage_Small,
                    Sprites  = null
                }
            };

            Updater_001.NextUpdater = Updater_002;
            Updater_002.NextUpdater = Updater_003;
            Updater_003.NextUpdater = Updater_004;
            Updater_004.NextUpdater = Updater_005;
            Updater_005.NextUpdaterAction = () => { };

            CurrentUpdater = Updater_001.Update;
        }
Пример #19
0
 public override void UpdateLaser(BoardForm board, Laser laser, Point point)
 {
     laser.SetSegmentEnd(Center);
     laser.Kill();
 }
Пример #20
0
 //생성자
 public MoveWorkFormController(BoardForm boardForm)
 {
     this.boardForm       = boardForm;
     this.moveWorkForm    = null;
     this.selectedTabPage = 0;
 }
Пример #21
0
 /// <summary>
 /// Update the given laser. The given board is the BoardForm the laser was generated by,
 /// and the point is the position of this tile in the board's multidimensional array of
 /// LevelTiles.
 /// </summary>
 public abstract void UpdateLaser(BoardForm board, Laser laser, Point point);
Пример #22
0
 /// <summary>
 /// Check if a position is a valid position on the board.
 /// </summary>
 private bool IsValidPosition(BoardForm boardForm, Point point)
 {
     return 0 <= point.X && point.X < boardForm.Dimensions.X &&
            0 <= point.Y && point.Y < boardForm.Dimensions.Y;
 }