예제 #1
0
        private static WeaponResConfigItem GetWeapon(FreeData fd, int type)
        {
            int c = fd.freeInventory.GetInventoryManager().GetInventory("w" + type).posList.Count;

            if (c > 0)
            {
                ItemInventory w  = fd.freeInventory.GetInventoryManager().GetInventory("w" + type);
                ItemPosition  ip = w.posList[0];
                int           id = (int)((IntPara)ip.GetParameters().Get("itemId")).GetValue();

                return(SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(id));
            }

            return(null);
        }
예제 #2
0
        private void redrawPart(ItemInventory inventory, ISkillArgs args, ItemPosition ip, FreeData fd)
        {
            if (inventory.name == "w1" || inventory.name == "w2" || inventory.name == "w3")
            {
                int id = (int)((IntPara)ip.GetParameters().Get("itemId")).GetValue();

                WeaponResConfigItem config = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(id);
                if (config != null)
                {
                    HashSet <int> list = new HashSet <int>();

                    foreach (XmlConfig.EWeaponPartType part in SingletonManager.Get <WeaponPartsConfigManager>().GetAvaliablePartTypes(id))
                    {
                        list.Add(FreeWeaponUtil.GetWeaponPart(part));
                    }

                    List <string> showP = new List <string>();
                    List <string> hideP = new List <string>();

                    for (int i = 1; i <= 5; i++)
                    {
                        if (list.Contains(i))
                        {
                            showP.Add(i.ToString());
                        }
                        else
                        {
                            hideP.Add(i.ToString());
                        }
                    }

                    ShowPartAction show = new ShowPartAction();
                    show.show = true;
                    show.SetPlayer("current");
                    show.SetScope(1);
                    if (inventory.name == "w1")
                    {
                        show.weaponKey = "1";
                    }
                    else if (inventory.name == "w2")
                    {
                        show.weaponKey = "2";
                    }
                    else
                    {
                        show.weaponKey = "3";
                    }

                    show.parts = StringUtil.GetStringFromStrings(showP, ",");
                    show.Act(args);

                    show.show  = false;
                    show.parts = StringUtil.GetStringFromStrings(hideP, ",");
                    show.Act(args);
                }
                else
                {
                    Debug.LogError(ip.key.GetName() + " 没有定义配件.");
                }
            }
        }
예제 #3
0
        public virtual void Draw(SimpleInventoryUI ui, IEventArgs args, ItemInventory inventory, ItemPosition ip)
        {
            this.inventory = inventory;
            if (fui == null)
            {
                fui = new FreeUICreateAction();
                Sharpen.Collections.AddAll(fui.GetComponents(), components);
            }
            ip.GetParameters().AddPara(new StringPara("inventory", inventory.GetName()));
            StringPara img      = new StringPara("img", string.Empty);
            StringPara itemName = new StringPara("name", string.Empty);
            IntPara    count    = new IntPara("count", 0);

            args.GetDefault().GetParameters().TempUse(img);
            args.GetDefault().GetParameters().TempUse(count);
            args.GetDefault().GetParameters().TempUse(itemName);

            img.SetValue(ip.GetKey().GetImg());
            count.SetValue(ip.GetCount());
            itemName.SetValue(ip.GetKey().GetName());
            FreeImageComponet back = GetBackground();

            if (ui.nomouse)
            {
                back.SetNoMouse("true");
            }
            if (ui.itemFixed)
            {
                back.SetFixed("true");
            }
            int startX = GetX(args, ui, ip, back);
            int startY = GetY(args, ui, ip, back);

            if (!StringUtil.IsNullOrEmpty(notused) && !StringUtil.IsNullOrEmpty(used))
            {
                if (ip.IsUsed())
                {
                    back.SetUrl(used);
                }
                else
                {
                    back.SetUrl(notused);
                }
            }
            back.SetX(startX.ToString());
            back.SetY(startY.ToString());
            back.SetRelative(ui.relative);
            back.SetEvent(inventory.GetName() + "," + ip.GetX() + "," + ip.GetY());
            FreeImageComponet itemImg         = back;
            FreeImageComponet secondComponent = GetItemImage();

            if (secondComponent != null)
            {
                back.SetEvent(string.Empty);
                itemImg = secondComponent;
            }
            if (ui.nomouse)
            {
                itemImg.SetNoMouse("true");
            }
            if (ui.itemFixed)
            {
                itemImg.SetFixed("true");
            }
            itemImg.SetUrl(ip.GetKey().GetImg());
            itemImg.SetOriginalSize(ip.GetKey().GetItemWidth() + "," + ip.GetKey().GetItemHeight());
            if (itemImg == back)
            {
                AdjustSize(args, ui, ip, inventory, back, itemImg, startX, startY);
            }
            else
            {
                AdjustSize(args, ui, ip, inventory, back, itemImg, 0, 0);
            }
            SetCount(ip);
            fui.SetKey(ip.GetUIKey());
            fui.SetShow(inventory.IsOpen());
            fui.SetScope(1);
            fui.SetPlayer("current");
            fui.Act(args);
            UpdateHotKey(ui, args, ip);
            args.GetDefault().GetParameters().Resume("img");
            args.GetDefault().GetParameters().Resume("name");
            args.GetDefault().GetParameters().Resume("count");
        }
예제 #4
0
        private void redrawPart(ItemInventory inventory, ISkillArgs args, ItemPosition ip, FreeData fd)
        {
            if (inventory.name == ChickenConstant.BagPrimeWeapon || inventory.name == ChickenConstant.BagSecondaryWeapon || inventory.name == ChickenConstant.BagPistolWeapon)
            {
                int id = (int)((IntPara)ip.GetParameters().Get("itemId")).GetValue();

                WeaponAllConfigs configs = SingletonManager.Get <WeaponConfigManagement>().FindConfigById(id);
                if (configs != null)
                {
                    HashSet <int> list = new HashSet <int>();

                    foreach (XmlConfig.EWeaponPartType part in configs.ApplyPartsSlot)
                    {
                        list.Add(FreeWeaponUtil.GetWeaponPart(part));
                    }

                    List <string> showP = new List <string>();
                    List <string> hideP = new List <string>();

                    for (int i = 1; i <= 5; i++)
                    {
                        if (list.Contains(i))
                        {
                            showP.Add(i.ToString());
                        }
                        else
                        {
                            hideP.Add(i.ToString());
                        }
                    }

                    ShowPartAction show = new ShowPartAction();
                    show.show = true;
                    show.SetPlayer("current");
                    show.SetScope(1);
                    if (inventory.name == ChickenConstant.BagPrimeWeapon)
                    {
                        show.weaponKey = "1";
                    }
                    else if (inventory.name == ChickenConstant.BagSecondaryWeapon)
                    {
                        show.weaponKey = "2";
                    }
                    else
                    {
                        show.weaponKey = "3";
                    }

                    show.parts = StringUtil.GetStringFromStrings(showP, ",");
                    show.Act(args);

                    show.show  = false;
                    show.parts = StringUtil.GetStringFromStrings(hideP, ",");
                    show.Act(args);
                }
                else
                {
                    Debug.LogError(ip.key.GetName() + " 没有定义配件.");
                }
            }
        }