Ejemplo n.º 1
0
        public ServerMenuSlot(CoopMenu menu, IReflectionHelper reflection, string serverName, string ip) : base(menu)
        {
            this.ServerName = serverName;
            this.IP         = ip;
            this.reflection = reflection;
            this.menu       = menu;

            var menuSlotsField = reflection.GetField <List <MenuSlot> >(menu, "menuSlots");//menuSlots for Join, hostSlots for Host
            var list           = menuSlotsField.GetValue();

            deleteButton = new ClickableTextureComponent("",
                                                         new Rectangle(0, 0, 48, 48), "", "Delete", Game1.mouseCursors, new Rectangle(322, 498, 12, 12), 3f, false);

            CoopMenuPerformLeftClickPreListenerAndOverrider.PerformLeftClick += (x) =>
            {
                if (deleteButton.bounds.Contains(Game1.getMousePosition()) &&
                    reflection.GetField <CoopMenu.Tab>(menu, "currentTab").GetValue() == CoopMenu.Tab.JOIN_TAB &&
                    reflection.GetField <List <MenuSlot> >(menu, "menuSlots").GetValue() != null)
                {
                    DeleteBookmark?.Invoke(menu, this);

                    x.Override = true;
                }
            };
        }
Ejemplo n.º 2
0
        public void TestDeleteBookmark()
        {
            DeleteBookmark  req;
            Request         req2;
            RecombeeBinding resp;

            // it 'does not fail with existing entity id'
            req  = new DeleteBookmark("user", "item", timestamp: UnixTimeStampToDateTime(0));
            resp = client.Send(req);
            req  = new DeleteBookmark("user", "item");
            try
            {
                client.Send(req);
                Assert.True(false, "No exception thrown");
            }
            catch (ResponseException ex)
            {
                Assert.Equal(404, (int)ex.StatusCode);
            }
        }