Beispiel #1
0
 public void SetImageIconBackButton(POPUP_STATE state)
 {
     if (state == POPUP_STATE.Servant || state == POPUP_STATE.Weapon || state == POPUP_STATE.EOS)
     {
         imageBackButtonIcon.gameObject.SetActive(true);
         textBackButton.rectTransform.anchoredPosition = new Vector2(52, 6);
     }
     else
     {
         imageBackButtonIcon.gameObject.SetActive(false);
         textBackButton.rectTransform.anchoredPosition = new Vector2(0, 6);
     }
 }
Beispiel #2
0
    private void TryServerConnect( HostData _hostData, string _password )
    {
        NetworkConnectionError error = MenuNetworking.instance.Connect(
            this.targetHost.ip[0], this.targetHost.port, _password );

        switch ( error )
        {
        case NetworkConnectionError.NoError:
        {
            this.popupState = POPUP_STATE.NONE;
            this.state = STATE.CONNECTING;
            break;
        }
        default:
        {
            this.StartMessagePopup( error.ToString(), "Close" );
            break;
        }
        }
    }
Beispiel #3
0
    private void RenderServerListGUI()
    {
        if ( this.serverListBackButton.Button() )
        {
            this.state = STATE.MAIN;
            return;
        }

        for ( int i = 0; i < this.serverRows.Count; ++i )
        {
            ServerDisplayRow row = this.serverRows[i];
            row.nameLabel.Label();
            row.ipLabel.Label();
            row.pingLabel.Label();

            if ( row.connectButton.Button() )
            {
                this.targetHost = MenuNetworking.instance.GetHostData( i );
                if ( this.targetHost.passwordProtected )
                {
                    this.StartEnterTextPopup( "Password" , "Please enter the server password" );
                }
                else
                {
                    this.TryServerConnect( this.targetHost, "" );
                }
            }
        }

        if ( this.popupState == POPUP_STATE.ENTER_TEXT )
        {
            int val = this.RenderPopUpWindow();

            if ( val == -1 )
            {
                this.popupState = POPUP_STATE.NONE;
            }
            else if ( val == 1 )
            {
                this.TryServerConnect( this.targetHost, this.popupTextField.text );
            }
        }
    }
Beispiel #4
0
    private void RenderOptionsGUI()
    {
        if ( this.optionsBackButton.Button() )
        {
            this.state = STATE.MAIN;
        }

        this.optionsNameLabel.Label();

        if ( this.optionsNameButton.Button() )
        {
            this.StartEnterTextPopup( "Name", "Edit your name:", this.optionsNameLabel.text );
        }

        if ( this.popupState != POPUP_STATE.NONE )
        {
            switch ( this.RenderPopUpWindow() )
            {
            case 0:
            {
                break;
            }
            case -1:
            {
                this.popupState = POPUP_STATE.NONE;
                break;
            }
            case 1:
            {
                this.popupState = POPUP_STATE.NONE;
                this.optionsNameLabel.text = PlayerOptions.instance.options.playerName = this.popupTextField.text;
                break;
            }
            default:
            {
                break;
            }
            }
        }
    }
Beispiel #5
0
    private void OnGUI()
    {
        if ( this.popupState != POPUP_STATE.NONE )
        {
            GUI.enabled = false;
        }

        switch ( this.state )
        {
        case STATE.MAIN:
        {
            this.RenderMainGUI();
            break;
        }
        case STATE.LOBBY:
        {
            this.RenderLobbyGUI();
            break;
        }
        case STATE.CREATE_GAME:
        {
            this.RenderCreateGameGUI();
            break;
        }
        case STATE.SERVER_LIST:
        {
            this.RenderServerListGUI();
            break;
        }
        case STATE.CONNECTING:
        {
            this.RenderConnectingGUI();
            break;
        }
        case STATE.OPTIONS:
        {
            this.RenderOptionsGUI();
            break;
        }
        default:
        {
            DebugConsole.Error( "Uncaught menu state \"" + this.state + "\"", this );
            break;
        }
        }

        if ( this.popupState != POPUP_STATE.NONE )
        {
            int result = this.RenderPopUpWindow();

            if ( result == 1 )
            {
                this.popupState = POPUP_STATE.NONE;
            }
        }

        GUI.enabled = true;
    }
