Ejemplo n.º 1
0
        protected override void Update()
        {
            base.Update();

            if (IsVisible() && character != null && select != null)
            {
                float dist = (interact_pos - character.transform.position).magnitude;
                if (dist > select.use_range * 1.2f)
                {
                    Hide();
                }
            }

            if (IsVisible())
            {
                Vector3 dir = TheCamera.Get().GetFacingFront();
                transform.rotation = Quaternion.LookRotation(dir, Vector3.up);
            }

            if (IsVisible() && select == null)
            {
                Hide();
            }

            //Auto focus
            UISlotPanel focus_panel = UISlotPanel.GetFocusedPanel();

            if (focus_panel != this && IsVisible() && PlayerControls.IsAnyGamePad())
            {
                Focus();
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            pause_panel.SetVisible(TheGame.Get().IsPausedByPlayer());

            foreach (PlayerControls controls in PlayerControls.GetAll())
            {
                if (controls.IsPressPause() && !TheGame.Get().IsPausedByPlayer())
                {
                    TheGame.Get().Pause();
                }
                else if (controls.IsPressPause() && TheGame.Get().IsPausedByPlayer())
                {
                    TheGame.Get().Unpause();
                }
            }

            //Gamepad auto focus
            UISlotPanel focus_panel = UISlotPanel.GetFocusedPanel();

            if (focus_panel != pause_panel && TheGame.Get().IsPausedByPlayer() && PlayerControls.IsAnyGamePad())
            {
                pause_panel.Focus();
            }
            if (focus_panel == pause_panel && !TheGame.Get().IsPausedByPlayer())
            {
                UISlotPanel.UnfocusAll();
            }
        }
        protected override void Update()
        {
            base.Update();

            //Auto focus
            UISlotPanel focus_panel = UISlotPanel.GetFocusedPanel();

            if (focus_panel != this && IsVisible() && PlayerControls.IsAnyGamePad())
            {
                prev_panel = focus_panel;
                Focus();
            }
        }
Ejemplo n.º 4
0
        protected override void Update()
        {
            base.Update();

            if (!PlayerControls.IsAnyGamePad())
            {
                return;
            }

            if (is_leader)
            {
                if (IsVisible())
                {
                    foreach (PlayerControls controls in PlayerControls.GetAll())
                    {
                        if (controls.IsMenuPressUp())
                        {
                            selection--;
                            selection = Mathf.Clamp(selection, 0, group_list.Count - 1);
                        }

                        if (controls.IsMenuPressDown())
                        {
                            selection++;
                            selection = Mathf.Clamp(selection, 0, group_list.Count - 1);
                        }

                        if (controls.IsPressMenuAccept())
                        {
                            if (selection >= 0 && selection < group_list.Count)
                            {
                                MenuButton button = group_list[selection];
                                button.Click();
                            }
                        }
                    }

                    foreach (MenuButton button in group_list)
                    {
                        button.SetArrow(selection == button.index);
                    }
                }
                else
                {
                    selection = start_index;
                }
            }
        }
        void Start()
        {
            GenerateAutomaticOutline();

            if ((TheGame.IsMobile() || PlayerControls.IsAnyGamePad()) && groups.Length > 0 && AssetData.Get().item_merge_fx != null)
            {
                if (fx_parent == null)
                {
                    fx_parent = new GameObject("FX");
                }

                GameObject fx = Instantiate(AssetData.Get().item_merge_fx, transform.position, AssetData.Get().item_merge_fx.transform.rotation);
                fx.GetComponent <ItemMergeFX>().target = this;
                fx.transform.SetParent(fx_parent.transform);
            }
        }