Ejemplo n.º 1
0
        private void SelectTypePanel(CrossHairType type)
        {
            if (type != _lastType)
            {
                _viewModel.normalActive    = false;
                _viewModel.addBloodActive  = false;
                _viewModel.countDownActive = false;
                _viewModel.noVisibleActive = false;

                switch (adapter.Type)
                {
                case CrossHairType.Normal:
                {
                    _viewModel.normalActive = true;
                }
                break;

                case CrossHairType.CountDown:
                {
                    _viewModel.countDownActive = true;
                }
                break;

                case CrossHairType.AddBlood:
                {
                    _viewModel.addBloodActive = true;
                }
                break;

                case CrossHairType.Novisible:
                {
                    _viewModel.noVisibleActive = true;
                }
                break;

                case CrossHairType.None:
                {
                }
                break;
                }
            }
        }
Ejemplo n.º 2
0
        private void RefreshCrossHair(float interval)
        {
            SelectTypePanel(adapter.Type);


            switch (adapter.Type)
            {
            case CrossHairType.Normal:
            {
                SetNormalCrossType(adapter.WeaponAvatarId);          //根据weapon不同过得subtype 设置不同的准心图片
                float startPos = Mathf.Abs(sTopRt.localPosition.y);
                float endPos   = Mathf.Abs(YEndPosOffset);
#if UNITY_EDITOR
                if (GlobalConst.EnableWeaponLog)
                {
                    DebugUtil.MyLog("SpreadUI EndPos:" + endPos + "||" + "currPos:" + startPos);
                }
#endif
                if (Mathf.Abs(YHistoryEndPosOffset - endPos) > 0.1f || YMoveTween == null)
                {
                    YHistoryEndPosOffset = endPos;
                    YMoveTween           = UIUtils.CallTween(startPos, endPos, UpdateYLinesPos,
                                                             (value) => { YMoveTween = null; }, adapter.SpreadDuration); //Mathf.Abs(startPos - endPos)/speed);
                }
                startPos = Mathf.Abs(hRight.localPosition.x);
                endPos   = Mathf.Abs(XEndPosOffset);
                if (Mathf.Abs(XHistoryEndPosOffset - endPos) > 0.1f || XMoveTween == null)
                {
                    XHistoryEndPosOffset = endPos;
                    XMoveTween           = UIUtils.CallTween(startPos, endPos, UpdateXLinesPos,
                                                             (value) => { XMoveTween = null; }, adapter.SpreadDuration); //Mathf.Abs(startPos - endPos)/speed);
                }
//                        CleanTween(adapter.Statue);
//                        switch (adapter.Statue)
//                        {
//                            case CrossHairNormalTypeStatue.Move:
//                                {
//                                    if (moveTween == null)  //想外移动 0.5秒内到达 endPos
//                                    {
//                                        float startPos = sTopRt.localPosition.y;
//                                        float endPos = normalTypeEndPos;
//                                        moveTween = UIUtils.CallTween(startPos, endPos, UpdateNormalLinePos, (value) => { moveTween = null; }, 0.5f);
//                                    }
//                                }
//                                break;
//                            case CrossHairNormalTypeStatue.Shot:    //每颗子弹会使准星向外移动1像素,最大移动至自身长度*3的距离(10像素的线段会移动20像素)。
//                                {
//                                    if (lastShootNum != adapter.ShootNum)
//                                    {
//                                        float startPos = sTopRt.localPosition.y;
//                                        float temperPos = startPos + (adapter.ShootNum - lastShootNum) * 1;
//                                        UpdateNormalLinePos(temperPos);
//                                        lastShootNum = adapter.ShootNum;
//                                    }
//                                }
//                                break;
//                            case CrossHairNormalTypeStatue.StopShot:    //0.3秒内,十字的每一条线段,会向内移动(准星中心点方向)移动到默认位置
//                                {
//                                    if (shootTween == null)
//                                    {
//                                        float startPos = sTopRt.localPosition.y;
//                                        float endPos = ConstStartPosOffset;
//                                        shootTween = UIUtils.CallTween(startPos, endPos, UpdateNormalLinePos, (value) => { shootTween = null; }, 0.3f);
//                                    }
//                                }
//                                break;
//                        }
            }
            break;

            case CrossHairType.AddBlood:
            {
            }
            break;

            case CrossHairType.Novisible:
            {
            }
            break;
            }
            _lastType = adapter.Type;
        }
