protected virtual void ShowItem(RoadNode data) { var isRed = data.IsRed ? ConstantData.KeyBetBanker : ConstantData.KeyBetLeisure; ResultType.TrySetComponentValue(string.Format(SpriteFormat, isRed)); SetItemPos(new Vector2(data.X - 1, data.Y - 1)); }
protected override void ShowItem(RoadNode data) { base.ShowItem(data); var numShow = data.DrawCount > 0; if (Count) { Count.gameObject.TrySetComponentValue(numShow); Count.TrySetComponentValue(data.DrawCount); } }
/// <summary> /// 插入节点数据 /// </summary> /// <param name="bRed"></param> /// <param name="nDrawCount"></param> /// <returns></returns> protected virtual bool InsertNode(bool bRed, int nDrawCount = 0) { if (First) { CurrentRed = bRed; First = false; } else { //是否需要另起一列 if (bRed != CurrentRed) { CurrentRed = bRed; CurrentY = 1; StartX++; CurrentX = StartX; LineCount.Add(0); while (CheckHasNode(CurrentX, CurrentY)) { StartX++; CurrentX = StartX; LineCount.Add(0); } } else { if (CheckHasNode(CurrentX, CurrentY + 1) || CurrentY + 1 > RolMaxHeight) { CurrentX++; } else { CurrentY++; } } } RoadNode newNode = new RoadNode(CurrentX, CurrentY, CurrentRed, nDrawCount); Nodes.Add(newNode); NodeDic.Add(new Vector2(CurrentX, CurrentY), newNode); LineCount[StartX - 1]++; return(true); }
public bool AddSingleItem(RoadNode node) { bool returnState = false; if (CheckHasNode(node.X, node.Y)) { int nLast = Nodes.Count > 0 ? Nodes.Count - 1 : 0; if (Nodes.Count != 0) { Nodes[nLast].DrawCount++; } } else { InsertNode(node.IsRed, node.DrawCount); returnState = true; } return(returnState); }
/// <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); }