예제 #1
0
        public override void SetHost(GameHost host)
        {
            if (THSharpConfigManager == null)
            {
                THSharpConfigManager = new THSharpConfigManager(host.Storage);
            }

            if (THSharpSkinElement == null)
            {
                THSharpSkinElement = new THSharpSkinElement(host.Storage, THSharpConfigManager);
            }

            base.SetHost(host);
        }
예제 #2
0
        //TODO: Implement "GetSkinAudioElement" and "GetAudioElement"
        //private readonly AudioManager thSharpAudio;

        public THSharpSkinElement(Storage storage, THSharpConfigManager config)
        {
            this.storage = storage;
            this.config  = config;

            if (thSharpResources == null)
            {
                thSharpResources = new ResourceStore <byte[]>();
                thSharpResources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore("THSharp.Game.Resources.dll"), "Assets"));
                thSharpResources.AddStore(new DllResourceStore("THSharp.Game.Resources.dll"));
                thSharpTextures = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(thSharpResources, @"Textures")));
                thSharpTextures.AddStore(new RawTextureLoaderStore(new OnlineStore()));

                var tracks = new ResourceStore <byte[]>(thSharpResources);
                tracks.AddStore(new NamespacedResourceStore <byte[]>(thSharpResources, @"Tracks"));
                tracks.AddStore(new OnlineStore());

                var samples = new ResourceStore <byte[]>(thSharpResources);
                samples.AddStore(new NamespacedResourceStore <byte[]>(thSharpResources, @"Samples"));
                samples.AddStore(new OnlineStore());

                //thSharpAudio = new AudioManager(tracks, samples);
            }
        }
예제 #3
0
 private void load(THSharpConfigManager config)
 {
     Child = GamemodeStore.GetWorkingGamemode(config.Get <string>(THSharpSetting.Gamemode))?.GetGamemodePlayfield();
 }
예제 #4
0
        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();
                }
            }
        }