private void RefreshAttachedComponent()
        {
            this.componentAttachedUIElement?.Destroy();
            this.componentAttachedUIElement = null;

            var actionState = this.privateState.CurrentActionState;

            if (actionState is null ||
                !actionState.IsDisplayingProgress)
            {
                return;
            }

            var targetWorldObject = actionState.TargetWorldObject;

            if (targetWorldObject is null)
            {
                // display over the character
                targetWorldObject = (IWorldObject)this.privateState.GameObject;
            }

            Vector2D offset = (0, 1.13);

            if (targetWorldObject == ClientCurrentCharacterHelper.Character &&
                GeneralOptionDisplayHealthbarAboveCurrentCharacter.IsDisplay)
            {
                // adjust the offset so the circle will not overlap with the current character's name and healthbar
                offset += (0, 0.2);
            }

            switch (targetWorldObject.ProtoWorldObject)
            {
            case IProtoStaticWorldObject protoStaticWorldObject:
                offset += protoStaticWorldObject.SharedGetObjectCenterWorldOffset(targetWorldObject);
                break;

            case IProtoCharacter protoCharacter:
                offset += protoCharacter.SharedGetObjectCenterWorldOffset(targetWorldObject);
                break;
            }

            this.componentAttachedUIElement = Client.UI.AttachControl(
                targetWorldObject,
                new ActionProgressControl()
            {
                ActionState = actionState
            },
                positionOffset: offset,
                isFocusable: false);

            CannotInteractMessageDisplay.Hide();
            InteractionTooltip.Hide();
        }
예제 #2
0
        private void RefreshAttachedComponent()
        {
            this.componentAttachedUIElement?.Destroy();
            this.componentAttachedUIElement = null;

            var actionState = this.privateState.CurrentActionState;

            if (actionState is null ||
                !actionState.IsDisplayingProgress)
            {
                return;
            }

            var targetWorldObject = actionState.TargetWorldObject;

            if (targetWorldObject is null)
            {
                // display over the character
                targetWorldObject = (IWorldObject)this.privateState.GameObject;
            }

            Vector2D offset = (0, 1.01);

            switch (targetWorldObject.ProtoWorldObject)
            {
            case IProtoStaticWorldObject protoStaticWorldObject:
                offset += protoStaticWorldObject.SharedGetObjectCenterWorldOffset(targetWorldObject);
                break;

            case IProtoCharacter protoCharacter:
                offset += protoCharacter.SharedGetObjectCenterWorldOffset(targetWorldObject);
                break;
            }

            this.componentAttachedUIElement = Client.UI.AttachControl(
                targetWorldObject,
                new ActionProgressControl()
            {
                ActionState = actionState
            },
                positionOffset: offset,
                isFocusable: false);

            CannotInteractMessageDisplay.Hide();
            InteractionTooltip.Hide();
        }