少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-29 d82561629d51d3863002a3f1bbb32ef6b1b429bb
System/Vip/VipInvest/WheelOfFortuneModel.cs
@@ -13,7 +13,7 @@
{
    [XLua.LuaCallCSharp]
   public class WheelOfFortuneModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    public class WheelOfFortuneModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
    {
        public class AngleClass
        {
@@ -28,29 +28,63 @@
        public Dictionary<int, AngleClass> AngleDic = new Dictionary<int, AngleClass>();
        private double[][] AngleList;
        public event Action<float> WheelOfFortuneUpdate;
        public event Action<int> onStateUpate;
        private string StrKey = string.Empty;
        private bool IsOk = false;
        private const int Redpoint_key1 = 20106;//幸运转盘红点
        public Redpoint redPointStre1 = new Redpoint(201, Redpoint_key1);
        private const int Redpoint_key1 = 20916;//幸运转盘红点
        public Redpoint redPointStre1 = new Redpoint(209, Redpoint_key1);
        VipModel m_Vipmodel;
        VipModel vipmodel { get { return m_Vipmodel ?? (m_Vipmodel = ModelCenter.Instance.GetModel<VipModel>()); } }
        public bool IsOpen
        {
            get
            {
                return FuncOpen.Instance.IsFuncOpen(144);
            }
        }
        public bool IsAdvance
        {
            get
            {
                return false;
            }
        }
        public bool priorityOpen
        {
            get
            {
                if (redPointStre1.state == RedPointState.Simple)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
        public override void Init()
        {
            OpenServerActivityCenter.Instance.Register(16, this);
            var BindJadewheel = Config.Instance.Get<FuncConfigConfig>("BindJadeWheelCfg");
            NeedJade = int.Parse(BindJadewheel.Numerical1);
            AngleList = JsonMapper.ToObject<double[][]>(BindJadewheel.Numerical5);
            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);
                }
            }
            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()
@@ -60,8 +94,8 @@
        public void OnBeforePlayerDataInitialize()
        {
            IsOk = false;
            IsOk = false;
        }
        public void OnPlayerLoginOk()
@@ -74,14 +108,18 @@
            StrKey = "IsOpenFiaryJadeRedPoint" + PlayerDatas.Instance.baseData.PlayerID;
            AngleSave = LocalSave.GetFloat(StrKey);
            RedPoint();
        }
        }
        private void OnFuncStateChangeEvent(int obj)
        {
            if (obj == 144)
            {
                if (onStateUpate != null)
                {
                    onStateUpate(16);
                }
                RedPoint();
            }
        }
@@ -94,22 +132,22 @@
            {
                if (AngleDic.ContainsKey(Lattice))
                {
                    float flo = UnityEngine.Random.Range(AngleDic[Lattice].AngleStart + 1f, AngleDic[Lattice].AngleEnd - 1f);
                    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;
                    }
                    if (Math.Abs(flo- AngleSave)<=0.2)
                    {
                        if ((flo + 1f )> (AngleDic[Lattice].AngleStart + 1f) && (flo + 1f) < (AngleDic[Lattice].AngleEnd - 1f))
                        {
                            flo += 1;
                        }
                        else if ((flo - 1f) > (AngleDic[Lattice].AngleStart + 1f) && (flo - 1f) < (AngleDic[Lattice].AngleEnd - 1f))
                        {
                            flo -= 1;
                        }
                    if (Math.Abs(flo- AngleSave)<=0.2)
                    {
                        if ((flo + 1f )> (AngleDic[Lattice].AngleStart + 1f) && (flo + 1f) < (AngleDic[Lattice].AngleEnd - 1f))
                        {
                            flo += 1;
                        }
                        else if ((flo - 1f) > (AngleDic[Lattice].AngleStart + 1f) && (flo - 1f) < (AngleDic[Lattice].AngleEnd - 1f))
                        {
                            flo -= 1;
                        }
                    }
                    LocalSave.SetFloat(StrKey, flo);
                    AngleSave = LocalSave.GetFloat(StrKey);
@@ -119,7 +157,7 @@
                    WheelOfFortuneUpdate(AngleSave);
                }
                RedPoint();
            }
            }
        }
        public void StartTheDraw()//开始抽奖
        {