コード例 #1
0
        /// <summary>
        /// 转到转盘
        /// </summary>
        /// <param name="turntableType"></param>
        /// <param name="isFirst"></param>
        public void GoToTurntable(int turntableType, bool isFirst = false)
        {
            if (!TurnTableListDic.ContainsKey(turntableType))
            {
                if (turntableType < 1 || turntableType > 3)
                {
                    return;
                }
                Initialization(turntableType);
                return;
            }
            var turntable = TurnTableListDic[turntableType];

            if (isFirst)
            {
                turntable.IsFirst = true;
            }
            TurnTableDic = turntable;
            _turntableManagerEntity.TurntableType = turntableType;
            isUpdate = true;
        }
コード例 #2
0
        /// <summary>
        /// 初始化转盘
        /// </summary>
        /// <param name="turntableType"></param>
        public void Initialization(int turntableType)
        {
            var list = CacheFactory.TurntableCache.GetTurntableList(turntableType);

            if (list.Count == 0)
            {
                return;
            }
            TurnTableDic = new TurntableList();
            var turntable = new  List <TurntableItem>();

            foreach (var item in list)
            {
                TurntableItem entity = new TurntableItem();
                entity.Idx         = item.TurntableId;
                entity.IsEffective = true;
                entity.Rate        = item.InitialRate;
                entity.IsTurntable = false;
                if (item.PrizeType == (int)EnumTurntablePrizeType.Turntable)
                {
                    entity.IsTurntable = true;
                }
                else if (item.PrizeType == (int)EnumTurntablePrizeType.Special)
                {
                    entity.SpecialItem = AnalysisSpecial(item);
                }
                turntable.Add(entity);
            }
            TurnTableDic.ItemList = turntable;
            TurnTableDic.IsFirst  = true;
            if (!TurnTableListDic.ContainsKey(turntableType))
            {
                TurnTableListDic.Add(turntableType, new TurntableList());
            }
            TurnTableListDic[turntableType]       = TurnTableDic;
            _turntableManagerEntity.TurntableType = turntableType;
            isUpdate = true;
        }