Пример #1
0
    public PropertyChar AddItem(SerializablePropertys propertys, string slug)
    {
        var v_slug = propertys.PropertyBySlug(slug);

        if (v_slug == null)
        {
            InputFieldHelper.Instance.ShowNoti(string.Format("Item {0} not found (check propertys list)", slug));
            return(null);
        }
        ShouldUpdateGUIContent = true;
        countNewItem++;
        if (v_slug.StackInBag)
        {
            for (int i = 0; i < PropertysChar.Count; i++)
            {
                var p = PropertysChar[i];
                if (p.Slug == slug)
                {
                    p.Count = p.Count + 1;
                    return(p);
                }
            }
        }
        var p_new = PropertyChar.CreateFromSlug(v_slug, slug);

        PropertysChar.Add(p_new);
        return(p_new);
    }
Пример #2
0
    //----------Outfits---------//
    public void ShowOutfits(GComponent lastPopup, CharGame charGame, SerializablePropertys propertys)
    {
        ItemChar itemChar = charGame.DataChar;

        var pm_choise = new QuickControlList();

        for (int i = 0; i < itemChar.ItemByType.Length; i++)
        {
            ItemChar.Items items = itemChar.ItemByType[i];
            if (items.ItemList != null && items.ItemList.Length > 0)
            {
                Item.EItemType eItemType = (Item.EItemType)i;
                pm_choise.AddBt(Item.StrEItemType[i], (EventContext context) =>
                {
                    this._showOutfits2(charGame, pm_choise.contentPane, eItemType, items, propertys);
                });
            }
        }
        pm_choise.AddBt("Cancel", (EventContext context) =>
        {
            pm_choise.Dispose();
        });
        pm_choise.SetParent(InputFieldHelper.Instance.PopUp);
        lastPopup.visible = false;
        pm_choise.SetOnDispose(() =>
        {
            lastPopup.visible = true;
        });
    }
Пример #3
0
    public void PickSlugItem(string hash, SerializablePropertys data, string slugCurrent, float x, float y, float w, ref float yGui, ref bool isWaitUI, PickItem onPick)
    {
        int idProperty = data.IndexOf(slugCurrent);
        var comboBox   = PropertysGUI.Instance.ComboBoxSlug(data);

        if (slugCurrent == null || slugCurrent == "")
        {
            comboBox.Empty = "NULL";
        }
        else
        {
            comboBox.Empty = slugCurrent + " (Not found)";
        }
        comboBox.SelectedItemIndex = idProperty;
        comboBox.Rect.x            = x;
        comboBox.Rect.y            = y;
        comboBox.Rect.width        = w;
        comboBox.Rect.height       = 32f;
        float limitHeight = 32f * 20;

        comboBox.Show(limitHeight, hash, (int idNext) => {
            onPick(data.AllKey[idNext]);
        });
        if (comboBox.IsDropDownWithHash(hash))
        {
            yGui    += limitHeight;
            isWaitUI = true;
            return;
        }
    }
Пример #4
0
    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);
    }
Пример #5
0
 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));
         }
     }
 }
Пример #6
0
    public void OnGUI(SerializablePackages packages, SerializablePropertys propertys, List <FlagAction> listFlagAction, TilesetAON tilesetAON, Rect rect)
    {
        float height_top = 68;

        AONGUI.Box(new Rect(rect.x, rect.y, rect.width, height_top), "", tilesetAON.ListStyleBlack2);
        if (OnTopMenu(packages, tilesetAON, new Rect(rect.x, rect.y, rect.width, rect.height)))
        {
            return;
        }
        if (OnGuiBot(packages, propertys, listFlagAction, tilesetAON, new Rect(rect.x, height_top, rect.width, rect.height)))
        {
            return;
        }
    }
Пример #7
0
    private void _showOutfits3(CharGame charGame, ItemChar.Items items, SerializablePropertys propertys)
    {
        var l = items.ItemList;

        for (int i = 0; i < l.Length; i++)
        {
            Item         item        = l[i];
            PropertyChar propertyOwn = GetOutfit(item);
            var          bt          = controlPropertys.AddItem(item.Slug, () =>
            {
                _showOutfits4(charGame, items, item, propertyOwn);
            });
            _setCellOutfits(i, propertyOwn);
        }
    }
