Пример #1
0
 public HomeFacade()
 {
     _lights         = new Lights();
     _airConditioner = new AirConditioner();
     _musicSystem    = new MusicSystem();
     _homeSecurity   = new HomeSecurity();
 }
Пример #2
0
        public bool Update(MusicSystem musicsystem)
        {
            var query1 = datacontext.MusicSystems.Find(musicsystem.ProductID);

            try
            {
                query1.ProductID             = musicsystem.ProductID;
                query1.ProductName           = musicsystem.ProductName;
                query1.BrandName             = musicsystem.BrandName;
                query1.Price                 = musicsystem.Price;
                query1.CategoryID            = musicsystem.CategoryID;
                query1.SubCategoryID         = musicsystem.SubCategoryID;
                query1.DimensionMainUnit     = musicsystem.DimensionMainUnit;
                query1.DimensionFrontSpeaker = musicsystem.DimensionFrontSpeaker;
                query1.Bluetooth             = musicsystem.Bluetooth;
                query1.Radio                 = musicsystem.Radio;
                query1.Recording             = musicsystem.Recording;
                query1.SurroundSound         = musicsystem.SurroundSound;
                query1.USB = musicsystem.USB;
                query1.NetWeightMainUnit = musicsystem.NetWeightMainUnit;
                query1.NetWeightWoofer   = musicsystem.NetWeightWoofer;
                query1.PowerConsumption  = musicsystem.PowerConsumption;

                datacontext.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                dc.PCErrorLoggers.Add(new PCErrorLogger()
                {
                    ErrorDate    = DateTime.Now,
                    ErrorMessage = ex.Message,
                    ErrorSource  = ex.Source
                });
                dc.SaveChanges();
                throw new DbUpdateException("Please enter valid Foreign keys");
            }
            catch (System.FormatException fe)
            {
                dc.PCErrorLoggers.Add(new PCErrorLogger()
                {
                    ErrorDate    = DateTime.Now,
                    ErrorMessage = fe.Message,
                    ErrorSource  = fe.Source
                });
                dc.SaveChanges();
                throw new System.FormatException();
            }
            catch (Exception q)
            {
                dc.PCErrorLoggers.Add(new PCErrorLogger()
                {
                    ErrorDate    = DateTime.Now,
                    ErrorMessage = q.Message,
                    ErrorSource  = q.Source
                });
                dc.SaveChanges();
                throw new Exception("Incorrect Format");
            }
            return(true);
        }
Пример #3
0
        private void AddNote(Note note, int pos, int length)
        {
            var ev = new MusicEvent(
                sample => player.PlayNote(
                    note.MidiNum, notesVelocity, length * MusicSystem.GetBlockSampleLength(), sample),
                pos);

            pendingEvents.Add(ev);
        }
Пример #4
0
 void Awake()
 {
     // Only one instance of SoundManager at a time!
     if (_instance != null)
     {
         Destroy(gameObject);
         return;
     }
     _instance = this;
     DontDestroyOnLoad(gameObject);
 }
Пример #5
0
    // overarching start code
    public override void Start()
    {
        rhasspy     = new Rhasspy(this);
        musicSystem = new MusicSystem(this);
        visuals     = new Visuals(this);

        musicSystem.Start();
        visuals.Start();

        rhasspy.Call();
        // musicSystem.SetDirectory("/home/sammy/Music/renamer/"); // assign the initial directory
    }
Пример #6
0
    public void HitBalloon(int value)
    {
        m_balloonLife -= value;
        if (balloonLife <= 0)
        {
            Time.timeScale = 0f;
            gameOverCanvas.SetActive(true);

            // switch to sacrifice theme
            MusicSystem ms = musicSys.GetComponent <MusicSystem>();
            ms.PlayClip(0);
        }
    }
Пример #7
0
    public void OnExitParty()
    {
        Debug.Log("OnExitParty");
        SceneManager.SetActiveScene(SceneManager.GetSceneByName("Game"));
        inGameMenuCanvas.SetActive(false);
        Destroy(gameObject);
        //SceneManager.UnloadSceneAsync("Scenes/Level1");
        UnloadLevel();
        Time.timeScale = 1f;
        MusicSystem ms = musicSys.GetComponent <MusicSystem>();

        ms.Stop();
    }
        public void Init(Canvas libraryUIPrefab, ChordEditor chordEditorPrefab, MusicSystem musicSystem)
        {
            InitLibrary(libraryUIPrefab);

            chordEditor = Instantiate(chordEditorPrefab);
            base.Init(chordEditor);

            chordEditor.ChordsUpdated.AddListener(UpdateChords);
            chordEventManager.Init();

            PointerPosChanged.AddListener(_ => PointerPosChangedEvent.Invoke());
            chordEditor.ChordsUpdated.AddListener(ChordPlacedEvent.Invoke);
        }
Пример #9
0
 public void EndLevelReached()  // Sacrifice has to be choose
 {
     Debug.Log("EndLevelReached");
     if (m_currentLevelIdx < 4)
     {
         endGameCanvas.SetActive(true);
         MusicSystem ms = musicSys.GetComponent <MusicSystem>();
         ms.PlayClip(0);
     }
     else
     {
         EndLevel(4);
     }
 }
Пример #10
0
        public void ShouldSwitchOnAll()
        {
            var light       = new Light();
            var tv          = new TV();
            var musicSystem = new MusicSystem();
            var security    = new Security();

            var facade = new HomeFacade(light, musicSystem, tv, security);

            facade.ArriveHome();

            Assert.That(light.IsSwitchOn);
            Assert.That(tv.IsSwitchOn);
            Assert.That(musicSystem.IsSwitchOn);
            Assert.That(security.IsSwitchOn);
        }
