public void backCallback(object pSender)
 {
     CCScene s = new TextInputTestScene();
     s.AddChild(textinputTestScene.backTextInputTest());
     CCDirector.SharedDirector.ReplaceScene(s);
     //s->release();
 }
Exemple #2
0
        public override void TouchEnded(CCTouch pTouch, CCEvent pEvent)
        {
            if (m_pTrackNode != null)
            {
                return;
            }

            CCPoint endPos = pTouch.LocationInView;

            endPos = CCDirector.SharedDirector.ConvertToGl(endPos);

            float delta = 5.0f;

            if (Math.Abs(endPos.X - m_beginPos.X) > delta ||
                Math.Abs(endPos.Y - m_beginPos.Y) > delta)
            {
                // not click
                m_beginPos.X = m_beginPos.Y = -1;
                return;
            }

            // decide the trackNode is clicked.
            CCRect  rect;
            CCPoint point = ConvertTouchToNodeSpaceAr(pTouch);

            CCLog.Log("KeyboardNotificationLayer:clickedAt(%f,%f)", point.X, point.Y);

            rect = TextInputTestScene.getRect(m_pTrackNode);
            CCLog.Log("KeyboardNotificationLayer:TrackNode at(origin:%f,%f, size:%f,%f)",
                      rect.Origin.X, rect.Origin.Y, rect.Size.Width, rect.Size.Height);

            this.onClickTrackNode(CCRect.CCRectContainsPoint(rect, point));
            CCLog.Log("----------------------------------");
        }
        public void restartCallback(object pSender)
        {
            CCScene s = new TextInputTestScene();

            s.AddChild(textinputTestScene.restartTextInputTest());
            CCDirector.SharedDirector.ReplaceScene(s);
        }
Exemple #4
0
        public void backCallback(object pSender)
        {
            CCScene s = new TextInputTestScene();

            s.AddChild(textinputTestScene.backTextInputTest());
            CCDirector.SharedDirector.ReplaceScene(s);
            //s->release();
        }
Exemple #5
0
        public virtual void keyboardWillShow(CCIMEKeyboardNotificationInfo info)
        {
            CCLog.Log("TextInputTest:keyboardWillShowAt(origin:{0:F3},{1:F3}, size:{2:F3},{3:F3})",
                      info.end.Origin.X, info.end.Origin.Y, info.end.Size.Width, info.end.Size.Height);

            if (m_pTrackNode != null)
            {
                return;
            }

            CCRect rectTracked = TextInputTestScene.getRect(m_pTrackNode);

            CCLog.Log("TextInputTest:trackingNodeAt(origin:{0:F3},{1:F3}, size:{2:F3},{3:F3})",
                      rectTracked.Origin.X, rectTracked.Origin.Y, rectTracked.Size.Width, rectTracked.Size.Height);

            // if the keyboard area doesn't intersect with the tracking node area, nothing need to do.
            if (!CCRect.CCRectIntersetsRect(rectTracked, info.end))
            {
                return;
            }

            // assume keyboard at the bottom of screen, calculate the vertical adjustment.
            float adjustVert = CCRect.CCRectGetMaxY(info.end) - CCRect.CCRectGetMinY(rectTracked);

            CCLog.Log("TextInputTest:needAdjustVerticalPosition({0:F3})", adjustVert);

            // move all the children node of KeyboardNotificationLayer
            CCNode ccnoed = new CCNode();

            var     children = ccnoed.Children;
            CCNode  node;
            int     count = children.Count;
            CCPoint pos;

            for (int i = 0; i < count; ++i)
            {
                node          = (CCNode)children[i];
                pos           = node.Position;
                pos.Y        += adjustVert;
                node.Position = pos;
            }
        }
Exemple #6
0
 public void restartCallback(object pSender)
 {
     CCScene s = new TextInputTestScene();
     s.AddChild(textinputTestScene.restartTextInputTest());
     CCDirector.SharedDirector.ReplaceScene(s);
 }