예제 #1
0
        private void btnTactAdd_Click(object sender, EventArgs e)
        {
            HomuTactListEntry entry = new HomuTactListEntry(int.Parse(txtTactListID.Text), txtTactListName.Text, (EHomuBehavior)cmbTactListBehav.SelectedIndex, (EHomuSkillUsage)cmbTactListSkill.SelectedIndex, cmbTactListSkillLvl.SelectedIndex);

            mConfig.TactList.Add(entry);
            listTacts.Items.Add(new HomuTactListViewItem(mConfig.TactList[mConfig.TactList.Count - 1]));
            // select me :o
            listTacts.SelectedIndices.Clear();
            listTacts.SelectedIndices.Add(listTacts.Items.Count - 1);
            listTacts.Items[listTacts.Items.Count - 1].EnsureVisible();
        }
예제 #2
0
        private void cmbTactListSkill_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listTacts.SelectedIndices.Count == 0 || listTacts.SelectedIndices[0] == -1)
            {
                return;
            }
            HomuTactListEntry entry = ((HomuTactListViewItem)listTacts.Items[listTacts.SelectedIndices[0]]).Entry;

            entry.Skill = (EHomuSkillUsage)cmbTactListSkill.SelectedIndex;
            listTacts.Invalidate();
        }
예제 #3
0
        private void txtTactListName_TextChanged(object sender, EventArgs e)
        {
            if (listTacts.SelectedIndices.Count == 0 || listTacts.SelectedIndices[0] == -1)
            {
                return;
            }
            HomuTactListEntry entry = ((HomuTactListViewItem)listTacts.Items[listTacts.SelectedIndices[0]]).Entry;

            entry.Name = txtTactListName.Text;
            listTacts.Invalidate();
        }
예제 #4
0
        private void cmbTactListSkillLvl_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listTacts.SelectedIndices.Count == 0 || listTacts.SelectedIndices[0] == -1)
            {
                return;
            }
            HomuTactListEntry entry = ((HomuTactListViewItem)listTacts.Items[listTacts.SelectedIndices[0]]).Entry;

            cmbTactListSkill.Enabled = (cmbTactListSkillLvl.SelectedIndex > 0);
            entry.Priority           = cmbTactListSkillLvl.SelectedIndex;
            listTacts.Invalidate();
        }
예제 #5
0
        private void txtTactListID_TextChanged(object sender, EventArgs e)
        {
            HomuTactListEntry entry = ((HomuTactListViewItem)listTacts.Items[listTacts.SelectedIndices[0]]).Entry;
            int id;

            if (int.TryParse(txtTactListID.Text, out id) == false)
            {
                txtTactListID.Text = "0";                 // should trigger it again
                return;
            }
            entry.ID = id;
            listTacts.Invalidate();
        }
예제 #6
0
        private void listTacts_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listTacts.SelectedIndices.Count == 0 || listTacts.SelectedIndices[0] == -1)
            {
                if (pnlTactEdit.Enabled == true)
                {
                    pnlTactEdit.Enabled = false;
                }
                return;
            }

            if (pnlTactEdit.Enabled == false)
            {
                pnlTactEdit.Enabled = true;
            }

            HomuTactListEntry entry = ((HomuTactListViewItem)listTacts.Items[listTacts.SelectedIndices[0]]).Entry;

            txtTactListID.Text                = entry.ID.ToString();
            txtTactListName.Text              = entry.Name;
            cmbTactListBehav.SelectedIndex    = (int)entry.Behavior;
            cmbTactListSkill.SelectedIndex    = (int)entry.Skill;
            cmbTactListSkillLvl.SelectedIndex = entry.Priority;
        }
예제 #7
0
        protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
        {
            ListViewItem item = Items[e.ItemIndex];

            if (item == null || !(item is HomuTactListViewItem))
            {
                e.DrawDefault = true;
                return;
            }

            HomuTactListEntry entry  = (item as HomuTactListViewItem).Entry;
            Color             texCol = Color.Black;

            switch (entry.Behavior)
            {
            case EHomuBehavior.Attack:
            case EHomuBehavior.Attack1st:
            case EHomuBehavior.AttackLast:
            case EHomuBehavior.AttackWeak:
                texCol = Color.Maroon;
                break;

            case EHomuBehavior.React:
            case EHomuBehavior.React1st:
            case EHomuBehavior.ReactLast:
                texCol = Color.Violet;
                break;

            case EHomuBehavior.Avoid:
                texCol = Color.Gray;
                break;

            case EHomuBehavior.Coward:
                texCol = Color.Blue;
                break;
            }

            SolidBrush drawBrush = new SolidBrush(texCol);
            Point      drawPoint = new Point(e.Bounds.X, e.Bounds.Y);

            e.DrawBackground();
            if (SelectedIndices.Contains(e.ItemIndex) == true)
            {
                e.Graphics.FillRectangle(Brushes.LightBlue, e.Bounds);
            }

            if (e.ColumnIndex == 0)
            {
                e.Graphics.DrawString(entry.ID.ToString(), new Font(Font, FontStyle.Bold), drawBrush, drawPoint);
            }
            else if (e.ColumnIndex == 1)
            {
                e.Graphics.DrawString(entry.Name, Font, drawBrush, drawPoint);
            }
            else if (e.ColumnIndex == 2)
            {
                e.Graphics.DrawString(entry.Behavior.ToString(), Font, drawBrush, drawPoint);
            }
            else if (e.ColumnIndex == 3 && entry.Behavior != EHomuBehavior.Avoid)
            {
                e.Graphics.DrawString(entry.Skill.ToString(), Font, drawBrush, drawPoint);
            }
            else if (e.ColumnIndex == 4 && entry.Behavior != EHomuBehavior.Avoid && entry.Skill != EHomuSkillUsage.NoSkill)
            {
                e.Graphics.DrawString(entry.Priority.ToString(), Font, drawBrush, drawPoint);
            }
        }
예제 #8
0
 public HomuTactListViewItem(HomuTactListEntry Entry)
     : base(new string[] { Entry.ID.ToString(), Entry.Name, Entry.Behavior.ToString(), Entry.Skill.ToString(), Entry.Priority.ToString() })
 {
     mEntry = Entry;
 }