예제 #1
0
        private void StopNearbyMusicBoxesPlaying(Mobile from, int range)
        {
            IPooledEnumerable eable = from.Map.GetItemsInRange(from.Location, range);

            foreach (Item i in eable)
            {
                if (i is MusicBoxAddon && i != this)
                {
                    MusicBoxComponent box = ((MusicBoxAddon)i).Components[0] as MusicBoxComponent;
                    if (((MusicBoxAddon)i).Turning)
                    {
                        ((MusicBoxAddon)i).EndTurn(from, box, true);
                    }
                }
            }
        }
예제 #2
0
 private void TogglePlayer(Mobile from, MusicBoxComponent box, bool stopping)
 {
     if (from.AccessLevel < AccessLevel.GameMaster)
     {
         if (Turning || stopping)
             box.StopMusic(from);
         else
             box.PlayMusic(from);
     }
     else
     {
         if (!Turning && !stopping) StopNearbyMusicBoxesPlaying(from, box.Range);
         IPooledEnumerable eable = from.Map.GetMobilesInRange(from.Location, box.Range);
         foreach (Mobile mob in eable)
         {
             if (Turning || stopping)
                 box.StopMusic(mob);
             else
                 box.PlayMusic(mob);
         }
         eable.Free();
     }
 }
예제 #3
0
        public void EndTurn(Mobile from, MusicBoxComponent box, bool autostop)
        {
            if (m_Timer != null)
            {
                m_Timer.Stop();
            }

            m_Timer  = null;
            box.Name = "Music Box: Stopped.";

            if (autostop)
            {
                TogglePlayer(from, box, true);
            }

            foreach (AddonComponent c in Components)
            {
                switch (c.ItemID)
                {
                case 0x2AFA:
                case 0x2AFE: --c.ItemID; break;
                }
            }
        }
예제 #4
0
 public TurnTimer(MusicBoxAddon addon, Mobile from, double duration, MusicBoxComponent box)
     : base(TimeSpan.FromSeconds(duration))
 {
     m_Addon = addon;
     m_From = from;
     m_Box = box;
     Priority = TimerPriority.TwoFiftyMS;
 }
예제 #5
0
        public void EndTurn(Mobile from, MusicBoxComponent box, bool autostop)
        {
            if (m_Timer != null)
                m_Timer.Stop();

            m_Timer = null;
            box.Name = "Music box: Stopped.";

            if (autostop) TogglePlayer(from, box, true);

            foreach (AddonComponent c in Components)
            {
                switch (c.ItemID)
                {
                    case 0x2AFA:
                    case 0x2AFE: --c.ItemID; break;
                }
            }
        }
예제 #6
0
        public void BeginTurn(Mobile from, double duration, MusicBoxComponent box)
        {
            m_Timer = new TurnTimer(this, from, duration, box);
            m_Timer.Start();
            box.Name = "Music box: Playing.";

            foreach (AddonComponent c in Components)
            {
                switch (c.ItemID)
                {
                    case 0x2AF9:
                    case 0x2AFD: ++c.ItemID; break;
                }
            }
        }
예제 #7
0
 public MusicBoxEntry(Mobile from, MusicBoxComponent box)
     : base(10003, 2)
 {
     m_From = from;
     m_Box  = box;
 }
예제 #8
0
 public MusicBoxGump(Mobile from, MusicBoxComponent box)
     : base(30, 30)
 {
     from.CloseGump(typeof(MusicBoxGump));
     m_Box = box;
     m_From = from;
     AddBackground(0, 0, 600, 480, 9400);
     AddPage(0);
     AddHtmlLocalized(250, 10, 180, 20, 1075130, 2124, false, false);
     int Xpos = 26, Ypos = 42;
     int z = 0;
     for (int x = 0; x < 3; x++)
     {
         for (int y = 0; y < 17; y++)
         {
             bool has = (box.HasTrack[z]);
             AddSongEntry(Xpos, Ypos, MusicBoxComponent.Locals[z], has ? 177 : 547, z + 100, has);
             Ypos += 20;
             z++;
         }
         Xpos += 200;
         Ypos = 42;
     }
     AddLabel(250, 460, 2124, "Add Songs");
     AddButton(220, 460, 1210, 1210, 99, GumpButtonType.Reply, 0);
 }
예제 #9
0
 public MusicBoxEntry(Mobile from, MusicBoxComponent box)
     : base(10003, 2)
 {
     m_From = from;
     m_Box = box;
 }