コード例 #1
0
 private void dataGridView_Items_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
 {
     if (Scrolling == false && e.ColumnIndex >= 0 && e.ColumnIndex < 2 && e.RowIndex > -1)
     {
         String text = "";
         try
         {
             int Id = Convert.ToInt32(this.dataGridView_Items.Rows[e.RowIndex].Cells[0].Value);
             if (Id > 0 && MainWindow.lEnableShowInfo == true)
             {
                 if (TaskEditor.LoadedElements == true)
                 {
                     text += Extensions.ColorClean(Extensions.GetItemProps(Id, 0));
                 }
                 text += Extensions.ColorClean(Extensions.ItemDesc(Id));
             }
             this.dataGridView_Items.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = text;
         }
         catch
         {
             this.dataGridView_Items.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText = text;
         }
     }
 }
コード例 #2
0
        private void dataGridView_Items_SelectionChanged(object sender, EventArgs e)
        {
            uint proctypes;
            int  l             = 3;
            int  selectedindex = this.comboBox_ItemsLists.SelectedIndex;

            l = Convert.ToInt32(ElementsEditor.database.task_items_list[selectedindex * 2]);
            int k = this.dataGridView_Items.CurrentCell.RowIndex - 1;

            if (k >= 0)
            {
                if (l != TaskEditor.eLC.ConversationListIndex && Loced == false)
                {
                    string line = "";
                    int    pos  = -1;
                    for (int i = 0; i < TaskEditor.eLC.Lists[l].elementFields.Length; i++)
                    {
                        if (TaskEditor.eLC.Lists[l].elementFields[i] == "proc_type")
                        {
                            pos = i;
                            break;
                        }
                    }
                    if (TaskEditor.eLC.Lists[l].elementFields[0] == "ID")
                    {
                        bool        result = uint.TryParse(TaskEditor.eLC.GetValue(l, k, pos), out proctypes);
                        List <uint> powers = new List <uint>(GetPowers(proctypes));
                        for (int p = 0; p < powers.Count; p++)
                        {
                            if (powers[p] == 0)
                            {
                                continue;
                            }

                            switch (p)
                            {
                            case 6:
                                line += Extensions.GetLocalization(3006) + "\n\n";    //proc_type_64
                                break;

                            case 15:
                                line += Extensions.GetLocalization(3015);    //proc_type_32768
                                break;
                            }
                        }
                        for (int p = 0; p < powers.Count; p++)
                        {
                            if (powers[p] == 0)
                            {
                                continue;
                            }

                            switch (p)
                            {
                            case 13:
                                line += Extensions.GetLocalization(3013);    //proc_type_8192
                                break;
                            }
                        }
                        if (l == 124)
                        {
                            for (int i = 0; i < TaskEditor.eLC.Lists[l].elementFields.Length; i++)
                            {
                                if (TaskEditor.eLC.Lists[l].elementFields[i] == "id_skill")
                                {
                                    line += Extensions.SkillDesc(Convert.ToInt32(TaskEditor.eLC.GetValue(l, k, i))) + "\n\n";
                                    break;
                                }
                            }
                        }
                        for (int p = 0; p < powers.Count; p++)
                        {
                            if (powers[p] == 0)
                            {
                                continue;
                            }

                            switch (p)
                            {
                            case 0:
                                line += Extensions.GetLocalization(3000);    //proc_type_1
                                break;

                            case 1:
                                line += Extensions.GetLocalization(3001);    //proc_type_2
                                break;

                            case 2:
                                line += Extensions.GetLocalization(3002);    //proc_type_4
                                break;

                            case 3:
                                line += Extensions.GetLocalization(3003);    //proc_type_8
                                break;

                            case 4:
                                line += Extensions.GetLocalization(3004);    //proc_type_16
                                break;

                            case 5:
                                line += Extensions.GetLocalization(3005);    //proc_type_32
                                break;

                            case 7:
                                line += Extensions.GetLocalization(3007);    //proc_type_128
                                break;

                            case 8:
                                line += Extensions.GetLocalization(3008);    //proc_type_256
                                break;

                            case 9:
                                line += Extensions.GetLocalization(3009);    //proc_type_512
                                break;

                            case 10:
                                line += Extensions.GetLocalization(3010);    //proc_type_1024
                                break;

                            case 11:
                                line += Extensions.GetLocalization(3011);    //proc_type_2048
                                break;

                            case 12:
                                line += Extensions.GetLocalization(3012);    //proc_type_4096
                                break;

                            case 14:
                                line += Extensions.GetLocalization(3014);    //proc_type_16384
                                break;
                            }
                        }
                        line += Extensions.ItemDesc(Convert.ToInt32(this.dataGridView_Items.Rows[k + 1].Cells[0].Value));
                        string[] blocks = line.Split(new char[] { '^' });
                        if (blocks.Length > 1)
                        {
                            int le1 = 0;
                            this.richTextBox_Desc.Text = "";
                            le1 = (line.IndexOf('^', 0));
                            this.richTextBox_Desc.AppendText(string.Format(line.Substring(0, le1)));
                            this.richTextBox_Desc.Select(0, le1);
                            this.richTextBox_Desc.SelectionColor = Color.White;

                            /*string result = "";
                             *
                             * if (blocks[0] != "")
                             * {
                             *  result += blocks[0];
                             * }*/

                            int   le    = 0;
                            int   st    = 0;
                            Color color = Color.White;
                            for (int i = 1; i < blocks.Length; i++)
                            {
                                if (blocks[i] != "")
                                {
                                    st = this.richTextBox_Desc.Text.Length;
                                    try
                                    {
                                        color = Color.FromArgb(int.Parse(blocks[i].Substring(0, 6), NumberStyles.HexNumber));
                                        this.richTextBox_Desc.AppendText(string.Format(blocks[i].Substring(6)));
                                    }
                                    catch
                                    {
                                        this.richTextBox_Desc.AppendText(string.Format("^" + blocks[i]));
                                    }
                                    le = this.richTextBox_Desc.Text.Length - st;
                                    this.richTextBox_Desc.Select(st, le);
                                    this.richTextBox_Desc.SelectionColor = color;
                                }
                            }
                        }
                        else
                        {
                            this.richTextBox_Desc.Text = line;
                            this.richTextBox_Desc.Select(0, this.richTextBox_Desc.Text.Length);
                            this.richTextBox_Desc.SelectionColor = Color.White;
                        }
                    }
                }
            }
            else
            {
                this.richTextBox_Desc.Text = "";
            }
            int scroll = this.dataGridView_Props.FirstDisplayedScrollingRowIndex;

            this.dataGridView_Props.Rows.Clear();
            if (k >= 0 && Loced == false)
            {
                for (int f = 0; f < TaskEditor.eLC.Lists[l].elementValues[k].Count; f++)
                {
                    this.dataGridView_Props.Rows.Add(new string[] { TaskEditor.eLC.Lists[l].elementFields[f], TaskEditor.eLC.GetValue(l, k, f) });
                }
            }
            if (scroll > -1 && k > -1)
            {
                this.dataGridView_Props.FirstDisplayedScrollingRowIndex = scroll;
            }
        }