Example #1
0
        public void UpdateWaypointList()
        {
            scrollView.ClearContent();
            float yPos = spacing;

            for (int i = 0; i < Waypoints.points.Count; i++)
            {
                UILabel label = new UILabel(Waypoints.points[i].name);
                label.Scale        = .5f;
                label.X            = spacing;
                label.Y            = yPos;
                label.Tag          = i;
                label.onLeftClick += label_onLeftClick;
                yPos += label.Height;
                scrollView.AddChild(label);

                UIImage image = new UIImage(closeTexture);
                image.ForegroundColor = Color.Red;
                image.Anchor          = AnchorPosition.Right;
                image.Position        = new Vector2(scrollView.Width - 10 - spacing, label.Position.Y + label.Height / 2);
                image.Tag             = i;
                image.onLeftClick    += image_onLeftClick;

                scrollView.AddChild(image);
            }
            scrollView.ContentHeight = scrollView.GetLastChild().Y + scrollView.GetLastChild().Height + spacing;
        }
Example #2
0
        private void PopulateCategoryView()
        {
            Category[] categories = Categories;
            if (SelectedCategory != null)
            {
                categories = SelectedCategory.SubCategories.ToArray();
                if (categories.Length == 0)
                {
                    return;
                }
            }

            _categoryView.ClearContent();
            float yPos = 0;

            for (int i = 0; i < categories.Length; i++)
            {
                UIButton button = new UIButton(categories[i].LocalizedName);
                button.Tag      = categories[i];
                button.AutoSize = false;
                button.Width    = 100;
                int x = i % numberCategoryColumns;
                int y = i / numberCategoryColumns;
                button.X            = Spacing + x * (button.Width + Spacing);
                button.Y            = Spacing + y * (button.Height + Spacing);
                button.onLeftClick += button_onLeftClick;
                yPos = button.Y + button.Height + Spacing;
                _categoryView.AddChild(button);
            }
            _categoryView.ContentHeight = yPos;
        }
Example #3
0
        private void PopulatePrefixDropDown()
        {
            prefixList.ClearContent();
            float yPos = Spacing;

            foreach (Item item in validPrefixes)
            {
                UILabel label = new UILabel(Lang.prefix[item.prefix].Value);
                if (item.prefix == 0)
                {
                    label.Text = "No Prefix";
                }
                label.Scale        = .4f;
                label.X            = Spacing;
                label.Y            = yPos;
                label.Tag          = item;
                label.onLeftClick += label_onLeftClick;
                label.onHover     += label_onHover;
                yPos += label.Height;
                if (rarityColors.ContainsKey(item.rare))
                {
                    label.ForegroundColor = rarityColors[item.rare];
                }
                if (item.rare > 11)
                {
                    label.ForegroundColor = rarityColors[11];
                }
                prefixList.AddChild(label);
            }
            prefixList.ContentHeight = yPos + Spacing;
        }
Example #4
0
 public void ClearContentSroll(int count)
 {
     m_sroll.ClearContent();
     m_sroll.Col = 3;
     //m_sroll.horizontal = false;
     m_sroll.InitializeItem = UpdateScoll;
     for (int i = 0; i < count; ++i)
     {
         m_sroll.AddItem();
     }
     m_sroll.Initialize();
 }
Example #5
0
 public void RefreshGroupPermissions()
 {
     checkboxContainer.ClearContent();
     for (int i = 0; i < HEROsModNetwork.Group.PermissionList.Count; i++)
     {
         UICheckbox cb = new UICheckbox(HEROsModNetwork.Group.PermissionList[i].Description);
         cb.Selected = HEROsModNetwork.Network.Groups[dropdown.SelectedItem].HasPermission(HEROsModNetwork.Group.PermissionList[i].Key);
         checkboxContainer.AddChild(cb);
         int index = i;
         cb.X = spacing + index % 2 * (Width / 2);
         cb.Y = index / 2 * (cb.Height) + spacing;
     }
     if (checkboxContainer.ChildCount > 0)
     {
         checkboxContainer.ContentHeight = checkboxContainer.GetLastChild().Y + checkboxContainer.GetLastChild().Height + spacing;
     }
 }
Example #6
0
        internal void BuildList()
        {
            scrollView.ClearContent();
            float yPos = Spacing;

            for (int i = 0; i < searchResults.Count; i++)
            {
                UILabel label = new UILabel(searchResults[i].Name);
                label.Tag           = i;
                label.Scale         = .35f;
                label.X             = Spacing;
                label.Y             = yPos;
                yPos               += label.Height;
                label.onLeftClick  += label_onLeftClick;
                label.onMouseEnter += label_onMouseEnter;
                label.onMouseLeave += label_onMouseLeave;
                scrollView.AddChild(label);
            }
            scrollView.ContentHeight = yPos + Spacing;
        }
