Ejemplo n.º 1
0
        public static void ShowOn(IWorldObject worldObject, string message)
        {
            if (Api.IsServer)
            {
                Api.Logger.Error("Cannot call this method on server");
                return;
            }

            Hide();

            var staticWorldObject      = worldObject as IStaticWorldObject;
            var protoStaticWorldObject = staticWorldObject?.ProtoStaticWorldObject;

            var positionOffset = protoStaticWorldObject?.SharedGetObjectCenterWorldOffset(staticWorldObject)
                                 ?? (0, 0);

            positionOffset += (0, 1.025);

            lastControl = new CannotInteractMessageDisplay();
            lastControl.Setup(message);

            lastControl.componentAttachedControl = Api.Client.UI.AttachControl(
                worldObject,
                lastControl,
                positionOffset: positionOffset,
                isFocusable: false);

            lastControl.componentAttachedControl.Destroy(delay: TimeoutSeconds);
        }
Ejemplo n.º 2
0
        protected override void OnUnloaded()
        {
            if (!ReferenceEquals(lastControl, this))
            {
                return;
            }

            lastControl = null;
            // reset interaction tooltip (so it will be displayed again)
            InteractionTooltip.Hide();
        }
Ejemplo n.º 3
0
        public static void ShowOn(IWorldObject worldObject, string message)
        {
            Hide();

            var staticWorldObject      = worldObject as IStaticWorldObject;
            var protoStaticWorldObject = staticWorldObject?.ProtoStaticWorldObject;

            var positionOffset = protoStaticWorldObject != null
                                     ? protoStaticWorldObject.SharedGetObjectCenterWorldOffset(staticWorldObject)
                                     : (0, 0);

            positionOffset += (0, 1.025);

            lastControl = new CannotInteractMessageDisplay();
            lastControl.Setup(message);

            lastControl.componentAttachedControl = Api.Client.UI.AttachControl(
                worldObject,
                lastControl,
                positionOffset: positionOffset,
                isFocusable: false);

            lastControl.componentAttachedControl.Destroy(delay: TimeoutSeconds);
        }
Ejemplo n.º 4
0
 public static void Hide()
 {
     lastControl?.componentAttachedControl.Destroy();
     lastControl = null;
 }