public void TestDecodeSkinColours(bool hasColours) { var decoder = new LegacySkinDecoder(); using (var resStream = TestResources.OpenResource(hasColours ? "skin.ini" : "skin-empty.ini")) using (var stream = new LineBufferedReader(resStream)) { var comboColors = decoder.Decode(stream).ComboColours; List <Color4> expectedColors; if (hasColours) { expectedColors = new List <Color4> { new Color4(142, 199, 255, 255), new Color4(255, 128, 128, 255), new Color4(128, 255, 255, 255), new Color4(100, 100, 100, 100), } } ; else { expectedColors = new DefaultSkin().Configuration.ComboColours; } Assert.AreEqual(expectedColors.Count, comboColors.Count); for (int i = 0; i < expectedColors.Count; i++) { Assert.AreEqual(expectedColors[i], comboColors[i]); } } }
/// <summary> /// Loads a default skin. /// </summary> /// <param name="skin">The skin to load.</param> public void LoadDefaultSkin(DefaultSkin skin) { // Dont load the skin imemdialy. Wait for first access. // This allows a custom skin to be loaded before the default skin _currentSkin = null; _defaultSkin = skin; }
/// <summary> /// Handles the Init event of the Page control. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnInit(EventArgs e) { base.OnInit(e); // Default behaviour this.OverrideRenderMethod = true; if (Skin == null) { Skin = new DefaultSkin(); } }
/// <summary> /// Initializes a new instance of the <see cref="BaseViewModel"/> class. /// </summary> /// <param name="breadcrumbProvider">The breadcrumb provider to replace the default <see cref="BreadcrumbTrailFromConfig"/>.</param> /// <exception cref="System.ArgumentNullException"></exception> protected BaseViewModel(IBreadcrumbProvider breadcrumbProvider) { if (breadcrumbProvider == null) { throw new ArgumentNullException(nameof(breadcrumbProvider)); } IsPublicView = true; EsccWebsiteSkin = new DefaultSkin(); Metadata = new Metadata(); BreadcrumbProvider = breadcrumbProvider; }
protected override Skin GetSkin() { Skin skin; try { skin = new LegacyBeatmapSkin(BeatmapInfo, store, audioManager); } catch (Exception e) { Logger.Error(e, "Skin failed to load"); skin = new DefaultSkin(); } return(skin); }
private void radSilver_CheckedChanged(object sender, EventArgs e) { DefaultSkin skin = DefaultSkin.Office2007Luna; if (sender == radLuna && radLuna.Checked) { skin = DefaultSkin.Office2007Luna; } else if (sender == radSilver && radSilver.Checked) { skin = DefaultSkin.Office2007Silver; } else if (sender == radObsidian && radObsidian.Checked) { skin = DefaultSkin.Office2007Obsidian; } skinningManager1.DefaultSkin = skin; }
private void load() { dependencies.CacheAs(this); dependencies.Cache(SentryLogger); dependencies.Cache(osuLogo = new OsuLogo { Alpha = 0 }); // bind config int to database RulesetInfo configRuleset = LocalConfig.GetBindable <string>(OsuSetting.Ruleset); uiScale = LocalConfig.GetBindable <float>(OsuSetting.UIScale); var preferredRuleset = int.TryParse(configRuleset.Value, out int rulesetId) // int parsing can be removed 20220522 ? RulesetStore.GetRuleset(rulesetId) : RulesetStore.GetRuleset(configRuleset.Value); try { Ruleset.Value = preferredRuleset ?? RulesetStore.AvailableRulesets.First(); } catch (Exception e) { // on startup, a ruleset may be selected which has compatibility issues. Logger.Error(e, $@"Failed to switch to preferred ruleset {preferredRuleset}."); Ruleset.Value = RulesetStore.AvailableRulesets.First(); } Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ShortName; // bind config int to database SkinInfo configSkin = LocalConfig.GetBindable <string>(OsuSetting.Skin); SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID.ToString(); configSkin.ValueChanged += skinId => { ILive <SkinInfo> skinInfo = null; if (Guid.TryParse(skinId.NewValue, out var guid)) { skinInfo = SkinManager.Query(s => s.ID == guid); } if (skinInfo == null) { if (guid == SkinInfo.CLASSIC_SKIN) { skinInfo = DefaultLegacySkin.CreateInfo().ToLive(); } } SkinManager.CurrentSkinInfo.Value = skinInfo ?? DefaultSkin.CreateInfo().ToLive(); }; configSkin.TriggerChange(); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade); SelectedMods.BindValueChanged(modsChanged); Beatmap.BindValueChanged(beatmapChanged, true); }
public void TestEmptyLegacyBeatmapSkinFallsBack() { CreateSkinTest(DefaultSkin.CreateInfo(), () => new LegacyBeatmapSkin(new BeatmapInfo(), null, null)); AddUntilStep("wait for hud load", () => Player.ChildrenOfType <SkinnableTargetContainer>().All(c => c.ComponentsLoaded)); AddAssert("hud from default skin", () => AssertComponentsFromExpectedSource(SkinnableTarget.MainHUDComponents, skinManager.CurrentSkin.Value)); }
public void SetSkinBlack() { DefaultSkin skin = DefaultSkin.Office2007Obsidian; skinningManager1.DefaultSkin = skin; }
public void SetSkinLight() { DefaultSkin skin = DefaultSkin.Office2007Luna; skinningManager1.DefaultSkin = skin; }
void OnGUI() { using (var skin = new DefaultSkin()) { int hUnit = Mathf.RoundToInt(Screen.height * DefaultSkin.LayoutScale); int wUnit = Mathf.RoundToInt(Screen.width * DefaultSkin.LayoutScale); int wRegularButton = wUnit; int wBigButton = wUnit * 2; int wHugeButton = wUnit * 3; int blockWidth = wUnit * 3; int blockHeight = hUnit * 3; int x = (Screen.width/2) - (blockWidth / 2); int y = (Screen.height/2) - (blockHeight / 2); hUnit /= 2; GUILayout.BeginArea(new Rect(x, y , blockWidth, blockHeight)); commonButtons(wRegularButton, wBigButton, hUnit); //last char has some additional buttons if (curPosCam == 9) { GUILayout.BeginHorizontal(); if (GUILayout.Button("<", GUILayout.Width(wRegularButton), GUILayout.Height(hUnit))) ChangePeople(-1); GUILayout.Box(Strings.Get("Character"), GUILayout.Width(wRegularButton), GUILayout.Height(hUnit)); if (GUILayout.Button(">", GUILayout.Width(wUnit), GUILayout.Height(hUnit))) ChangePeople(1); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("<", GUILayout.Width(wRegularButton), GUILayout.Height(hUnit))) ChangeClothes(-1); GUILayout.Box(Strings.Get("Clothes"), GUILayout.Width(wRegularButton), GUILayout.Height(hUnit)); if (GUILayout.Button(">", GUILayout.Width(wUnit), GUILayout.Height(hUnit))) ChangeClothes(1); GUILayout.EndHorizontal(); } var btnLbl = closerCamera ? Strings.Get("Return") : Strings.Get("Closer"); GUILayout.BeginHorizontal(); if (closerCamera) { Observation.transform.Find("MainCamera").RotateAround( Observation.transform.position - new Vector3(0,0,0.8f), Vector3.up, -20*Time.deltaTime ); } if (GUILayout.Button(btnLbl, GUILayout.Width(wHugeButton), GUILayout.Height(hUnit))) { switchCamera(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); } }