示例#1
0
        public Tab GetTabData(string tabName = "trade_tab")
        {
            Logger.Console.Debug($"Tab Scan of {tabName}.");

            Tab returnTab = new Tab();

            if (!ActivateTab(tabName))
            {
                return(returnTab);
            }

            foreach (Position stashData in StashPositions.GetStashPositions(ResolutionEnum))
            {
                if (stashData == null)
                {
                    continue;
                }
                ItemInfoParser itemParser = GetItemInfo(stashData);
                if (itemParser.Item.Name == "Not For Sell")
                {
                    continue;
                }
                itemParser.AddPlace(stashData.ClickTargetX, stashData.ClickTargetY);
                returnTab.AddItem(itemParser.Item);
            }

            Logger.Console.Debug("Tab Scan completed.");
            return(returnTab);
        }
示例#2
0
        private void CreateUI()
        {
            Label label = AddControl <Label>();
            {
                label.Content.Text = "Settings";
                label.Style        = new VisualStyle(EditorStyle.BoldLabel);
            }

            Tab tab = AddControl <Tab>();
            {
                tab.Content.Text = string.Empty;

                IDesignerControl general  = tab.AddItem("General");
                IDesignerControl security = tab.AddItem("Security");

                // Create the controls on the tabs
                CreateGeneralTab(general);
                CreateSecurityTab(security);
            }
        }
示例#3
0
        public void TabAddItem()
        {
            tlog.Debug(tag, $"TabAddItem START");

            var testingTarget = new Tab();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <Tab>(testingTarget, "Should return Tab instance.");

            try
            {
                TabItemData item1 = new TabItemData();
                testingTarget.AddItem(item1);
                TabItemData item2 = new TabItemData();
                testingTarget.InsertItem(item2, 1);

                testingTarget.SelectedItemIndex = 1;

                try
                {
                    testingTarget.DeleteItem(0);
                }
                catch (Exception e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    Assert.Fail("Caught Exception : Failed!");
                }
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"TabAddItem END (OK)");
        }
示例#4
0
        public void Activate()
        {
            Window window = Window.Instance;

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };
            window.Add(root);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            createText[0]            = new TextLabel();
            createText[0].Text       = "Create Tab just by properties";
            createText[0].Size2D     = new Size2D(450, 100);
            createText[0].Position2D = new Position2D(200, 100);
            createText[0].MultiLine  = true;
            root.Add(createText[0]);

            tab                 = new Tab();
            tab.Size2D          = new Size2D(700, 108);
            tab.Position2D      = new Position2D(100, 300);
            tab.BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            //tab.IsNatureTextWidth = true;
            //tab.ItemGap = 40;
            //tab.LeftSpace = 56;
            //tab.RightSpace = 56;
            //tab.TopSpace = 1;
            //tab.BottomSpace = 0;
            tab.Style.UnderLine.Size            = new Size(1, 3);
            tab.Style.UnderLine.BackgroundColor = color[0];
            tab.Style.Text.PointSize            = 25;
            tab.Style.Text.TextColor            = new Selector <Color>
            {
                Normal   = Color.Black,
                Selected = color[0],
            };
            tab.ItemChangedEvent += TabItemChangedEvent;
            root.Add(tab);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                if (i == 1)
                {
                    item.Text = "Long Tab " + i;
                }
                tab.AddItem(item);
            }
            tab.SelectedItemIndex = 0;

            ///////////////////////////////////////////////Create by Attributes//////////////////////////////////////////////////////////
            createText[1]            = new TextLabel();
            createText[1].Text       = "Create Tab just by Attributes";
            createText[1].Size2D     = new Size2D(450, 100);
            createText[1].Position2D = new Position2D(1000, 100);
            createText[1].MultiLine  = true;
            root.Add(createText[1]);

            TabStyle attrs = new TabStyle
            {
                //IsNatureTextWidth = false,
                ItemPadding = new Extents(56, 56, 1, 0),
                UnderLine   = new ViewStyle
                {
                    Size = new Size(1, 3),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundColor        = new Selector <Color> {
                        All = color[0]
                    },
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color>
                    {
                        Normal   = Color.Black,
                        Selected = color[0],
                    },
                },
            };

            tab2                   = new Tab(attrs);
            tab2.Size2D            = new Size2D(500, 108);
            tab2.Position2D        = new Position2D(900, 300);
            tab2.BackgroundColor   = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab2.ItemChangedEvent += Tab2ItemChangedEvent;
            root.Add(tab2);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                tab2.AddItem(item);
            }
            tab2.SelectedItemIndex = 0;

            button = new Button();
            button.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button.Size2D          = new Size2D(280, 80);
            button.Position2D      = new Position2D(400, 700);
            button.Style.Text.Text = mode[index];
            button.ClickEvent     += ButtonClickEvent;
            root.Add(button);

            button2 = new Button();
            button2.Style.BackgroundImage       = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png";
            button2.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
            button2.Size2D          = new Size2D(580, 80);
            button2.Position2D      = new Position2D(250, 500);
            button2.Style.Text.Text = "LayoutDirection is left to right";
            button2.ClickEvent     += ButtonClickEvent2;
            root.Add(button2);
        }
