コード例 #1
0
ファイル: BuildElement.cs プロジェクト: qkwlqk/EloBuddy
        public BuildElement(BuildCreator bc, Menu menu, LoLItem item, int index, ShopActionType action)
        {
            this.action = action;
            this.bc = bc;
            this.item = item;
            p = index;

            upBox = new CheckBox("up", false);
            removeBox = new CheckBox("remove", false);
            itemName = new Label(" ");
            costSlots = new Label(" ");

            PropertyInfo property2 = typeof (CheckBox).GetProperty("Size");

            property2.GetSetMethod(true).Invoke(itemName, new object[] {new Vector2(400, 0)});
            property2.GetSetMethod(true).Invoke(costSlots, new object[] {new Vector2(400, 0)});
            property2.GetSetMethod(true).Invoke(upBox, new object[] {new Vector2(40, 20)});
            property2.GetSetMethod(true).Invoke(removeBox, new object[] {new Vector2(80, 20)});


            menu.Add(position + "nam" + RandGen.r.Next(), itemName);
            menu.Add(position + "cs" + RandGen.r.Next(), costSlots);
            menu.Add(position + "up" + RandGen.r.Next(), upBox);
            menu.Add(position + "rem" + RandGen.r.Next(), removeBox);
            updateText();

            upBox.CurrentValue = false;
            removeBox.CurrentValue = false;
            upBox.OnValueChange += upBox_OnValueChange;
            removeBox.OnValueChange += removeBox_OnValueChange;
            property = typeof (CheckBox).GetProperty("Position");
        }
コード例 #2
0
ファイル: BuildElement.cs プロジェクト: iJamesPHP/EloBuddy
        public BuildElement(BuildCreator bc, Menu menu, IItem item, int index, ShopActionType action)
        {
            this.action = action;
            this.bc     = bc;
            this.item   = item;
            p           = index;

            upBox     = new CheckBox("up", false);
            removeBox = new CheckBox("remove", false);
            itemName  = new Label(" ");
            costSlots = new Label(" ");

            var property2 = typeof(CheckBox).GetProperty("Size");

            property2.GetSetMethod(true).Invoke(itemName, new object[] { new Vector2(400, 0) });
            property2.GetSetMethod(true).Invoke(costSlots, new object[] { new Vector2(400, 0) });
            property2.GetSetMethod(true).Invoke(upBox, new object[] { new Vector2(40, 20) });
            property2.GetSetMethod(true).Invoke(removeBox, new object[] { new Vector2(80, 20) });


            menu.Add(position + "nam" + RandGen.r.Next(), itemName);
            menu.Add(position + "cs" + RandGen.r.Next(), costSlots);
            menu.Add(position + "up" + RandGen.r.Next(), upBox);
            menu.Add(position + "rem" + RandGen.r.Next(), removeBox);
            updateText();

            upBox.CurrentValue       = false;
            removeBox.CurrentValue   = false;
            upBox.OnValueChange     += upBox_OnValueChange;
            removeBox.OnValueChange += removeBox_OnValueChange;
            property = typeof(CheckBox).GetProperty("Position");
        }
コード例 #3
0
        public BuildElement(BuildCreator bc, Menu menu, LoLItem item, int index, ShopActionType action)
        {
            this.Action = action;
            this._bc    = bc;
            this.Item   = item;
            P           = index;

            _upBox     = new CheckBox("up", false);
            _removeBox = new CheckBox("remove", false);
            _itemName  = new Label(" ");
            _costSlots = new Label(" ");

            PropertyInfo property2 = typeof(CheckBox).GetProperty("Size");

            property2.GetSetMethod(true).Invoke(_itemName, new object[] { new Vector2(400, 0) });
            property2.GetSetMethod(true).Invoke(_costSlots, new object[] { new Vector2(400, 0) });
            property2.GetSetMethod(true).Invoke(_upBox, new object[] { new Vector2(40, 20) });
            property2.GetSetMethod(true).Invoke(_removeBox, new object[] { new Vector2(80, 20) });


            menu.Add(Position + "nam" + RandGen.R.Next(), _itemName);
            menu.Add(Position + "cs" + RandGen.R.Next(), _costSlots);
            menu.Add(Position + "up" + RandGen.R.Next(), _upBox);
            menu.Add(Position + "rem" + RandGen.R.Next(), _removeBox);
            UpdateText();

            _upBox.CurrentValue       = false;
            _removeBox.CurrentValue   = false;
            _upBox.OnValueChange     += upBox_OnValueChange;
            _removeBox.OnValueChange += removeBox_OnValueChange;
            _property = typeof(CheckBox).GetProperty("Position");
        }
