コード例 #1
0
 static EntityBlackboard()
 {
     {
         var setter = typeof(EntityBlackboard).GetMethod("SetComponentData", BindingFlags.Public | BindingFlags.Instance);
         _SET_COMPONENT_DATA = (caller, type, value) => setter.MakeGenericMethod(type).Invoke(caller, new [] { value });
     }
 }
コード例 #2
0
        static EntityBlackboard()
        {
            {
                var getter = typeof(EntityBlackboard).GetMethod("GetComponentData", BindingFlags.Public | BindingFlags.Instance);
                _GET_COMPONENT_DATA = (caller, type) => getter.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }

            {
                var getter = typeof(EntityBlackboard).GetMethod("GetSharedComponentData", BindingFlags.Public | BindingFlags.Instance);
                _GET_SHARED_COMPONENT_DATA = (caller, type) => getter.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }

            {
                var getter = typeof(EntityBlackboard).GetMethod("GetManagedData", BindingFlags.Public | BindingFlags.Instance);
                _GET_MANAGED_DATA = (caller, type) => getter.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }

            {
                var getter = typeof(EntityBlackboard).GetMethod("GetUnityComponent", BindingFlags.Public | BindingFlags.Instance);
                _GET_COMPONENT_OBJECT = (caller, type) => getter.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }

            {
                var setter = typeof(EntityBlackboard).GetMethod("SetComponentData", BindingFlags.Public | BindingFlags.Instance);
                _SET_COMPONENT_DATA = (caller, type, value) => setter.MakeGenericMethod(type).Invoke(caller, new [] { value });
            }

            {
                var predicate = typeof(EntityBlackboard).GetMethod("HasComponent", BindingFlags.Public | BindingFlags.Instance);
                _HAS_COMPONENT = (caller, type) => (bool)predicate.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }
        }
コード例 #3
0
ファイル: Utility.cs プロジェクト: benwager/KlakNDI
        public ComputeDataSetter(ComputeBuffer buffer)
        {
            var method = typeof(ComputeBuffer).GetMethod
                             ("InternalSetNativeData",
                             BindingFlags.InvokeMethod |
                             BindingFlags.NonPublic |
                             BindingFlags.Instance);

            _setData = (SetDataDelegate)Delegate.CreateDelegate
                           (typeof(SetDataDelegate), buffer, method);
        }
コード例 #4
0
ファイル: PeakMeterCtrl.cs プロジェクト: dan-huang/CUETools
        /// <summary>
        /// Set meter band value
        /// </summary>
        /// <param name="arrayValue">Array value for the bands</param>
        /// <param name="offset">Starting offset position</param>
        /// <param name="size">Number of values to set</param>
        /// <returns></returns>
        public bool SetData(int[] arrayValue, int offset, int size)
        {
            if (arrayValue == null)
            {
                throw new ArgumentNullException("arrayValue");
            }
            if (arrayValue.Length < (offset + size))
            {
                throw new ArgumentOutOfRangeException("arrayValue");
            }

            if (this.InvokeRequired)
            {
                SetDataDelegate setDelegate = new SetDataDelegate(this.SetData);
                return((bool)this.Invoke(setDelegate, arrayValue, offset, size));
            }
            bool isRunning = this.IsActive;

            Monitor.Enter(this._meterData);

            int maxIndex = offset + size;

            for (int i = offset; i < maxIndex; i++)
            {
                if (i < this._meterData.Length)
                {
                    PeakMeterData pm = this._meterData[i];
                    pm.Value = Math.Min(arrayValue[i], this._MaxRangeValue);
                    pm.Value = Math.Max(pm.Value, 0);
                    if (pm.Falloff < pm.Value)
                    {
                        pm.Falloff = pm.Value;
                        pm.Speed   = this._FalloffSpeed;
                    }
                    this._meterData[i] = pm;
                }
            }
            Monitor.Exit(this._meterData);

            // check that timer should be restarted
            if (_AnimDelay != Timeout.Infinite)
            {
                if (_animationTimer == null)
                {
                    StartAnimation(_AnimDelay);
                }
            }
            else
            {
                Refresh();
            }

            return(isRunning);
        }
コード例 #5
0
ファイル: PageList.cs プロジェクト: tomohiro-toyota2456/RTS
    //初期化用関数
    //総データ数と1ページあたりのデータを入れる
    //ページ切り替えのアクションとデータを入れるときのアクションを入れる
    public int Setup(int dataCount, int onePage, NotificationChangedPageDelegate notificationChangedPageAction, SetDataDelegate setDataAction)
    {
        setDataDel = setDataAction;
        notificationChangedPageDel = notificationChangedPageAction;

        this.onePage   = onePage;
        this.dataCount = dataCount;
        maxPage        = dataCount / onePage;
        maxPage        = dataCount % onePage == 0 ? maxPage : maxPage + 1;
        curPage        = 1;

        ChangePage(1);

        return(maxPage);
    }
