/// <summary>
        /// 激活
        /// </summary>
        public void OnInteractiveEnable()
        {
            EventHandGrabObject.AddListener(OnGrabObject, Core.ExecutionPriority.High);
            EventHandReleaseObject.AddListener(OnIdleObject, Core.ExecutionPriority.High);

            coroutineUpdate = StartCoroutine(OnUpdate());
        }
Esempio n. 2
0
    private void Start()
    {
        //EventCameraZoom.AddListener((float lerp) =>
        //{
        //    Debug.Log("缩放:" + lerp);
        //});

        //EventCameraRotate.AddListener((Vector3 lerp) =>
        //{
        //    Debug.Log("旋转向量值:" + lerp);
        //});

        //EventHandGrip.AddListener((int handIndex) =>
        //{
        //    Debug.Log("握拳:" + handIndex);
        //});

        //EventHandIdle.AddListener((int handIndex) =>
        //{
        //    Debug.Log("释放:" + handIndex);
        //});

        //Test();

        //var result = IsContains(1, OperatePlatform.Mouse);

        //Debug.Log("result:" + result);

        EventHandGrabObject.AddListener((go, handIndex) =>
        {
            //Debug.Log("抓取手:" + handIndex + "  物体:" + go);
        });

        //EventHandRayTarget.AddListener((hit, handIndex) =>
        //{
        //    Debug.Log("手:" + handIndex + "  射线点:" + hit.collider.gameObject);
        //});

        EventHandRayTargetEnter.AddListener(key, (handIndex) =>
        {
            //Debug.Log("手:" + handIndex + "物体移入:" + key);
        });

        EventHandRayTargetExit.AddListener(key, (handIndex) =>
        {
            //Debug.Log("手:" + handIndex + "物体移出:" + key);
        });

        EventHandReleaseObject.AddListener((go, handIndex) =>
        {
            //Debug.Log("释放手:" + handIndex + "  物体:" + go);
        });
    }
Esempio n. 3
0
        /// <summary>
        /// 初始化背包
        /// </summary>
        public void OnInitialize()
        {
            DeleteBagItem();

            if (backpackItem == null)
            {
                backpackItem = Resources.Load <GameObject>("Prefabs\\backpackItem");
            }

            string jsonData = Json.JsonHelper.ReadJsonString(Application.streamingAssetsPath + "/Backpack/JsonData/" + backpackJsonFileNmae + ".json");

            if (string.IsNullOrEmpty(jsonData))
            {
                return;
            }

            dataConfig = Json.JsonHelper.JsonToObject <KGUI_ItemDataConfig>(jsonData);

            if (dataConfig == null)
            {
                return;
            }

            areaPanel.onEnter.AddListener(OnEnter);
            areaPanel.onExit.AddListener(OnExit);

            backpackTrigger.onEnter.AddListener(OnEnter);

            CloseBag();

            CreateItems();

            //根据数量设置高度
            RectTransform   rectTransform = content.GetComponent <RectTransform>();
            int             count         = dataConfig.ItemDatas.Count / 2 + dataConfig.ItemDatas.Count % 2;
            GridLayoutGroup gridLayout    = rectTransform.GetComponent <GridLayoutGroup>();

            //计算高度
            float height = gridLayout.cellSize.y * count + gridLayout.padding.top + gridLayout.spacing.y * (count - 1);

            rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, height);
            float positionY = -(rectTransform.sizeDelta.y - rectTransform.parent.GetComponent <RectTransform>().sizeDelta.y) / 2;

            //赋予初始位置
            rectTransform.localPosition = new Vector3(rectTransform.localPosition.x, positionY, rectTransform.localPosition.z);



            //kinect事件注册
            EventHandReleaseObject.AddListener(HandIdle, Core.ExecutionPriority.High);
        }
Esempio n. 4
0
        void Register()
        {
            //Events.EventHandReleaseObject.AddListener(Events.EventLevel.B, OnReleaseObject);
            //MCKinect.Events.KinectEventHandReleaseObject.AddListener(MCKinect.Events.EventLevel.B, OnReleaseObject);
            //Events.EventHandGrabObject.AddListener(Events.EventLevel.B, OnGrabObject);

            EventHandReleaseObject.AddListener(OnReleaseObject);
            EventHandGrabObject.AddListener(OnGrabObject);

            if (panel != null)
            {
                panel.onEnter.AddListener(OnPanelEnter);
                panel.onExit.AddListener(OnPanelExit);
            }
        }
