コード例 #1
0
        public void Init(Item data, GalleryManager gM)
        {
            touchGestureDetector = TouchGestureDetector.Instance;
            galleryM             = gM;

            ObjectTag  touchTag    = ObjectTag.None;
            GameObject beginObject = null;

            if (!Reflect(data))
            {
                touchGestureDetector.onGestureDetected.AddListener((gesture, touchInfo) =>
                {
                    if (gesture == TouchGestureDetector.Gesture.TouchBegin)
                    {
                        touchTag    = ObjectTag.None;
                        beginObject = null;
                        if (touchInfo.HitDetection(out beginObject, charaObj[2]))
                        {
                            touchTag = ObjectTag.Character;
                        }
                        //if (touchInfo.HitDetection(out beginObject, returnObj))
                        //{
                        //    touchTag = ObjectTag.ReturnObj;
                        //}
                        if (touchInfo.HitDetection(out beginObject, soundIcon))
                        {
                            touchTag = ObjectTag.Sound;
                        }
                    }
                    if (gesture == TouchGestureDetector.Gesture.Click)
                    {
                        GameObject hit;
                        if (touchTag == ObjectTag.Character &&
                            touchInfo.HitDetection(out hit, charaObj[2]))
                        {
                            galleryM.CharacterSpeak(person.voice);
                        }
                        if (touchTag == ObjectTag.Sound &&
                            touchInfo.HitDetection(out hit, soundIcon))
                        {
                            galleryM.CharacterSpeak(person.voice);
                        }
                        //if (touchTag == ObjectTag.ReturnObj
                        //&& touchInfo.HitDetection(out hit, returnObj))
                        //{
                        //    galleryM.ContentClose();
                        //}
                    }
                });
            }
        }
コード例 #2
0
        public void Init(GalleryManager gallery, GalleryManager.ItemTag item)
        {
            galleryM = gallery;
            tag      = item;
            unLocked = galleryM.CheckContent(item);
            //button.interactable = unLocked;
            if (unLocked)
            {
                text.text = "???";
                if (galleryM.GetItem(tag) != null)
                {
                    text.text = galleryM.GetItem(tag).name;
                }
                if (galleryM.GetPerson(tag) != null)
                {
                    text.text = galleryM.GetPerson(tag).name;
                }

                tGD.onGestureDetected.AddListener((gesture, touchInfo) =>
                {
                    if (gesture == TouchGestureDetector.Gesture.TouchBegin)
                    {
                        beginObj = null;
                        touchInfo.HitDetection(out beginObj, gameObject);
                    }
                    if (gesture == TouchGestureDetector.Gesture.Click)
                    {
                        GameObject hit = null;
                        if (touchInfo.HitDetection(out hit, gameObject))
                        {
                            Debug.Log(beginObj.GetHashCode());
                            Debug.Log(hit.GetHashCode());
                            if (hit != null && hit == beginObj)
                            {
                                Debug.Log("Open");
                                galleryM.ContentOpen(tag);
                            }
                        }
                    }
                });
            }
            else
            {
                text.text = "???";
            }
        }