示例#5
0
        public void ScanTab(string name_tab = "trade_tab")
        {
            Position found_pos = null;

            _LoggerService.Log($"Search {name_tab} trade tab...");

            for (int count_try = 0; count_try < 16; count_try++)
            {
                var screen_shot = ScreenCapture.CaptureRectangle(10, 90, 450, 30);

                found_pos = OpenCV_Service.FindObject(screen_shot, $"Assets/{Properties.Settings.Default.UI_Fragments}/notactive_" + name_tab + ".jpg");

                if (found_pos != null && found_pos.IsVisible)
                {
                    break;
                }
                else
                {
                    found_pos = OpenCV_Service.FindObject(screen_shot, $"Assets/{Properties.Settings.Default.UI_Fragments}/active_" + name_tab + ".jpg");
                    if (found_pos != null && found_pos.IsVisible)
                    {
                        screen_shot.Dispose();

                        break;
                    }
                }
                screen_shot.Dispose();

                Thread.Sleep(500);
            }

            if (found_pos != null && found_pos.IsVisible)
            {
                Win32.MoveTo(10 + found_pos.Left + found_pos.Width / 2, 90 + found_pos.Top + found_pos.Height / 2);

                Thread.Sleep(200);

                Win32.DoMouseClick();

                Thread.Sleep(250);

                List <Cell> skip          = new List <Cell>();
                Point       _StashTabSize = Utils.ZeroStash();
                int         tabSize       = Utils.WidthHeightTab();
                for (int i = 0; i < 12; i++)
                {
                    for (int j = 0; j < 12; j++)
                    {
                        if (skip.Find(cel => cel.Left == i && cel.Top == j) != null)
                        {
                            continue;
                        }

                        Win32.MoveTo(0, 0);

                        Thread.Sleep(100);

                        Win32.MoveTo(_StashTabSize.Y + tabSize * i, _StashTabSize.Y + tabSize * j);

                        #region OpenCv

                        var screen_shot = ScreenCapture.CaptureRectangle(_StashTabSize.Y - 30 + tabSize * i, _StashTabSize.X - 30 + tabSize * j, 60, 60);

                        Position pos = OpenCV_Service.FindObject(screen_shot, $"Assets/{Properties.Settings.Default.UI_Fragments}/empty_cel.png", 0.5);

                        if (!pos.IsVisible)
                        {
                            #region Good code

                            string item_info = CommandsService.CtrlC_PoE();

                            if (item_info != "empty_string")
                            {
                                var item = new Item
                                {
                                    Price     = _itemmService.GetPrice_PoE(item_info),
                                    Name      = CommandsService.GetNameItem_PoE_Pro(item_info),
                                    StackSize = CommandsService.GetStackSize_PoE_Pro(item_info)
                                };

                                item.Places.Add(new Cell(i, j));

                                if (item.StackSize == 1)
                                {
                                    item.SizeInStack = 1;
                                }
                                else
                                {
                                    item.SizeInStack = (int)CommandsService.GetSizeInStack(item_info);
                                }

                                if (item.Name.Contains("Resonator"))
                                {
                                    if (item.Name.Contains("Potent"))
                                    {
                                        item.Places.Add(new Cell(i, j + 1));
                                        skip.Add(new Cell(i, j + 1));
                                    }

                                    if (item.Name.Contains("Prime") || item.Name.Contains("Powerful"))
                                    {
                                        item.Places.Add(new Cell(i, j + 1));
                                        skip.Add(new Cell(i, j + 1));
                                        item.Places.Add(new Cell(i + 1, j + 1));
                                        skip.Add(new Cell(i + 1, j + 1));
                                        item.Places.Add(new Cell(i + 1, j));
                                        skip.Add(new Cell(i + 1, j));
                                    }
                                }

                                _Tabs.AddItem(item);

                                #endregion
                            }

                            screen_shot.Dispose();

                            #endregion
                        }
                    }
                }

                Win32.SendKeyInPoE("{ESC}");

                _LoggerService.Log("Scan is end!");
            }
            else
            {
                throw new Exception($"{name_tab} not found.");
            }
        }