Esempio n. 5
0
    void ontest()
    {
        gameObject.AddGrabObject(onGrab);
        gameObject.RemoveGrabObject(onGrab);
        gameObject.RemoveGrabObjectAll();

        gameObject.AddReleaseObject(OnRelease);
        gameObject.RemoveReleaseObject(OnRelease);
        gameObject.RemoveReleaseObjectAll();

        gameObject.AddRayTargetEnter(OnTargetEnter);
        gameObject.RemoveRayTargetEnter(OnTargetEnter);
        gameObject.RemoveRayTargetEnter();


        gameObject.AddRayTargetExit(OnTargetExit);
        gameObject.RemoveRayTargetExit();
        gameObject.RemoveRayTargetExit(OnTargetExit);


        EventHandRay.AddListener(onRay);
        EventHandRay.RemoveListener(onRay);

        EventHandRays.AddListener(OnRays);
        EventHandRays.RemoveListener(OnRays);

        EventHandStart.AddListener(onstart);
        EventHandStart.RemoveListener(onstart);

        EventHandStop.AddListener(onstop);
        EventHandStop.RemoveListener(onstop);

        EventHandUIRay.AddListener(onRay);
        EventHandUIRay.RemoveListener(onRay);

        EventCameraZoom.AddListener(onzoom);
        EventCameraZoom.RemoveListener(onzoom);

        EventCameraRotate.AddListener(onrotate);
        EventCameraRotate.RemoveListener(onrotate);

        EventHandGrabObject.AddListener(ongrabobject);
        EventHandGrabObject.RemoveListener(ongrabobject);

        EventHandReleaseObject.AddListener(onreleaseobject);
        EventHandReleaseObject.RemoveListener(onreleaseobject);

        EventHandGrabObjectKey.AddListener(gameObject, onGrab);
        EventHandGrabObjectKey.RemoveListener(gameObject, onGrab);

        EventHandReleaseObjectKey.AddListener(gameObject, OnRelease);
        EventHandReleaseObjectKey.RemoveListener(gameObject, OnRelease);

        EventHandRayTarget.AddListener(onraytarget);
        EventHandRayTarget.RemoveListener(onraytarget);

        EventHandRayTargetEnter.AddListener(gameObject, OnTargetEnter);
        EventHandRayTargetEnter.RemoveListener(gameObject, OnTargetEnter);

        EventHandRayTargetExit.AddListener(gameObject, OnTargetExit);
        EventHandRayTargetExit.RemoveListener(gameObject, OnTargetExit);

        EventHandUIRayEnter.AddListener(gameObject, onuienter);
        EventHandUIRayEnter.RemoveListener(gameObject, onuienter);

        EventHandUIRayExit.AddListener(gameObject, onuiexit);
        EventHandUIRayExit.RemoveListener(gameObject, onuiexit);

        EventHandUIRay.AddListener(onRay);
        EventHandUIRay.RemoveListener(onRay);
    }
Esempio n. 6
0
 void Awake()
 {
     EventHandGrabObject.AddListener(OnGrab, Core.ExecutionPriority.High);
     EventHandReleaseObject.AddListener(OnIdle, Core.ExecutionPriority.High);
     initDeskHeight = deskHeight;
 }
Esempio n. 7
0
 void Start()
 {
     EventHandGrabObject.AddListener(OnGrab, Core.ExecutionPriority.High);
     EventHandReleaseObject.AddListener(OnIdle, Core.ExecutionPriority.High);
 }
Esempio n. 8
0
 void Awake()
 {
     //if (limitObj == null) limitObj = gameObject.transform.parent.gameObject;
     EventHandGrabObject.AddListener(OnGrab, Core.ExecutionPriority.High);
     EventHandReleaseObject.AddListener(OnIdle, Core.ExecutionPriority.High);
 }
Esempio n. 9
0
 private void Start()
 {
     EventHandReleaseObject.AddListener(Release, Core.ExecutionPriority.High);
 }