Пример #8
0
    //----------Pets---------//

    public void ShowPets(GComponent lastPopup, SerializablePropertys propertys)
    {
        _controlPropertys_Init();
        lastPopup.visible = false;
        controlPropertys._btClose.onClick.Clear();
        controlPropertys._btClose.onClick.Add(() =>
        {
            // controlPropertys.Hide();
            _controlPropertys_Dispose();
            lastPopup.visible = true;
        });
        controlPropertys.SetTitle("Pets");
        controlPropertys.ListItem.selectedIndex = -1;
        _refreshPets(propertys, true);
        controlPropertys.ShowOn(InputFieldHelper.Instance.PopUp);
    }
Пример #9
0
    private bool OnTopMenu(SerializablePropertys data, TilesetAON tilesetAON, Rect rect)
    {
        float widthLeft = 200;
        //menu
        float yGui = rect.y;

        AONGUI.Label(new Rect(rect.x + 4, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Property edit :");
        yGui += 32f;
        float xGui = rect.x + 4;

        AONGUI.Label(new Rect(xGui, yGui + DefineAON.GUI_Y_Label, 90, DefineAON.GUI_Height_Label), "Slug property");
        xGui += 94;
        AONGUI.TextField(new Rect(xGui, yGui + DefineAON.GUI_Y_TextField, 200, DefineAON.GUI_Height_TextField), slugNameAdd, (string text) => {
            slugNameAdd = text;
        });

        xGui += 204;
        if (slugNameAdd.Length == 0)
        {
            // GUI.Label(new Rect( rect.x, yGui + DefineAON.GUI_Y_Label, 200, DefineAON.GUI_Height_Label ), "Input slug property");
        }
        else
        {
            bool isUnique = true;
            var  keys     = data.AllKey;
            for (int i = 0; i < keys.Count; i++)
            {
                if (keys[i] == slugNameAdd)
                {
                    isUnique = false;
                    break;
                }
            }
            if (isUnique)
            {
                AONGUI.Button(new Rect(xGui, yGui + DefineAON.GUI_Y_Button, 80, DefineAON.GUI_Height_Button), "Add (Enter)", KeyCode.Return, () => {
                    data.Add(slugNameAdd);
                    slugNameAdd = "";
                });
            }
            else
            {
                AONGUI.Label(new Rect(xGui, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Slug should be unique");
            }
        }
        return(false);
    }
Пример #10
0
    private void _importAllFromResource(SerializablePropertys property)
    {
        // Pet
        var petlist = PetsDatabase.Instance.PetList;

        foreach (var pets in petlist)
        {
            var topic = pets.topic;
            var d     = pets.data;
            foreach (var s in d)
            {
                string key = "pet/" + s;
                var    p   = property.PropertyBySlug(key);
                if (p == null)
                {
                    p = property.Add(key);
                }
                p._Type = SerializablePropertys.EType.Pet;
                p.Name  = UtilsAON.NameFormat(s);
                if (string.IsNullOrEmpty(p.Des))
                {
                    p.Des = UtilsAON.DesFormat(s);
                }
                p.RefSlug = topic + "/" + s;
            }
        }
        // Outfit
        // string[] str = AutoTileMap_Editor.Instance.ItemCharData.StrItemList;
        Item[] item = AutoTileMap_Editor.Instance.ItemCharData.ItemList;
        foreach (var i in item)
        {
            string s   = i.SlugGlobal;
            string key = "outfit/" + s;
            var    p   = property.PropertyBySlug(key);
            if (p == null)
            {
                p = property.Add(key);
            }
            p._Type = SerializablePropertys.EType.Outfit;
            p.Name  = UtilsAON.NameFormat(i.Slug);
            if (string.IsNullOrEmpty(p.Des))
            {
                p.Des = UtilsAON.DesFormat(i.Slug);
            }
            p.RefSlug = s;
        }
    }
Пример #11
0
    public void OnGUI(SerializablePropertys data, List <FlagAction> listFlagAction, TilesetAON tilesetAON, Rect rect)
    {
        float height_top = 68;

        AONGUI.Box(new Rect(rect.x, rect.y, rect.width, height_top), "", tilesetAON.ListStyleBlack2);
        AONGUI.Button(new Rect(rect.x + rect.width - 170, rect.y + DefineAON.GUI_Y_Button, 160, DefineAON.GUI_Height_Button), "Import full from Resource", () => {
            _importAllFromResource(data);
        });
        if (OnTopMenu(data, tilesetAON, new Rect(rect.x, rect.y, rect.width, rect.height)))
        {
            return;
        }
        if (OnGuiBot(data, listFlagAction, tilesetAON, new Rect(rect.x, height_top, rect.width, rect.height)))
        {
            return;
        }
    }
Пример #12
0
    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);
    }
Пример #13
0
    private void _showPet(SerializablePropertys propertys, SerializablePropertys.Property propertyData, PropertyChar propertyOwn)
    {
        controlPropertys.ResetSelectItem();

        controlPropertys.SetItemName(propertyData.Name);

        controlPropertys.SetItemDes(propertyData.Des);

        if (string.IsNullOrEmpty(propertyData.RefSlug))
        {
            InputFieldHelper.Instance.ShowNoti("Item model is null");
            return;
        }
        controlPropertys.LoadModelItem("pets/" + propertyData.RefSlug);

        if (propertyOwn != null)
        {
            bool isEquip = propertyOwn.IsActive;
            if (!isEquip)
            {
                controlPropertys.AddAction("Equip", () =>
                {
                    // basicMecanimControl.Pet = propertyData.RefSlug;
                    EquipPet(propertyOwn);
                    _refreshPets(propertys, false);
                });
            }
            else
            {
                controlPropertys.SetItemDes("Item is equipped");
                controlPropertys.AddAction("Unequip", () =>
                {
                    // basicMecanimControl.Pet = "";
                    UnquipCurrentPet();
                    _refreshPets(propertys, false);
                });
            }
        }
    }
Пример #14
0
    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);
    }
