Exemplo n.º 1
0
    public void Cancel()
    {
        if (ValueChanged())
        {
            UISystem.instance.CreatePopup(LocalizationSystem.GetEntry("settings.valuechanged"), "menu.yes", "menu.no",
                                          () =>
            {
                Apply();
                UISystem.instance.CloseCurrentWindow();
                UISystem.instance.CloseWindow(gameObject);
            },
                                          () =>
            {
                if (m_TMPPref.CurrentLanguage != Core.instance.PlayerPrefs.CurrentLanguage)
                {
                    LocalizationSystem.ChangeLanguage(Core.instance.PlayerPrefs.CurrentLanguage);
                }

                UISystem.instance.CloseCurrentWindow();
                UISystem.instance.CloseWindow(gameObject);
                AudioMgr.PlayUISound("Cancel");
            });
        }
        else
        {
            UISystem.instance.CloseCurrentWindow();
            AudioMgr.PlayUISound("Cancel");
        }
    }
Exemplo n.º 2
0
 private void Start()
 {
     m_RealText      = LocalizationSystem.GetEntry("intro.welcome") + " " + System.Environment.UserName;
     m_TextMesh      = GetComponent <TextMeshPro>();
     m_TextMesh.text = m_RealText;
     m_TextMesh.text = new string(m_RealText.ToCharArray().OrderBy(x => Random.value).ToArray());
     m_TextMat       = GetComponent <Renderer>().material;
 }
Exemplo n.º 3
0
    IEnumerator End()
    {
        UISystem.instance.SetMenuPresence(true);
        InterfaceUtilities.FadeToBlack(false, 2.0f);
        yield return(new WaitForSeconds(3.0f));

        InterfaceUtilities.AddCaption(LocalizationSystem.GetEntry("end.thanks"), new Vector2(400.0f, 100.0f), 40.0f, Color.white, true, false, 2.0f);
        yield return(new WaitForSeconds(5.0f));

        SceneManager.LoadScene(0);
    }
Exemplo n.º 4
0
 public void BackToMainMenu()
 {
     UISystem.instance.CreatePopup(LocalizationSystem.GetEntry("menu.confirmmain"), "menu.yes", "menu.no",
                                   () =>
     {
         UISystem.instance.ClearAll();
         UISystem.instance.LockUnlockPauseAction(false);
         SceneManager.LoadScene(0);
     },
                                   () =>
     {
         UISystem.instance.CloseCurrentWindow();
     });
 }
Exemplo n.º 5
0
 public void ToggleConfirmExit()
 {
     CreatePopup(LocalizationSystem.GetEntry("menu.confirm"), "menu.yes", "menu.no", () => { Application.Quit(); }, () => { AudioMgr.PlayUISound("Cancel");  CloseCurrentWindow(); });
 }
Exemplo n.º 6
0
 public void OnLanguageChange()
 {
     Content = LocalizationSystem.GetEntry(Key);
 }
