Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="original"></param>
        /// <returns></returns>
        public static GameObjectTarget Clone(GameObjectTarget original)
        {
            if (original == null)
            {
                return(null);
            }

            var newTarget = new GameObjectTarget {
                action          = original.action,
                gameObject      = original.gameObject,
                broadcastTarget = original.broadcastTarget,
                parameter       = CallbackParameter.Clone(original.parameter),
                _methodName     = original._methodName
            };

            if (original.cachedListeners != null)
            {
                newTarget.cachedListeners = new List <IGameEventListener>(original.cachedListeners);
            }

            if (original._cachedListenersView != null)
            {
                newTarget._cachedListenersView = new List <MonoBehaviour>(original._cachedListenersView);
            }

            return(newTarget);
        }
 public CallbackEventArgs(ulong userId, ulong guildId, ulong channelId, CallbackParameter parameter)
 {
     this.UserId    = userId;
     this.GuildId   = guildId;
     this.ChannelId = channelId;
     this.Parameter = parameter;
 }
        public LinkDecorator(CffGridView grid, CallbackParameter parameter, WebControl link, ISecurityManager securityManager)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(grid.ClientInstanceName, "grid");

            this.grid            = grid;
            this.parameter       = parameter;
            this.link            = link;
            this.securityManager = securityManager;
        }
        protected void TransactionGridViewCustomCallback(object sender, ReportGridViewCustomCallbackEventArgs e)
        {
            CallbackParameter   parameter   = CallbackParameter.Parse(e.Parameters);
            ArchivedTransaction transaction = (ArchivedTransaction)TransactionGridView.GetRow(parameter.RowIndex);

            var redirectionParameter = new RedirectionParameter(parameter.FieldName, SessionWrapper.Instance.Get.ClientFromQueryString.Id, SessionWrapper.Instance.Get.CustomerFromQueryString.Id, transaction.Batch);

            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.Get.Scope);
            Redirector       redirector      = new Redirector(RedirectionService.Create(this, securityManager));

            redirector.Redirect(redirectionParameter);
        }
Exemple #5
0
        protected void ReportGridViewCustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            CallbackParameter        parameter            = CallbackParameter.Parse(e.Parameters);
            AgedBalancesReportRecord record               = (AgedBalancesReportRecord)reportGridView.GetRow(parameter.RowIndex);
            RedirectionParameter     redirectionParameter = new RedirectionParameter(parameter.FieldName,
                                                                                     record.ClientNumber, record.Id);

            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.Scope);
            Redirector       redirector      = new Redirector(RedirectionService.Create(this, securityManager));

            redirector.Redirect(redirectionParameter);
        }
Exemple #6
0
        protected void CreditSearchGridViewCustomCallback(object sender, ReportGridViewCustomCallbackEventArgs e)
        {
            CallbackParameter parameter = CallbackParameter.Parse(e.Parameters);

            CreditNoteSearchResult creditNote = (CreditNoteSearchResult)creditSearchGridView.GetRow(parameter.RowIndex);

            RedirectionParameter redirectionParameter = new RedirectionParameter(parameter.FieldName,
                                                                                 creditNote.ClientId,
                                                                                 creditNote.CustomerId, creditNote.Batch);
            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, this.CurrentScope());
            Redirector       redirector      = new Redirector(RedirectionService.Create(this, securityManager));

            redirector.Redirect(redirectionParameter);
        }
    public void CallJavaScriptFfmpegFunction()
    {
        videoWriterExample.SaveMovieToIndexedDB();
        var executer          = new NativeExecuter();
        var callbackParameter = new CallbackParameter
        {
            callbackGameObjectName = gameObject.name,
            callbackFunctionName   = "Callback",
            callbackMoviePathName  = videoWriterExample.indexedDBDataPath
        };
        var parameterJson = JsonUtility.ToJson(callbackParameter);

        //var parameterJson = JsonUtility.ToJson(videoWriterExample.indexedDBDataPath);
        Debug.Log("CallJavaScriptFfmpegFunction: " + videoWriterExample.indexedDBDataPath);
        executer.Execute("FfmpegMethod", parameterJson);
    }
