예제 #1
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
        private void createCharButton_Click(object sender, EventArgs e)
        {
            SimpleCharacter chara = new SimpleCharacter(charNameBox.Text, (int)charInitBox.Value, (int)bodyAtrInput.Value, (int)agilityAtrInput.Value, (int)reactionAtrInput.Value,
                                                        (int)strengthAtrInput.Value, (int)charismaAtrInput.Value, (int)intuitionAtrInput.Value, (int)logicAtrInput.Value, (int)willpowerAtrInput.Value);

            addCharacterToCharacterList(chara);
            PersistentListHandler.WriteListFile(charList);
        }
예제 #2
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
 private void addToTrackerButton_Click(object sender, EventArgs e)
 {
     if (charListBox.SelectedItem != null)
     {
         SimpleCharacter chara = (SimpleCharacter)charListBox.SelectedItem;
         addToTracker(chara);
     }
 }
예제 #3
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
        public void addCharacterToCharacterList(SimpleCharacter chara)
        {
            charListBox.DataSource = null;
            charList.Add(chara);

            charListBox.DataSource    = charList;
            charListBox.ValueMember   = "Name";
            charListBox.DisplayMember = "name";
        }
예제 #4
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
        private void addToTracker(SimpleCharacter chara)
        {
            initTrackerArr[trackedCount] = chara;
            initTrackerList.Add(chara);
            trackedCount++;
            String[]     arr = { chara.Name, chara.CurrentInit.ToString() };
            ListViewItem lvi = new ListViewItem(arr);

            initTracker.Items.Add(lvi);
        }
예제 #5
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
 private void addToTrackerWithRollsButton_Click(object sender, EventArgs e)
 {
     if (charListBox.SelectedItem != null)
     {
         SimpleCharacter chara     = (SimpleCharacter)charListBox.SelectedItem;
         Random          rand      = new Random();
         int             totalInit = chara.Init;
         for (int i = 0; i < chara.InitDice; i++)
         {
             totalInit = totalInit + rand.Next(1, 7);
         }
         chara.CurrentInit = totalInit;
         addToTracker(chara);
     }
 }
예제 #6
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
        private void ImportCharacterButton_Click(object sender, EventArgs e)
        {
            DialogResult res = openFileDialog1.ShowDialog();

            if (res == DialogResult.OK) // Test result.
            {
                string           file = openFileDialog1.FileName;
                ChummerCharacter cc   = ChummerCharacter.Load(file);
                cc.ParseAttributes();
                string name = cc.alias;
                //string arm = cc.primaryarm;
                SimpleCharacter cha = new SimpleCharacter(cc.alias, 1, cc.BOD, cc.AGI, cc.REA, cc.STR, cc.CHA, cc.INT, cc.LOG, cc.WIL);
                addCharacterToCharacterList(cha);
            }
            PersistentListHandler.WriteListFile(charList);
        }
예제 #7
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
 private void editCharButton_Click(object sender, EventArgs e)
 {
     if (charListBox.SelectedItem != null)
     {
         SimpleCharacter chara = new SimpleCharacter(charNameBox.Text, (int)charInitBox.Value, (int)bodyAtrInput.Value, (int)agilityAtrInput.Value, (int)reactionAtrInput.Value,
                                                     (int)strengthAtrInput.Value, (int)charismaAtrInput.Value, (int)intuitionAtrInput.Value, (int)logicAtrInput.Value, (int)willpowerAtrInput.Value);
         charList[charListBox.SelectedIndex] = chara;
         charListBox.DataSource = null;
         //charList.RemoveAt(charListBox.SelectedIndex-1);
         //charList.Insert(charListBox.SelectedIndex, chara);
         charListBox.DataSource    = charList;
         charListBox.ValueMember   = "Name";
         charListBox.DisplayMember = "name";
     }
     PersistentListHandler.WriteListFile(charList);
 }
예제 #8
0
        public static List <SimpleCharacter> getPersistentList(DMTool toolInstance)
        {
            List <SimpleCharacter> clist = new List <SimpleCharacter>();
            String localPath             = AppDomain.CurrentDomain.BaseDirectory;

            if (Directory.Exists(localPath))
            {
                if (File.Exists(localPath + "/PersistentList.txt") == false)
                {
                    FileStream fs = null;
                    try
                    {
                        fs = File.Create(localPath + "/PersistentList.txt");
                    }
                    catch (Exception e)
                    {
                        System.Windows.Forms.MessageBox.Show("Unable to create PersistentList.txt, check user permissions at: " + localPath);
                        Environment.Exit(0);
                    }
                    fs.Close();
                }
                StreamReader sr = null;

                try
                {
                    sr = new StreamReader(localPath + "/PersistentList.txt");
                }
                catch (Exception f)
                {
                    System.Windows.Forms.MessageBox.Show("Unable to open PersistentList.txt (file opened by another program?) at: " + localPath);
                    Environment.Exit(0);
                }

                String lineContents = "";
                lineContents = sr.ReadLine();
                while (sr.Peek() >= 0)
                {
                    string[]        line  = lineContents.Split(' ');
                    SimpleCharacter chara = new SimpleCharacter(line[0], Convert.ToInt32(line[1]), Convert.ToInt32(line[2]), Convert.ToInt32(line[3]), Convert.ToInt32(line[4]), Convert.ToInt32(line[5]), Convert.ToInt32(line[6]), Convert.ToInt32(line[7]), Convert.ToInt32(line[8]), Convert.ToInt32(line[9]));
                    toolInstance.addCharacterToCharacterList(chara);
                    lineContents = sr.ReadLine();
                }
                sr.Close();
            }
            return(clist);
        }
예제 #9
0
파일: DMTCore.cs 프로젝트: Zaelix/DMToolkit
 private void charListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (charListBox.SelectedItem != null)
     {
         editCharButton.Enabled = true;
         delCharButton.Enabled  = true;
         SimpleCharacter chara = (SimpleCharacter)charListBox.SelectedItem;
         charNameBox.Text        = chara.Name;
         charInitBox.Value       = chara.Init;
         bodyAtrInput.Value      = chara.Body;
         agilityAtrInput.Value   = chara.Agility;
         reactionAtrInput.Value  = chara.Reaction;
         strengthAtrInput.Value  = chara.Strength;
         charismaAtrInput.Value  = chara.Charisma;
         intuitionAtrInput.Value = chara.Intuition;
         logicAtrInput.Value     = chara.Logic;
         willpowerAtrInput.Value = chara.Willpower;
     }
     else
     {
         editCharButton.Enabled = false;
         delCharButton.Enabled  = false;
     }
 }