Ejemplo n.º 1
0
        public void doMouseClick(int x, int y)
        {
            Point    p   = new Point(x, y);
            DateTime now = DateTime.Now;

            //AppController.sEventLog.WriteLine("seconds: {0}",(now - sLastHit).Seconds);
            if ((now - sLastHit).Seconds < 1)
            {
                return;
            }
            sLastHit = now;
            int i = 0;

            foreach (Rectangle r in mItemRects)
            {
                if (r != null && r.Contains(p))
                {
                    mCurrentMenuIndex = i;
                    AppController.SysClick();
                    mParentForm.draw();
                    DiwiMenuCallbackHandler cb = (DiwiMenuCallbackHandler)mCallbacks[i];
                    if (cb != null)
                    {
                        mCurrentMenuIndex = -1;
                        cb(i, (string)mItems[i]);
                        return;
                    }
                }
                i++;
            }
        }
Ejemplo n.º 2
0
 public void menuSelect()
 {
     if (mCurrentMenuIndex != -1)
     {
         DiwiMenuCallbackHandler cb = (DiwiMenuCallbackHandler)mCallbacks[mCurrentMenuIndex];
         if (cb != null)
         {
             int i = mCurrentMenuIndex;
             mCurrentMenuIndex = -1;
             AppController.SysClick();
             cb(i, (string)mItems[i]);
         }
     }
 }
Ejemplo n.º 3
0
        void keydown(Object o, KeyEventArgs e)
        {
            switch (e.KeyValue)
            {
            case (int)sKeys.M_DOWN:
                mMenu.decIndex();
                if (mDoDrawMenu == false)
                {
                    mDoDrawMenu = true;
                    blendCount  = 4;
                }
                draw();
                break;

            case (int)sKeys.M_LEFT:
            case (int)sKeys.S_LEFT:
                if (mIsMapPage)
                {
                    AppController.SysClick();
                    MapHandler.mapRadius *= 1.5F;
                }
                break;

            case (int)sKeys.M_RIGHT:
            case (int)sKeys.S_RIGHT:
                if (mIsMapPage)
                {
                    AppController.SysClick();
                    MapHandler.mapRadius *= 0.75F;
                }
                break;

            case (int)sKeys.M_UP:
                if (mDoDrawMenu == false)
                {
                    mDoDrawMenu = true;
                    blendCount  = 4;
                }
                mMenu.incIndex();
                draw();
                break;
            }

            e.Handled = true;  //all key events handled by the form
            if (e.KeyCode == Keys.Enter)
            {
                mMenu.menuSelect();
            }
        }
Ejemplo n.º 4
0
        public void doMouseClick(int x, int y)
        {
            Point p = new Point(x, y);

            if (mRect.Contains(p))
            {
                AppController.SysClick();
                if (mCallback != null)
                {
                    mParentForm.XorRectangle(mRect.X, mRect.Y, mRect.Width, mRect.Height);
                    mCallback();
                    return;
                }
            }
        }