Beispiel #1
0
 public static CaBase DoModal(CaBase cab, string strTitle, string strKind)
 {
     string strEndsWith = strKind;
     System.Reflection.Assembly ass = typeof(CaBase).Module.Assembly;
     Type[] atype = ass.GetTypes();
     ArrayList alsType = new ArrayList();
     ArrayList alsName = new ArrayList();
     foreach (Type type in atype) {
         string strName = type.ToString();
         if (strName.EndsWith(strEndsWith)) {
             alsType.Add(type);
             string strDisplayName = Helper.GetDisplayName(type);
             if (strDisplayName == null) {
                 int ichDot = strName.IndexOf('.');
                 strDisplayName = strName.Substring(ichDot + 1, strName.Length - (ichDot + 1 + strEndsWith.Length));
             }
             alsName.Add(strDisplayName);
         }
     }
     CaNew frmCaNew = new CaNew(cab, strTitle, strKind, (Type[])alsType.ToArray(typeof(Type)), (string[])alsName.ToArray(typeof(string)) );
     frmCaNew.ShowDialog();
     if (frmCaNew.DialogResult == DialogResult.Cancel)
         return null;
     return frmCaNew.GetCab();
 }
Beispiel #2
0
        public CaNew(CaBase cab, string strTitle, string strKind, Type[] atype, string[] astrName)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_atype = atype;
            m_cab = null;
            m_strParse = null;
            m_strKind = strKind;

            // To do - might want to pretty print these type names

            Text = strTitle;
            m_labelWhatType.Text = m_labelWhatType.Text.Replace("$1", strKind);
            m_labelText.Text = m_labelText.Text.Replace("$1", strKind);
            Array.Sort(astrName, atype);
            Array.Sort(astrName);
            m_comboBoxType.DataSource = astrName;
            m_cab = cab;
            if (cab != null) {
                m_comboBoxType.SelectedIndex = Array.IndexOf(atype, m_cab.GetType());
            } else {
                m_comboBoxType.SelectedIndex = 0;
            }
            SelectCa(m_comboBoxType.SelectedIndex);
        }
Beispiel #3
0
 public Artillery(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
 }
Beispiel #4
0
 public TakeoverSpecialist(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
     m_aggr = Aggressiveness.Coward;
 }
Beispiel #5
0
 public ShortRangeInfantry(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
 }
Beispiel #6
0
 public RocketVehicle(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
 }
Beispiel #7
0
 public MobileUnit(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty)
 {
     m_aggr = aggr;
     m_cab = cab;
 }
Beispiel #8
0
 public MobileHeadquarters(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
     m_aggr = Aggressiveness.Coward;
 }
Beispiel #9
0
 public MediumTank(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
 }
Beispiel #10
0
 public MachineGunVehicle(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
 }
Beispiel #11
0
 public GalaxMiner(Side side, int tx, int ty, Aggressiveness aggr, CaBase cab)
     : base(side, tx, ty, aggr, cab)
 {
     m_aggr = Aggressiveness.Coward;
 }
Beispiel #12
0
        void SelectCa(int n)
        {
            if (m_cab == null || m_cab.GetType() != m_atype[n])
                m_cab = (CaBase)System.Activator.CreateInstance(m_atype[n]);

            m_labelDescription.Text = Helper.GetDescription(m_cab.GetType());

            m_richTextBox.Clear();

            // String replacement, order independent

            string str = m_cab.GetString();
            CaType[] acat = m_cab.GetTypes();
            for (int j = 0; j < acat.Length; j++)
                str = str.Replace("$" + (j + 1), "~" + j + acat[j].ToString() + "~" + j);

            // Save this away for hittesting purposes

            m_strParse = (string)str.Clone();

            // && delimited pieces are links

            while (str.Length != 0) {
                int ichT = str.IndexOf("~");
                if (ichT == -1) {
                    m_richTextBox.AppendText(str);
                    break;
                }
                if (ichT != 0)
                    m_richTextBox.AppendText(str.Substring(0, ichT));
                str = str.Remove(0, ichT + 2);

                // Now add the underlined text

                int ichStart = m_richTextBox.TextLength;
                int cchLink = str.IndexOf("~");
                Debug.Assert(cchLink != -1);
                m_richTextBox.AppendText(str.Substring(0, cchLink));
                str = str.Remove(0, cchLink + 2);
                m_richTextBox.Select(ichStart, cchLink);
                Color clr = m_richTextBox.SelectionColor;
                Font fnt = m_richTextBox.SelectionFont;
                m_richTextBox.SelectionColor = Color.Blue;
                m_richTextBox.SelectionFont = new Font(fnt.FontFamily, fnt.Size, /* FontStyle.Bold | */ FontStyle.Underline);
                m_richTextBox.Select(m_richTextBox.TextLength, 0);
                m_richTextBox.SelectionFont = fnt;
                m_richTextBox.SelectionColor = clr;
            }
        }