private void _refreshPets(SerializablePropertys propertys, bool isBeginShow) { int lastSelectedIndex = controlPropertys.ListItem.selectedIndex; controlPropertys.ResetListItem(); controlPropertys.ResetSelectItem(); for (int i = 0; i < propertys.Count; i++) { var propertyData = propertys.PropertyByIndex(i); if (propertyData.IsPet) { PropertyChar propertyOwn = GetPet(propertyData); var bt = controlPropertys.AddItem(propertyData.Name, () => { _showPet(propertys, propertyData, propertyOwn); }); bool isOwn = propertyOwn != null; bool isEquip = false; if (propertyOwn != null) { isEquip = propertyOwn.IsActive; } controlPropertys.SetItemCaption(bt, isOwn, isEquip); if (isBeginShow && isEquip) { lastSelectedIndex = i; } } } controlPropertys.SetSelectedIndex(lastSelectedIndex); }
private void _addAllPets(SerializablePackages.Package package, SerializablePropertys propertys) { package.RemoveAll(); for (int i = 0; i < propertys.Count; i++) { SerializablePropertys.Property p = propertys.PropertyByIndex(i); if (p._Type == SerializablePropertys.EType.Pet) { package.AddProperty(propertys.SlugByIndex(i)); } } }
private void _refreshCertificates(SerializablePropertys propertys) { int lastSelectedIndex = controlPropertys.ListItem.selectedIndex; controlPropertys.ResetListItem(); controlPropertys.ResetSelectItem(); for (int i = 0; i < propertys.Count; i++) { var propertyData = propertys.PropertyByIndex(i); if (propertyData.IsCertificates) { PropertyChar propertyOwn = GetCertificates(propertyData); var bt = controlPropertys.AddItem(propertyData.Name, () => { _showCertificates(propertyData, propertyOwn); }); controlPropertys.SetItemOwn(bt, propertyOwn != null); } } controlPropertys.SetSelectedIndex(lastSelectedIndex); }
private bool OnGuiBot(SerializablePropertys data, List <FlagAction> listFlagAction, TilesetAON tilesetAON, Rect rect) { if (data == null) { return(false); } float yGui = rect.y + 4; float widthLeft = 200; AONGUI.Label(new Rect(rect.x + 4, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Edit property:"); yGui += 32f; { comboBoxSlug.UpdateListContent(data.AllKey); comboBoxSlug.Empty = "Not selected"; comboBoxSlug.SelectedItemIndex = slugIndext; comboBoxSlug.Rect.x = rect.x; comboBoxSlug.Rect.y = yGui; comboBoxSlug.Rect.width = widthLeft; comboBoxSlug.Rect.height = 32f; comboBoxSlug.Show(rect.height - yGui, "defause", true, false, (int next) => { slugIndext = next; }); } // if(comboBoxSlug.IsDropDownListVisible){ // return true; // } yGui = rect.y + 4; rect.x = rect.x + widthLeft + 4; if (slugIndext < 0 || slugIndext >= data.AllKey.Count) { return(true); } AONGUI.Button(new Rect(rect.x, yGui + DefineAON.GUI_Y_Button, 120, DefineAON.GUI_Height_Button), "Remove by slug", () => { data.Remove(slugIndext); }); SerializablePropertys.Property property = data.PropertyByIndex(slugIndext); AONGUI.Button(new Rect(rect.x + 130, yGui + DefineAON.GUI_Y_Button, 120, DefineAON.GUI_Height_Button), "Duplicate by slug", () => { var n = data.Copy(slugIndext); if (n >= 0) { slugIndext = n; } }); yGui += 32f; AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 40, DefineAON.GUI_Height_Label), "Name"); AONGUI.TextField(new Rect(rect.x + 40, yGui + DefineAON.GUI_Y_TextField, widthLeft - 40, DefineAON.GUI_Height_TextField), property.Name, (string text) => { property.Name = text; }); yGui += 32f; AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 40, DefineAON.GUI_Height_Label), "Des"); AONGUI.TextField(new Rect(rect.x + 40, yGui + DefineAON.GUI_Y_TextField, widthLeft - 40, DefineAON.GUI_Height_TextField), property.Des, (string text) => { property.Des = text; }); yGui += 32f; string[] strType = SerializablePropertys.StrEType; AONGUI.SelectionGrid(new Rect(rect.x, yGui, rect.width, 24f), (int)property._Type, strType, strType.Length, tilesetAON.ListStyleGrid, (int next) => { var tNext = (SerializablePropertys.EType)next; if (tNext != property._Type) { property._Type = tNext; } }); yGui += 32f; // if(property.IsItem){ // property.StackInBag = GUI.Toggle(new Rect( rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label ), property.StackInBag, "Can Stack in bag"); // yGui += 32f; // } // property.CanEquip = GUI.Toggle(new Rect( rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label ), property.CanEquip, " Can Equip"); if (property.IsOutfit) { // float xGui = rect.x + widthLeft + 4; float xGui = rect.x; AONGUI.Label(new Rect(xGui, yGui + DefineAON.GUI_Y_Label, 60, DefineAON.GUI_Height_Label), "Item :"); xGui += 60; string[] str = AutoTileMap_Editor.Instance.ItemCharData.StrItemList; var combobox = ComboBoxHelper.Instance.StringN(str); var hash = "item"; int currentItem = ComboBoxHelper.Instance.IndextOfStringN(str, property.RefSlug); if (currentItem == -1) { if (property.RefSlug != null && property.RefSlug != "") { combobox.Empty = property.RefSlug + " (not found)"; } else { combobox.Empty = "NULL"; } } combobox.SelectedItemIndex = currentItem; combobox.Rect.x = xGui; combobox.Rect.y = yGui; combobox.Rect.width = widthLeft; combobox.Rect.height = 32f; float limitHeight = 32f * 6; combobox.Show(limitHeight, hash, (int nextItem) => { property.RefSlug = str[nextItem]; }); if (combobox.IsDropDownWithHash(hash)) { yGui += limitHeight; return(false); } yGui += 32f; } // property.CanUsing = GUI.Toggle(new Rect( rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label ), property.CanUsing, " Can Using"); if (property.IsItem) { // float xGui = rect.x + widthLeft + 4; float xGui = rect.x; AONGUI.Label(new Rect(xGui, yGui + DefineAON.GUI_Y_Label, 60, DefineAON.GUI_Height_Label), "Action :"); xGui += 60; var combobox = ComboBoxHelper.Instance.FlagAction(listFlagAction); var hash = "property"; int currentFlagAction = FlagAction.IndextFlagAction(listFlagAction, property.ActionUsing); if (currentFlagAction == -1) { if (property.ActionUsing != null && property.ActionUsing != "") { combobox.Empty = property.ActionUsing + " (not found)"; } else { combobox.Empty = "NULL"; } } combobox.SelectedItemIndex = currentFlagAction; combobox.Rect.x = xGui; combobox.Rect.y = yGui; combobox.Rect.width = widthLeft; combobox.Rect.height = 32f; float limitHeight = 32f * 6; combobox.Show(limitHeight, hash, (int nextAction) => { property.ActionUsing = listFlagAction[nextAction].Name; }); if (combobox.IsDropDownWithHash(hash)) { yGui += limitHeight; return(false); } yGui += 32f; } // property.Consume = GUI.Toggle(new Rect( rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label ), property.Consume, "Consumable"); // yGui += 32f; if (property.IsPet) { AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 40, DefineAON.GUI_Height_Label), "Pet"); AONGUI.TextField(new Rect(rect.x + 40, yGui + DefineAON.GUI_Y_TextField, widthLeft - 40, DefineAON.GUI_Height_TextField), property.RefSlug, (string text) => { property.RefSlug = text; }); AONGUI.Button(new Rect(rect.x + widthLeft + 10, yGui + DefineAON.GUI_Y_TextField, 40, DefineAON.GUI_Height_TextField), "Pick", () => { InputFieldHelper.Instance.ShowPickModel((string topic, string pet) => { Debug.Log(topic + "/" + pet); property.RefSlug = topic + "/" + pet; InputFieldHelper.Instance.HidePickModel(); }); }); yGui += 32f; } if (property.IsItem || property.IsCertificates) { AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 40, DefineAON.GUI_Height_Label), "Icon"); AONGUI.TextField(new Rect(rect.x + 40, yGui + DefineAON.GUI_Y_TextField, widthLeft - 40, DefineAON.GUI_Height_TextField), property.RefIcon, (string text) => { property.RefIcon = text; }); AONGUI.Button(new Rect(rect.x + widthLeft + 10, yGui + DefineAON.GUI_Y_TextField, 40, DefineAON.GUI_Height_TextField), "Pick", () => { InputFieldHelper.Instance.ShowPickIcon((string topic, string icon) => { // Debug.Log(topic + "/" + icon); property.RefIcon = topic + "/" + icon; InputFieldHelper.Instance.HidePickIcon(); }); }); yGui += 32f; } return(false); }