Пример #15
0
    public void ShowWithData(SerializablePropertys dataRaw, SerializablePackages.Package package, CallBackClose onCloseShop, CallBackBuy onBuy)
    {
        // ShowWithDataOnGUi(dataRaw, package, onCloseShop);
        // Repair data
        // mOnCloseShop = onCloseShop;
        mOnBuy              = onBuy;
        m_dataRaw           = dataRaw;
        m_package           = package;
        m_indextItemSeleted = 0;
        var propertys = m_package.data;

        string[] m_s_Left  = new string[propertys.Count];
        string[] m_s_Right = new string[propertys.Count];
        for (int i = 0; i < propertys.Count; i++)
        {
            var slug = propertys[i].property;
            if (string.IsNullOrEmpty(slug))
            {
                m_s_Left[i] = "Item is empty";
            }
            else
            {
                var propertyData = m_dataRaw.PropertyBySlug(slug);
                m_s_Left[i] = NameOf(propertyData, slug);
            }
            var payBy = m_package.data[i].payBy;
            if (payBy == null)
            {
                m_s_Right[i] = "NULL";
            }
            else
            {
                m_s_Right[i] = payBy.coin.ToString() + " " + DefineAON.CoinName;
            }
        }
        // UI
        _controlShop_Dispose();
        if (_controlShop == null)
        {
            _controlShop = new ControlShop();
            _controlShop._btClose.onClick.Add(() =>
            {
                // _controlShop.Hide();
                _controlShop_Dispose();
                UnTryCostume(null);
                if (onCloseShop != null)
                {
                    var callback = onCloseShop;
                    onCloseShop  = null;
                    callback();
                }
            });
        }
        else
        {
            _controlShop.ResetListItem();
        }
        _controlShop.SetTitle(m_package.Name);
        for (int i = 0; i < m_s_Left.Length; i++)
        {
            int ii = i;
            var bt = _controlShop.AddItem(m_s_Left[i], m_s_Right[i], () =>
            {
                SetSelectItem(ii);
            });
        }
        m_indextItemSeleted = -1;
        RefreshDataSelect();
        _controlShop.ShowOn(InputFieldHelper.Instance.PopUp);
    }
Пример #16
0
 public ComboBox ComboBoxSlug(SerializablePropertys data)
 {
     comboBoxSlug.UpdateListContent(data == null ? null : data.AllKey);
     return(comboBoxSlug);
 }