コード例 #4
0
        private void AddElement(LoLItem it, ShopActionType ty)
        {
            if (ty != ShopActionType.Buy || ty != ShopActionType.Sell)
            {
                int hp = myBuild.Count(e => e.action == ShopActionType.StartHpPot) -
                         myBuild.Count(e => e.action == ShopActionType.StopHpPot);
                if (ty == ShopActionType.StartHpPot && hp != 0)
                {
                    return;
                }
                if (ty == ShopActionType.StopHpPot && hp == 0)
                {
                    return;
                }
            }

            BuildElement b = new BuildElement(this, menu, it, myBuild.Any() ? myBuild.Max(a => a.position) + 1 : 1, ty);

            List <LoLItem> c = new List <LoLItem>();

            BrutalItemInfo.InventorySimulator(myBuild, c);
            b.cost = BrutalItemInfo.InventorySimulator(new List <BuildElement> {
                b
            }, c);
            b.freeSlots = 7 - c.Count;
            b.updateText();
            if (b.freeSlots == -1)
            {
                Chat.Print("Couldn't add " + it + ", inventory is full.");
                b.Remove(menu);
            }
            else
            {
                myBuild.Add(b);
            }
        }
コード例 #5
0
        private void AddElement(IItem it, ShopActionType ty)
        {
            if (ty != ShopActionType.Buy || ty != ShopActionType.Sell)
            {
                var hp = myBuild.Count(e => e.action == ShopActionType.StartHpPot) -
                         myBuild.Count(e => e.action == ShopActionType.StopHpPot);
                if (ty == ShopActionType.StartHpPot && hp != 0)
                {
                    return;
                }
                if (ty == ShopActionType.StopHpPot && hp == 0)
                {
                    return;
                }
            }

            var b = new BuildElement(this, menu, it, myBuild.Any() ? myBuild.Max(a => a.position) + 1 : 1, ty);

            var c = new List <IItem>();

            BrutalItemInfo.InventorySimulator(myBuild, c);
            b.cost = BrutalItemInfo.InventorySimulator(new List <BuildElement> {
                b
            }, c);
            b.freeSlots = 7 - c.Count;
            b.updateText();
            if (b.freeSlots == -1)
            {
                Chat.Print("Eklenemedi " + it + ", envanter dolu.");
                b.Remove(menu);
            }
            else
            {
                myBuild.Add(b);
            }
        }
コード例 #6
0
ファイル: BuildCreator.cs プロジェクト: qkwlqk/EloBuddy
        private void AddElement(LoLItem it, ShopActionType ty)
        {
            if (ty != ShopActionType.Buy || ty != ShopActionType.Sell)
            {
                int hp = myBuild.Count(e => e.action == ShopActionType.StartHpPot) -
                         myBuild.Count(e => e.action == ShopActionType.StopHpPot);
                if (ty == ShopActionType.StartHpPot && hp != 0) return;
                if (ty == ShopActionType.StopHpPot && hp == 0) return;
            }

            BuildElement b = new BuildElement(this, menu, it, myBuild.Any() ? myBuild.Max(a => a.position) + 1 : 1, ty);

            List<LoLItem> c = new List<LoLItem>();
            BrutalItemInfo.InventorySimulator(myBuild, c);
            b.cost = BrutalItemInfo.InventorySimulator(new List<BuildElement> { b }, c);
            b.freeSlots = 7 - c.Count;
            b.updateText();
            if (b.freeSlots == -1)
            {
                Chat.Print("Couldn't add " + it + ", inventory is full.");
                b.Remove(menu);
            }
            else
                myBuild.Add(b);
        }