Ejemplo n.º 3
0
        private void RefreshCrossHair(float interval)
        {
            adapter.UpdateSpread();
            SelectTypePanel(adapter.Type);


            switch (adapter.Type)
            {
            case CrossHairType.Normal:
            {
                // SpreadRootTrans.localPosition = new Vector3(adapter.XSpreadOffset*GMVariable.SpreadOffsetFactor,adapter.YSpreadOffset*GMVariable.SpreadOffsetFactor,0);
                SetNormalCrossType(adapter.WeaponAvatarId);          //根据weapon不同过得subtype 设置不同的准心图片
                float startPos       = Mathf.Abs(sTopRt.localPosition.y);
                float endPos         = Mathf.Abs(YEndPosOffset);
                float spreadDuration = 1f;
                //   DebugUtil.MyLog("SpreadUI spreadDuration:"+spreadDuration+" startPos:"+ startPos+" | EndPos:" + endPos+"|"+"currPos:"+sTopRt.localPosition.x);
                if (Mathf.Abs(YHistoryEndPosOffset - endPos) > 0.1f)
                {
                    if (YMoveTween != null)
                    {
                        YMoveTween.Kill();
                    }
                    YHistoryEndPosOffset = endPos;
                    spreadDuration       = adapter.SpreadDuration;
                    YMoveTween           = UIUtils.CallTween(startPos, endPos, UpdateYLinesPos, (value) => {
                            YMoveTween.Kill(); YMoveTween = null;
                        }, spreadDuration);                                                   //Mathf.Abs(startPos - endPos)/speed);
                }

                endPos = Mathf.Abs(XEndPosOffset);
                if (Mathf.Abs(XHistoryEndPosOffset - endPos) > 0.1f)
                {
                    if (XMoveTween != null)
                    {
                        XMoveTween.Kill();
                    }

                    startPos             = Mathf.Abs(hLeftRt.localPosition.x);
                    XHistoryEndPosOffset = endPos;

                    XMoveTween = UIUtils.CallTween(startPos, endPos, UpdateXLinesPos,
                                                   (value) => { XMoveTween.Kill(); XMoveTween = null; }, spreadDuration); //Mathf.Abs(startPos - endPos)/speed);
                }

//                        CleanTween(adapter.Statue);
//                        switch (adapter.Statue)
//                        {
//                            case CrossHairNormalTypeStatue.Move:
//                                {
//                                    if (moveTween == null)  //想外移动 0.5秒内到达 endPos
//                                    {
//                                        float startPos = sTopRt.localPosition.y;
//                                        float endPos = normalTypeEndPos;
//                                        moveTween = UIUtils.CallTween(startPos, endPos, UpdateNormalLinePos, (value) => { moveTween = null; }, 0.5f);
//                                    }
//                                }
//                                break;
//                            case CrossHairNormalTypeStatue.Shot:    //每颗子弹会使准星向外移动1像素,最大移动至自身长度*3的距离(10像素的线段会移动20像素)。
//                                {
//                                    if (lastShootNum != adapter.ShootNum)
//                                    {
//                                        float startPos = sTopRt.localPosition.y;
//                                        float temperPos = startPos + (adapter.ShootNum - lastShootNum) * 1;
//                                        UpdateNormalLinePos(temperPos);
//                                        lastShootNum = adapter.ShootNum;
//                                    }
//                                }
//                                break;
//                            case CrossHairNormalTypeStatue.StopShot:    //0.3秒内,十字的每一条线段,会向内移动(准星中心点方向)移动到默认位置
//                                {
//                                    if (shootTween == null)
//                                    {
//                                        float startPos = sTopRt.localPosition.y;
//                                        float endPos = ConstStartPosOffset;
//                                        shootTween = UIUtils.CallTween(startPos, endPos, UpdateNormalLinePos, (value) => { shootTween = null; }, 0.3f);
//                                    }
//                                }
//                                break;
//                        }
            }
            break;

            case CrossHairType.AddBlood:
            {
            }
            break;

            case CrossHairType.Novisible:
            {
            }
            break;
            }
            _lastType = adapter.Type;
        }