void SetValue(int index, bool value)
 {
     if (index == 0)
     {
         // None was selected so we reset all the bits to false
         m_Field.SetValue(System.Enum.ToObject(m_Field.enumType, 0));
         foreach (var toggle in toggles)
         {
             if (toggle.getter != null)
             {
                 toggle.UpdateValueLabel();
             }
         }
     }
     else
     {
         int intValue = System.Convert.ToInt32(m_Field.GetValue());
         if (value)
         {
             intValue |= m_Field.enumValues[index];
         }
         else
         {
             intValue &= ~m_Field.enumValues[index];
         }
         m_Field.SetValue(System.Enum.ToObject(m_Field.enumType, intValue));
     }
 }
예제 #2
0
 void SetValue(int index, bool value)
 {
     if (index == 0)
     {
         // None was selected so we reset all the bits to false
         m_Field.SetValue(System.Enum.ToObject(m_Field.enumType, 0));
     }
     else
     {
         int intValue = System.Convert.ToInt32(m_Field.GetValue());
         if (value)
         {
             intValue |= m_Field.enumValues[index];
         }
         else
         {
             intValue &= ~m_Field.enumValues[index];
         }
         m_Field.SetValue(System.Enum.ToObject(m_Field.enumType, intValue));
     }
 }
예제 #3
0
        void SetValue(int index, bool value)
        {
            int intValue = System.Convert.ToInt32(m_Field.GetValue());

            if (value)
            {
                intValue |= m_Field.enumValues[index];
            }
            else
            {
                intValue &= ~m_Field.enumValues[index];
            }
            m_Field.SetValue(System.Enum.ToObject(m_Field.enumType, intValue));
        }