Ejemplo n.º 1
0
        public CubeWrapper(SlideShowApp app, Cube cube, AMQConnector amq)
        {
            mApp = app;
            mCube = cube;
            mCube.userData = this;
            mIndex = 0;
            amqConn = amq;

            // Here we attach more event handlers for button and accelerometer actions.
            mCube.ButtonEvent += OnButton;
            mCube.TiltEvent += OnTilt;
            mCube.ShakeStartedEvent += OnShakeStarted;
            mCube.ShakeStoppedEvent += OnShakeStopped;
            mCube.FlipEvent += OnFlip;
        }
Ejemplo n.º 2
0
        // Here we initialize our app.
        public override void Setup()
        {
            AMQConnector amqConn = new AMQConnector ();
            //amqConn.Connect ();

            // Load up the list of images.
            mImageNames = LoadImageIndex ();

            // Loop through all the cubes and set them up.
            foreach (Cube cube in CubeSet) {

                // Create a wrapper object for each cube. The wrapper object allows us
                // to bundle a cube with extra information and behavior.
                CubeWrapper wrapper = new CubeWrapper (this, cube, amqConn);
                mWrappers.Add (wrapper);
                wrapper.DrawSlide ();
            }

            // ## Event Handlers ##
            // Objects in the Sifteo API (particularly BaseApp, CubeSet, and Cube)
            // fire events to notify an app of various happenings, including actions
            // that the player performs on the cubes.
            //
            // To listen for an event, just add the handler method to the event. The
            // handler method must have the correct signature to be added. Refer to
            // the API documentation or look at the examples below to get a sense of
            // the correct signatures for various events.
            //
            // **NeighborAddEvent** and **NeighborRemoveEvent** are triggered when
            // the player puts two cubes together or separates two neighbored cubes.
            // These events are fired by CubeSet instead of Cube because they involve
            // interaction between two Cube objects. (There are Cube-level neighbor
            // events as well, which comes in handy in certain situations, but most
            // of the time you will find the CubeSet-level events to be more useful.)
            CubeSet.NeighborAddEvent += OnNeighborAdd;
            CubeSet.NeighborRemoveEvent += OnNeighborRemove;
        }