Example #1
0
 public void OnTouchMove(BarleyBreakElem target)
 {
     if (target == emptyElem)
     {
         moveOK = true;
     }
 }
Example #2
0
        // On element click handler
        public void OnElemTouch(BarleyBreakElem target)
        {
            //if (canSelect) {
            if (target.number != maxElemsCount)
            {
                selectedElem = target;

                selectedElem.addSelectorMark();
            }
            //}
        }
Example #3
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            if (selectedElem != null)
            {
                tryToMove();

                moveOK = false;

                selectedElem.remSelectorMark();

                selectedElem = null;
            }
        }
Example #4
0
        // Create all elements
        public void genElements()
        {
            int elemsRowCounter = 1;
            int elemsColCounter = 1;

            CGSize elementSize = new CGSize(elemSize, elemSize);

            for (int i = 0; i < maxElemsCount; i++)
            {
                nfloat xPos = (elemsColCounter - 1) * elemSize + elemMargin * elemsColCounter;
                nfloat yPos = (elemsRowCounter - 1) * elemSize + elemMargin * elemsRowCounter;

                CGPoint elementPos = new CGPoint(xPos, yPos);

                BarleyBreakElem el = new BarleyBreakElem(new CGRect(elementPos, elementSize));
                el.posIndex = new CGPoint(elemsRowCounter, elemsColCounter);
                el.number   = numbArray [i];
                el.index    = i;

                el.OnElemTouch += OnElemTouch;

                barleyElems.Add(el);

                this.AddSubview(el);

                if (el.number == maxElemsCount)
                {
                    emptyElem = el;
                }

                if (elemsColCounter == maxElemsInRow)
                {
                    elemsColCounter = 1;

                    elemsRowCounter++;
                }
                else
                {
                    elemsColCounter++;
                }
            }
        }