Example #7
0
        public void PopulateRegionsList()
        {
            scrollView.ClearContent();

            bCreateRegion.Visible  = true;
            bDeleteRegion.Visible  = false;
            bAddGroup.Visible      = false;
            bAddPlayer.Visible     = false;
            bBack.Visible          = false;
            colorSlider.Visible    = false;
            bSaveColor.Visible     = false;
            bProtectChests.Visible = false;

            SelectedRegion = null;

            float yPos = Spacing;

            for (int i = 0; i < HEROsModNetwork.Network.Regions.Count; i++)
            {
                HEROsModNetwork.Region region = HEROsModNetwork.Network.Regions[i];
                UIButton bEdit = new UIButton(Language.GetTextValue("LegacyInterface.48"));                 // "Edit"
                UIRect   bg    = new UIRect();
                bg.X      = LargeSpacing;
                bg.Y      = yPos;
                bg.Height = bEdit.Height + SmallSpacing * 2;
                bg.Width  = scrollView.Width - 20 - LargeSpacing * 2;

                yPos += bg.Height;

                bg.ForegroundColor = i % 2 == 0 ? Color.Transparent : Color.Blue * .1f;

                UILabel label = new UILabel(region.Name);
                label.X     = Spacing;
                label.Y     = Spacing;
                label.Scale = .5f;

                bEdit.X            = bg.Width - bEdit.Width - Spacing;
                bEdit.Y            = SmallSpacing;
                bEdit.Tag          = i;
                bEdit.onLeftClick += bEdit_onLeftClick;

                UIRect regionColor = new UIRect();
                regionColor.ForegroundColor = region.Color;
                regionColor.Height          = bg.Height - Spacing * 2;
                regionColor.Width           = regionColor.Height;
                regionColor.Y = Spacing;

                UILabel lX      = new UILabel("X: " + region.X);
                UILabel lY      = new UILabel("Y: " + region.Y);
                UILabel lWidth  = new UILabel("Width: " + region.Width);
                UILabel lHeight = new UILabel("Height: " + region.Height);

                lX.Scale      = .35f;
                lY.Scale      = lX.Scale;
                lWidth.Scale  = lX.Scale;
                lHeight.Scale = lX.Scale;

                lWidth.X  = bEdit.X - 100;
                lHeight.X = lWidth.X;
                lHeight.Y = bg.Height - lHeight.Height;

                lX.X = lWidth.X - 75;
                lY.X = lX.X;
                lX.Y = lWidth.Y;
                lY.Y = lHeight.Y;

                regionColor.X = lX.X - regionColor.Width - Spacing;

                bg.AddChild(label);
                bg.AddChild(bEdit);
                bg.AddChild(lX);
                bg.AddChild(lY);
                bg.AddChild(lWidth);
                bg.AddChild(lHeight);
                bg.AddChild(regionColor);

                scrollView.AddChild(bg);
            }
            scrollView.ContentHeight = yPos + Spacing;
        }
Example #8
0
        public void UpdateList()
        {
            scrollView.ClearContent();
            float yPos = spacing;

            for (int i = 0; i < Main.player.Length; i++)
            {
                Player player = Main.player[i];
                if (player.active)
                {
                    UIPlayerHead playerHead = new UIPlayerHead(player);
                    playerHead.X = 8;
                    playerHead.Y = yPos;
                    yPos        += playerHead.Height;
                    UILabel label = new UILabel(player.name);
                    label.Scale        = .5f;
                    label.Anchor       = AnchorPosition.Left;
                    label.X            = playerHead.X + playerHead.Width + 8;
                    label.Y            = playerHead.Y + playerHead.Width / 2 + 8;
                    label.onLeftClick += label_onLeftClick;
                    label.Tag          = i;

                    scrollView.AddChild(playerHead);
                    scrollView.AddChild(label);
                }
            }
            // TODO changes to offline users might not prop to all admin?
            if (HEROsModNetwork.LoginService.MyGroup.IsAdmin)
            {
                UILabel lOfflinePlayers = new UILabel("Offline Users");
                lOfflinePlayers.Scale           = .6f;
                lOfflinePlayers.X               = Spacing;
                lOfflinePlayers.Y               = yPos + Spacing;
                lOfflinePlayers.ForegroundColor = Microsoft.Xna.Framework.Color.Yellow;
                yPos = lOfflinePlayers.Y + lOfflinePlayers.Height;
                scrollView.AddChild(lOfflinePlayers);
                for (int i = 0; i < HEROsModNetwork.Network.RegisteredUsers.Count; i++)
                {
                    HEROsModNetwork.UserWithID user = HEROsModNetwork.Network.RegisteredUsers[i];
                    //ErrorLogger.Log("? " + user.ID);
                    //foreach (var item in HEROsModNetwork.Network.Players)
                    //{
                    //	ErrorLogger.Log("U" + item.ID);
                    //}
                    if (HEROsModNetwork.Network.Players.Any(x => x.ID == user.ID))
                    {
                        //	ErrorLogger.Log("Continue on " + user.ID);
                        continue;
                    }
                    UILabel lUser = new UILabel(user.Username);
                    lUser.Scale           = .5f;
                    lUser.X               = 40 + Spacing * 2;
                    lUser.Y               = yPos;
                    lUser.ForegroundColor = new Microsoft.Xna.Framework.Color(200, 200, 200);
                    yPos += lUser.Height;
                    lUser.onLeftClick += lUser_onLeftClick;
                    lUser.Tag          = user.ID;
                    scrollView.AddChild(lUser);
                }
            }


            scrollView.ContentHeight = yPos + spacing;
        }