Пример #11
0
 private void AddChord(Chord chord, int pos)
 {
     foreach (Note note in chord.Notes)
     {
         for (int i = 0; i < chordsPerBlock; ++i)
         {
             //Why -10? Because it works! ¯\_(ツ)_/¯
             long offset = (long)(MusicSystem.GetOutputBlockSampleLength() * ((double)i / chordsPerBlock) - 10);
             var  ev     = new MusicEvent(
                 sample => player.PlayNote(
                     note.MidiNum, chordsVelocity, MusicSystem.GetBlockSampleLength(),
                     sample + offset),
                 pos);
             pendingEvents.Add(ev);
         }
     }
 }
Пример #12
0
    public void OnExitParty()
    {
        gameOverCanvas.SetActive(false);
        Debug.Log("OnExitParty");
        mainMenuCanvas.SetActive(true);
        ingameCanvas.SetActive(false);
        partyInstance.OnExitParty();
        Destroy(partyInstance);
        //m_state = State.InGame;

        // stop music when going back to title
        GameObject musicSys = GameObject.FindGameObjectWithTag("Music");

        Debug.Assert(musicSys);
        MusicSystem ms = musicSys.GetComponent <MusicSystem>();

        ms.Stop();
    }
Пример #13
0
 public bool Insert(MusicSystem music)
 {
     try
     {
         datacontext.MusicSystems.Add(music);
         int result = datacontext.SaveChanges();
     }
     catch (DbUpdateException ex)
     {
         dc.PCErrorLoggers.Add(new PCErrorLogger()
         {
             ErrorDate    = DateTime.Now,
             ErrorMessage = ex.Message,
             ErrorSource  = ex.Source
         });
         dc.SaveChanges();
         throw new DbUpdateException("Please enter valid Foreign keys");
     }
     catch (System.FormatException fe)
     {
         dc.PCErrorLoggers.Add(new PCErrorLogger()
         {
             ErrorDate    = DateTime.Now,
             ErrorMessage = fe.Message,
             ErrorSource  = fe.Source
         });
         dc.SaveChanges();
         throw new System.FormatException();
     }
     catch (Exception q)
     {
         dc.PCErrorLoggers.Add(new PCErrorLogger()
         {
             ErrorDate    = DateTime.Now,
             ErrorMessage = q.Message,
             ErrorSource  = q.Source
         });
         dc.SaveChanges();
         throw new Exception("Incorrect Format");
     }
     return(true);
 }
Пример #14
0
        public object Read(NodeEntry node, BinaryReader reader, List <INodeParser> parsers)
        {
            var result = new MusicSystem();

            reader.Skip(4);
            result.Unknown1 = reader.ReadPackedString();
            if (result.Unknown1 != "None")
            {
                result.Unknown2 = reader.ReadPackedString();
                result.Unknown3 = reader.ReadByte();
                result.Unknown4 = reader.ReadPackedString();
                result.Unknown5 = reader.ReadPackedString();
                result.Unknown6 = reader.ReadUInt16();
                result.Unknown7 = reader.ReadPackedString();
                result.Unknown8 = reader.ReadUInt32();
            }

            result.Node = node;

            return(result);
        }
Пример #15
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
     instance = this;
     FMODUnity.RuntimeManager.LoadBank(musicBank);
     currentMusicIndex = 0;
     MasterVolume      = 1f;
     MusicVolume       = .5f;
     SFXVolume         = .5f;
     Music             = FMODUnity.RuntimeManager.GetBus("bus:/MASTER/MUS");
     SFX    = FMODUnity.RuntimeManager.GetBus("bus:/MASTER/SFX");
     Master = FMODUnity.RuntimeManager.GetBus("bus:/MASTER");
     Music.setVolume(MusicVolume);
     SFX.setVolume(SFXVolume);
     Master.setVolume(MasterVolume);
 }
Пример #16
0
    public void StartLevel(int levelIdx)
    {
        musicSys = GameObject.FindGameObjectWithTag("Music");
        Debug.Assert(musicSys);

        Time.timeScale    = 1f;
        m_currentLevelIdx = levelIdx;
        if (m_currentLevelIdx == 5)
        {
            inGameCanvas.SetActive(false);
            loadedSceneName = "End";
        }
        else
        {
            loadedSceneName = "Level" + levelIdx.ToString();
            MusicSystem ms = musicSys.GetComponent <MusicSystem>();
            ms.PlayClip(m_currentLevelIdx);
        }

        loader = SceneManager.LoadSceneAsync("Scenes/" + loadedSceneName, LoadSceneMode.Additive);
        //loader.allowSceneActivation = false;
        firstUpdateInLevel = true;
        m_balloonLife      = balloonLifeStart;
    }
Пример #17
0
        void Start()
        {
            //musicSources = GameObject.Find("Camera").GetComponents<AudioSource>(); //note : why doesnt it work as intended ?
            musicSources = UnityEngine.Camera.main.GetComponents <AudioSource>(); //this works tho

            playerSource = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>();
            player       = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterController2D>();

            Snd_playerMvt = GetComponent <PlayerMovementSounds>();
            musicSystem   = GetComponent <MusicSystem>();
            InitDict();

            //volume musique speakers
            foreach (AudioSource s in musicSources)
            {
                s.volume = musicVolume;
            }
            //volume player speakers
            playerSource.volume = playerVolume;

            //for tests ...
            //playerSources = GameObject.FindGameObjectWithTag("Player").GetComponents<AudioSource>(); //somehow this doesnt work
            //players = GameObject.FindGameObjectWithTag("Player").GetComponents<CharacterController2D>(); //somehow this doesnt work
        }
Пример #18
0
 public Tester()
 {
     musicSystem = new MusicSystem();
 }