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

        m_ButtonOK = RegisterButtonDelegate("OK_Button", () => { SendResult(E_PopupResultCode.Ok); }, null);

        RegisterButtonDelegate("Skip_Button", () => { SendResult(E_PopupResultCode.Cancel); }, null);

        m_EmailButton = RegisterButtonDelegate("Email_Button",
                                               () =>
        {
#if !UNITY_EDITOR && (UNITY_IPHONE || UNITY_ANDROID)
            ShowKeyboard(m_EmailButton, GuiScreen.E_KeyBoardMode.Email, OnKeyboardClose, m_Email, TextDatabase.instance[0103041]);
#endif
        },
                                               null);

        AddTextField(m_EmailButton, OnKeyboardClose);

        m_HintLabel = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, "Hint_Label");
        m_HintLabel.SetNewText("");

        m_ReceiveNewsSwitch = GuiBaseUtils.RegisterSwitchDelegate(Layout, "WantNews_Switch", (switchValue) => { m_ReceiveNews = switchValue; });

        CheckEmailValidity();
    }
Ejemplo n.º 2
0
    // GUIVIEW INTERFACE

    protected override void OnViewInit()
    {
        base.OnViewInit();

        m_SliderSoundVolume = GuiBaseUtils.GetControl <GUIBase_Slider>(Layout, SLIDER_SOUND_VOLUME);
        m_SliderMusicVolume = GuiBaseUtils.GetControl <GUIBase_Slider>(Layout, SLIDER_MUSIC_VOLUME);
        m_SwitchMusic       = GuiBaseUtils.GetControl <GUIBase_Switch>(Layout, SWITCH_MUSIC);
    }
Ejemplo n.º 3
0
    protected GUIBase_Switch PrepareSwitch(GUIBase_Layout inLayout, string inName, GUIBase_Switch.SwitchDelegate inSwitchDlgt)
    {
        GUIBase_Switch _switch = GetWidget(inLayout, inName).GetComponent <GUIBase_Switch>();

        if (_switch == null)
        {
            throw new MFScreenInitException("Widget [ " + inName + " } dosn't have switch component");
        }

        _switch.RegisterDelegate(inSwitchDlgt);
        return(_switch);
    }
Ejemplo n.º 4
0
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------
    // 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_HintLabel        = GuiBaseUtils.GetControl <GUIBase_Label>(layout, HINT_LABEL);
        m_LanguageEnum     = GuiBaseUtils.GetControl <GUIBase_Enum>(layout, LANGUAGE_ENUM);

        if (m_OriginalGraphicValue < 0)
        {
            m_OriginalGraphicValue = GuiOptions.graphicDetail;
        }
    }
Ejemplo n.º 5
0
    //---------------------------------------------------------
    public static GUIBase_Switch RegisterSwitchDelegate(GUIBase_Layout layout, string switchName, GUIBase_Switch.SwitchDelegate d)
    {
        GUIBase_Switch control = GetControl <GUIBase_Switch>(layout, switchName);

        if (control != null)
        {
            control.RegisterDelegate(d);
        }
        else
        {
            Debug.LogError("Can't find switch '" + switchName + "'");
        }
        return(control);
    }
Ejemplo n.º 6
0
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------
    // 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);
    }
Ejemplo n.º 7
0
    // GUIVIEW INTERFACE

    protected override void OnViewInit()
    {
#if MADFINGER_KEYBOARD_MOUSE
        m_ScreenLayout   = GetLayout("MainOpt", "00Controls_Layout_PC");
        m_KeyboardButton = GuiBaseUtils.GetControl <GUIBase_Button>(Layout, KEYBOARD_BUTTON);
#else
        if (GamepadInputManager.Instance.IsNvidiaShield())
        {
            m_ScreenLayout = GetLayout("MainOpt", "00Controls_Layout_Shield");
        }
        else
        {
            m_ControlSchemeEnum = GuiBaseUtils.GetControl <GUIBase_Enum>(Layout, CONTROLS_SCHEME);
            m_FireButtonSize    = GuiBaseUtils.GetControl <GUIBase_Slider>(Layout, FIRE_BUTTON_SIZE);
            m_SwitchLefthanded  = GuiBaseUtils.GetControl <GUIBase_Switch>(Layout, SWITCH_LEFT_HANDED);
            m_CustomizeButton   = GuiBaseUtils.GetControl <GUIBase_Button>(Layout, CUSTOMIZE_BUTTON);
            m_MogaHelpButton    = GuiBaseUtils.GetControl <GUIBase_Button>(Layout, MOGA_HELP_BUTTON);
        }
#endif
        m_SliderSensitivity = GuiBaseUtils.GetControl <GUIBase_Slider>(Layout, SLIDER_SENSITIVITY);
        m_SwitchYAxis       = GuiBaseUtils.GetControl <GUIBase_Switch>(Layout, SWITCH_INVERT_Y);
        m_GamepadButton     = GuiBaseUtils.GetControl <GUIBase_Button>(Layout, GAMEPAD_BUTTON);
    }
Ejemplo n.º 8
0
    public void Init()
    {
        m_initialised = true;
        m_Pivot       = MFGuiManager.Instance.GetPivot("MogaGui_Pivot");
        m_Layout      = m_Pivot.GetLayout("Connection_Layout");
        m_TextLabel   = GuiBaseUtils.PrepareLabel(m_Layout, "Text_Label");

        //help
        m_HelpPivot       = MFGuiManager.Instance.GetPivot("MogaHelp_Pivot");
        m_HelpLayout      = m_HelpPivot.GetLayout("MogaHelp_Layout");
        m_HelpCloseButton = GuiBaseUtils.GetControl <GUIBase_Button>(m_HelpLayout, "Close_Button");
        m_HelpSwitch      = GuiBaseUtils.GetControl <GUIBase_Switch>(m_HelpLayout, "ShowHelp_Switch");

        m_MogaPocket = GuiBaseUtils.GetChild <GUIBase_Widget>(m_HelpLayout, "Moga", true);
        m_MogaPro    = GuiBaseUtils.GetChild <GUIBase_Widget>(m_HelpLayout, "MogaPro", true);

        m_TouchWidgets = new List <GUIBase_Widget>();
        m_TouchWidgets.Add(m_HelpCloseButton.Widget);
        foreach (var btn in m_HelpSwitch.m_Buttons)
        {
            m_TouchWidgets.Add(btn.Widget);
        }
    }
Ejemplo n.º 9
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);
    }
    // GUIVIEW INTERFACE

    protected override void OnViewInit()
    {
        m_SwitchFloatingFire = GuiBaseUtils.GetControl <GUIBase_Switch>(Layout, FLOATING_FIRE);
    }
Ejemplo n.º 11
0
    // 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);
    }