Example #1
0
        /// <summary>
        /// 显示最近赢牌的类型
        /// </summary>
        protected void SetWinType(List <ITrendReciveData> data)
        {
            if (!CardTypeGrid && !CardTypeItem)
            {
                return;
            }
            List <TrendLoadItem> itemList = new List <TrendLoadItem>();

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

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

                var recordData = data[i];
                if (recordData.GetResultType() != -1)
                {
                    int colorIndex;
                    var str = GetCardType(recordData.GetResultType(), out colorIndex);
                    trendLoadItem.SetItemContent(str, colorIndex);
                    trendLoadItem.SetItemBg(colorIndex);
                }

                if (i == data.Count - 1)
                {
                    trendLoadItem.StartFlash();
                }
            }

            CardTypeGrid.Reposition();
            CardTypeGrid.repositionNow = true;
            if (!gameObject.activeSelf)
            {
                return;
            }
            StartCoroutine(FreshScrollBar());
        }
Example #2
0
        /// <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();
                }
            }
        }
Example #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);
        }
Example #4
0
        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);
        }