public void SetUpElement(RequireType type, object[] param, bool showWarning) { this.type = type; if (type == RequireType.Material) { int materialID = (int)param[0]; int count = (int)param[1]; MaterialDataModel maModel = new MaterialDataModel(); if (maModel.Create(materialID)) { _model = maModel; SetElementInfo(maModel.Icon, maModel.Name + " X" + count, maModel.Rarity.color); ShowLockWaring(showWarning); } } else if (type == RequireType.PreTech) { int techID = (int)param[0]; TechnologyDataModel techModel = new TechnologyDataModel(); if (techModel.Create(techID)) { _model = techModel; SetElementInfo(techModel.Icon, techModel.Name, techModel.Rarity.color); ShowLockWaring(showWarning); } } else if (type == RequireType.ResearchPoint) { ushort count = (ushort)param[0]; var techPointImage = Utility.LoadSprite("SpriteOutput/UI/Main/Technology/TechPage_PointCost_Icon"); string text = MultiLanguage.Instance.GetTextValue(Research_Require_TechPoint_Text) + ":" + count.ToString(); SetElementInfo(techPointImage, text, Color.white); ShowLockWaring(showWarning); } if (anim != null) { anim.Play(); } }
private double?GetData(float acc, RequireType require) { int retry = 15; while (retry != 0) { try { if (calc_cache == null) { calc_cache = ctb_pp_calc.SendCalculateCtb(new ArraySegment <byte>(this.ctb_pp_calc.Beatmap.RawData), ctb_pp_calc.Mods); } switch (require) { case RequireType.PP: return(CalculatePp(calc_cache, ctb_pp_calc.Mods, acc, calc_cache.FullCombo, 0)); case RequireType.Star: return(calc_cache.Stars); case RequireType.AR: return(calc_cache.ApproachRate); default: return(null); } } catch { Thread.Sleep(50); retry--; } } return(0); }