Esempio n. 1
0
        public void OnInputMove(Vector2 position)
        {
            if (!CGame.Instance.model.player.CanAction())
            {
                return;
            }
            if (!IsActiveIcon(selectedIcon))
            {
                return;
            }

            CIcon targetIcon = field.GetIconByPoint(position);

            if (selectedIcon != targetIcon && IsActiveIcon(targetIcon))
            {
                if (selectedIcon.IsNeighbour(targetIcon))
                {
                    if (StartSwipe(selectedIcon, targetIcon))
                    {
                        CGame.Input.Block();
                    }
                }

                selectedIcon = null;
            }
        }
Esempio n. 2
0
        private void ColumnFreeFall(int col)
        {
            List <CIcon> dead = new List <CIcon>();

            for (int row = 0; row < field.height; row++)
            {
                CIcon current = field.GetIconAt(new CCell(row, col));

                if (current.IsDead())
                {
                    dead.Add(current);
                    continue;
                }
                else if (dead.Count == 0)
                {
                    continue;                     // do nothing - current icon is now at correct place
                }

                field.SetIconAt(new CCell(row - dead.Count, col), current);

                move.AddMove(current, field.GetIconCenterByCell(current.cell));
            }

            DeadFreeFall(col, dead);
        }
Esempio n. 3
0
        protected void SearchAllMoves(int firstIndex, int secondIndex, int thirdIndex)
        {
            CIcon first  = GetIconByIndex(firstIndex);
            CIcon second = GetIconByIndex(secondIndex);
            CIcon third  = GetIconByIndex(thirdIndex);

            SearchTargetMoves(first, second, third);
            SearchTargetMoves(third, first, second);
            SearchTargetMoves(second, third, first);
        }
Esempio n. 4
0
        public CShutcutButton(String str) : base()
        {
            icon = CIcon.FileAssociatedImage(str, true);

            Path = str;
            //	Text		= str;
            Image     = icon;
            Width     = icon.Width + 5;
            Height    = icon.Height + 5;
            FlatStyle = FlatStyle.Popup;
        }
Esempio n. 5
0
        public bool OnInputBegin(Vector2 position)
        {
            var selectedIcon = field.GetIconByPoint(position);

            if (IsActiveIcon(selectedIcon))
            {
                this.selectedIcon = selectedIcon;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
        private CIcon RegisterIcon(CCell position)
        {
            GameObject gameObject = Instantiate(CGame.Config.match.gems.prefab) as GameObject;

            gameObject.transform.SetParent(this.transform);
            gameObject.transform.localScale = Vector3.one;
            gameObject.transform.position   = GetIconCenterByCell(position);

            CIcon icon = gameObject.GetComponent <CIcon>();

            SetIconAt(position, icon);

            do
            {
                icon.SetRandomColor();
            } while (CanCreateMatch(icon));

            return(icon);
        }
Esempio n. 7
0
        protected void SearchTargetMoves(CIcon first, CIcon second, CIcon target)
        {
            if (first.color != second.color)
            {
                return;
            }

            foreach (CIcon cell in GetNeighbours(target))
            {
                if (cell != first && cell != second && cell.color == first.color)
                {
                    moves.Add(new Move()
                    {
                        from = target,
                        to   = cell
                    });
                }
            }
        }
Esempio n. 8
0
        private bool CanCreateMatch(CIcon icon)
        {
            CCell cell = icon.cell;

            if (cell.col >= 2 &&
                GetIconAt(new CCell(cell.row, cell.col - 1)).IsMatchable(icon) &&
                GetIconAt(new CCell(cell.row, cell.col - 2)).IsMatchable(icon)
                )
            {
                return(true);
            }

            if (cell.row >= 2 &&
                GetIconAt(new CCell(cell.row - 1, cell.col)).IsMatchable(icon) &&
                GetIconAt(new CCell(cell.row - 2, cell.col)).IsMatchable(icon)
                )
            {
                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        public List <CIcon> GetNeighbours(CIcon icon)
        {
            var list = new List <CIcon>();

            if (icon.cell.col > 0)
            {
                list.Add(field.GetIconAt(new CCell(icon.cell.row, icon.cell.col - 1)));
            }
            if (icon.cell.col < field.width - 1)
            {
                list.Add(field.GetIconAt(new CCell(icon.cell.row, icon.cell.col + 1)));
            }
            if (icon.cell.row > 0)
            {
                list.Add(field.GetIconAt(new CCell(icon.cell.row - 1, icon.cell.col)));
            }
            if (icon.cell.row < field.height - 1)
            {
                list.Add(field.GetIconAt(new CCell(icon.cell.row + 1, icon.cell.col)));
            }

            return(list);
        }
Esempio n. 10
0
 private bool IsActiveIcon(CIcon icon)
 {
     return(icon != null && icon.IsIdle());
 }
Esempio n. 11
0
 public bool StartSwipe(CIcon selected, CIcon targeted)
 {
     return(field.actions.Add(new Actions.CSwipe(field, selected, targeted)));
 }
Esempio n. 12
0
 public void OnInputEnd(Vector2 position)
 {
     selectedIcon = null;
 }
Esempio n. 13
0
        static private void IconStatements(CIcon MIcon)
        {
            if (MIcon == CIcon.Error)
            {
                MessageBeep(30);
                frmIcon = Icon.FromHandle(largeIcon[109]);
            }

            if (MIcon == CIcon.Explorer)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[220]);
            }

            if (MIcon == CIcon.Find)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[22]);
            }

            if (MIcon == CIcon.Information)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[221]);
            }

            if (MIcon == CIcon.Mail)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[156]);
            }

            if (MIcon == CIcon.Media)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[116]);
            }

            if (MIcon == CIcon.Print)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[136]);
            }

            if (MIcon == CIcon.Question)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[23]);
            }

            if (MIcon == CIcon.RecycleBinEmpty)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[31]);
            }

            if (MIcon == CIcon.RecycleBinFull)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[32]);
            }

            if (MIcon == CIcon.Stop)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[27]);
            }

            if (MIcon == CIcon.User)
            {
                MessageBeep(0);
                frmIcon = Icon.FromHandle(largeIcon[170]);
            }

            if (MIcon == CIcon.Warning)
            {
                MessageBeep(30);
                frmIcon = Icon.FromHandle(largeIcon[217]);
            }
        }
Esempio n. 14
0
 public void SetIconAt(CCell position, CIcon icon)
 {
     icons[position.row, position.col] = icon;
     icon.cell.Set(position);
 }
Esempio n. 15
0
 public CSwipe(CField field, CIcon selected, CIcon targeted)
 {
     this.field    = field;
     this.selected = selected;
     this.targeted = targeted;
 }
Esempio n. 16
0
 public CSwipeBack(CField field, CIcon selected, CIcon targeted) : base(field, selected, targeted)
 {
 }
Esempio n. 17
0
        /// <summary>
        /// MIcon: Display MyIcon on the message box.
        /// </summary>
        static public DialogResult Show(string Message, string Title, CButtons MButtons, CIcon MIcon)
        {
            BuildMessageBox(Title);
            frmTitle.Text   = Title;
            frmMessage.Text = Message;
            ButtonStatements(MButtons);
            IconStatements(MIcon);
            Image imageIcon = new Bitmap(frmIcon.ToBitmap(), 38, 38);

            pIcon.Image = imageIcon;
            newMessageBox.ShowDialog();
            return(CYReturnButton);
        }