Beispiel #1
0
 private void bApply_onLeftClick(object sender, EventArgs e)
 {
     HEROsModNetwork.Group group = new HEROsModNetwork.Group(dropdown.GetItem(dropdown.SelectedItem));
     group.ID = HEROsModNetwork.Network.Groups[dropdown.SelectedItem].ID;
     group.ImportPermissions(ExportPermissions());
     HEROsModNetwork.LoginService.RequestSetGroupPermissions(group);
 }
Beispiel #2
0
 void dropdown_selectedChanged(object sender, EventArgs e)
 {
     if (player == null)
     {
         HEROsModNetwork.Group playersNewGroup = HEROsModNetwork.Network.GetGroupByName(dropdown.GetItem(dropdown.SelectedItem));
         HEROsModNetwork.LoginService.RequestSetOfflinePlayerGroup(playerIndex, playersNewGroup);
     }
     else
     {
         //send new group to servera
         HEROsModNetwork.Group playersNewGroup = HEROsModNetwork.Network.GetGroupByName(dropdown.GetItem(dropdown.SelectedItem));
         HEROsModNetwork.LoginService.RequestSetPlayerGroup(playerIndex, playersNewGroup);
     }
 }
Beispiel #3
0
        public PlayerInfo(int playerIndex, bool offlineUser)
        {
            if (!offlineUser)
            {
                this.player = HEROsModNetwork.Network.Players[playerIndex];
            }
            this.playerIndex           = playerIndex;
            this.UpdateWhenOutOfBounds = true;
            Width = 350;
            UIImage     bClose      = new UIImage(closeTexture);
            UILabel     lGroup      = new UILabel("Group:");
            UIButton    bBan        = new UIButton("Ban");
            UIButton    bKick       = new UIButton("Kick");
            UILabel     label       = new UILabel();
            SnoopWindow snoopWindow = new SnoopWindow();

            snoopWindow.SetPlayer(Main.player[0]);
            dropdown = new UIDropdown();
            UIButton bTeleport = new UIButton("Teleport To");
            UIButton bRestore  = new UIButton("Restore Changes Made by this Player");

            bTeleport.AutoSize = false;
            bTeleport.Width    = 150;
            bRestore.AutoSize  = false;


            // if logged in
            if (player != null && player.Username.Length > 0)
            {
                dropdown.AddItem(HEROsModNetwork.Network.AdminGroup.Name);
                for (int i = 0; i < HEROsModNetwork.Network.Groups.Count; i++)
                {
                    dropdown.AddItem(HEROsModNetwork.Network.Groups[i].Name);
                    if (player.Group.Name == HEROsModNetwork.Network.Groups[i].Name)
                    {
                        dropdown.SelectedItem = i + 1;
                    }
                }
            }
            else if (player == null)
            {
                HEROsModNetwork.UserWithID user = HEROsModNetwork.Network.RegisteredUsers[playerIndex];
                dropdown.AddItem(HEROsModNetwork.Network.AdminGroup.Name);
                for (int i = 0; i < HEROsModNetwork.Network.Groups.Count; i++)
                {
                    dropdown.AddItem(HEROsModNetwork.Network.Groups[i].Name);

                    if (user.groupID == HEROsModNetwork.Network.Groups[i].ID)
                    {
                        dropdown.SelectedItem = i + 1;
                    }
                }
            }
            dropdown.selectedChanged += dropdown_selectedChanged;

            bClose.Y       = spacing;
            lGroup.Scale   = .5f;
            lGroup.X       = spacing;
            lGroup.Y       = spacing;
            dropdown.X     = lGroup.X + lGroup.Width + 4;
            dropdown.Y     = lGroup.Y;
            dropdown.Width = 200;
            dropdown.UpdateWhenOutOfBounds = true;
            if (player != null && player.Username.Length > 0)
            {
                label.Text = "Logged in as " + player.Username;
            }
            else
            {
                label.Text = "Not Logged In";
            }
            label.X     = spacing;
            label.Y     = dropdown.Y + dropdown.Height + spacing;
            label.Scale = .35f;
            bBan.X      = label.X;
            bBan.Y      = label.Y + label.Height + spacing;
            bKick.X     = bBan.X + bBan.Width + spacing;
            bKick.Y     = bBan.Y;

            bTeleport.X = Width - bTeleport.Width - spacing;
            bTeleport.Y = bBan.Y;

            bRestore.X = Spacing;
            bRestore.Y = bTeleport.Y + bTeleport.Height + spacing;

            snoopWindow.X = bRestore.X;
            snoopWindow.Y = bRestore.Y + bRestore.Height + spacing;

            Width  = bTeleport.X + bTeleport.Width + spacing;
            Height = bRestore.Y + bRestore.Height + spacing;

            bRestore.Width = Width - spacing * 2;

            AddChild(bClose);
            AddChild(label);
            HEROsModNetwork.Group myGroup = HEROsModNetwork.LoginService.MyGroup;
            if (!offlineUser)
            {
                if (myGroup.HasPermission("TeleportToPlayers"))
                {
                    AddChild(bTeleport);
                }
                if (myGroup.HasPermission("Ban"))
                {
                    AddChild(bBan);
                }
                if (myGroup.HasPermission("Kick"))
                {
                    AddChild(bKick);
                }
                if (myGroup.HasPermission("Snoop"))
                {
                    snoopWindow.SetPlayer(Main.player[playerIndex]);
                    AddChild(snoopWindow);
                    Width  = snoopWindow.X + snoopWindow.Width + spacing * 2;
                    Height = snoopWindow.Y + snoopWindow.Height + spacing * 2;
                }
            }
            if (myGroup.IsAdmin)
            {
                AddChild(lGroup);
                AddChild(dropdown);
                if (offlineUser || player != null && player.Username.Length > 0)
                {
                    //AddChild(bRestore);
                }
            }
            bBan.Tag  = Main.player[playerIndex].name;
            bKick.Tag = Main.player[playerIndex].name;

            bClose.X               = Width - bClose.Width - spacing;
            bKick.onLeftClick     += bKick_onLeftClick;
            bBan.onLeftClick      += bBan_onLeftClick;
            bClose.onLeftClick    += bClose_onLeftClick;
            bTeleport.onLeftClick += bTeleport_onLeftClick;
            bRestore.onLeftClick  += bRestore_onLeftClick;
        }