public static void ComboBox(string id, List <string> valores, float x, float y, float width, float height, byte r, byte g, byte b, float op) { DesenharShape(x, y, width, height, r, g, b, op); CmbBox it = V.comboBoxes.Find(item => item.id == id); if (it == null) { V.comboBoxes.Add(new CmbBox(id, valores)); } else { Escrever(it.valor, false, x + 2, y - 5, 24, 000, 000, 000, 255); if (MouseIn(x, y, width, height) && V.mouseButton == "Left" && !TeclaDesativada("mouseLeft")) { it.open = !it.open; DesativarTecla("mouseLeft", 500); } byte color = 255; if (it.open) { int n = it.valores.Count(); for (int m = 0; m < n; m++) { if (MouseIn(x, y + (25 * (m + 1)), width, height)) { DesenharShape(x, y + (25 * (m + 1)), width, height, 120, 120, 120, op); if (V.mouseButton == "Left") { it.valorIndex = m; it.valor = it.valores[m]; it.open = false; } } else { DesenharShape(x, y + (25 * (m + 1)), width, height, color, color, color, op, 000, 000, 000, 255, 1); } Escrever(it.valores[m], false, x + 2, y - 5 + (25 * (m + 1)), 24, 000, 000, 000, 255); if (color == 255) { color = 220; } else { color = 255; } } } } DesenharShape(x + width - 25, y, 25, height - 1, r, g, b, op); DesenharTriangulo(x + width - 2, y + height - 3, 10, 000, 000, 000, 255); }
/// <summary> /// 显示DataView /// </summary> private void ShowDataView() { //CmbBox.Text = this.Text.Substring(0, this.Text.Length - 1); //this.Text = ""; dropDown.Refresh(); SetDataGridView(); dropDown.Show(this, CalculatePoz()); CmbBox.Text = CmbBox.Text.Trim(); CmbBox.Focus(); CmbBox.SelectionStart = CmbBox.Text.Length; }
public static void Limpar(string[] textBoxes, string[] comboBoxes) { for (int m = 0; m < textBoxes.Count(); m++) { TxtBox it = V.txtBoxes.Find(item => item.id == textBoxes[m]); if (it != null) { it.txt = ""; } } for (int m = 0; m < comboBoxes.Count(); m++) { CmbBox it = V.comboBoxes.Find(item => item.id == comboBoxes[m]); if (it != null) { it.valor = it.valores[0]; it.valorIndex = 0; } } }
public static void EditarMateriaF() { List <string> itens = new List <string>(); List <string> recursos = new List <string>(); if (menuCreatorPos < 250) { menuCreatorPos += 25; } if (F.Key("esc")) { editarMateria1 = false; F.Limpar(new string[] { "objeto_nome", "objeto_dialog" }, new string[] { "objeto_acao", "objeto_itemDar", "objeto_itemReceber", "objeto_recursosReceber" }); } //COLISAO //F.DesenharShape(colisaoX, colisaoY, colisaoW, colisaoH, 255, 000, 255, 120, 255, 000, 255, 255, 1); //F.DesenharShape(colisaoX-3, colisaoY-3, 6, 6, 255, 000, 255, 255); //F.DesenharShape(colisaoX+colisaoW-3, colisaoY-3, 6, 6, 255, 000, 255, 255); //F.DesenharShape(colisaoX-3, colisaoY+colisaoH-3, 6, 6, 255, 000, 255, 255); //F.DesenharShape(colisaoX+colisaoW-3, colisaoY+colisaoH-3, 6, 6, 255, 000, 255, 255); //if(F.MouseIn(colisaoX+colisaoW-3, colisaoY-3, 6, 6) && V.mouseButton == "Left"){ //colisaoW += V.mouseX-oldMouseX; //colisaoY += V.mouseY-oldMouseY; //colisaoH -= V.mouseY-oldMouseY; //} F.DesenharShape(Screen.width - menuCreatorPos, 0, 250, Screen.height, 19, 19, 19, 230); F.Escrever("Nome:", false, Screen.width - menuCreatorPos + 10, 0, 24, 255, 255, 255, 255); F.TextBox("objeto_nome", "", "", Screen.width - menuCreatorPos + 20 + F.TxtWidth("Nome:", 24, false), 5, 240 - (F.TxtWidth("Nome:", 24, false) + 20), 25, 255, 255, 255, 255); F.Escrever("Diálogo:", false, Screen.width - menuCreatorPos + 10, 30, 24, 255, 255, 255, 255); F.TextArea("objeto_dialog", "", Screen.width - menuCreatorPos + 10, 65, 230, 100, 255, 255, 255, 255); for (int m = 0; m < V.itens.Count(); m++) { itens.Add(V.itens[m].nome); } for (int m = 0; m < V.recursos.Count(); m++) { recursos.Add(V.recursos[m].nome); } CmbBox cmbBox = V.comboBoxes.Find(item => item.id == "objeto_acao"); if (cmbBox != null && cmbBox.valor == "Trocar item por recursos") { F.Escrever("Quantidade:", false, Screen.width - menuCreatorPos + 10, 365, 24, 255, 255, 255, 255); F.TextBox("objeto_recursosQuantidade", "Numeros", "", Screen.width - menuCreatorPos + 20 + F.TxtWidth("Quantidade:", 24, false), 370, 240 - (F.TxtWidth("Quantidade:", 24, false) + 20), 25, 255, 255, 255, 255); } if (cmbBox != null && cmbBox.valor != "Somente falar" && cmbBox.valor != "Dar Item") { F.Escrever("Receber:", false, Screen.width - menuCreatorPos + 10, 300, 24, 255, 255, 255, 255); } if (cmbBox != null && cmbBox.valor == "Trocar item por item") { F.ComboBox("objeto_itemReceber", itens, Screen.width - menuCreatorPos + 10, 335, 230, 25, 255, 255, 255, 255); } if (cmbBox != null && cmbBox.valor == "Trocar item por recursos") { F.ComboBox("objeto_recursosReceber", recursos, Screen.width - menuCreatorPos + 10, 335, 230, 25, 255, 255, 255, 255); } if (cmbBox != null && cmbBox.valor != "Somente falar") { F.Escrever("Dar:", false, Screen.width - menuCreatorPos + 10, 230, 24, 255, 255, 255, 255); F.ComboBox("objeto_itemDar", itens, Screen.width - menuCreatorPos + 10, 265, 230, 25, 255, 255, 255, 255); } F.ComboBox("objeto_acao", new List <string>() { "Somente falar", "Dar Item", "Trocar item por item", "Trocar item por recursos" }, Screen.width - menuCreatorPos + 10, 185, 230, 25, 255, 255, 255, 255); if (F.Button("Salvar", 32, Screen.width - menuCreatorPos + 25, Screen.height - 75, 200, 50, 221, 66, 82, 255)) { TxtBox txtBox; txtBox = V.txtBoxes.Find(item => item.id == "objeto_nome"); editarMateria2.nome = txtBox.txt; txtBox = V.txtBoxes.Find(item => item.id == "objeto_dialog"); editarMateria2.dialog = txtBox.txt; cmbBox = V.comboBoxes.Find(item => item.id == "objeto_acao"); if (cmbBox.valor == "Dar Item") { cmbBox = V.comboBoxes.Find(item => item.id == "objeto_itemDar"); editarMateria2.itens.Add(V.itens[cmbBox.valorIndex]); editarMateria2.troca = new int[] { cmbBox.valorIndex }; } if (cmbBox.valor == "Trocar item por item") { int item1, item2; cmbBox = V.comboBoxes.Find(item => item.id == "objeto_itemDar"); editarMateria2.itens.Add(V.itens[cmbBox.valorIndex]); item1 = cmbBox.valorIndex; cmbBox = V.comboBoxes.Find(item => item.id == "objeto_itemReceber"); editarMateria2.itens.Add(V.itens[cmbBox.valorIndex]); item2 = cmbBox.valorIndex; editarMateria2.troca = new int[] { item1, item2 }; } if (cmbBox.valor == "Trocar item por recursos") { int i1, i2; cmbBox = V.comboBoxes.Find(item => item.id == "objeto_itemDar"); editarMateria2.itens.Add(V.itens[cmbBox.valorIndex]); i1 = cmbBox.valorIndex; cmbBox = V.comboBoxes.Find(item => item.id == "objeto_recursosReceber"); editarMateria2.itens.Add(V.itens[cmbBox.valorIndex]); i2 = cmbBox.valorIndex; txtBox = V.txtBoxes.Find(item => item.id == "objeto_recursosQuantidade"); editarMateria2.itens.Add(V.itens[int.Parse(txtBox.txt)]); editarMateria2.troca = new int[] { i1, i2, int.Parse(txtBox.txt) }; } editarMateria1 = false; F.Limpar(new string[] { "objeto_nome", "objeto_dialog" }, new string[] { "objeto_acao", "objeto_itemDar", "objeto_itemReceber", "objeto_recursosReceber" }); } }