bool configBarStyle(string key, string value, Configuration.Options options) { rotation_ = (options.asFloat(0, Default.BarRotation) / 180f) * (float)Math.PI; switch (value.ToLower()) { case "simple": renderStyledBar_ = Graphic.renderSimpleBar; break; case "segments": renderStyledBar_ = Graphic.renderSegmentedBar; break; case "tiles": renderStyledBar_ = Graphic.renderTiledBar; tiles_ = options.asInteger(1, Default.BarTileCount); tileSpace_ = options.asFloat(2, Default.BarTileSpace); if (options.Count >= 4) { if (!toValueType(options[3], out tileSpaceType_, Default.BarTileSpaceType)) { return(false); } } if (options.Count >= 5) { if (RenderTarget.spriteExist(options[4])) { tileName_ = options[4]; } else { return(false); } } break; default: log(Console.LogType.Error, $"Invalid bar style '{value}'"); return(false); } return(true); }
bool configBar(string key, string value, Configuration.Options options) { barShow_ = true; barEmbedded_ = Configuration.asBoolean(value, false); switch (options[0].ToLower()) { case "simple": barRenderMethod_ = Graphic.renderSimpleBar; break; case "segments": barRenderMethod_ = Graphic.renderSegmentedBar; break; case "tiles": barRenderMethod_ = Graphic.renderTiledBar; break; default: log(Console.LogType.Error, $"Invalid list bar style: {options[0]}"); return(false); } barThickness_ = Configuration.asFloat(options[1], Default.ListBarThickness); if (!toValueType(options[2], out barThicknessType_, Default.ListBarThicknessType)) { return(false); } if (barThickness_ <= 0f || barEmbedded_) { barThickness_ = 1f; barThicknessType_ = ValueType.Relative; } barBackground_ = Configuration.asColor(options[3], Template.BackgroundColor); return(true); }