示例#6
0
        private void CreateTabView()
        {
            // Init parent of TabView
            parentView[1]        = new View();
            parentView[1].Size   = new Size(1920, 200);
            parentView[1].Layout = new LinearLayout()
            {
                LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.Center, CellPadding = new Size2D(100, 0)
            };
            root.Add(parentView[1]);

            ///////////////////////////////////////////////Create by Property//////////////////////////////////////////////////////////
            tab                           = new Tab();
            tab.Size                      = new Size(700, 108);
            tab.BackgroundColor           = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab.Underline.Size            = new Size(1, 3);
            tab.Underline.BackgroundColor = color[0];
            tab.PointSize                 = 25;
            tab.TextColorSelector         = new ColorSelector
            {
                Normal   = Color.Black,
                Selected = color[0],
            };
            tab.ItemChangedEvent += TabItemChangedEvent;
            parentView[1].Add(tab);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                if (i == 1)
                {
                    item.Text = "Long Tab " + i;
                }
                tab.AddItem(item);
            }
            tab.SelectedItemIndex = 0;

            ///////////////////////////////////////////////Create by Style//////////////////////////////////////////////////////////
            TabStyle st = new TabStyle
            {
                //IsNatureTextWidth = false,
                ItemPadding = new Extents(56, 56, 1, 0),
                UnderLine   = new ViewStyle
                {
                    Size = new Size(1, 3),
                    PositionUsesPivotPoint = true,
                    ParentOrigin           = Tizen.NUI.ParentOrigin.BottomLeft,
                    PivotPoint             = Tizen.NUI.PivotPoint.BottomLeft,
                    BackgroundColor        = new Selector <Color> {
                        All = color[0]
                    },
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = 25
                    },
                    TextColor = new Selector <Color>
                    {
                        Normal   = Color.Black,
                        Selected = color[0],
                    },
                },
            };

            tab2                   = new Tab(st);
            tab2.Size              = new Size(500, 108);
            tab2.BackgroundColor   = new Color(1.0f, 1.0f, 1.0f, 0.5f);
            tab2.ItemChangedEvent += Tab2ItemChangedEvent;
            parentView[1].Add(tab2);

            for (int i = 0; i < 3; i++)
            {
                Tab.TabItemData item = new Tab.TabItemData();
                item.Text = "Tab " + i;
                tab2.AddItem(item);
            }
            tab2.SelectedItemIndex = 0;
        }