コード例 #6
0
        static EntityJobChunkBlackboard()
        {
            {
                var getter = typeof(EntityJobChunkBlackboard).GetMethod("GetComponentData", BindingFlags.Public | BindingFlags.Instance);
                _GET_COMPONENT_DATA = (caller, type) => getter.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }

            {
                var setter = typeof(EntityJobChunkBlackboard).GetMethod("SetComponentData", BindingFlags.Public | BindingFlags.Instance);
                _SET_COMPONENT_DATA = (caller, type, value) => setter.MakeGenericMethod(type).Invoke(caller, new[] { value });
            }

            {
                var predicate = typeof(EntityJobChunkBlackboard).GetMethod("HasComponentData", BindingFlags.Public | BindingFlags.Instance);
                _HAS_COMPONENT_DATA = (caller, type) => (bool)predicate.MakeGenericMethod(type).Invoke(caller, new object[0]);
            }
        }
コード例 #7
0
        static Win32DnD()
        {
            // Required for all other OLE functions to work
            Win32OleInitialize(IntPtr.Zero);

            // We reuse those
            DragDropEventArgs     = new DragEventArgs(new DataObject(DataFormats.FileDrop, new string[0]), 0, 0, 0, DragDropEffects.None, DragDropEffects.None);
            DragFeedbackEventArgs = new GiveFeedbackEventArgs(DragDropEffects.None, true);
            DragContinueEventArgs = new QueryContinueDragEventArgs(0, false, DragAction.Continue);
            DragFormats           = new ArrayList();
            DragFormatArray       = new FORMATETC[0];
            DragMediums           = new ArrayList();

            // Set up delegates
            // IDataObject
            DOQueryInterface      = new QueryInterfaceDelegate(ComIDataObject.QueryInterface);
            DOAddRef              = new AddRefDelegate(ComIDataObject.AddRef);
            DORelease             = new ReleaseDelegate(ComIDataObject.Release);
            GetData               = new GetDataDelegate(ComIDataObject.GetData);
            GetDataHere           = new GetDataHereDelegate(ComIDataObject.GetDataHere);
            QueryGetData          = new QueryGetDataDelegate(ComIDataObject.QueryGetData);
            GetCanonicalFormatEtc = new GetCanonicalFormatEtcDelegate(ComIDataObject.GetCanonicalFormatEtc);
            SetData               = new SetDataDelegate(ComIDataObject.SetData);
            EnumFormatEtc         = new EnumFormatEtcDelegate(ComIDataObject.EnumFormatEtc);
            DAdvise               = new DAdviseDelegate(ComIDataObject.DAdvise);
            DUnadvise             = new DUnadviseDelegate(ComIDataObject.DUnadvise);
            EnumDAdvise           = new EnumDAdviseDelegate(ComIDataObject.EnumDAdvise);

            // IDropSource
            DSQueryInterface  = new QueryInterfaceDelegate(ComIDropSource.QueryInterface);
            DSAddRef          = new AddRefDelegate(ComIDropSource.AddRef);
            DSRelease         = new ReleaseDelegate(ComIDropSource.Release);
            QueryContinueDrag = new QueryContinueDragDelegate(ComIDropSource.QueryContinueDrag);
            GiveFeedback      = new GiveFeedbackDelegate(ComIDropSource.GiveFeedback);

            // IDropTarget
            DTQueryInterface = new QueryInterfaceDelegate(ComIDropTarget.QueryInterface);
            DTAddRef         = new AddRefDelegate(ComIDropTarget.AddRef);
            DTRelease        = new ReleaseDelegate(ComIDropTarget.Release);
            DragEnter        = new DragEnterDelegate(ComIDropTarget.DragEnter);
            DragOver         = new DragOverDelegate(ComIDropTarget.DragOver);
            DragLeave        = new DragLeaveDelegate(ComIDropTarget.DragLeave);
            Drop             = new DropDelegate(ComIDropTarget.Drop);
        }
コード例 #8
0
 private void OnDestroy()
 {
     UpdateData -= SetData;
 }
コード例 #9
0
 private void Awake()
 {
     UpdateData += SetData;
 }
