Example #1
0
        /* ForceDownload */
        /* ******************** */
        #region ForceDownload

        /*
         * Force Download
         * ReneCommunicatorFile up = new ReneCommunicatorFile();
         * FileStream file = new FileStream("ApplicationInformation.xml", FileMode.Open, FileAccess.Read);
         * up.Data = file;
         * up.FileName = "ApplicationInformation2.xml";
         * up.FileDestination = "";
         * guest.Download(up);
         * file.Close();
         */
        #endregion

        #endregion

        /* ******************** */
        /* ******************** */
        /* Game Engine Calls */
        /* ******************** */
        /* ******************** */
        #region Game Engine

        /* TankMove */
        /* ******************** */
        #region TankMove
        public bool TankMove(double x, double y)
        {
            ReneServiceCallback guest = OperationContext.Current.GetCallbackChannel <ReneServiceCallback>();
            User user = guest.User();

            ReneCommunicatorService.ReneServiceCallbackUserPairs.ForEach(
                delegate(ReneServiceCallbackUserPair rs)
            {
                ReneServiceCallback callback = rs.ReneServiceCallback;

                object[] o = new object[4];
                o[0]       = guest;
                o[1]       = callback;
                o[2]       = x;
                o[3]       = y;

                Thread _backgroundThread;
                _backgroundThread = new Thread(TankMove_DoWork);
                _backgroundThread.SetApartmentState(ApartmentState.MTA);
                _backgroundThread.Start(o);
            }
                );



            guest.TankMove("TankMoveDone", user, x, y);

            return(true);
        }
Example #2
0
        void TankMove_DoWork(object s)
        {
            Guid g = Guid.NewGuid();

            object[] o = s as object[];

            ReneServiceCallback sender   = o[0] as ReneServiceCallback;
            ReneServiceCallback receiver = o[1] as ReneServiceCallback;
            double x = (double)o[2];
            double y = (double)o[3];

            if (!TestCallBack(sender) || !TestCallBack(receiver))
            {
                return;
            }

            if (sender.User().PublicKey != receiver.User().PublicKey)
            {
                receiver.TankMove("TankMoveDone", sender.User(), x, y);
            }
        }