Пример #1
0
 private void GetTrayInputButton()
 {
     if (trayInputButton == null)
     {
         trayInputButton = GetComponentInParent <TrayInputButton>();
     }
 }
        private void Start()
        {
            trayInputButton = GetComponentInParent <TrayInputButton>();
            if (trayInputButton == null)
            {
                Log.LogError(this, "Could not find TrayInputButton in parent");
            }
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <MembershipData>(cPDataEntityCollection.LocalPlayerHandle, out membershipData))
            {
                IsPlayerAMember = membershipData.IsMember;
                IsLocked        = !membershipData.IsMember;
                membershipData.MembershipDataUpdated += onMembershipDataUpdated;
                if (IsLocked)
                {
                    Content.LoadAsync(onMemberLockLoaded, MemberLockContentKey);
                }
            }
            else
            {
                trayInputButton.Lock(TrayInputButton.ButtonState.Disabled);
                Content.LoadAsync(onMemberLockLoaded, MemberLockContentKey);
            }
        }
Пример #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 = 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");
            }
        }
 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);
 }
Пример #6
0
 private void Start()
 {
     dataEntityCollection            = Service.Get <CPDataEntityCollection>();
     propService                     = Service.Get <PropService>();
     trayInputButton                 = GetComponentInParent <TrayInputButton>();
     memberLockedButton              = GetComponent <MemberLockedTrayInputButton>();
     trayInputButton.OnStateChanged += onTrayInputButtonStateChanged;
 }
Пример #7
0
 private void restartButtonComponents(TrayInputButton trayInputButton)
 {
     IRestartable[] componentsInChildren = trayInputButton.GetComponentsInChildren <IRestartable>();
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         componentsInChildren[i].Restart();
     }
 }
Пример #8
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);
        }
Пример #9
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;
            }
        }
Пример #10
0
        private void Start()
        {
            dispatcher = Service.Get <EventDispatcher>();
            dispatcher.AddListener <InputEvents.ActionEvent>(onAction);
            inputButton     = GetComponentInParent <InputButton>();
            trayInputButton = GetComponentInParent <TrayInputButton>();
            GameObject localPlayerGameObject = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;

            if (localPlayerGameObject != null)
            {
                locomotionEventBroadcaster = localPlayerGameObject.GetComponent <LocomotionEventBroadcaster>();
                if (locomotionEventBroadcaster != null)
                {
                    locomotionEventBroadcaster.OnStickDirectionEvent += OnStickDirection;
                }
            }
        }
        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];
                    ref Color reference = ref trayInputButton.IconTint.Colors[i];
                    reference = IconTints[i];
                }
                trayInputButton.IconSprite.SelectSprite((int)DefaultState);
                trayInputButton.IconTint.SelectColor((int)DefaultState);
            }
        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 Start()
 {
     parentButton    = GetComponentInParent <Button>();
     trayInputButton = GetComponentInParent <TrayInputButton>();
     parentButton.onClick.AddListener(onButtonClicked);
 }
Пример #14
0
 private void Awake()
 {
     inputButton = GetComponent <TrayInputButton>();
 }
Пример #15
0
 private void Awake()
 {
     eventChannel = new EventChannel(Service.Get <EventDispatcher>());
     inputButton  = GetComponentInChildren <TrayInputButton>();
 }