示例#1
0
        protected override void Update()
        {
            if (Input.IsPressing(Keys.E))
            {
                if (Player.LocalPlayer.ContainerOpened)
                {
                    Player.LocalPlayer.CloseContainer();
                }
                else
                {
                    Player.LocalPlayer.OpenContainer(Player.LocalPlayer);
                }
            }

            if (Input.IsPressing(Keys.Escape))
            {
                Player.LocalPlayer.CloseContainer();
            }

            if (Input.IsPressed(Keys.R))
            {
                Player.LocalPlayer.AddItemFast(new ContainerItem(ItemCache.GetIdentifier((ushort)r.Next((int)ItemCache.TotalItems))));
            }

            AnimateDisplayName();

            Player.LocalPlayer.HotbarSelectedIndex -= Input.MouseScrollDeltaStep;

            int index = HoveringIndex();

            if (Player.LocalPlayer.ContainerOpened)
            {
                if (index != -1 && Input.IsPressing(Keys.MouseLeftButton))
                {
                    Player.LocalPlayer.MainGrab(index);
                }
                else if (index != -1 && Input.IsPressing(Keys.MouseRightButton))
                {
                    Player.LocalPlayer.AltGrab(index);
                }
            }
        }