Example #1
0
 public void ChangeToHardLayer(bool isHard)
 {
     if (isHard)
     {
         UtilFunc.ChangeLayer(transform, 9);
     }
     else
     {
         UtilFunc.ChangeLayer(transform, 0);
     }
 }
Example #2
0
        public void ResetModel()
        {
            Model.transform.parent = transform;
            UtilFunc.ChangeLayer(transform);
            Model.transform.localScale    = Vector3.one;
            Model.transform.localPosition = Vector3.zero;
            Model.transform.localRotation = Quaternion.identity;
            Mesh = Model.transform.GetChild(0).gameObject;

            if (_roll != null)
            {
                _roll.Target = Model.transform;
            }
        }
Example #3
0
        protected virtual void OnDrag(Vector2 delta)
        {
            if (!UtilData.HandMjTouchEnable)
            {
                return;
            }
            if (ForbidDrag)
            {
                return;
            }

            if (_dragClone == null)
            {
                //克隆出一个新的麻将
                _dragClone = MahjongManager.Instance.CreateCloneMajong(gameObject);
                _dragClone.transform.parent     = transform.parent;
                _dragClone.transform.position   = transform.position;
                _dragClone.transform.rotation   = transform.rotation;
                _dragClone.transform.localScale = transform.localScale;
                UtilFunc.ChangeLayer(_dragClone.transform, transform.gameObject.layer);
                _dragClone.GetComponent <MahjongItem>().RemoveMahjongScript();
                mRecordMahjongPos = transform.position;

                //偏移要打出的麻将
                if (mHideMahjongOnDrag)
                {
                    transform.position = new Vector3(100, 100, 100);
                }
            }

            var handCarmera = GameObject.Find("GameTable/handCardCamera").GetComponent <Camera>();

            //物体的屏幕坐标
            Vector3 screenPos = handCarmera.WorldToScreenPoint(_dragClone.transform.position);

#if (UNITY_ANDROID || UNITY_IPHONE) && !UNITY_EDITOR
            Vector3 mousePos = Input.touches[0].position;
#else
            Vector3 mousePos = Input.mousePosition;
#endif
            mousePos.z = screenPos.z;

            Vector3 worldPos = handCarmera.ScreenToWorldPoint(mousePos);
            _dragClone.transform.position = new Vector3(worldPos.x, worldPos.y, worldPos.z);
        }