int GetRideAllExp(RideData ridedata) { int exp = ridedata.exp; int level = ridedata.level - 1; while (level >= 0) { table.RideFeedData feeddata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(ridedata.baseid, level); if (feeddata != null) { exp += (int)feeddata.upExp; } level--; } return(exp); }
protected override void OnShow(object data) { base.OnShow(data); if (data is RideData) { m_ridedata = data as RideData; m_label_rarity.text = DataManager.Manager <RideManager>().GetRideQualityStr(m_ridedata.quality); m_label_level.text = m_ridedata.level.ToString(); table.RideFeedData feeddata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(m_ridedata.baseid, (int)m_ridedata.level); if (feeddata != null) { float value = (feeddata.speed / 10000.0f) * 100; m_label_speed.text = value.ToString() + "%"; } m_slider_satiationscorllbar.value = m_ridedata.repletion * 1.0f / m_ridedata.maxRepletion; m_slider_satiationscorllbar.transform.Find("Percent").GetComponent <UILabel>().text = string.Format("{0}/{1}", m_ridedata.repletion, m_ridedata.maxRepletion); m_label_life.text = m_ridedata.life.ToString(); m_sprite_icon.spriteName = m_ridedata.icon; if (m_ridedata.life > 0)//封印 { m_widget_fengyin.gameObject.SetActive(true); m_widget_qiuqi.gameObject.SetActive(false); m_label_name.text = string.Format("封印{0}", m_ridedata.name); m_btn_btn_diuqi.GetComponentInChildren <UILabel>().text = "封印"; m_label_change_life.text = (m_ridedata.life - m_ridedata.subLife).ToString(); m_label_life.text = m_ridedata.life.ToString(); } else { m_widget_fengyin.gameObject.SetActive(false); m_widget_qiuqi.gameObject.SetActive(true); m_label_name.text = string.Format("丢弃{0}", m_ridedata.name); m_btn_btn_diuqi.GetComponentInChildren <UILabel>().text = "丢弃"; } } }
int CaculateLevel(RideData left, RideData right, TransExpType type) { int rate = GameTableManager.Instance.GetGlobalConfig <int>("PassOnRateRide", ((int)type * 10).ToString()); int level = right.level; int leftRideExp = GetRideAllExp(left); if (leftRideExp <= 0) { return(level); } int leftExp = Mathf.CeilToInt(leftRideExp * rate * 0.01f) + right.exp; table.RideFeedData feeddata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(right.baseid, level); while (feeddata != null) { leftExp -= (int)feeddata.upExp; if (leftExp >= 0) { level++; if (leftExp > 0) { feeddata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(right.baseid, level); if (feeddata == null) { level--; } } else { feeddata = null; } } else { feeddata = null; } } return(level); }
public override void SetGridData(object data) { base.SetGridData(data); if (data is table.RideDataBase) { m_database = (table.RideDataBase)data; if (lableName != null) { lableName.text = m_database.name; } if (lableRate != null) { lableRate.text = DataManager.Manager <RideManager>().GetRideQualityStr(m_database.quality); } if (lableSpeed != null) { table.RideFeedData feeddata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(m_database.rideID, 0); if (feeddata != null) { float value = (feeddata.speed / 100.0f); if (lableSpeed != null) { lableSpeed.text = value.ToString() + "%"; } } } if (icon != null) { UIManager.GetTextureAsyn(m_database.icon , ref iuiIconAtlas, () => { if (null != icon) { icon.mainTexture = null; } }, icon, true); } if (border != null) { string borderIconName = ItemDefine.GetItemBorderIcon(m_database.quality); UIManager.GetAtlasAsyn(borderIconName , ref iuiBorderAtlas, () => { if (null != border) { border.atlas = null; } }, border, true); } if (m_spriteGetTip != null) { m_spriteGetTip.enabled = !DataManager.Manager <RideManager>().ContainRide(m_database.rideID); } } }