Ejemplo n.º 1
0
        public override void AddControls(List <IMyTerminalControl> controls)
        {
            MyTerminalControlSlider <MyShipController>
            hours       = new MyTerminalControlSlider <MyShipController>("WaitForHours", MyStringId.GetOrCompute("Hours"), MyStringId.GetOrCompute("Hours to wait for")),
                minutes = new MyTerminalControlSlider <MyShipController>("WaitForMinutes", MyStringId.GetOrCompute("Minutes"), MyStringId.GetOrCompute("Minutes to wait for")),
                seconds = new MyTerminalControlSlider <MyShipController>("WaitForSeconds", MyStringId.GetOrCompute("Seconds"), MyStringId.GetOrCompute("Seconds to wait for"));

            hours.DefaultValue = 0f;
            hours.Normalizer   = Normalizer;
            hours.Denormalizer = Denormalizer;
            hours.Writer       = Writer;
            IMyTerminalValueControl <float> valueControl = hours;

            valueControl.Getter = block => duration.Hours;
            valueControl.Setter = (block, value) => {
                duration = TimeSpan.FromHours((int)value);
                minutes.UpdateVisual();
                seconds.UpdateVisual();
            };
            controls.Add(hours);

            minutes.DefaultValue = 0f;
            minutes.Normalizer   = Normalizer;
            minutes.Denormalizer = Denormalizer;
            minutes.Writer       = Writer;
            valueControl         = minutes;
            valueControl.Getter  = block => duration.Minutes;
            valueControl.Setter  = (block, value) => {
                duration = TimeSpan.FromMinutes((int)value);
                hours.UpdateVisual();
                seconds.UpdateVisual();
            };
            controls.Add(minutes);

            seconds.DefaultValue = 0f;
            seconds.Normalizer   = Normalizer;
            seconds.Denormalizer = Denormalizer;
            seconds.Writer       = Writer;
            valueControl         = seconds;
            valueControl.Getter  = block => duration.Seconds;
            valueControl.Setter  = (block, value) => {
                duration = TimeSpan.FromSeconds((int)value);
                hours.UpdateVisual();
                minutes.UpdateVisual();
            };
            controls.Add(seconds);
        }
Ejemplo n.º 2
0
 void SelectionChanged()
 {
     if (!MySandboxGame.IsDedicated)
     {
         m_soundPair.Init(m_cueId);
         var soundData = MyAudio.Static.GetCue(m_cueId);
         if (soundData != null)
         {
             IsLoopable = soundData.Loopable;
         }
     }
     m_loopableTimeSlider.UpdateVisual();
     m_playButton.UpdateVisual();
     m_stopButton.UpdateVisual();
 }
Ejemplo n.º 3
0
 void SelectionChanged()
 {
     if (!MySandboxGame.IsDedicated)
     {
         if (m_cueIdString.Value.Length > 0)
         {
             m_cueId = new MySoundPair(m_cueIdString.Value);
         }
         else
         {
             m_cueId = MySoundPair.Empty;
         }
         var soundData = MyAudio.Static.GetCue(m_cueId.Arcade);
         if (soundData != null)
         {
             IsLoopable = soundData.Loopable;
         }
     }
     m_loopableTimeSlider.UpdateVisual();
     m_playButton.UpdateVisual();
     m_stopButton.UpdateVisual();
 }
Ejemplo n.º 4
0
        public void SelectSound(MyCueId cueId, bool sync)
        {
            if (sync)
            {
                SyncObject.SendSelectSoundRequest(cueId);
            }
            else
            {
                CueId = cueId;

                if (!MySandboxGame.IsDedicated)
                {
                    m_soundPair.Init(cueId);
                    var soundData = MyAudio.Static.GetCue(cueId);
                    if (soundData != null)
                    {
                        IsLoopable = soundData.Loopable;
                    }
                }
                m_loopableTimeSlider.UpdateVisual();
                m_playButton.UpdateVisual();
                m_stopButton.UpdateVisual();
            }
        }