Пример #17
0
    private bool OnGuiBot(SerializablePackages packages, SerializablePropertys propertys, List <FlagAction> listFlagAction, TilesetAON tilesetAON, Rect rect)
    {
        if (packages == null)
        {
            return(false);
        }
        float yGui      = rect.y + 4;
        float widthLeft = 250;

        AONGUI.Label(new Rect(rect.x + 4, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Edit package:");
        yGui += 32f;
        {
            comboBoxSlug.UpdateListContent(packages.AllKey);
            comboBoxSlug.Empty             = "Not selected";
            comboBoxSlug.SelectedItemIndex = slugIndex;
            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) => {
                slugIndex = next;
            });
        }
        // if(comboBoxSlug.IsDropDownListVisible){
        //  return true;
        // }
        yGui   = rect.y + 4;
        rect.x = rect.x + widthLeft + 4;
        if (slugIndex < 0 || slugIndex >= packages.Count)
        {
            return(true);
        }

        AONGUI.Button(new Rect(rect.x, yGui + DefineAON.GUI_Y_Button, 120, DefineAON.GUI_Height_Button), "Remove by slug", () => {
            packages.Remove(slugIndex);
            slugIndex = -1;
        });

        SerializablePackages.Package package = packages.PackageByIndex(slugIndex);
        AONGUI.Button(new Rect(rect.x + 130, yGui + DefineAON.GUI_Y_Button, 120, DefineAON.GUI_Height_Button), "Duplicate by slug", () => {
            var n = packages.Copy(slugIndex);
            if (n >= 0)
            {
                slugIndex = n;
            }
        });

        AONGUI.Button(new Rect(rect.x + 260, yGui + DefineAON.GUI_Y_Button, 100, DefineAON.GUI_Height_Label), "Add all Pets", () => {
            _addAllPets(package, propertys);
        });
        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), package.Name, (string text) => {
            package.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), package.Des, (string text) => {
            package.Des = text;
        });
        yGui += 32f;
        if (propertys == null || propertys.Count <= 0)
        {
            AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Propertys is empty");
            return(false);
        }
        AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Propertys list:");
        yGui += 32f;
        {
            comboBoxItem.UpdateListContent(package.data.Keys);
            comboBoxItem.Empty             = "Not selected";
            comboBoxItem.SelectedItemIndex = itemIndex;
            comboBoxItem.Rect.x            = rect.x;
            comboBoxItem.Rect.y            = yGui;
            comboBoxItem.Rect.width        = widthLeft;
            comboBoxItem.Rect.height       = 32f;
            comboBoxItem.Show(rect.height - yGui, "defause", true, true, ( int next) => {
                itemIndex = next;
            });
        }
        AONGUI.Button(new Rect(rect.x + widthLeft + 10, yGui + DefineAON.GUI_Y_Button, 30, DefineAON.GUI_Height_Label), " + ", () => {
            if (itemIndex >= 0 && itemIndex < propertys.Count)
            {
                package.AddProperty(propertys.SlugByIndex(itemIndex));
            }
            else
            {
                package.AddProperty(propertys.SlugByIndex(0));
            }
        });
        if (itemIndex < 0)
        {
            return(false);
        }
        AONGUI.Button(new Rect(rect.x + widthLeft + 50, yGui + DefineAON.GUI_Y_Button, 30, DefineAON.GUI_Height_Label), " - ", () => {
            package.Remove(itemIndex);
        });
        if (package.data.Count == 0)
        {
            return(false);
        }
        if (itemIndex >= package.data.Count)
        {
            itemIndex = package.data.Count - 1;
            return(false);
        }
        rect.x = rect.x + widthLeft + 10;
        yGui  += 32f;
        string slugProperty = package.data[itemIndex].property;

        {
            // Pick Property
            bool isWaitUI = false;
            PropertysGUI.Instance.PickSlugItem(slugIndex.ToString(), propertys, slugProperty, rect.x, yGui, widthLeft, ref yGui, ref isWaitUI, (string slugPropertyPick) => {
                package.data[itemIndex].property = slugPropertyPick;
                package.data.ResetKeys();
            });
            yGui += 32f;
        }
        AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, widthLeft, DefineAON.GUI_Height_Label), "Pay by:");
        yGui += 32f;

        SerializablePackages.PayBy payBy = package.data[itemIndex].payBy;
        AONGUI.Label(new Rect(rect.x, yGui + DefineAON.GUI_Y_Label, 100, DefineAON.GUI_Height_Label), "Coin");
        AONGUI.TextField(new Rect(rect.x + 100, yGui + DefineAON.GUI_Y_Label, widthLeft - 100, DefineAON.GUI_Height_Label), payBy.coin.ToString(), (string text) => {
            payBy.coin = UtilsAON.StrToIntDef(text);
        });
        yGui += 32f;
        return(false);
    }
Пример #18
0
 private void _showOutfits2(CharGame charGame, GComponent lastPopup, Item.EItemType eItemType, ItemChar.Items items, SerializablePropertys propertys)
 {
     _controlPropertys_Init();
     lastPopup.visible = false;
     controlPropertys._btClose.onClick.Clear();
     controlPropertys._btClose.onClick.Add(() =>
     {
         _controlPropertys_Dispose();
         lastPopup.visible = true;
     });
     controlPropertys.SetTitle(Item.StrEItemType[(int)eItemType]);
     controlPropertys.ResetListItem();
     controlPropertys.ResetSelectItem();
     _showOutfits3(charGame, items, propertys);
     _refreshListOutfits(items);
     controlPropertys.ShowOn(InputFieldHelper.Instance.PopUp);
 }