Beispiel #1
0
    public void ShowHelp(bool showSwitch)
    {
        if (m_initialised && MFGuiManager.Instance != null)
        {
            m_HelpSwitch.SetValue(GuiOptions.showMogaHelp);
            GuiBaseUtils.RegisterButtonDelegate(m_HelpCloseButton, null, OnCloseButton);
            GuiBaseUtils.RegisterSwitchDelegate(m_HelpLayout, "ShowHelp_Switch", OnHelpSwitch);

            MFGuiManager.Instance.ShowLayout(m_HelpLayout, true);

            if (MogaGamepad.IsMogaPro())
            {
                m_MogaPro.Show(true, true);
            }
            else
            {
                m_MogaPocket.Show(true, true);
            }

            InputManager.FlushInput();
            InputManager.IsEnabled = false;
            m_IsHelpOn             = true;

            //hide switch pokud jej nechceme zobrazovat
            m_HelpSwitch.Widget.Show(showSwitch, true);
        }
    }
Beispiel #2
0
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------

    public void OnReset()
    {
        m_GraphicEnum.Selection = (int)GuiOptions.graphicDetail;         // this will invoke OnGraphicChanged() delegate
        m_ShowHintsSwitch.SetValue(GuiOptions.showHints);
        m_LanguageEnum.Selection = (int)GuiOptions.language;

        UpdateHint();
    }
Beispiel #3
0
    protected override void OnViewReset()
    {
#if !MADFINGER_KEYBOARD_MOUSE
        if (!GamepadInputManager.Instance.IsNvidiaShield())
        {
            m_ControlSchemeEnum.Selection = (int)GuiOptions.m_ControlScheme;
            m_FireButtonSize.SetValue(GuiOptions.fireButtonScale - 0.5f);             // offset scale by 0.5 so the final range is 0.5-1.5
            m_SwitchLefthanded.SetValue(GuiOptions.leftHandAiming);
        }
#endif
        m_SliderSensitivity.SetValue(GuiOptions.sensitivity);
        m_SwitchYAxis.SetValue(GuiOptions.invertYAxis);
    }
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------
    // IGuiPageOptionsDisplay methods
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------

    public void OnInit(GUIBase_Layout layout)
    {
        m_GraphicEnum      = GuiBaseUtils.GetControl <GUIBase_Enum>(layout, GRAPHDETAILS_ENUM);
        m_AutoDetectButton = GuiBaseUtils.GetControl <GUIBase_Button>(layout, DETECTGRAPHIC_BUTTON);
        m_ShowHintsSwitch  = GuiBaseUtils.GetControl <GUIBase_Switch>(layout, SHOWHINTS_SWITCH);
        m_LanguageEnum     = GuiBaseUtils.GetControl <GUIBase_Enum>(layout, LANGUAGE_ENUM);

        m_FullscreenSwitch    = GuiBaseUtils.GetControl <GUIBase_Switch>(layout, FULLSCREEN_SWITCH);
        m_ResolutionEnum      = GuiBaseUtils.GetControl <GUIBase_Enum>(layout, RESOLUTION_ENUM);
        m_ResolutionLabels[0] = GuiBaseUtils.GetControl <GUIBase_Label>(layout, RESOLUTION_LABEL + 0);
        m_ResolutionLabels[1] = GuiBaseUtils.GetControl <GUIBase_Label>(layout, RESOLUTION_LABEL + 1);
        m_ResolutionLabels[2] = GuiBaseUtils.GetControl <GUIBase_Label>(layout, RESOLUTION_LABEL + 2);
        m_ApplyButton         = GuiBaseUtils.GetControl <GUIBase_Button>(layout, APPLY_BUTTON);

        m_ShowHintsSwitch.SetValue(GuiOptions.showHints);
    }
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------

    public void OnShow()
    {
        m_GraphicEnum.RegisterDelegate(OnGraphicChanged);
        m_AutoDetectButton.RegisterReleaseDelegate(OnDetectGraphicButton);
        m_ShowHintsSwitch.RegisterDelegate(OnShowHintChanged);
        m_LanguageEnum.RegisterDelegate(OnLanguageChanged);

        m_FullscreenSwitch.RegisterDelegate(OnFullscreenToggled);
        m_ResolutionEnum.RegisterDelegate(OnResolutionChanged);
        m_ApplyButton.RegisterReleaseDelegate(OnApplyButton);

        if (GuiOptions.fullScreenResolution.width <= 0 || GuiOptions.fullScreenResolution.height <= 0)
        {
            GuiOptions.fullScreenResolution = Screen.resolutions[Screen.resolutions.Length - 1];
        }

        m_FullscreenSwitch.SetValue(Screen.fullScreen);

        m_ResolutionEnumSelection = -1;
        m_ResolutionMax           = Screen.resolutions.Length - 1;

        m_CurrentResolution.width  = Screen.width;
        m_CurrentResolution.height = Screen.height;

        m_ResolutionLabels[m_ResolutionEnum.Selection].SetNewText(m_CurrentResolution.width + "x" + m_CurrentResolution.height);

        for (int i = 0; i < Screen.resolutions.Length; i++)
        {
            if (Screen.resolutions[i].width == m_CurrentResolution.width && Screen.resolutions[i].height == m_CurrentResolution.height)
            {
                m_ResolutionEnumSelection = i;
                break;
            }
        }

        SetApplyButton();
    }
