예제 #1
0
        private void CheckForGamePadConfig(InputManager iM)
        {
            try
            {
                List <string> preGamePadConfigs = new Fileread().LookForGamePadConfig();
                List <string> p1Config          = new List <string>();
                List <string> p2Config          = new List <string>();
                for (int i = 0; i < preGamePadConfigs.Count; i++)
                {
                    if (preGamePadConfigs[i] != "Player two:")
                    {
                        if (preGamePadConfigs[i] != "Player one:")
                        {
                            p1Config.Add(preGamePadConfigs[i]);
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                bool leave = false;
                for (int i = 0; i < preGamePadConfigs.Count; i++)
                {
                    if (preGamePadConfigs[i] == "Player two:")
                    {
                        for (int j = i; j < preGamePadConfigs.Count; j++)
                        {
                            if (preGamePadConfigs[j] != "Player two:")
                            {
                                p2Config.Add(preGamePadConfigs[j]);
                            }
                            if (j == preGamePadConfigs.Count - 1)
                            {
                                leave = true; break;
                            }
                        }
                    }
                    if (leave)
                    {
                        break;
                    }
                }
                SetPreConfig(iM, p1Config, p2Config);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
        public SoundManager(ContentManager content)
        {
            noCopySounds = new List <SoundEffect>();
            otherSounds  = new List <SoundEffect>();

            NoCopySounds = new List <SoundEffectInstance>();
            OtherSounds  = new List <SoundEffectInstance>();

            InitiateSoundEffects(content);

            List <string> tempList = new Fileread().NoCopySounds();

            if (tempList.Count > 0)
            {
                for (int i = 0; i < tempList.Count; i++)
                {
                    var filestream = new FileStream(tempList[i], FileMode.Open);//Monogame community R0x
                    using (filestream)
                    {
                        noCopySounds.Add(SoundEffect.FromStream(filestream));
                    }
                    NoCopySounds.Add(noCopySounds[i].CreateInstance());
                }
            }

            tempList = new Fileread().OtherSounds();
            if (tempList.Count > 0)
            {
                for (int i = 0; i < tempList.Count; i++)
                {
                    var filestream = new FileStream(tempList[i], FileMode.Open);
                    using (filestream)
                    {
                        otherSounds.Add(SoundEffect.FromStream(filestream));
                    }
                    OtherSounds.Add(otherSounds[i].CreateInstance());
                }
            }
        }