Пример #1
0
        public frmShopEditor()
        {
            InitializeComponent();

            // Load item names
            for (int i = 0; i < itemNames.Length; i++)
            {
                itemNames[i] = TextItemNames.GetName(i);
            }

            // Draw the tab stuff
            for (int i = 0; i < 3; i++)
            {
                tabPage[i]         = new TabPage("Page " + (i + 1).ToString());
                tabPage[i].Padding = new System.Windows.Forms.Padding(3);
                tabPage[i].UseVisualStyleBackColor = true;
                tabPage[i].TabIndex = i;

                tabMain.TabPages.Add(tabPage[i]);

                // Draw the item stuff
                for (int j = 0; j < 10; j++)
                {
                    LinkLabel ll = new LinkLabel();

                    ll.AutoSize = true;
                    ll.Text     = "Item " + ((i * 10) + j + 1).ToString();
                    ll.Left     = 6;
                    ll.Top      = (j * 27) + 10;
                    ll.Tag      = ((i * 10) + j);

                    ll.LinkClicked += (s, e) =>
                    {
                        LinkLabel l     = s as LinkLabel;
                        int       index = (int)l.Tag;

                        ModuleArbiter.ShowSelect(typeof(frmItemEditor), cboItem[index].SelectedIndex);
                    };

                    tabPage[i].Controls.Add(ll);
                    lblItem[(i * 10) + j] = ll;

                    ComboBox c = new ComboBox();

                    Helpers.CheckFont(c);

                    for (int k = 0; k < itemNames.Length; k++)
                    {
                        c.Items.Add("[" + k.ToString("X2") + "] " + itemNames[k]);
                    }

                    c.Width         = 160;
                    c.DropDownStyle = ComboBoxStyle.DropDownList;
                    c.Left          = ll.Left + 50;
                    c.Top           = ll.Top - 3;

                    tabPage[i].Controls.Add(c);
                    cboItem[(i * 10) + j] = c;
                }
            }

            // Load the shop data
            ShopData.Init();
            string[] shopNames = Properties.Resources.shopnames.SplitN();
            loading = true;
            for (int i = 0; i < ShopData.Entries; i++)
            {
                cboShop.Items.Add("[" + i.ToString("X2") + "] " + shopNames[i]);
            }
            loading = false;
            cboShop.SelectedIndex = 0;
        }