Beispiel #6
0
    protected override void OnViewShow()
    {
        base.OnViewShow();

        m_PreferVoiceChat = Game.Settings.GetBool("PreferVoiceChat", false);

        bool isTutorial = Ftue.IsActive;

        // bind buttons
        for (int idx = 0; idx < m_Buttons.Length; ++idx)
        {
            int pageId = idx;
            GuiBaseUtils.RegisterButtonDelegate(m_Buttons[idx],
                                                () =>
            {
                if (CurrentPageIndex != pageId)
                {
                    GotoPage(pageId);
                }
            },
                                                null);
            if (idx > 0 && isTutorial == true)
            {
                m_Buttons[idx].Widget.Show(false, true);
            }
        }

        m_VoiceChatSwitch = RegisterSwitchDelegate(VOICECHAT_SWITCH, (state) => { m_PreferVoiceChat = state; });
        m_VoiceChatSwitch.SetValue(m_PreferVoiceChat);

        LobbyClient.OnServerFound       += ServerFound;
        LobbyClient.OnNoServerAvailable += NoServerAvailable;

        // Disable the voice chat switch but keep it in the dialog data. Maybe we will re-use it later
        // for something else
        m_VoiceChatSwitch.Widget.Show(false, true);
    }
Beispiel #7
0
 protected override void OnViewReset()
 {
     m_SliderSoundVolume.SetValue(GuiOptions.soundVolume);
     m_SliderMusicVolume.SetValue(GuiOptions.musicVolume);
     m_SwitchMusic.SetValue(GuiOptions.musicOn);
 }
 protected override void OnViewReset()
 {
     m_SwitchFloatingFire.SetValue(GuiOptions.floatingFireButton);
 }
    // PRIVATE METHODS

    void RefreshPage()
    {
        bool hasCustomAccount  = CloudUser.instance.userAccountKind == E_UserAcctKind.Normal;
        bool canChangePassword = hasCustomAccount;

        // nickname
        bool nicknameChanged   = m_Nickname != CloudUser.instance.nickName ? true : false;
        bool nicknameIsValid   = string.IsNullOrEmpty(m_Nickname) == false && m_Nickname.Length >= CloudUser.MIN_ACCOUNT_NAME_LENGTH ? true : false;
        bool canUpdateNickname = nicknameChanged == true ? nicknameIsValid : true;

        // password
        bool passwordChanged   = m_Password1Hash != CloudUser.instance.passwordHash ? true : false;
        bool passwordIsValid   = m_PasswordLength >= CloudUser.MIN_PASSWORD_LENGTH ? true : false;
        bool passwordsMatch    = m_Password1Hash == m_Password2Hash ? true : false;
        bool canUpdatePassword = passwordChanged == true ? passwordIsValid && passwordsMatch : true;

        // receive news
        bool receiveNewsChanged = m_ReceiveNews != CloudUser.instance.receiveNews ? true : false;

        // region
        bool regionChanged = m_Region != CloudUser.instance.region ? true : false;

        // all together
        bool anyChanged      = nicknameChanged || passwordChanged || receiveNewsChanged || regionChanged;
        bool canApplyChanges = canUpdateNickname && canUpdatePassword;

        // error hint
        GUIBase_Label hint = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, HINT_LABEL);

        if (nicknameChanged == true && nicknameIsValid == false)
        {
            hint.SetNewText(string.Format(TextDatabase.instance[0107013], CloudUser.MIN_ACCOUNT_NAME_LENGTH));
            hint.Widget.Show(true, true);
        }
        else if (hasCustomAccount == true && anyChanged == true && canApplyChanges == true)
        {
            hint.SetNewText(TextDatabase.instance[0107026]);
            hint.Widget.Show(true, true);
        }
        else if (canChangePassword == false)
        {
            hint.SetNewText(string.Format(TextDatabase.instance[0107025], CloudUser.MIN_PASSWORD_LENGTH));
            hint.Widget.Show(true, true);
        }
        else if (passwordChanged == true && passwordIsValid == false)
        {
            hint.SetNewText(string.Format(TextDatabase.instance[0107014], CloudUser.MIN_PASSWORD_LENGTH));
            hint.Widget.Show(true, true);
        }
        else if (passwordChanged == true && passwordsMatch == false)
        {
            hint.SetNewText(TextDatabase.instance[0107015]);
            hint.Widget.Show(true, true);
        }
        else
        {
            hint.Widget.Show(false, true);
        }

        // controls
        GuiBaseUtils.GetControl <GUIBase_Button>(Layout, NICKNAME_BUTTON).SetNewText(m_Nickname);
        GuiBaseUtils.GetControl <GUIBase_Button>(Layout, PASSWORD1_BUTTON).SetDisabled(canChangePassword ? false : true);
        GuiBaseUtils.GetControl <GUIBase_Button>(Layout, PASSWORD2_BUTTON)
        .SetDisabled(canChangePassword && passwordChanged ? !passwordIsValid : true);
        GuiBaseUtils.GetControl <GUIBase_Roller>(Layout, REGION_ROLLER).SetSelection((int)m_Region);
        GuiBaseUtils.GetControl <GUIBase_Button>(Layout, CONFIRM_BUTTON).SetDisabled(anyChanged ? !canApplyChanges : true);

        GUIBase_Switch news = GuiBaseUtils.GetControl <GUIBase_Switch>(Layout, NEWS_SWITCH);

        news.IsDisabled = CloudUser.instance.userAccountKind == E_UserAcctKind.Guest;
        news.SetValue(m_ReceiveNews);

        UpdateDecoration(REGION_DECOR, (int)m_Region);
    }