コード例 #1
0
    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 GetTrayInputButton()
 {
     if (trayInputButton == null)
     {
         trayInputButton = GetComponentInParent <TrayInputButton>();
     }
 }
コード例 #3
0
 private void Start()
 {
     trayInputButton = GetComponentInParent <TrayInputButton>();
     if (trayInputButton != null)
     {
         if (trayInputButton.IsBackgroundVisible)
         {
             Sprite[] sprites = trayInputButton.BackgroundSprite.Sprites;
             originalSprites = new Sprite[OverrideSprites.Length];
             for (int i = 0; i < OverrideSprites.Length; i++)
             {
                 originalSprites[i] = sprites[i];
                 if (OverrideSprites[i] != null)
                 {
                     sprites[i]   = OverrideSprites[i];
                     isOverridden = true;
                 }
             }
             int currentViewState = (int)trayInputButton.CurrentViewState;
             trayInputButton.BackgroundSprite.SelectSprite(currentViewState);
         }
         else
         {
             Log.LogError(this, "Background sprite is not visible for this button");
         }
     }
     else
     {
         Log.LogError(this, "Could not find TrayInputButton in parent");
     }
 }
コード例 #4
0
    private void Start()
    {
        trayInputButton = GetComponentInParent <TrayInputButton>();
        if (trayInputButton != null)
        {
            clickListener = trayInputButton.GetComponent <ButtonClickListener>();
            clickListener.OnClick.AddListener(OnClicked);
        }
        else
        {
            Log.LogError(this, "TrayInputButton not found");
        }
        dispatcher = Service.Get <EventDispatcher>();
        GameObject localPlayerGameObject = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;

        if (localPlayerGameObject != null)
        {
            locomotionEventBroadcaster = localPlayerGameObject.GetComponent <LocomotionEventBroadcaster>();
            SlideController component = localPlayerGameObject.GetComponent <SlideController>();
            if (component != null && component.enabled)
            {
                changeState(isSliding: true);
            }
        }
        if (locomotionEventBroadcaster != null)
        {
            locomotionEventBroadcaster.OnControllerChangedEvent += onControllerChanged;
        }
        else
        {
            Log.LogError(this, "LocomotionEventBroadcaster was not found in the scene");
        }
    }
コード例 #5
0
 private void Start()
 {
     dataEntityCollection            = Service.Get <CPDataEntityCollection>();
     propService                     = Service.Get <PropService>();
     trayInputButton                 = GetComponentInParent <TrayInputButton>();
     memberLockedButton              = GetComponent <MemberLockedTrayInputButton>();
     trayInputButton.OnStateChanged += onTrayInputButtonStateChanged;
 }
コード例 #6
0
 private void Start()
 {
     button          = GetComponentInParent <Button>();
     trayInputButton = button.GetComponent <TrayInputButton>();
     eventChannel    = new EventChannel(Service.Get <EventDispatcher>());
     eventChannel.AddListener <FishingEvents.SetFishingState>(onSetFishingState);
     eventChannel.AddListener <FishingEvents.FishingGameplayStateChanged>(onFishingGameplayStateChanged);
 }
コード例 #7
0
    private void Start()
    {
        Button componentInParent = GetComponentInParent <Button>();

        trayInputButton = componentInParent.GetComponent <TrayInputButton>();
        eventChannel    = new EventChannel(Service.Get <EventDispatcher>());
        eventChannel.AddListener <FishingEvents.ActivateBobberButton>(onActivateBobberButton);
        eventChannel.AddListener <FishingEvents.DeactivateBobberButton>(onDeactivateBobberButton);
        eventChannel.AddListener <FishingEvents.PulseBobberButton>(onPulseBobberButton);
        eventChannel.AddListener <FishingEvents.StopBobberButtonPulse>(onTopBobberButtonPulse);
    }
コード例 #8
0
    private void Start()
    {
        Button componentInParent = GetComponentInParent <Button>();

        inputButton        = componentInParent.gameObject.AddComponent <InputButton>();
        inputButton.Action = Action;
        trayButton         = componentInParent.GetComponent <TrayInputButton>();
        if (trayButton != null)
        {
            trayButton.OnStateChanged += inputButton.OnButtonStateChanged;
        }
    }
