/// <summary> /// 为血条分配一个位置,分配失败,则表示Movie已经满了。 /// </summary> /// <param name="t"></param> /// <returns></returns> private static bool AllocBloodPos(ENTITY_TYPE t, ref MovieNode btr) { if (m_entiySizeMap.ContainsKey(t)) { Vector2 BloodSize = m_entiySizeMap[t]; btr.isValid = false; if (UnUsedMovieNodeList.Count > 0) { MovieNode bt = UnUsedMovieNodeList.Dequeue(); btr.RowIndex = bt.RowIndex; btr.ColIndex = bt.ColIndex; btr.start.x = MovieCell_Width * bt.RowIndex; btr.start.y = MovieCell_Height * bt.ColIndex; btr.end.x = btr.start.x + BloodSize.x; btr.end.y = btr.start.y + BloodSize.y; btr.vSize = BloodSize; btr.isValid = true; } else { btr = new MovieNode(); btr.start.x = MovieCell_Width * CurrentRowIndex; btr.start.y = MovieCell_Height * CurrentColIndex; btr.end.x = btr.start.x + BloodSize.x; btr.end.y = btr.start.y + BloodSize.y; btr.vSize = BloodSize; btr.RowIndex = CurrentRowIndex; btr.ColIndex = CurrentColIndex; CurrentRowIndex++; if (CurrentRowIndex >= MaxRowCount) { CurrentColIndex++; if (CurrentColIndex >= MaxColCount) { return(false); } CurrentRowIndex = 0; } btr.isValid = true; } return(true); } return(false); }
/// <summary> /// 为头顶名分配一个位置,分配失败,则表示Movie已经满了。 /// </summary> /// <param name="btr"></param> /// <returns></returns> private static bool AllocTopNamePos(ref MovieNode btr) { btr.isValid = false; if (UnUsedMovieNodeList.Count > 0) { MovieNode bt = UnUsedMovieNodeList.Dequeue(); btr.RowIndex = bt.RowIndex; btr.ColIndex = bt.ColIndex; btr.start.x = MovieCell_Width * bt.RowIndex; btr.start.y = MovieCell_Height * bt.ColIndex; btr.end.x = btr.start.x + TopNameSize.x; btr.end.y = btr.start.y + TopNameSize.y; btr.vSize = TopNameSize; btr.isValid = true; } else { btr.start.x = MovieCell_Width * CurrentRowIndex; btr.start.y = MovieCell_Height * CurrentColIndex; btr.end.x = btr.start.x + TopNameSize.x; btr.end.y = btr.start.y + TopNameSize.y; btr.vSize = TopNameSize; btr.RowIndex = CurrentRowIndex; btr.ColIndex = CurrentColIndex; CurrentRowIndex++; if (CurrentRowIndex >= MaxRowCount) { CurrentColIndex++; if (CurrentColIndex >= MaxColCount) { return(false); } CurrentRowIndex = 0; } btr.isValid = true; } return(true); }