int FindCurLevelIndex() { Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; int playerLevel = 0; if (mainPlayer != null) { playerLevel = mainPlayer.BaseAttr.Level; } int indexCount = 0; Tab_BiographyItem item = null; foreach (int key in TableManager.GetBiographyItem().Keys) { item = TableManager.GetBiographyItemByID(key, 0); if (item == null) { continue; } if (playerLevel <= item.EndLevel && playerLevel >= item.BeginLevel) { break; } indexCount++; } return(indexCount); }
public void SetData(int index) { gameObject.name = index.ToString(); // rangeStart = 10*index + 1; rangeEnd = 10 * index + 10; Tab_BiographyItem itemTab = TableManager.GetBiographyItemByID(index, 0); int contentLbHeight = 0; if (itemTab != null) { m_LevelRangeName.text = StrDictionary.GetClientString_WithNameSex(itemTab.Name); m_LevelRangeContent.text = StrDictionary.GetClientString_WithNameSex(itemTab.Content); // contentBkSp m_LevelRangeContent.MakePixelPerfect(); contentLbHeight = m_ContentBackSp.height + itemTab.AddBackHeigh; m_ContentBackSp.height = contentLbHeight; // icon position m_ContentIconSp.spriteName = itemTab.SpriteIconName; m_ContentIconSp.MakePixelPerfect(); float IconPosition_y = m_ContentBackSp.gameObject.transform.localPosition.y + itemTab.AddBackHeigh + 100; m_ContentIconSp.gameObject.transform.localPosition = new Vector3(m_ContentIconSp.gameObject.transform.localPosition.x, IconPosition_y, 0f); SetAlreadyReachSp(itemTab.BeginLevel, itemTab.EndLevel); } //if (m_LevelRangeName != null) //m_LevelRangeName.text = rangeStart.ToString() + " 级到 " +rangeEnd.ToString() + " 级"; }