コード例 #9
0
 private void Start()
 {
     trayInputButton = GetComponentInParent <TrayInputButton>();
     getTubeData();
     getTubeDefinitions();
     if (tubeData != null)
     {
         onTubeSelected(tubeData.SelectedTubeId);
         return;
     }
     onTubeSelected(0);
     Service.Get <EventDispatcher>().AddListener <NetworkControllerEvents.LocalPlayerDataReadyEvent>(onLocalPlayerDataReady);
 }
コード例 #10
0
    private void Start()
    {
        dispatcher = Service.Get <EventDispatcher>();
        dispatcher.AddListener <InputEvents.ActionEvent>(onAction);
        inputButton     = GetComponentInParent <InputButton>();
        trayInputButton = GetComponentInParent <TrayInputButton>();
        GameObject localPlayerGameObject = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;

        if (localPlayerGameObject != null)
        {
            locomotionEventBroadcaster = localPlayerGameObject.GetComponent <LocomotionEventBroadcaster>();
            if (locomotionEventBroadcaster != null)
            {
                locomotionEventBroadcaster.OnStickDirectionEvent += OnStickDirection;
            }
        }
    }
コード例 #11
0
    public void SetUpButton(TrayInputButton trayInputButton)
    {
        GameObject gameObject = Object.Instantiate(ButtonPrefab);

        gameObject.transform.SetParent(trayInputButton.Behaviour.transform, worldPositionStays: false);
        if (trayInputButton.IconSprite != null && trayInputButton.IconTint != null)
        {
            trayInputButton.Icon.enabled       = true;
            trayInputButton.IconSprite.Sprites = new Sprite[ButtonIcons.Length];
            trayInputButton.IconTint.Colors    = new Color[ButtonIcons.Length];
            for (int i = 0; i < ButtonIcons.Length; i++)
            {
                trayInputButton.IconSprite.Sprites[i] = ButtonIcons[i];
                trayInputButton.IconTint.Colors[i]    = IconTints[i];
            }
            trayInputButton.IconSprite.SelectSprite((int)DefaultState);
            trayInputButton.IconTint.SelectColor((int)DefaultState);
        }
        else
        {
            trayInputButton.Icon.enabled = false;
            Log.LogError(this, "Button object did not have an icon sprite or tint selector");
        }
        trayInputButton.DefaultState        = DefaultState;
        trayInputButton.IsBackgroundVisible = IsBackgroundVisible;
        if (!IsBackgroundVisible)
        {
            trayInputButton.GetComponent <Image>().enabled = false;
        }
        TrayInputButton.ButtonState buttonVisualState = DefaultState;
        TrayInputButton.ButtonState buttonState       = DefaultState;
        if (trayInputButton.IsLocked)
        {
            buttonVisualState = trayInputButton.CurrentViewState;
            buttonState       = TrayInputButton.ButtonState.Disabled;
        }
        trayInputButton.InitializeView(DefaultState, buttonVisualState);
        trayInputButton.GetComponent <Button>().interactable = (buttonState != TrayInputButton.ButtonState.Disabled);
        trayInputButton.gameObject.SetActive(value: true);
    }
コード例 #12
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");
        }
    }
コード例 #13
0
 private void Awake()
 {
     inputButton = GetComponent <TrayInputButton>();
 }
コード例 #14
0
 private void Awake()
 {
     eventChannel = new EventChannel(Service.Get <EventDispatcher>());
     inputButton  = GetComponentInChildren <TrayInputButton>();
 }
コード例 #15
0
 private void Start()
 {
     divingController = getDivingController();
     trayInputButton  = GetComponentInParent <TrayInputButton>();
 }
コード例 #16
0
 private void Start()
 {
     parentButton    = GetComponentInParent <Button>();
     trayInputButton = GetComponentInParent <TrayInputButton>();
     parentButton.onClick.AddListener(onButtonClicked);
 }