Exemplo n.º 7
0
    private void PerformInteractiveRebind(InputAction action, int bindingIndex, bool altAction, int slotIdx, bool allCompositeParts = false)
    {
        InputHandler.LockDeviceSwap = true;
        CurrentRebindOperation?.Cancel();
        m_CanvasGroup.interactable = false;
        WaitingRebindWindow.SetActive(true);

        CurrentRebindOperation = action.PerformInteractiveRebinding(bindingIndex).OnCancel((operation) =>
        {
            CurrentRebindOperation?.Dispose();
            CurrentRebindOperation = null;

            //Hide Rebind UI
            m_CurrentSlot = null;
            m_CanvasGroup.interactable = true;
            WaitingRebindWindow.SetActive(false);
            InputHandler.LockDeviceSwap = false;
        }).OnComplete((operation) =>
        {
            if (ActionAlreadyMap(action.bindings[bindingIndex].effectivePath, slotIdx, out string actionName))
            {
                string content = LocalizationSystem.GetEntry("inputs.replaceinput").Replace("%", actionName);
                UISystem.instance.CreatePopup(content, "menu.yes", "menu.no",
                                              () =>
                {
                    if (altAction)
                    {
                        m_CurrentSlot.AltPath = action.bindings[bindingIndex].effectivePath;
                        m_CurrentSlot.SetAltIcon();
                    }
                    else
                    {
                        m_CurrentSlot.ActionPath = action.bindings[bindingIndex].effectivePath;
                        m_CurrentSlot.SetInputIcon();
                    }

                    UISystem.instance.CloseCurrentWindow();
                    AudioMgr.PlayUISound("Swap");
                    InputHandler.LockDeviceSwap = false;
                },
                                              () =>
                {
                    InputActionMap map = InputHandler.Inputs.actions.actionMaps[0]; //The PlayerInput map
                    int idx            = FindRealBinding(action.bindings[bindingIndex].effectivePath);
                    map.ApplyBindingOverride(idx, new InputBinding {
                        overridePath = altAction ? m_CurrentSlot.AltPath : m_CurrentSlot.ActionPath
                    });
                    UISystem.instance.CloseCurrentWindow();
                    AudioMgr.PlayUISound("Cancel");
                    InputHandler.LockDeviceSwap = false;
                });
            }
            else
            {
                if (altAction)
                {
                    m_CurrentSlot.AltPath = action.bindings[bindingIndex].effectivePath;
                    m_CurrentSlot.SetAltIcon();
                }
                else
                {
                    m_CurrentSlot.ActionPath = action.bindings[bindingIndex].effectivePath;
                    m_CurrentSlot.SetInputIcon();
                }

                AudioMgr.PlayUISound("Swap");
                InputHandler.LockDeviceSwap = false;
            }

            m_CanvasGroup.interactable = true;
            WaitingRebindWindow.SetActive(false);
            CurrentRebindOperation?.Dispose();
            CurrentRebindOperation = null;
        });

        if (InputHandler.PCLayout)
        {
            CurrentRebindOperation.WithCancelingThrough("<Keyboard>/escape");
        }
        else
        {
            CurrentRebindOperation.WithCancelingThrough("<Gamepad>/start");
            CurrentRebindOperation.WithControlsExcluding("<Gamepad>/rightStick");
            CurrentRebindOperation.WithControlsExcluding("<Gamepad>/leftStick");
            CurrentRebindOperation.WithControlsExcluding("<DualShockGamepad>/touchpadButton");
        }

        CurrentRebindOperation.Start();
    }
Exemplo n.º 8
0
    void FeedInputTable()
    {
        InputHandler.InputBindingInfo[] ActionIndex = InputHandler.GetInputsForCurrentDevice();
        Dictionary <string, int>        InputSlots  = InputHandler.PCLayout ? new Dictionary <string, int>() : null; //PC Layout allow player to map 2 inputs to one action
        int childcount = 1;

        for (int i = 0; i < ActionIndex.Length; ++i)
        {
            InputHandler.InputBindingInfo act = ActionIndex[i];
            ActionRebindSlot slot;
            string           actName    = act.Action.name;
            bool             lockRebind = false;

            //No rebind allowed for camera
            if (string.CompareOrdinal(act.Action.expectedControlType, "Vector2") == 0)
            {
                if (act.ControlPath.Contains("Mouse"))
                {
                    continue;
                }

                lockRebind = true;

                if (InputHandler.PCLayout && act.IsComposite)
                {
                    actName    = TryDisassembleCompositeAction(act.Action, act.BindIndex);
                    lockRebind = false;
                }
            }

            if (InputHandler.PCLayout && InputSlots.ContainsKey(actName))
            {
                slot         = GetSlotAt(InputSlots[actName]);
                slot.AltPath = act.ControlPath;
                slot.SetAltIcon();
                SetEventOnBindButton(slot.AltRebindButton.GetComponent <EventTrigger>());
            }
            else
            {
                slot                  = GameObject.Instantiate(ActionRebindTemplate.gameObject, m_SlotLayout.transform).GetComponent <ActionRebindSlot>();
                slot.SlotIndex        = i;
                slot.ActionLabel.text = LocalizationSystem.GetEntry(actName.ToLower());
                slot.ActionPath       = act.ControlPath;
                slot.SetInputIcon();

                if (lockRebind)
                {
                    slot.LockBind();
                }

                if (InputHandler.PCLayout)
                {
                    InputSlots.Add(actName, childcount);
                    childcount++;
                }

                SetEventOnBindButton(slot.ActionRebindButton.GetComponent <EventTrigger>());
            }

            slot.ID = act.Action.id.ToString();
            slot.SetIndex(act.BindIndex);
            slot.gameObject.SetActive(true);
        }

        SetNavigation();
        SetDefaultItemSelected();
    }