コード例 #10
0
ファイル: PeakMeterCtrl.cs プロジェクト: sneat/3.5
        /// <summary>
        /// Set meter band value
        /// </summary>
        /// <param name="arrayValue">Array value for the bands</param>
        /// <param name="offset">Starting offset position</param>
        /// <param name="size">Number of values to set</param>
        /// <returns></returns>
        public bool SetData(int[] arrayValue, int offset, int size)
        {
            if (arrayValue == null)
                throw new ArgumentNullException("arrayValue");
            if (arrayValue.Length < (offset + size))
                throw new ArgumentOutOfRangeException("arrayValue");

            if (this.InvokeRequired)
            {
                SetDataDelegate setDelegate = new SetDataDelegate(this.SetData);
                return (bool)this.Invoke(setDelegate, arrayValue, offset, size);
            }
            bool isRunning = this.IsActive;

            Monitor.Enter(this._meterData);

            int maxIndex = offset + size;
            for (int i = offset; i < maxIndex; i++)
            {
                if (i < this._meterData.Length)
                {
                    PeakMeterData pm = this._meterData[i];
                    pm.Value = Math.Min(arrayValue[i], this._MaxRangeValue);
                    pm.Value = Math.Max(pm.Value, 0);
                    if (pm.Falloff < pm.Value)
                    {
                        pm.Falloff = pm.Value;
                        pm.Speed = this._FalloffSpeed;
                    }
                    this._meterData[i] = pm;
                }
            }
            Monitor.Exit(this._meterData);
 
            // check that timer should be restarted
            if (_AnimDelay != Timeout.Infinite)
            {
                if (_animationTimer == null)
                {
                    StartAnimation(_AnimDelay);
                }
            }
            else
            {
                Refresh();
            }

            return isRunning;
        }
コード例 #11
0
ファイル: Win32DnD.cs プロジェクト: nlhepler/mono
		static Win32DnD()
		{
			// Required for all other OLE functions to work
			Win32OleInitialize(IntPtr.Zero);

			// We reuse those
			DragDropEventArgs = new DragEventArgs(new DataObject(DataFormats.FileDrop, new string[0]), 0, 0, 0, DragDropEffects.None, DragDropEffects.None);
			DragFeedbackEventArgs = new GiveFeedbackEventArgs(DragDropEffects.None, true);
			DragContinueEventArgs = new QueryContinueDragEventArgs(0, false, DragAction.Continue);
			DragFormats = new ArrayList();
			DragFormatArray = new FORMATETC[0];
			DragMediums = new ArrayList();

			// Set up delegates
			// IDataObject
			DOQueryInterface = new QueryInterfaceDelegate(ComIDataObject.QueryInterface);
			DOAddRef = new AddRefDelegate(ComIDataObject.AddRef);
			DORelease = new ReleaseDelegate(ComIDataObject.Release);
			GetData = new GetDataDelegate(ComIDataObject.GetData);
			GetDataHere = new GetDataHereDelegate(ComIDataObject.GetDataHere);
			QueryGetData = new QueryGetDataDelegate(ComIDataObject.QueryGetData);
			GetCanonicalFormatEtc = new GetCanonicalFormatEtcDelegate(ComIDataObject.GetCanonicalFormatEtc);
			SetData = new SetDataDelegate(ComIDataObject.SetData);
			EnumFormatEtc = new EnumFormatEtcDelegate(ComIDataObject.EnumFormatEtc);
			DAdvise = new DAdviseDelegate(ComIDataObject.DAdvise);
			DUnadvise = new DUnadviseDelegate(ComIDataObject.DUnadvise);
			EnumDAdvise = new EnumDAdviseDelegate(ComIDataObject.EnumDAdvise);

			// IDropSource
			DSQueryInterface = new QueryInterfaceDelegate(ComIDropSource.QueryInterface);
			DSAddRef = new AddRefDelegate(ComIDropSource.AddRef);
			DSRelease = new ReleaseDelegate(ComIDropSource.Release);
			QueryContinueDrag = new QueryContinueDragDelegate(ComIDropSource.QueryContinueDrag);
			GiveFeedback = new GiveFeedbackDelegate(ComIDropSource.GiveFeedback);

			// IDropTarget
			DTQueryInterface = new QueryInterfaceDelegate(ComIDropTarget.QueryInterface);
			DTAddRef = new AddRefDelegate(ComIDropTarget.AddRef);
			DTRelease = new ReleaseDelegate(ComIDropTarget.Release);
			DragEnter = new DragEnterDelegate(ComIDropTarget.DragEnter);
			DragOver = new DragOverDelegate(ComIDropTarget.DragOver);
			DragLeave = new DragLeaveDelegate(ComIDropTarget.DragLeave);
			Drop = new DropDelegate(ComIDropTarget.Drop);
		}