private void Start()
    {
        button               = GetComponentInParent <Button>();
        inputButton          = button.GetComponent <InputButton>();
        trayInputButton      = button.GetComponent <TrayInputButton>();
        interactButtonToggle = GetComponent <InteractButtonToggle>();
        tooltipButton        = button.gameObject.AddComponent <TooltipInputButton>();
        PropUser component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();
        Prop     prop      = component.Prop;

        if (prop != null)
        {
            propValidator = prop.GetComponent <PropValidateDeployLocation>();
            if (propValidator != null)
            {
                validator = propValidator.GetValidator();
                if (validator == null)
                {
                    propValidator.OnValidatorSpawned += onValidatorSpawned;
                }
                else
                {
                    onValidPositionChanged(validator.IsValidPosition);
                    validator.OnValidPositionChanged += onValidPositionChanged;
                }
            }
        }
        Content.LoadAsync(onTooltipLoaded, TooltipPrefab);
    }
Пример #2
0
    private void Start()
    {
        bool flag = false;

        networkServiceManager = Service.Get <INetworkServicesManager>();
        Button componentInParent = GetComponentInParent <Button>();

        if (componentInParent != null)
        {
            trayInputButton    = componentInParent.GetComponent <TrayInputButton>();
            tooltipInputButton = componentInParent.gameObject.AddComponent <TooltipInputButton>();
            Transform transform = findLayoutPanel();
            if (transform != null)
            {
                baitUI   = transform.Find("BaitUI").gameObject;
                baitText = baitUI.GetComponentInChildren <Text>();
                clock    = transform.Find("ClockPanel").gameObject;
                clock.SetActive(value: false);
                timerTooltip = transform.Find("Tooltip").gameObject;
                timerText    = timerTooltip.transform.Find("TimerText").GetComponent <Text>();
                timerTooltip.GetComponent <Button>().onClick.AddListener(onTooltipClicked);
                tooltipInputButton.TooltipAnimator = timerTooltip.GetComponent <Animator>();
                tooltipInputButton.TooltipEnabled  = false;
                SubscribeToEvents();
                updateTimer = new Timer(1f, repeat: true, delegate
                {
                    OnTimerTick();
                });
                CoroutineRunner.Start(updateTimer.Start(), this, "FishingButtonTimer");
                updateBaitUI();
                flag = true;
            }
        }
        if (!flag)
        {
            Log.LogError(this, "Failed to find all the UI components required to initialize FishingButtonUIUpdater. Aborting");
        }
    }