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
        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);
        }