private void load(THSharpConfigManager config) { Child = GamemodeStore.GetWorkingGamemode(config.Get <string>(THSharpSetting.Gamemode))?.GetGamemodePlayfield(); }
private void load(THSharpConfigManager config) { RelativeSizeAxes = Axes.Both; Anchor = Anchor.Centre; Origin = Anchor.Centre; Width = 0.2f; FillFlowContainer <GamemodeIcon> gamemodeContainer; Children = new Drawable[] { gamemodeContainer = new FillFlowContainer <GamemodeIcon> { RelativeSizeAxes = Axes.Both, } }; foreach (Gamemode gamemode in GamemodeStore.LoadedGamemodes) { GamemodeIcon icon = new GamemodeIcon(gamemode); icon.Action = () => { config.Set(THSharpSetting.Gamemode, gamemode.Name); foreach (GamemodeIcon i in gamemodeContainer) { i.FadeTo(0.2f, 100, Easing.InOutBack); } icon.FadeTo(0.8f, 100, Easing.InOutBack); }; gamemodeContainer.Add(icon); } GamemodeStore.OnGamemodeRemoved += gamemode => { foreach (GamemodeIcon icon in gamemodeContainer) { if (icon.Gamemode.Name == gamemode.Name) { gamemodeContainer.Remove(icon); if (icon.Gamemode.Name == config.Get <string>(THSharpSetting.Gamemode)) { gamemodeContainer.FirstOrDefault()?.Action?.Invoke(); } break; } } }; GamemodeStore.OnGamemodeAdd += gamemode => { GamemodeIcon icon = new GamemodeIcon(gamemode); icon.Action = () => { config.Set(THSharpSetting.Gamemode, gamemode.Name); foreach (GamemodeIcon i in gamemodeContainer) { i.FadeTo(0.2f, 100, Easing.InOutBack); } icon.FadeTo(0.8f, 100, Easing.InOutBack); }; gamemodeContainer.Add(icon); }; foreach (GamemodeIcon icon in gamemodeContainer) { if (icon.Gamemode.Name == config.Get <string>(THSharpSetting.Gamemode)) { icon.Action?.Invoke(); } } }