Ejemplo n.º 1
0
        private void SetTest(TrendData data, TrendNormalItem item)
        {
            RoadNodeTable testBankerRoad = new RoadNodeTable(_datas);

            testBankerRoad.AddSingleItem(data);
            RoadNodeTable viewTable = new RoadNodeTable(testBankerRoad, Type, 6);

            if (testBankerRoad.Nodes.Count > 0)
            {
                switch (Type)
                {
                case EnumTrendType.BigRoad:
                    break;

                default:
                    viewTable.AddSingleItem(testBankerRoad.Nodes.Last(), testBankerRoad);
                    break;
                }
            }
            if (viewTable.Nodes.Count > 0)
            {
                var lastNode = viewTable.Nodes.Last();
                var isRed    = lastNode.IsRed ? ConstantData.KeyBetBanker : ConstantData.KeyBetLeisure;
                item.ResultType.TrySetComponentValue(string.Format(item.SpriteFormat, isRed));
            }
            else
            {
                item.ResultType.spriteName = "9999";
            }
        }
Ejemplo n.º 2
0
        protected override void OnSingleRecord(IRecycleData data)
        {
            var itemData = data as TrendData;

            if (_datas == null)
            {
                _datas = new RoadNodeTable(new List <TrendData>(), 6);
            }
            if (_branchDatas == null)
            {
                switch (Type)
                {
                case EnumTrendType.BigRoad:
                    _branchDatas = _datas;
                    break;

                default:
                    _branchDatas = new RoadNodeTable(_datas, Type, 6);
                    break;
                }
            }
            if (itemData != null)
            {
                if (!_datas.AddSingleItem(itemData))
                {
                    if (CacheData.Count > 0)
                    {
                        var cachelast = CacheData.Last() as RoadNode;
                        var getLast   = _datas.Nodes.Last();
                        if (cachelast != null && (cachelast.X == getLast.X && cachelast.Y == getLast.Y))
                        {
                            var lastView = CacheViews.Last();
                            CacheData[CacheData.Count - 1] = getLast;
                            lastView.UpdateView(getLast);
                        }
                    }
                }
                else
                {
                    switch (Type)
                    {
                    case EnumTrendType.BigRoad:
                        _branchDatas = _datas;
                        break;

                    default:
                        _branchDatas.AddSingleItem(_datas.Nodes.Last(), _datas);
                        break;
                    }
                    if (_branchDatas.Nodes.Count > 0)
                    {
                        var lastNode = _branchDatas.Nodes.Last();
                        AddChildToShow(lastNode);
                    }
                }
            }
            GetPridict();
        }
Ejemplo n.º 3
0
 public RoadNodeTable(RoadNodeTable copy)
 {
     CurrentX     = copy.CurrentX;
     CurrentY     = copy.CurrentY;
     StartX       = copy.StartX;
     RolMaxHeight = copy.RolMaxHeight;
     Nodes        = copy.Nodes.ToList();
     NodeDic      = new Dictionary <Vector2, RoadNode>(copy.NodeDic);
     LineCount    = copy.LineCount.ToList();
     First        = copy.First;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 同步大路数据
        /// </summary>
        protected void OnGetMainDatas(List <TrendData> datas)
        {
            _datas = new RoadNodeTable(datas, 6);
            switch (Type)
            {
            case EnumTrendType.BigRoad:
                _branchDatas = _datas;
                break;

            default:
                _branchDatas = new RoadNodeTable(_datas, Type, 6);
                break;
            }
            CacheData = _branchDatas.Nodes.ConvertAll(item => item as IRecycleData);
            AddChildrenToShow();
            GetPridict();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 三小路
        /// </summary>
        /// <param name="bigRoad"></param>
        /// <param name="type"></param>
        /// <param name="maxHeight"></param>
        /// <returns></returns>
        public RoadNodeTable(RoadNodeTable bigRoad, EnumTrendType type, int maxHeight)
        {
            CurrentX     = 1;
            CurrentY     = 1;
            StartX       = 1;
            Nodes        = new List <RoadNode>();
            NodeDic      = new Dictionary <Vector2, RoadNode>();
            LineCount    = new List <int>();
            RolMaxHeight = maxHeight;
            LineCount.Add(0);
            First = true;
            Nstep = (int)type + 1;
            var bigRoadList = bigRoad.Nodes;

            //遍历大路单
            foreach (var it in bigRoadList)
            {
                AddSingleItem(it, bigRoad);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加单独数据(三小路)
        /// </summary>
        /// <param name="it"></param>
        /// <param name="bigRoad"></param>
        /// <returns></returns>
        public bool AddSingleItem(RoadNode it, RoadNodeTable bigRoad)
        {
            bool returnState = false;

            //满足此两项条件 方可产生节点
            if (it.X > Nstep || (it.X == Nstep && it.Y > 1))
            {
                //看整齐
                if (it.Y == 1)
                {
                    returnState = InsertNode(bigRoad.GetRolCount(it.X - 2) == bigRoad.GetRolCount(it.X + 1 - Nstep));
                }
                else
                {
                    //看有无
                    int nTempX = it.X + 1 - Nstep;
                    returnState = bigRoad.CheckHasNode(nTempX, it.Y) ? InsertNode(true) : InsertNode(!bigRoad.CheckHasNode(nTempX, it.Y - 1));
                }
            }
            return(returnState);
        }