Example #1
0
        private eContactChange State_MultiDrag()
        {
            var data = new MultiDragData(CalcAvgTouchPos(), CalcMaxSeparation(), mMultiDrag_FrameCount);

            XBulletinBoard.Instance().mBroadcaster_MultiDrag.Post(data);
            ++mMultiDrag_FrameCount;
            return(eContactChange.NoChange);
        }
Example #2
0
        private void ExitSinglePoke(ePokeDetail detail, bool current_pos_valid)
        {
            SinglePokeData data = current_pos_valid                                                                                                                                                               ?
                                  new SinglePokeData(detail, mSinglePoke_StartPos, GetSingleTouchPos(), mSinglePoke_FrameCount) :
                                  new SinglePokeData(detail, mSinglePoke_StartPos, mSinglePoke_FrameCount);

            XBulletinBoard.Instance().mBroadcaster_SinglePoke.Post(data);
        }
Example #3
0
        public void Update()
        {
            // check for create menu
            var enumerator_fiveContacts = mListener_FiveContacts.CreateEnumerator();

            if (enumerator_fiveContacts.MoveNext())
            {
                if (mRootSelector == null)
                {
                    mRootSelector = XUI.Instance().CreateSelector(new XUI._Position(), "Debug Menu",
                                                                  XUI.eStyle.Frontend, XUI.eStyle.FrontendButton,
                                                                  XUI.eStyle.FrontendTitle, mOptions);
                }
            }

            // check for menu selection
            var selection_data = mListener_SelectorSelection.GetMaxOne();

            if (selection_data != null)
            {
                if (selection_data.mSelectorID == mRootSelector.GetID())
                {
                    // destroy this selector
                    XUI.Instance().DestroySelector(mRootSelector.GetID());
                    mRootSelector = null;

                    switch (selection_data.mIndexSelected)
                    {
                    case 0:
                        // map selected, sent message for that system to do what it wants
                        Console.WriteLine("map selected");
                        mBroadcaster_MenuSelection.Post(new MenuSelectionEvent(selection_data.mSelectorID, mOptions[0]));
                        break;

                    case 2:
                        // exit selected, do nothing, menu will close
                        break;

                    case 4:
                        // quit selected, send message to end program.  this menu will close
                        XBulletinBoard.Instance().mBroadcaster_ExitGameEvent.Post(new Game1.ExitGameEvent());
                        break;

                    default:
                        // problem
                        XUtils.Assert(false);
                        break;
                    }
                }
            }
        }
Example #4
0
        public XWorldCam(xCoord screen_dim)
        {
            mScreenDim = screen_dim;
            mAspect    = ((float)(screen_dim.y)) / screen_dim.x;
            InitFromWorld();

            mListener_MultiDrag = new XListener <XTouch.MultiDragData>(1, eEventQueueFullBehaviour.IgnoreOldest,
                                                                       "worldcammultidrag");
            XBulletinBoard.Instance().mBroadcaster_MultiDrag.Subscribe(mListener_MultiDrag);

            mListener_WorldRegenerated = new XListener <XWorld.WorldRegenerated>(1, eEventQueueFullBehaviour.IgnoreOldest,
                                                                                 "worldcamworldregenerated");
            XWorld.Instance().GetBroadcaster_WorldRegenerated().Subscribe(mListener_WorldRegenerated);
        }
Example #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            XBulletinBoard.Instance().Init();
            XTouch.Instance().Init();
            XKeyInput.Instance().Init();
            XWorld.Instance().Init();
            XMouse.Instance().Init();
            XFontDraw.Instance().Init(GraphicsDevice, Content);
            XRenderManager.Instance().Initialize(GraphicsDevice, mGraphicsDeviceManager, Content);
            XUI.Instance().Init();
            XRootDebugMenu.Instance().Init();

            base.Initialize();

            XBulletinBoard.Instance().mBroadcaster_ExitGameEvent.Subscribe(mListener_ExitGameEvent);
        }
Example #6
0
        public Game1()
        {
            mGraphicsDeviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory  = "Content";

            mListener_ExitGameEvent = new XListener <ExitGameEvent>(1, eEventQueueFullBehaviour.Ignore, "ExitGame");

            XBulletinBoard.CreateInstance();
            XFontDraw.CreateInstance();
            XRenderManager.CreateInstance();
            XTouch.CreateInstance();
            XKeyInput.CreateInstance();
            XWorld.CreateInstance();
            XMouse.CreateInstance();
            XUI.CreateInstance();
            XRootDebugMenu.CreateInstance();
        }
Example #7
0
        private eContactChange State_SinglePoke()
        {
            double  k_drift_thresh_sqr = XMath.Sqr(45d);
            Vector2 current_pos        = GetSingleTouchPos();
            Vector2 drift = current_pos - mSinglePoke_StartPos;

            if (drift.LengthSquared() > k_drift_thresh_sqr)
            {
                return(eContactChange.StillToMoving);
            }

            ePokeDetail    detail = mSinglePoke_FrameCount == 0 ? ePokeDetail.Start : ePokeDetail.Hold;
            SinglePokeData data   = new SinglePokeData(detail, mSinglePoke_StartPos, current_pos, mSinglePoke_FrameCount);

            XBulletinBoard.Instance().mBroadcaster_SinglePoke.Post(data);
            ++mSinglePoke_FrameCount;

            return(eContactChange.NoChange);
        }
Example #8
0
 public void Init()
 {
     mListener_FourContacts = new XListener <XTouch.FourContacts>(1, eEventQueueFullBehaviour.Ignore, "XUITB4C");
     XBulletinBoard.Instance().mBroadcaster_FourContacts.Subscribe(mListener_FourContacts);
 }
Example #9
0
 public void Init()
 {
     XBulletinBoard.Instance().mBroadcaster_FiveContacts.Subscribe(mListener_FiveContacts);
     XUI.Instance().GetBroadcaster_SelectorSelectionEvent().Subscribe(mListener_SelectorSelection);
 }
Example #10
0
 private void Transition_5Contacts_Any()
 {
     XBulletinBoard.Instance().mBroadcaster_FiveContacts.Post(new FiveContacts());
 }
Example #11
0
 private void _Init_Input()
 {
     XBulletinBoard.Instance().mBroadcaster_SinglePoke.Subscribe(_mListener_SinglePoke);
 }