Exemplo n.º 1
0
        public EffectData SetEffect(string device, string index)
        {
            int i;
            EffectData result;

            Console.WriteLine("{0}: Setting effect to {1}", device, index);
            if (int.TryParse(index, out i))
            {
                result = GetEffectManager(device).SelectEffect(i);
                Console.WriteLine(TankManager.TreadsManager.ActiveEffect.Information.Name);

            }
            else
            {
                result = new EffectData(new EffectInfo());
                Console.WriteLine("{0}: Setting effect to {1} FAILED!", device, index);
            }

            return result;
        }
Exemplo n.º 2
0
        public EffectData GetActiveEffectData()
        {
            EffectData result = new EffectData(new EffectInfo());
            lock (this)
            {
                result = GetEffectData(_activeIndex);
            }

            return result;
        }
Exemplo n.º 3
0
        public EffectData SelectEffect(int index)
        {
            EffectData result = new EffectData(new EffectInfo());
            lock (this)
            {
                if (index >= 0 && index < _effectList.Count)
                {
                    _effectList[_activeIndex].Deactivate();
                    _activeIndex = index;

                    result = GetEffectData(index);

                    _effectList[_activeIndex].Activate();

                    State = TankState.Running;
                }
            }

            return result;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets status data about affect of a given index.
        /// This call is thread UN-SAFE!!
        /// </summary>
        /// <param name="index"></param>
        /// <returns>EffectData</returns>
        private EffectData GetEffectData(int index)
        {
            EffectData result = new EffectData(new EffectInfo());

            if (index >= 0 && index < _effectList.Count)
            {
                result = new EffectData(_effectList[index].Information);
                result.Id = index;
                result.Color = ColorHelper.ColorToString(_effectList[index].Color);
                result.Argument = (_effectList[index].Argument != null) ? _effectList[index].Argument : string.Empty;
                result.IsSensorDriven = _effectList[index].IsSensorDriven;
            }

            return result;
        }
Exemplo n.º 5
0
        public List<EffectData> GetEffectsList()
        {
            List<EffectData> result = new List<EffectData>();
            for (int i = 0; i < _effectList.Count; i++)
            {
                EffectData info = new EffectData(_effectList[i].Information);
                info.Id = i;
                result.Add(info);
            }

            return result;
        }