Exemplo n.º 1
0
 private void skinChanged()
 {
     SkinChanged(CurrentSkin);
     OnSkinChanged?.Invoke();
 }
Exemplo n.º 2
0
 private void skinChanged()
 {
     SkinChanged(CurrentSkin, allowDefaultFallback);
     OnSkinChanged?.Invoke();
 }
Exemplo n.º 3
0
        internal static bool LoadSkin(string skin = null, bool clearCache = false)
        {
            InitializeSkinList();

            bool found = true;

            if (skin == null || Skins.Find(s => s.Equals(skin, StringComparison.CurrentCultureIgnoreCase)) == null)
            {
                found = skin == null;
                skin  = ConfigManager.sSkin;
            }

            bool forceDefault = false;

            if ((GameBase.Mode == OsuModes.Edit || GameBase.TestMode) && ConfigManager.sEditorDefaultSkin)
            {
                skin         = DEFAULT_SKIN;
                forceDefault = true;
            }

            if (!Directory.Exists(Path.Combine(SKINS_FOLDER, skin)))
            {
                skin         = DEFAULT_SKIN;
                forceDefault = true;
            }

            bool isNewSkin = false;

            if (clearCache || Current == null || !skin.Equals(Current.RawName, StringComparison.CurrentCultureIgnoreCase))
            {
                if (Current != null)
                {
                    Debug.Print(@"Skin reloaded");
                }

                TextureManager.ClearSkinCache(true);

                SkinOsu newSkin = LoadSkinRaw(skin);

                if (newSkin != null)
                {
                    isNewSkin = true;
                    Current   = newSkin;

                    if (skin == ConfigManager.sSkin)
                    {
                        CurrentUserSkin = Current;
                    }

                    AudioEngine.ClearSkinCache();

                    if (GameBase.Mode == OsuModes.Play) //todo: check if we actually need to load samples here.
                    {
                        AudioEngine.LoadAllSamples();
                    }
                    else
                    {
                        AudioEngine.LoadPrioritySamples();
                    }
                }
            }

            BeatmapColours.Clear();

            ResetColoursToSkin();

            if (ConfigManager.sUseSkinCursor && Current != CurrentUserSkin && !forceDefault)
            {
                //Special user override.
                SkinOsu tempHolder = Current;

                Current = CurrentUserSkin;
                LoadCursor();
                Current = tempHolder;
            }
            else
            {
                LoadCursor();
            }

            if (isNewSkin)
            {
                OnSkinChanged?.Invoke();
            }

            return(found);
        }
Exemplo n.º 4
0
 public void SetSkin(BattlePlayerSkin skin)
 {
     skin_ = skin;
     OnSkinChanged.Invoke();
 }