コード例 #1
0
ファイル: RoadNodeTable.cs プロジェクト: da1fanshu/yizhe
 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;
 }
コード例 #2
0
ファイル: TrendOtherLoadView.cs プロジェクト: da1fanshu/yizhe
        /// <summary>
        /// 大路显示
        /// </summary>
        protected virtual void SetOtherLoad(RoadNodeTable roadNodeTable)
        {
            List <TrendLoadItem> loadItemList = new List <TrendLoadItem>();

            foreach (Transform child in OtherLoad.transform)
            {
                TrendLoadItem item = child.GetComponent <TrendLoadItem>();
                if (item)
                {
                    item.gameObject.SetActive(false);
                    loadItemList.Add(item);
                }
            }

            var widthX = OtherLoad.GetComponent <UIGrid>().cellWidth;
            var widthY = OtherLoad.GetComponent <UIGrid>().cellHeight;

            for (int i = 0; i < roadNodeTable.Nodes.Count; i++)
            {
                TrendLoadItem trendLoadItem;
                if (loadItemList.Count > 0 && loadItemList[0] != null)
                {
                    trendLoadItem = loadItemList[0];
                    trendLoadItem.gameObject.SetActive(false);
                    loadItemList.RemoveAt(0);
                }
                else
                {
                    trendLoadItem = YxWindowUtils.CreateItem(TrendOtherLoadItem, OtherLoad);
                }

                var recordData = roadNodeTable.Nodes[i];
                var area       = recordData.IsRed ? 0 : 1;
                trendLoadItem.SetItemBg(area);
                trendLoadItem.transform.localPosition = new Vector3((recordData.X - 1) * widthX, (recordData.Y - 1) * -widthY, 0);

                var hCount = roadNodeTable.Nodes[i].DrawCount;
                if (ShowDraw && hCount > 0)
                {
                    trendLoadItem.GetComponentInChildren <UILabel>().text = hCount.ToString();
                }
                if (i == roadNodeTable.Nodes.Count - 1)
                {
                    trendLoadItem.StartFlash();
                }
            }
        }
コード例 #3
0
        private void GetNextItem(RoadNodeTable road, TrendLoadItem nextBlack, TrendLoadItem nextRed)
        {
            if (road.Nodes.Count == 0)
            {
                nextBlack.gameObject.SetActive(false);
                nextRed.gameObject.SetActive(false);
                return;
            }
            nextBlack.gameObject.SetActive(true);
            var nextBlackType = road.Nodes[road.Nodes.Count - 1].IsRed ? 0 : 1;

            nextBlack.SetItemBg(nextBlackType);
            var nextRedType = !road.Nodes[road.Nodes.Count - 1].IsRed ? 0 : 1;

            nextRed.SetItemBg(nextRedType);
            nextRed.gameObject.SetActive(true);
        }
コード例 #4
0
ファイル: TrendDishLoadView.cs プロジェクト: da1fanshu/yizhe
        protected RoadNodeTable SetDishLoad(List <ITrendReciveData> recordDatas)
        {
            List <TrendLoadItem> dishLoadItemList = new List <TrendLoadItem>();

            foreach (Transform child in DishLoadGrid.transform)
            {
                TrendLoadItem item = child.GetComponent <TrendLoadItem>();
                if (item)
                {
                    item.gameObject.SetActive(false);
                    dishLoadItemList.Add(item);
                }
            }

            for (int i = 0; i < recordDatas.Count; i++)
            {
                TrendLoadItem trendLoadItem;
                if (dishLoadItemList.Count > 0 && dishLoadItemList[0] != null)
                {
                    trendLoadItem = dishLoadItemList[0];
                    trendLoadItem.gameObject.SetActive(true);
                    dishLoadItemList.RemoveAt(0);
                }
                else
                {
                    trendLoadItem = YxWindowUtils.CreateItem(DishTrendLoadItem, DishLoadGrid.transform);
                }

                var recordData = recordDatas[i];
                trendLoadItem.SetItemBg(recordData.GetResultArea());
                if (i == recordDatas.Count - 1)
                {
                    trendLoadItem.StartFlash();
                }
            }

            DishLoadGrid.Reposition();
            DishLoadGrid.repositionNow = true;

            var roadNodeTable = new RoadNodeTable(recordDatas, 6);

            return(roadNodeTable);
        }
コード例 #5
0
ファイル: TrendDishLoadView.cs プロジェクト: da1fanshu/yizhe
        protected override void OnFreshView()
        {
            base.OnFreshView();
            if (Data == null)
            {
                return;
            }
            var roadNodeTable = SetDishLoad((List <ITrendReciveData>)Data);

            if (BigLoadView)
            {
                BigLoadView.UpdateView(roadNodeTable);
            }

            if (BigEyeLoadView)
            {
                var bigEyeRoad = new RoadNodeTable(roadNodeTable, EnumTrendType.BigEyeRoad, 6);
                BigEyeLoadView.UpdateView(bigEyeRoad);
            }

            if (SmallLoadView)
            {
                var smallRoad = new RoadNodeTable(roadNodeTable, EnumTrendType.SmallRoad, 6);
                SmallLoadView.UpdateView(smallRoad);
            }

            if (RoachLoadView)
            {
                var roachRoad = new RoadNodeTable(roadNodeTable, EnumTrendType.RoachRoad, 6);
                RoachLoadView.UpdateView(roachRoad);
            }

            if (TrendPredictNextView)
            {
                TrendPredictNextView.UpdateView(Data);
            }

            if (TrendTotalInfoView)
            {
                TrendTotalInfoView.UpdateView(Data);
            }
        }
コード例 #6
0
ファイル: RoadNodeTable.cs プロジェクト: da1fanshu/yizhe
        /// <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);
            }
        }
コード例 #7
0
ファイル: RoadNodeTable.cs プロジェクト: da1fanshu/yizhe
        /// <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);
        }
コード例 #8
0
        private void GetNext(List <ITrendReciveData> recorDatas)
        {
            var nextData = TrendCfg.CreatTrendReciveData(null).SetResultArea();

            recorDatas.Add(nextData);

            var road       = new RoadNodeTable(recorDatas, 6);
            var bigEyeRoad = new RoadNodeTable(road, EnumTrendType.BigEyeRoad, 6);

            GetNextItem(bigEyeRoad, NextBlackBigEye, NextRedBigEye);

            var smallRoad = new RoadNodeTable(road, EnumTrendType.SmallRoad, 6);

            GetNextItem(smallRoad, NextBlackSmall, NextRedSmall);

            var roachRoad = new RoadNodeTable(road, EnumTrendType.RoachRoad, 6);

            GetNextItem(roachRoad, NextBlackRoach, NextRedRoach);

            recorDatas.RemoveAt(recorDatas.Count - 1);
        }