| System/Vip/VipInvest/CheckDisplay.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Vip/VipInvest/RotatePointer.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Vip/VipInvest/WheelOfFortuneModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Vip/VipInvest/WheelOfFortuneWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/Vip/VipInvest/CheckDisplay.cs
@@ -5,10 +5,12 @@ using UnityEngine; using System.Collections; using UnityEngine.UI; using System; namespace Snxxz.UI { public class CheckDisplay:MonoBehaviour { public static event Action EndOfFlashing; [SerializeField] Image m_Image1; [SerializeField] Image m_Image2; [SerializeField] Image m_Image3; @@ -17,8 +19,32 @@ [SerializeField] Image m_Image6; [SerializeField] Image m_Image7; [SerializeField] Image m_Image8; [SerializeField] Image m_Image9; [SerializeField] Image m_Image9; [Header("闪烁时间")] public float FlashingTime = 2f; private float _time=0; bool IsBool = false; private void OnEnable() { IsBool = false; _time = 0; } private void LateUpdate() { if (IsBool) { _time += Time.deltaTime; if (FlashingTime < _time) { CloseAll(); if (EndOfFlashing != null) { EndOfFlashing(); } } } } public void CloseAll() { m_Image1.gameObject.SetActive(false); @@ -30,6 +56,8 @@ m_Image7.gameObject.SetActive(false); m_Image8.gameObject.SetActive(false); m_Image9.gameObject.SetActive(false); IsBool = false; _time = 0; } public void ShowSelected(int Index) @@ -63,9 +91,8 @@ case 9: m_Image9.gameObject.SetActive(true); break; } IsBool = true; } } System/Vip/VipInvest/RotatePointer.cs
@@ -8,9 +8,10 @@ using DG.Tweening; using System; namespace Snxxz.UI { public class RotatePointer:MonoBehaviour { namespace Snxxz.UI { public class RotatePointer : MonoBehaviour { public bool _isRotate = false;//是否旋转 public float Speed = 2000;//旋转速度 public float Angle = 0; // 这个是设置停止的角度 @@ -23,7 +24,7 @@ [Header("加速减速时间")] public float SpeedTime = 1; [Header("最小速度")] public float MinSpeed= 400; public float MinSpeed = 400; [Header("最大速度")] public float MaxSpeed = 800; WheelOfFortuneModel wheelOfFortuneModel { get { return ModelCenter.Instance.GetModel<WheelOfFortuneModel>(); } } @@ -40,17 +41,14 @@ } private void OnEnable() { } } void Update() { if (!_isRotate) { if (-Angle != transform.eulerAngles.z) { if (Math.Abs((360 - Angle) - transform.eulerAngles.z) > 2) { transform.localRotation = Quaternion.Euler(0, 0, -Angle); m_CheckDisplay.ShowSelected(wheelOfFortuneModel.Lattice); @@ -59,16 +57,12 @@ IsButtonShow(true); } IsRotateBool = false; } } return; //不旋转结束 } if (IsRotateBool) { _time += Time.deltaTime; if (_time < SpeedTime)//匀加速 { Speed = MinSpeed + Acceleration * _time; @@ -99,7 +93,7 @@ //这里有个360,使用来防止指针回转的,如果不加这个360,你会看到指针倒退 Sequence sequence = DOTween.Sequence(); sequence.Append(transform.DORotate(new Vector3(0, 0, -(360 + Angle)), 2f, RotateMode.FastBeyond360)); sequence.AppendCallback(()=> sequence.AppendCallback(() => { _isRotate = false; // 设置不旋转 if (IsButtonShow != null) @@ -107,17 +101,15 @@ IsButtonShow(true); } m_CheckDisplay.ShowSelected(wheelOfFortuneModel.Lattice); }); }); IsRotateBool = false; } // DebugEx.LogError(transform.eulerAngles.z); } } } //外部调用,初始化时间和打开旋转 //外部调用,初始化时间和打开旋转,设置停止角度 public void SetTime(bool _bool) { _time =0; _time = 0; Angle = wheelOfFortuneModel.AngleSave; if (_bool) { @@ -129,14 +121,7 @@ IsRotateBool = true; _isRotate = true; } } private void TweenOver() { } //外部调用,设置停止角度 } } } System/Vip/VipInvest/WheelOfFortuneModel.cs
@@ -39,17 +39,17 @@ var BindJadewheel = Config.Instance.Get<FuncConfigConfig>("BindJadeWheelCfg"); NeedJade = int.Parse(BindJadewheel.Numerical1); AngleList = JsonMapper.ToObject<double[][]>(BindJadewheel.Numerical5); for (int i = 0; i < AngleList.Length; i++) { if (AngleDic.Count <= 0) { int Type = i + 1; AngleClass angleClass = new AngleClass(); angleClass.AngleStart = (float)AngleList[i][0]; angleClass.AngleEnd = (float)AngleList[i][1]; AngleDic.Add(Type, angleClass); } } if (AngleDic.Count <= 0) { for (int i = 0; i < AngleList.Length; i++) { int Type = i + 1; AngleClass angleClass = new AngleClass(); angleClass.AngleStart = (float)AngleList[i][0]; angleClass.AngleEnd = (float)AngleList[i][1]; AngleDic.Add(Type, angleClass); } } } public override void UnInit() @@ -93,8 +93,8 @@ { if (AngleDic.ContainsKey(Lattice)) { float flo = UnityEngine.Random.Range(AngleDic[Lattice].AngleStart + 0.05f, AngleDic[Lattice].AngleEnd - 0.05f); float flo = UnityEngine.Random.Range(AngleDic[Lattice].AngleStart + 1f, AngleDic[Lattice].AngleEnd - 1f); flo = (float)Math.Round((double)flo, 2); if (flo > 360f) { flo = flo - 360f; @@ -108,7 +108,6 @@ } RedPoint(); } } public void StartTheDraw()//开始抽奖 { @@ -154,7 +153,6 @@ return 0; } } } System/Vip/VipInvest/WheelOfFortuneWin.cs
@@ -55,7 +55,8 @@ protected override void OnAfterOpen() { wheelOfFortuneModel.WheelOfFortuneUpdate += WheelOfFortuneUpdate; RotatePointer.IsButtonShow += IsButtonShow; RotatePointer.IsButtonShow += IsButtonShow; CheckDisplay.EndOfFlashing += EndOfFlashing; if (wheelOfFortuneModel.redPointStre1.state == RedPointState.Simple) { int GetDayOfYear = DateTime.Now.DayOfYear; @@ -68,10 +69,14 @@ protected override void OnPreClose() { wheelOfFortuneModel.WheelOfFortuneUpdate -= WheelOfFortuneUpdate; RotatePointer.IsButtonShow -= IsButtonShow; RotatePointer.IsButtonShow -= IsButtonShow; CheckDisplay.EndOfFlashing -= EndOfFlashing; } private void EndOfFlashing() { TiedJadeChange(); } private void WheelOfFortuneUpdate(float Angel) { @@ -87,8 +92,7 @@ private void OnClickButton() { m_CheckDisplay.CloseAll(); wheelOfFortuneModel.StartTheDraw();//开始抽奖 m_RotatePointer.SetTime(m_Toggle.isOn); wheelOfFortuneModel.StartTheDraw();//开始抽奖 } private void OnClickToggle(bool _bool) {