예제 #1
0
 // Allows us to edit a single page of bitvector flags.
 public FlagEditor(BitvectorFlagType[] flags, int initialValue, int group)
 {
     InitializeComponent();
     _initialValue = initialValue;
     _myArray = new CheckBoxArray(this);
     Value = initialValue;
     for (int i = 0; i < 32; i++)
     {
         _myArray.AddNewCheckBox();
         _myArray[i].Checked = ((_initialValue & (1 << i)) != 0);
         _myArray[i].Enabled = false;
     }
     _myArray.AddValueLabel();
     for (int x = 0; x < flags.Length; x++)
     {
         for (int y = 0; y < 32; y++)
         {
             if ((flags[x].BitvectorData.Group == group) && (flags[x].BitvectorData.Vector == 1 << y))
             {
                 _myArray[y].Text = flags[x].Name;
                 _myArray[y].Enabled = flags[x].Settable;
             }
         }
     }
     // TODO: Set text for each control based on the flags we were passed.
     //_myArray[1].BackColor = System.Drawing.Color.Red;
 }
예제 #2
0
 // Allows us to edit a flag type.
 //public FlagEditor(int flags, int initialValue)
 //{
 //    InitializeComponent();
 //    _initialValue = initialValue;
 //    _myArray = new CheckBoxArray(this);
 //    Value = initialValue;
 //    for (int i = 0; i < 32; i++)
 //    {
 //        _myArray.AddNewCheckBox();
 //        _myArray[i].Checked = ((_initialValue & (1 << i)) != 0);
 //        _myArray[i].Enabled = false;
 //    }
 //    _myArray.AddValueLabel();
 //    for (int x = 0; x < flags.Length; x++)
 //    {
 //        for (int y = 0; y < 32; y++)
 //        {
 //            if (flags[x].bit == 1 << y)
 //            {
 //                _myArray[y].Text = flags[x].name;
 //                _myArray[y].Enabled = flags[x].settable;
 //            }
 //        }
 //    }
 //    // TODO: Set text for each control based on the flags we were passed.
 //    //_myArray[1].BackColor = System.Drawing.Color.Red;
 //}
 // Allows us to edit a single page of bitvector flags.
 public MultiFlagEditor(BitvectorFlagType[] flags, int[] initialValues)
 {
     InitializeComponent();
     _initialValue = initialValues;
     _flags = flags;
     _currentGroup = 0;
     _myArray = new CheckBoxArray(this);
     for (int i = 0; i < 32; i++)
     {
         _myArray.AddNewCheckBox();
         //_myArray[i].Checked = ((_initialValue[0] & (1 << i)) != 0);
         _myArray[i].Enabled = false;
     }
     _myArray.AddValueLabel();
     UpdateDialogWithBitvector();
     // TODO: Set text for each control based on the flags we were passed.
     //_myArray[1].BackColor = System.Drawing.Color.Red;
 }
예제 #3
0
파일: Affect.cs 프로젝트: xuesong/ModernMUD
 public string AffectString(bool mortal)
 {
     return(BitvectorFlagType.AffectString(_bitVectors, mortal));
 }
예제 #4
0
        /// <summary>
        /// Gets a bitvector's string values.
        /// </summary>
        /// <param name="bvect"></param>
        /// <param name="flags"></param>
        /// <returns></returns>
        public static string BitvectorString( ref Bitvector bvect, BitvectorFlagType[] flags )
        {
            int i;

            for( i = 0; flags[ i ].BitvectorData.Vector > 0; i++ )
            {
                if( flags[ i ].BitvectorData.Group == bvect.Group && flags[ i ].BitvectorData.Vector == bvect.Vector )
                    return flags[ i ].Name;
            }
            return null;
        }