コード例 #1
0
    public SimAssetId GetSimAssetId()
    {
        GameObject simGO = GetSimGameObject();

        if (!simGO)
        {
            Log.Error($"[{nameof(ViewBindingDefinition)}] ({gameObject.name}) Failed to find Sim GameObject... The binding will not work.");
            return(SimAssetId.Invalid);
        }

        SimAsset assetIdAuth = simGO.GetComponent <SimAsset>();

        if (!assetIdAuth)
        {
            Log.Error($"[{nameof(ViewBindingDefinition)}] ({gameObject.name}) The Sim GameObject {simGO.name} doesn't " +
                      $"have any {nameof(SimAsset)} component attached to it. The binding will not work.");
            return(SimAssetId.Invalid);
        }

        return(assetIdAuth.GetSimAssetId());
    }
コード例 #2
0
    public void ActivateTooltipDisplay(ItemAuth itemGameActionAuth, Entity itemOwner)
    {
        if (!Input.GetKey(KeyCode.LeftAlt))
        {
            if (_currentDelayedTooltipActivationCoroutine == null)
            {
                _currentDelayedTooltipActivationCoroutine = this.DelayedCall(_displayDelay, () =>
                {
                    ActivateTooltipDisplay(itemGameActionAuth, itemOwner);
                });

                return;
            }
            else
            {
                StopCoroutine(_currentDelayedTooltipActivationCoroutine);
                _currentDelayedTooltipActivationCoroutine = null;
            }
        }

        if (itemGameActionAuth != null)
        {
            SimAsset simAsset = itemGameActionAuth.GetComponent <SimAsset>();
            if (simAsset != null)
            {
                Entity itemEntity = FindItemFromAssetId(simAsset.GetSimAssetId(), itemOwner);
                if (itemEntity != Entity.Null)
                {
                    _itemName.text = itemGameActionAuth.Name; // update title Text
                    UpdateTooltipDescription(itemEntity, itemGameActionAuth);
                    UpdateTooltipColors(Color.white);
                    _shouldBeDisplayed = true;
                }
            }
        }
    }