Beispiel #6
0
    public void StartMessagePopup( string _title , string _label, string _closeButtonString = "Close" )
    {
        this.popupState = POPUP_STATE.MESSAGE;

        //this.popupLabelText = _labelText;
        //this.popupButtonText = _buttonText;
        this.popupTitleLabel.text = _title;
        this.popupLabelLabel.text = _label;
        this.popupCloseButton.text = _closeButtonString;
    }
Beispiel #7
0
    public void StartEnterTextPopup( string _title, string _label, string _startingString = "",
	                                string _cancelButtonText = "Cancel", string _acceptButtonSString = "Accept" )
    {
        this.popupState = POPUP_STATE.ENTER_TEXT;
        this.popupTitleLabel.text = _title;
        this.popupLabelLabel.text = _label;
        this.popupTextField.text = _startingString;
        this.popupCancelButton.text = _cancelButtonText;
        this.popupAcceptButton.text = _acceptButtonSString;
    }
Beispiel #8
0
 void SetState(POPUP_STATE _state)
 {
     current     = _state;
     DEBUG_STATE = _state.ToString();
 }
Beispiel #9
0
    public void OnClickLeftButton(int num)
    {
        popupState = (POPUP_STATE)num;
        SetImageIconBackButton(popupState);
        switch ((POPUP_STATE)num)
        {
        case POPUP_STATE.Servant:
        {
            SetTextBackButton("Party");
            objSubView = Instantiate(Resources.Load("UI/Lobby/PartyInfoVC")) as GameObject;
            objSubView.transform.SetParent(this.transform);
            objSubView.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
            BackbuttonUI.SetActive(true);
            imageBackButtonIcon.sprite = Resources.Load <Sprite>("UI/Lobby/Image/icon_party_info");
        }
        break;

        case POPUP_STATE.Weapon:
        {
            SetTextBackButton("Inventory");
            objSubView = Instantiate(Resources.Load("UI/Lobby/InventoryVC")) as GameObject;
            objSubView.transform.SetParent(this.transform);
            objSubView.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
            BackbuttonUI.SetActive(true);
            imageBackButtonIcon.sprite = Resources.Load <Sprite>("UI/Lobby/Image/icon_inventory");
        }
        break;

        case POPUP_STATE.EOS:
        {
            SetTextBackButton("Shop");
            objSubView = Instantiate(Resources.Load("UI/Lobby/ShopInfoVC")) as GameObject;
            objSubView.transform.SetParent(this.transform);
            objSubView.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
            BackbuttonUI.SetActive(true);
            imageBackButtonIcon.sprite = Resources.Load <Sprite>("UI/Lobby/Image/icon_shop");

            PacketManager.Inst.RequestLocalShopInfo(SHOP_TYPE.EOS);
        }
        break;

        case POPUP_STATE.Gacha:
        {
            SetTextBackButton("Gacha");
            objSubView = Instantiate(Resources.Load("UI/Lobby/GachaScene")) as GameObject;
            objSubView.transform.SetParent(this.transform);
            objSubView.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
            BackbuttonUI.SetActive(true);

            LobbySound.SetActive(false);
            GachaSound.SetActive(true);
        }
        break;

        case POPUP_STATE.Stage:
        {
            SetTextBackButton("Stage");
            objSubView = Instantiate(Resources.Load("UI/Lobby/StageScene")) as GameObject;
            objSubView.transform.SetParent(this.transform);
            objSubView.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
            BackbuttonUI.SetActive(true);
        }
        break;

        default:
            DebugLog.Log(false, "Invalid State : " + num.ToString());
            popupState = POPUP_STATE.Servant;
            return;
        }

        EtcSetActiveWithAnimation(false);
        accountInfoUI.SetActive(false);
        BackbuttonUI.SetActive(true);
    }