Exemple #8
0
        //=====================================================================================================================//
        //=================================================== Public Methods ==================================================//
        //=====================================================================================================================//

        #region Public Methods

        public static EventIDTarget Clone(EventIDTarget original)
        {
            if (original == null)
            {
                return(null);
            }

            var newTarget = new EventIDTarget {
                action    = original.action,
                eventID   = original.eventID,
                delay     = original.delay,
                allOfType = original.allOfType,
                parameter = CallbackParameter.Clone(original.parameter)
            };

            return(newTarget);
        }
Exemple #9
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool OnValidate()
        {
            if (action == ActionType.BroadcastToListeners)
            {
                return(PopulateListeners());
            }

            cachedListeners      = new List <IGameEventListener>();
            _cachedListenersView = new List <MonoBehaviour>();

            if (action == ActionType.SendMessage || action == ActionType.BroadcastMessage)
            {
                return(gameObject != null && !string.IsNullOrEmpty(_methodName));
            }

            _methodName = "";
            parameter   = new CallbackParameter();

            return(true);
        }
Exemple #10
0
        /// <summary>
        /// <see cref="ReferencedInstanceMethod"/> のような挙動もちょっと特殊と言えば特殊で。
        /// ネイティブに渡すコールバックは static で済むなら static がいい感じもあり。
        ///
        /// 今回の場合、<see cref="SetCallback(IntPtr, Callback)"/> の第1引数に渡したパラメーターを、
        /// <see cref="Callback"/> の第1引数で渡してもらえる作りになってる。
        /// ここに、インスタンスを渡せないかを考える。
        ///
        /// ネイティブ側を経由するので、pinned ポインターを使う必要がある。
        /// <seealso cref="GCHandle.Alloc(object, GCHandleType)"/>
        /// <seealso cref="GCHandleType.Pinned"/>
        /// <seealso cref="GCHandle.AddrOfPinnedObject"/>
        /// </summary>
        private static void ViaCallbackParameter()
        {
            // コールバックに渡してほしいパラメーターを用意
            var p = new CallbackParameter();

            // ネイティブに渡しても大丈夫なように pinned (ピン止め)して、
            var h = GCHandle.Alloc(p, GCHandleType.Pinned);
            // IntPtr 化する。
            var ptr = GCHandle.ToIntPtr(h);

            void SetHandler()
            {
                // IntPtr 化したオブジェクト(のアドレス)
                SetCallback(ptr, (param, value) =>
                {
                    // ポインターからオブジェクトを復元
                    var p1 = (CallbackParameter)GCHandle.FromIntPtr(param).Target;
                    Console.WriteLine(p1.Value += value);
                });
            }

            MakeGarbage();

            SetHandler();

            MakeGarbage();
            GC.Collect(2, GCCollectionMode.Forced);
            // コールバックは static なのでガベコレの影響を受けない。
            // h.Free() しない限りは p もコンパクションの影響を受けない。

            for (uint i = 0; i < 5; i++)
            {
                FireCallback(i);
            }

            // ただし、Free を忘れるとメモリリークする。
            h.Free();
        }
Exemple #11
0
        //=====================================================================================================================//
        //=================================================== Public Methods ==================================================//
        //=====================================================================================================================//

        #region Public Methods

        public static BehaviourTarget Clone(BehaviourTarget original)
        {
            if (original == null)
            {
                return(null);
            }

            var newTarget = new BehaviourTarget {
                behaviour   = original.behaviour,
                action      = original.action,
                _gameObject = original._gameObject,
                _methodName = original._methodName,
                _methodIdx  = original._methodIdx,
                _methodArg  = CallbackParameter.Clone(original._methodArg),
                type        = original.type,
                cloth       = original.cloth,
                lodGroup    = original.lodGroup,
                collider    = original.collider,
                renderer    = original.renderer
            };

            return(newTarget);
        }
        //=====================================================================================================================//
        //=================================================== Public Methods ==================================================//
        //=====================================================================================================================//

        #region Public Methods

        public static BehaviourTarget Clone(BehaviourTarget original)
        {
            if (original == null)
            {
                return(null);
            }

            var newTarget = new BehaviourTarget {
                _behaviour  = original._behaviour,
                _action     = original._action,
                _gameObject = original._gameObject,
                _methodName = original._methodName,
                _methodIdx  = original._methodIdx,
                _methodArg  = CallbackParameter.Clone(original._methodArg),
                _type       = original._type,
                _cloth      = original._cloth,
                _lodGroup   = original._lodGroup,
                _collider   = original._collider,
                _renderer   = original._renderer
            };

            return(newTarget);
        }