public void InputFieldSelectedRegister(InputField _inpf)
    {
        _inpf.transform.FindChild("Text").GetComponent<Text>().color = green;
        _inpf.GetComponent<Image>().sprite = defaultLogin_sprite;
        errorText_go.SetActive(false);

        _inpf.placeholder.gameObject.SetActive(false);

        // Go to LateUpdate
        isInputActive = true;
        currentInpf = _inpf;
    }
Example #2
0
    /**
     * Prepares a text area and an accept button to create a new game
     */
    public void NewGame()
    {
        if (character == null) {
            character = Instantiate (text) as InputField;
            save = Instantiate (apply) as Button;

            character.transform.SetParent(canvas.transform);
            save.transform.SetParent(canvas.transform);

            character.GetComponent<RectTransform>().localPosition = new Vector2(-50, -200);
            save.GetComponent<RectTransform>().localPosition = new Vector2(100, -200);

            save.onClick.AddListener(() => StartGame());
            save.onClick.AddListener(() => GameControl.control.LoadNextScreen("Overworld"));
        }
    }
    public void ChangeScene()
    {
        loginID = id_field.GetComponent <InputField>().text;
        loginPW = pw_field.GetComponent <InputField>().text;

        if (loginID == "aaa" && loginPW == "1234")
        {
            PlayerPrefs.SetString("loginID", loginID);
            PlayerPrefs.SetString("loginPW", loginPW);

            SceneManager.LoadScene("SampleScene");
        }
        else
        {
            //
            Debug.Log("아이디 또는 패스워드가 잘못되었습니다.");
            //팝업 활성화
        }
    }
Example #4
0
        private void OnItemBeginEdit(object sender, VirtualizingTreeViewItemDataBindingArgs e)
        {
            ExposeToEditor dataItem = (ExposeToEditor)e.Item;

            if (dataItem != null)
            {
                InputField inputField = e.EditorPresenter.GetComponentInChildren <InputField>(true);
                inputField.text = dataItem.name;
                inputField.ActivateInputField();
                inputField.Select();
                LayoutElement layout = inputField.GetComponent <LayoutElement>();

                Text text = e.ItemPresenter.GetComponentInChildren <Text>(true);
                text.text = dataItem.name;

                RectTransform rt = text.GetComponent <RectTransform>();
                layout.preferredWidth = rt.rect.width;
            }
        }
Example #5
0
    public void Objects()
    {
        string user = username.GetComponent <InputField>().text;

        PlayerPrefs.SetString("username", user);

        PlayerPrefs.SetFloat("time", timeSlider.value);

        PlayerPrefs.SetInt("lives", lives.value);

        if (check == false)
        {
            startLife = 9;
        }
        else
        {
            startLife = dropLife;
        }
    }
Example #6
0
    public void AddCharacter(string character)
    {
        if (texto.Length < limiteCaracteres)
        {
            texto             = String.Concat(texto, character);
            _display.text     = texto;
            currentInput.text = texto;

            if (currentInput.GetComponent <BehaviourInputField>())
            {
                if (currentInput.GetComponent <BehaviourInputField>()._isMath)
                {
                    currentInput.GetComponent <BehaviourInputField>().SetStateEmpty(currentInput.text);
                }
                else
                {
                    currentInput.GetComponent <BehaviourInputField>().SetEmptyStandard(currentInput.text);
                }
            }
        }
    }
    public void RegisterConfirm()
    {
        planet_name      = planet_name_input.text;
        nickname         = nickname_input.text;
        email            = planet_email_input.text;
        password         = password_input.text;
        confirm_password = confim_password_input.text;

        if (planet_name != "" && email != "" && password != "" && confirm_password != "" && nickname != "")
        {
            if (password == confirm_password)
            {
                StartCoroutine(RegisterUser());
            }
            else
            {
                password_input.transform.FindChild("Text").GetComponent <Text>().color = red;
                password_input.GetComponent <Image>().sprite = errorLogin_sprite;
                confim_password_input.transform.FindChild("Text").GetComponent <Text>().color = red;
                confim_password_input.GetComponent <Image>().sprite = errorLogin_sprite;

                errorText_go.SetActive(true);
                errorText_go.GetComponent <Text>().text = "Ошибка:\nПароли не совпадают.";
            }
        }
        else
        {
            planet_name_input.transform.FindChild("Text").GetComponent <Text>().color = red;
            planet_name_input.GetComponent <Image>().sprite = errorLogin_sprite;
            nickname_input.transform.FindChild("Text").GetComponent <Text>().color = red;
            nickname_input.GetComponent <Image>().sprite = errorLogin_sprite;
            planet_email_input.transform.FindChild("Text").GetComponent <Text>().color = red;
            planet_email_input.GetComponent <Image>().sprite = errorLogin_sprite;
            password_input.transform.FindChild("Text").GetComponent <Text>().color = red;
            password_input.GetComponent <Image>().sprite = errorLogin_sprite;
            confim_password_input.transform.FindChild("Text").GetComponent <Text>().color = red;
            confim_password_input.GetComponent <Image>().sprite = errorLogin_sprite;

            errorText_go.SetActive(true);
            errorText_go.GetComponent <Text>().text = "Ошибка:\nЗаполните все поля.";
        }
    }
Example #8
0
    void Update()
    {
        var titleRect = title.GetComponent <RectTransform>();
        var newHeight = UIHelper.CalculateTextFieldHeight(title, 30);

        titleRect.sizeDelta = new Vector2(titleRect.sizeDelta.x, newHeight);

        resizePanel.sizeDelta = new Vector2(resizePanel.sizeDelta.x,
                                            title.GetComponent <RectTransform>().sizeDelta.y
                                            + url.GetComponent <RectTransform>().sizeDelta.y
                                            + imagePreview.rectTransform.sizeDelta.y
                                            //Padding, spacing, button, fudge factor
                                            + 20 + 30 + 30 + 20);

        canvas.transform.rotation = Camera.main.transform.rotation;

        if (url.text != prevURL && !String.IsNullOrEmpty(url.text))
        {
            answerURL = url.text;
            prevURL   = url.text;

            if (!Regex.IsMatch(answerURL, "http://|https://"))
            {
                answerURL = "file:///" + url.text;
            }

            www         = new WWW(answerURL);
            downloading = true;
        }

        if (downloading && www.isDone)
        {
            var texture = www.texture;
            imagePreview.texture = texture;
            var width  = imagePreview.rectTransform.sizeDelta.x;
            var ratio  = texture.width / width;
            var height = texture.height / ratio;
            imagePreview.rectTransform.sizeDelta = new Vector2(width, height);

            downloading = false;
        }
    }
Example #9
0
    void Update()
    {
        KeyCode inserted;

        if (Input.anyKeyDown)
        {
            //inserted = KeyCode.Insert;
            //var temp = inserted;
        }
        if (input.caretPosition < 6)
        {
            input.caretPosition = 6;
        }

        if (input.text.Length < 5)
        {
            input.text = "Stack.";
        }
        input.GetComponent <InputField>().placeholder.GetComponent <Text>().text = "Stack.push() pop()";
    }
Example #10
0
    public void confirmPasswordCheck()
    {
        Image confirmPasswordImage = confirmPasswordInput.GetComponent <Image>();

        if (confirmPasswordInput.text == passwordInput.text)
        {
            confirmPasswordImage.color = Color.green;
            isValidArray[PSWMV]        = true;
        }
        else if (confirmPasswordInput.text == "")
        {
            confirmPasswordImage.color = Color.white;
            isValidArray[PSWMV]        = false;
        }
        else
        {
            confirmPasswordImage.color = Color.red;
            isValidArray[PSWMV]        = false;
        }
    }
Example #11
0
    //-----------------------------------------------------------------
    //! @summary   現在の時間の入力があった時の処理
    //!
    //! @parameter [void] なし
    //!
    //! @return    なし
    //-----------------------------------------------------------------
    public void OnEndEditNowTimeInputField()
    {
        // 入力が無い場合、もしくはマイナスの値だった場合は現在の時間で設定する
        if ((m_nowTimeInputField.text == "") || (float.Parse(m_nowTimeInputField.text) < 0))
        {
            // 現在の時間を取得
            float time = m_musicalScoreController.GetNowTime();

            // 表示する
            m_nowTimeInputField.text
                  = m_nowTimeInputField.GetComponent <RectTransform>().GetChild(1).GetComponent <Text>().text
                  = time.ToString();

            // 処理を終了する
            return;
        }

        // スクロールバーを指定された時間の位置まで移動する
        m_musicalScoreController.SetNowTime(float.Parse(m_nowTimeInputField.text));
    }
Example #12
0
    public void BotaoPerfil(GameObject a)
    {
        Color c;

        ColorUtility.TryParseHtmlString("#C2C2C25F", out c);

        if (PlayerPrefs.HasKey("Nome"))
        {
            Sistema.instancia.BotaoSom();
            SceneManager.LoadScene("Perfil");
            Sistema.instancia.SetClick(1);
        }
        else
        {
            LimparCampos();
            inputIdade.GetComponent <Image>().color = c;
            inputNome.GetComponent <Image>().color  = c;
            ShowPopup(a);
        }
    }
Example #13
0
    private void InitOptionsInputfield()
    {
        optionNameInputField.Select();
        optionNameInputField.ActivateInputField();

        EventTrigger eventTrigger = optionNameInputField.GetComponent <EventTrigger>();

        EventTrigger.Entry deselectEntry = new EventTrigger.Entry();
        deselectEntry.eventID = EventTriggerType.Deselect;
        deselectEntry.callback.AddListener((data) => { OnDeselect(data); });

        optionNameInputField.onEndEdit.AddListener(delegate { OnEndEdit(optionNameInputField); });

        EventTrigger.Entry selectEntry = new EventTrigger.Entry();
        selectEntry.eventID = EventTriggerType.Select;
        selectEntry.callback.AddListener((data) => { OnSelect(data); });

        eventTrigger.triggers.Add(deselectEntry);
        eventTrigger.triggers.Add(selectEntry);
    }
Example #14
0
    public void Actualizar()
    {
        if (RevisarInputs() == false)
        {
            return;
        }
        AbrirConexion();

        dbCmd = dbCon.CreateCommand(); //   La consulta de la tabla en la base de datos
        Debug.Log("Antes de Agregar");
        dbCmd.CommandText = "UPDATE usuarios SET nombre = '" + input1.GetComponent <Text>().text + "', NOMBRE = '" + input1.GetComponent <Text>().text + "' WHERE IdUsuario =  " + input1.GetComponent <Text>().text;
        dbCmd.ExecuteNonQuery();
        Debug.Log("Se ha Actualizado el registro");
        txtAcciones.text += "Se ha Actualizado el registro \n";
        dbCmd.Dispose();
        dbCmd = null;
        dbCon.Close();
        dbCon             = null;
        txtAcciones.text += "Cerrando Conexion \n";
    }
Example #15
0
        protected override bool SetupView()
        {
            InputField component = base.view.transform.Find("Dialog/Content/InputField").GetComponent <InputField>();

            component.characterLimit = 0;
            component.GetComponent <InputFieldHelper>().mCharacterlimit = 40;
            base.view.transform.Find("Dialog/Content/Room").gameObject.SetActive(this._mode == Mode.World);
            base.view.transform.Find("Dialog/Content/WorldModeBtn").gameObject.SetActive(this._mode == Mode.World);
            base.view.transform.Find("Dialog/Content/GuildModeBtn").gameObject.SetActive(this._mode == Mode.Guild);
            base.view.transform.Find("Dialog/Content/FriendModeBtn").gameObject.SetActive(this._mode == Mode.Friend);
            base.view.transform.Find("Dialog/Content/Friend").gameObject.SetActive(this._mode == Mode.Friend);
            base.view.transform.Find("Dialog/TabBtns/GuildBtn").GetComponent <Button>().enabled = false;
            this.UpdateFriendListOpenState();
            this.UpdateNewMsgBtnTip();
            this.SetupChannelView();
            this.SetupChatList();
            this.SetupFriendList();
            this.SetupTabView();
            return(false);
        }
        public static void InsertEventSubmit(this InputField target, string strEvent, object objParam)
        {
            if (target == null)
            {
                Debug.LogError("insert event fail,because InputField is null.");
                return;
            }
            if (string.IsNullOrEmpty(strEvent))
            {
                Debug.LogError("insert event fail,because string event is null.");
            }

            XUEventListenerBase listenerBase = target.GetComponent <XUEventListenerBase>();

            if (listenerBase == null)
            {
                target.gameObject.AddComponent <XUInputFieldListener>().SetEventSubmit(strEvent, objParam, eventDelegateXU);
            }
            else
            {
                if (listenerBase is XUInputFieldListener)
                {
                    (listenerBase as XUInputFieldListener).SetEventSubmit(strEvent, objParam, eventDelegateXU);
                }
                else
                {
                    Dictionary <EventTriggerType, Dictionary <string, object> > eventMap = listenerBase.GetEventMap();
                    Object.DestroyImmediate(listenerBase);

                    XUInputFieldListener listener = target.gameObject.AddComponent <XUInputFieldListener>();
                    foreach (var keyValue in eventMap)
                    {
                        foreach (var keyValue1 in keyValue.Value)
                        {
                            listener.SetEvent(keyValue.Key, keyValue1.Key, keyValue1.Value, eventDelegate);
                        }
                    }
                    listener.SetEventSubmit(strEvent, objParam, eventDelegateXU);
                }
            }
        }
Example #17
0
    //Called by QuizToggle before deactivating this canvas.
    public void DetermineInitialPositions()
    {
        //Set initial positions for deactivate
        initialQuestionFieldPos       = questionField.GetComponent <RectTransform> ().anchoredPosition;
        initialQuestionFieldAnchorMin = questionField.GetComponent <RectTransform> ().anchorMin;
        initialQuestionFieldAnchorMax = questionField.GetComponent <RectTransform> ().anchorMax;

        initialActualAnswerPos            = actualAnswerField.GetComponent <RectTransform> ().anchoredPosition;
        initialActualAnswerFieldAnchorMin = actualAnswerField.GetComponent <RectTransform> ().anchorMin;
        initialUserAnswerFieldAnchorMax   = actualAnswerField.GetComponent <RectTransform> ().anchorMax;

        initialUserAnswerPos            = userAnswerField.GetComponent <RectTransform> ().anchoredPosition;
        initialUserAnswerFieldAnchorMin = userAnswerField.GetComponent <RectTransform> ().anchorMin;
        initialUserAnswerFieldAnchorMax = userAnswerField.GetComponent <RectTransform> ().anchorMax;
    }
Example #18
0
    private void ResetClick()
    {
        WaistPosInput = WaistPosInput.GetComponent <InputField>();

        this.x = Frame.Pose.position.x;
        this.y = Frame.Pose.position.y;
        this.z = Frame.Pose.position.z;

        this.qx = Frame.Pose.rotation.x;
        this.qy = Frame.Pose.rotation.y;
        this.qz = Frame.Pose.rotation.z;
        this.qw = Frame.Pose.rotation.w - 1F;

        this.waist = float.Parse(WaistPosInput.text) / 100;

        PlayerPrefs.SetFloat(configdate.WAIST, waist);
        PlayerPrefs.Save();

        Quaternion qtmp = new Quaternion(Frame.Pose.rotation.x - qx,
                                         Frame.Pose.rotation.y - qy,
                                         Frame.Pose.rotation.z - qz,
                                         Frame.Pose.rotation.w - qw);

        myPos.transform.rotation = qtmp;
        textDebug.text           = "ip:" + this.ip + "\n";

        textDebug.text += "X:" + myPos.transform.position.x + " \n"
                          + "Y:" + (myPos.transform.position.y + waist) + "\n"
                          + "Z:" + myPos.transform.position.z + "\n"
                          + "qX:" + myPos.transform.rotation.x + "\n"
                          + "qY:" + myPos.transform.rotation.y + "\n"
                          + "qZ:" + myPos.transform.rotation.z + "\n"
                          + "qW:" + myPos.transform.rotation.w + "\n"
                          + "off_x:" + this.x + "\n"
                          + "off_y:" + this.y + "\n"
                          + "off_z:" + this.z + "\n"
                          + "off_qx:" + this.qx + "\n"
                          + "off_qy:" + this.qy + "\n"
                          + "off_qz:" + this.qz + "\n"
                          + "off_q2:" + this.qw + "\n";
    }
        void Start()
        {
            theLineMarker.initLineMarker(this, theFocusLord);

            inputRect = theInputField.GetComponent <RectTransform>();

            startYPos = inputRect.anchoredPosition.y;
            InitTextFields();

            theInputField.onValidateInput += delegate(string input, int charIndex, char addedChar) { return(MyValidate(addedChar, charIndex)); };
            theInputField.onValueChanged.AddListener(_ => doValidateInput());

            theFocusLord.initReferences(theInputField, this);

            // poor mans reActivate
            theFocusLord.stealFocus    = true;
            theInputField.interactable = true;

            ColorCodeDaCode();
            FocusCursor();
        }
        public InputFieldScroller(SliderScrollbar sliderScroller, InputField inputField)
        {
            Instances.Add(this);

            this.sliderScroller = sliderScroller;
            this.inputField     = inputField;

            inputField.onValueChanged.AddListener(OnTextChanged);

            inputRect         = inputField.GetComponent <RectTransform>();
            layoutElement     = inputField.gameObject.AddComponent <LayoutElement>();
            parentLayoutGroup = inputField.transform.parent.GetComponent <VerticalLayoutGroup>();

            layoutElement.minHeight = 25;
            layoutElement.minWidth  = 100;

            if (!canvasScaler)
            {
                canvasScaler = UIManager.CanvasRoot.GetComponent <CanvasScaler>();
            }
        }
    public void StartGame()
    {
        SceneManager.LoadScene("2Game");

        string user = username.GetComponent <InputField>().text;

        PlayerPrefs.SetString("username", user);

        PlayerPrefs.SetFloat("time", timeSlider.value);

        PlayerPrefs.SetInt("lives", lives.value);

        if (check == false)
        {
            startLife = 9;
        }
        else
        {
            startLife = dropLife;
        }
    }
Example #22
0
    public void getFriendImageUrl(string id, Image image, GameObject imobject)
    {
        GetUserDataRequest getdatarequest = new GetUserDataRequest()
        {
            PlayFabId = id,
        };

        PlayFabClientAPI.GetUserData(getdatarequest, (result) =>
        {
            Dictionary <string, UserDataRecord> data = result.Data;
            imobject.SetActive(true);
            if (data.ContainsKey("PlayerAvatarUrl"))
            {
                // image.GetComponent<MonoBehaviour>().StartCoroutine(loadImage(data["PlayerAvatarUrl"].Value, image));
                filterInputField.GetComponent <MonoBehaviour>().StartCoroutine(loadImage(data["PlayerAvatarUrl"].Value, image));
            }
        }, (error) =>
        {
            Debug.Log("Data updated error " + error.ErrorMessage);
        }, null);
    }
Example #23
0
    public void onbtnLogin()
    {
        string email    = Email.text;
        string password = Password.text;

        if (string.IsNullOrEmpty(email))
        {
            Email.Select();
            Email.ActivateInputField();
            return;
        }

        if (string.IsNullOrEmpty(password))
        {
            Password.Select();
            Password.GetComponent <InputField>().ActivateInputField();
            return;
        }

        mm.EmailLogin(email, password);
    }
Example #24
0
    IEnumerator Confirm()
    {
        string writtenText = inputField.GetComponent <InputField>().text + " ";

        confirmedText.text = writtenText;
        inputField.text    = "";
        confirmButton.gameObject.SetActive(false);
        inputField.gameObject.SetActive(false);

        yield return(new WaitForSeconds(1f));

        string moreText = GetResultMonologue(CarryData.Instance.result).Next().Speech;

        for (int i = 0; i < moreText.Length; i++)
        {
            confirmedText.text += moreText[i];
            yield return(new WaitForSeconds(.05f));
        }

        StartCoroutine(FinishDay());
    }
Example #25
0
    protected override void OnAwake()
    {
        if (m_difficultyDropdown != null)
        {
            m_difficultyDropdown.options.Clear();

            for (int i = 0; i < Util.GetEnumNum <GameDifficult>(); ++i)
            {
                GameDifficult item = (GameDifficult)i;
                m_difficultyDropdown.options.Add(new Dropdown.OptionData(item.ToString()));
            }
            m_difficultyDropdown.captionText.text = m_difficultyDropdown.options[0].text;
        }
        m_monsterNum.contentType        = InputField.ContentType.IntegerNumber;
        m_monsterNum.text               = "1";
        m_greaterRifitLevelImage        = m_greaterRifitLevel.GetComponent <Image>();
        m_greaterRifitLevel.contentType = InputField.ContentType.IntegerNumber;
        m_greaterRifitLevel.text        = "1";
        m_greaterRifitLevelImage.color  = Color.gray;
        m_greaterRifitLevel.enabled     = false;
    }
    void ButtonValue()
    {
        var input_task = tugas.GetComponent <InputField>();
        var input_desc = deskripsi.GetComponent <InputField>();
        var input_cost = lamanya.GetComponent <InputField>();

        var se_task = new InputField.SubmitEvent();
        var se_desc = new InputField.SubmitEvent();
        var se_cost = new InputField.SubmitEvent();

        se_task.AddListener(submit_task);
        se_desc.AddListener(submit_desc);
        se_cost.AddListener(submit_cost);

        input_task.onEndEdit = se_task;
        input_desc.onEndEdit = se_desc;
        input_cost.onEndEdit = se_cost;

        back.onClick.AddListener(Home);
        submit.onClick.AddListener(Submit);
    }
    public void ButtonClick()
    {
        switch (transform.name)
        {
        case "CreateButton":
            Debug.Log("「作成する」を押した");

            string name = "";

            //  入力されたテキストから名前を取得
            this.inputField = inputField.GetComponent <InputField>();
            name            = inputField.text;

            // 選択された職業の取得
            string selectedLabel = toggleGroup.ActiveToggles().First().GetComponentsInChildren <Text>()
                                   .First(t => t.name == "Label").text;
            Debug.Log(selectedLabel + "が選択された");

            // キャラクターの追加
            ProcessingSQL countSQL = new ProcessingSQL();
            countSQL.InsertSQL(name, selectedLabel);

            //
            CharacterList.CharacterName = name;
            Debug.Log(CharacterList.CharacterName);

            Debug.Log("キャラクター作成終了");
            // キャラクター作成完了画面に遷移
            SceneManager.LoadScene("CreateResult");
            break;

        case "BackButton":
            Debug.Log("「戻る」を押した");
            SceneManager.LoadScene("CharacterList");
            break;

        default:
            break;
        }
    }
        private void RefreshStartText()
        {
            if (!ShowDefaultText)
            {
                return;
            }

            if (this.StartedTyping)
            {
                if (_wish.sortingOrder > _like.sortingOrder)
                {
                    // I wish
                    if (_message.text.Equals(this.becauseText) || !StartedTyping)
                    {
                        _message.text = this.wouldText;
                    }
                }
                else
                {
                    // I like
                    if (_message.text.Equals(this.wouldText) || !StartedTyping)
                    {
                        _message.text = this.becauseText;
                    }
                }

                _message.GetComponent <InputField>().MoveTextEnd(true);
            }
            else
            {
                if (_wish.sortingOrder > _like.sortingOrder)
                {
                    // I wish
                    if (_message.text.Equals(this.becauseText) || !StartedTyping)
                    {
                        _message.text = this.wouldText;
                    }
                }
            }
        }
Example #29
0
    void Update()
    {
        if (imageEditorState == ImageEditorState.Opening)
        {
            if (explorerPanel != null)
            {
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    Destroy(explorerPanel.gameObject);
                    imageEditorState = ImageEditorState.Showing;
                }
            }

            if (explorerPanel != null && explorerPanel.answered)
            {
                foreach (string path in explorerPanel.answerPaths)
                {
                    if (entries.Count < MAXANSWERS)
                    {
                        CreateNewEntry(path, false);
                    }
                }

                imageEditorState = ImageEditorState.Showing;

                Destroy(explorerPanel.gameObject);

                //NOTE(Simon): Reset the background color, in case it was red/invalid previously
                var background = imageAlbumList.parent.parent.GetComponent <Image>();
                background.color = defaultPanelColor;
            }
        }

        if (imageEditorState == ImageEditorState.Showing)
        {
            var   titleRect = question.GetComponent <RectTransform>();
            float newHeight = UIHelper.CalculateInputFieldHeight(question, 3);
            titleRect.sizeDelta = new Vector2(titleRect.sizeDelta.x, newHeight);
        }
    }
Example #30
0
    public void OnLoginBack(ProtocolBase proto)
    {
        //在这里获取这次游戏的对局信息,包括玩家数量、状态
        int           start     = 0;
        ProtocolBytes protocol  = (ProtocolBytes)proto;
        string        protoName = protocol.GetString(start, ref start);
        int           Ret       = protocol.GetInt(start, ref start);

        if (Ret == 0)
        {
            Debug.Log("登录成功");
            GameMgr.instance.local_player_ID = IDInput.GetComponent <InputField>().text;
            Debug.Log("GameManager.instance.player_ID is " + GameMgr.instance.local_player_ID);

            MenuPanel.SetActive(true);
            this.gameObject.SetActive(false);
        }
        else
        {
            Debug.Log("登录失败");
        }
    }
Example #31
0
        public void OnClickHost()
        {
            if (!playerNameInput.text.Equals(""))
            {
                //Start new Server
                SafeIP();

                NetworkClient nc = lobbyManager.StartHost();
                if (nc == null)
                {
                    lobbyManager.StopHostClbk();
                    lobbyManager.SetStatusInfo("Failed to start server!");
                }

                //Set player name
                LobbyManager.LocalPlayerName = playerNameInput.text;
            }
            else
            {
                StartCoroutine(playerNameInput.GetComponent <BlinkingImage>().blinkOnce());
            }
        }
Example #32
0
    public void VerificaInput(InputField input)
    {
        SetId inputAtual = input.GetComponent <SetId>();

        Debug.Log("Meu ID é = " + inputAtual.Id);
        Debug.Log("entrada: " + inputs[inputAtual.Id].text);
        Debug.Log("reposta: " + resp[inputAtual.Id]);
        //TODO: CONVERTER TODA A ENTRADA P MINUSCULO
        if (resp[inputAtual.Id].Equals(inputs[inputAtual.Id].text))
        {
            //Debug.Log("resposta certa");
            //inputs[inputAtual.Id].image.color = new Color32(69, 202, 35, 255); //cor verde
            _acertos[inputAtual.Id] = 1;
        }
        else
        {
            //Debug.Log("resposta errada");
            // inputs[inputAtual.Id].image.color = new Color32(202, 41, 49, 255);//cor vermelha
            _acertos[inputAtual.Id] = 0;
        }
        VerficaAcertos();
    }
Example #33
0
	void InitComponents ()
	{
		uiPanel = GameObject.Find ("SendBirdUnity/UIPanel");
		(Instantiate (uiThemePrefab) as GameObject).transform.parent = uiPanel.transform;

		uiTheme = GameObject.FindObjectOfType (typeof(SendBirdTheme)) as SendBirdTheme;

		#region MenuPanel

		menuPanel = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel");
		menuPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG;

		var txtMenuTitle = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/TxtTitle").GetComponent<Text> ();
		txtMenuTitle.color = uiTheme.titleColor;

		btnConnect = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnConnect").GetComponent<Button> ();
		btnConnect.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnConnect.GetComponent<Image> ().type = Image.Type.Sliced;
		btnConnect.onClick.AddListener (() => {
			nickname = inputUserName.text;
			userId = nickname; // Assign user's unique id.

			if (nickname == null || nickname.Length <= 0) {
				return;
			}

			SendBirdClient.Connect (userId, (user, e) => {
				if (e != null) {
					Debug.Log (e.Code + ": " + e.Message);
					return;
				}


				btnConnect.gameObject.SetActive (false);

				btnOpenChannelList.gameObject.SetActive (true);
				btnStartGroupChannel.gameObject.SetActive (true);
				btnGroupChannelList.gameObject.SetActive (true);

				SendBirdClient.UpdateCurrentUserInfo (nickname, null, (e1) => {
					if (e1 != null) {
						Debug.Log (e.Code + ": " + e.Message);
						return;
					}

				});
			});
		});


		btnOpenChannelList = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnOpenChannel").GetComponent<Button> ();
		btnOpenChannelList.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnOpenChannelList.GetComponent<Image> ().type = Image.Type.Sliced;
		btnOpenChannelList.onClick.AddListener (() => {
			menuPanel.SetActive (false);
			OpenOpenChannelList ();
		});

		btnStartGroupChannel = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnStartGroupChannel").GetComponent<Button> ();
		btnStartGroupChannel.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnStartGroupChannel.GetComponent<Image> ().type = Image.Type.Sliced;
		btnStartGroupChannel.onClick.AddListener (() => {
			menuPanel.SetActive (false);

			OpenUserList ();
		});

		btnGroupChannelList = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/BtnGroupChannel").GetComponent<Button> ();
		btnGroupChannelList.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnGroupChannelList.GetComponent<Image> ().type = Image.Type.Sliced;
		btnGroupChannelList.onClick.AddListener (() => {
			menuPanel.SetActive (false);

			OpenGroupChannelList ();
		});

		inputUserName = GameObject.Find ("SendBirdUnity/UIPanel/MenuPanel/InputUserName").GetComponent<InputField> ();
		inputUserName.GetComponent<Image> ().sprite = uiTheme.inputTextBG;

		#endregion

		#region OpenChannel

		openChannelPanel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel");
		openChannelPanel.GetComponent<Image> ().sprite = uiTheme.chatFrameBG;

		txtOpenChannelContent = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/ScrollArea/TxtContent").GetComponent<Text> (); // (Text);
		txtOpenChannelContent.color = uiTheme.messageColor;

		txtOpenChannelTitle = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/TxtTitle").GetComponent<Text> ();
		txtOpenChannelTitle.color = uiTheme.titleColor;

		openChannelScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/Scrollbar").GetComponent<Scrollbar> ();

		ColorBlock cb = openChannelScrollbar.colors;
		cb.normalColor = uiTheme.scrollBarColor;
		cb.pressedColor = uiTheme.scrollBarColor;
		cb.highlightedColor = uiTheme.scrollBarColor;
		openChannelScrollbar.colors = cb;
		openChannelScrollbar.onValueChanged.AddListener ((float value) => {
			if (value <= 0) {
				autoScroll = true;
				lastTextPositionY = txtOpenChannelContent.transform.position.y;
				return;
			}

			if (lastTextPositionY - txtOpenChannelContent.transform.position.y >= 100) {
				autoScroll = false;
			}

			lastTextPositionY = txtOpenChannelContent.transform.position.y;
		});

		inputOpenChannel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel").GetComponent<InputField> ();
		inputOpenChannel.GetComponent<Image> ().sprite = uiTheme.inputTextBG;
		inputOpenChannel.onEndEdit.AddListener ((string msg) => {
			SubmitOpenChannel ();
		});

		GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Placeholder").GetComponent<Text> ().color = uiTheme.inputTextPlaceholderColor;
		GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/InputOpenChannel/Text").GetComponent<Text> ().color = uiTheme.inputTextColor;

		btnOpenChannelSend = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelSend").GetComponent<Button> ();
		btnOpenChannelSend.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnOpenChannelSend.GetComponentInChildren<Text> ().color = uiTheme.sendButtonColor;
		btnOpenChannelSend.onClick.AddListener (() => {
			SubmitOpenChannel ();
		});

		btnOpenChannelClose = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelPanel/BtnOpenChannelClose").GetComponent<Button> ();
		btnOpenChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
		btnOpenChannelClose.onClick.AddListener (() => {
			openChannelPanel.SetActive (false);
			menuPanel.SetActive (true);
		});

		#endregion

		#region ChannelList

		openChannelListPanel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel");
		openChannelListPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG;

		channelGridPannel = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/ScrollArea/GridPanel");

		GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor;

		var channelScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/Scrollbar").GetComponent<Scrollbar> ();
		cb = channelScrollbar.colors;
		cb.normalColor = uiTheme.scrollBarColor;
		cb.pressedColor = uiTheme.scrollBarColor;
		cb.highlightedColor = uiTheme.scrollBarColor;
		channelScrollbar.colors = cb;

		channelScrollbar.onValueChanged.AddListener ((float value) => {
			if (value <= 0) {
				LoadOpenChannels ();
			}
		});

		btnOpenChannelListClose = GameObject.Find ("SendBirdUnity/UIPanel/OpenChannelListPanel/BtnOpenChannelListClose").GetComponent<Button> ();
		btnOpenChannelListClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
		btnOpenChannelListClose.onClick.AddListener (() => {
			openChannelListPanel.SetActive (false);
			menuPanel.SetActive(true);
		});

		#endregion

		#region GroupChannel

		groupChannelPanel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel");
		groupChannelPanel.GetComponent<Image> ().sprite = uiTheme.chatFrameBG;

		txtGroupChannelTitle = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent<Text> ();
		txtGroupChannelTitle.color = uiTheme.titleColor;

		btnGroupChannelClose = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelClose").GetComponent<Button> ();
		btnGroupChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
		btnGroupChannelClose.onClick.AddListener (() => {
			groupChannelPanel.SetActive (false);
			menuPanel.SetActive (true);
		});

		txtGroupChannelContent = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/ScrollArea/TxtContent").GetComponent<Text> (); // (Text);
		txtGroupChannelContent.color = uiTheme.messageColor;

		txtGroupChannelTitle = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/TxtTitle").GetComponent<Text> ();
		txtGroupChannelTitle.color = uiTheme.titleColor;

		groupChannelScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/Scrollbar").GetComponent<Scrollbar> ();
		ColorBlock cb_groupChannel = groupChannelScrollbar.colors;
		cb_groupChannel.normalColor = uiTheme.scrollBarColor;
		cb_groupChannel.pressedColor = uiTheme.scrollBarColor;
		cb_groupChannel.highlightedColor = uiTheme.scrollBarColor;
		groupChannelScrollbar.colors = cb_groupChannel;
		groupChannelScrollbar.onValueChanged.AddListener ((float value) => {
			if (value <= 0) {
				autoScroll = true;
				lastTextPositionY = txtGroupChannelContent.transform.position.y;
				return;
			}

			if (lastTextPositionY - txtGroupChannelContent.transform.position.y >= 100) {
				autoScroll = false;
			}

			lastTextPositionY = txtGroupChannelContent.transform.position.y;
		});

		inputGroupChannel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel").GetComponent<InputField> ();
		inputGroupChannel.GetComponent<Image> ().sprite = uiTheme.inputTextBG;
		inputGroupChannel.onEndEdit.AddListener ((string msg) => {
			SubmitGroupChannel ();
		});

		GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Placeholder").GetComponent<Text> ().color = uiTheme.inputTextPlaceholderColor;
		GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/InputGroupChannel/Text").GetComponent<Text> ().color = uiTheme.inputTextColor;

		btnGroupChannelSend = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelPanel/BtnGroupChannelSend").GetComponent<Button> ();
		btnGroupChannelSend.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnGroupChannelSend.GetComponentInChildren<Text> ().color = uiTheme.sendButtonColor;
		btnGroupChannelSend.onClick.AddListener (() => {
			SubmitGroupChannel ();
		});

		#endregion

		#region UserList

		userListPanel = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel");
		userListPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG;

		userListGridPanel = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/ScrollArea/GridPanel");

		GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor;

		var userListScrollBar = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/Scrollbar").GetComponent<Scrollbar> ();
		cb = userListScrollBar.colors;
		cb.normalColor = uiTheme.scrollBarColor;
		cb.pressedColor = uiTheme.scrollBarColor;
		cb.highlightedColor = uiTheme.scrollBarColor;
		userListScrollBar.colors = cb;
		userListScrollBar.onValueChanged.AddListener ((float value) => {
			if (value <= 0) {
				LoadUsers ();
			}
		});

		btnUserListClose = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/BtnUserListClose").GetComponent<Button> ();
		btnUserListClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
		btnUserListClose.onClick.AddListener (() => {
			userListPanel.SetActive (false);
			menuPanel.SetActive (true);
		});

		btnInvite = GameObject.Find ("SendBirdUnity/UIPanel/UserListPanel/BtnInvite").GetComponent<Button> ();
		btnInvite.GetComponent<Image> ().sprite = uiTheme.sendButton;
		btnInvite.onClick.AddListener (() => {
			if(mUserList.Count <= 0)
			{
				return;
			}

			userListPanel.SetActive (false);
			groupChannelPanel.SetActive (true);

			GroupChannel.CreateChannelWithUserIds(mUserList, false, (channel, e) => {
				if(e != null)
				{
					Debug.Log(e.Code + ": " + e.Message);
					return;
				}

				currentChannel = channel;
				ResetGroupChannelContent();
				txtGroupChannelTitle.text = GetDisplayMemberNames(channel.Members);
			});
		});

		#endregion

		#region GroupChannelList

		groupChannelListPanel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel");
		groupChannelListPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG;

		groupChannelListGridPanel = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/ScrollArea/GridPanel");

		GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor;

		var groupChannelListScrollbar = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/Scrollbar").GetComponent<Scrollbar> ();
		cb = groupChannelListScrollbar.colors;
		cb.normalColor = uiTheme.scrollBarColor;
		cb.pressedColor = uiTheme.scrollBarColor;
		cb.highlightedColor = uiTheme.scrollBarColor;
		groupChannelListScrollbar.colors = cb;
		groupChannelListScrollbar.onValueChanged.AddListener ((float value) => {
			if (value <= 0) {
				LoadGroupChannels();
			}
		});

		btnGroupChannelClose = GameObject.Find ("SendBirdUnity/UIPanel/GroupChannelListPanel/BtnGroupChannelListClose").GetComponent<Button> ();
		btnGroupChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
		btnGroupChannelClose.onClick.AddListener (() => {
			groupChannelListPanel.SetActive (false);
			if (!groupChannelListPanel.activeSelf) {
				menuPanel.SetActive (true);
			}
		});

		#endregion

		uiPanel.SetActive (true);
		menuPanel.SetActive (true);
		openChannelListPanel.SetActive (false);
		openChannelPanel.SetActive (false);
		groupChannelPanel.SetActive (false);
		userListPanel.SetActive (false);
		groupChannelListPanel.SetActive (false);
	}
    void Start()
    {
        timeLimit = 1;
        messageList = new List<GameObject> ();

        messageInputObj = GameObject.Find("InputField");
        messageInput = messageInputObj.GetComponent<InputField>();

        messageFunctions = (MessageInputHelper)messageInput.GetComponent(typeof(MessageInputHelper));

        initMessages ();
    }
Example #35
0
    void InitComponents()
    {
        uiPanel = GameObject.Find ("JIVERUI/UIPanel");
        (Instantiate (uiThemePrefab) as GameObject).transform.parent = uiPanel.transform;

        uiTheme = GameObject.FindObjectOfType (typeof(JiverTheme)) as JiverTheme;
        mainPanel = GameObject.Find ("JIVERUI/UIPanel/MainPanel");
        mainPanel.GetComponent<Image> ().sprite = uiTheme.chatFrameBG;

        channelPanel = GameObject.Find ("JIVERUI/UIPanel/ChannelPanel");
        channelPanel.GetComponent<Image> ().sprite = uiTheme.channelListFrameBG;

        gridPannel = GameObject.Find ("JIVERUI/UIPanel/ChannelPanel/ScrollArea/GridPanel");

        txtContent = GameObject.Find("JIVERUI/UIPanel/MainPanel/ScrollArea/TxtContent").GetComponent<Text>();// (Text);
        txtContent.color = uiTheme.messageColor;

        txtTitle = GameObject.Find ("JIVERUI/UIPanel/MainPanel/TxtTitle").GetComponent<Text> ();
        txtTitle.color = uiTheme.titleColor;

        scrollbar = GameObject.Find ("JIVERUI/UIPanel/MainPanel/Scrollbar").GetComponent<Scrollbar>();
        ColorBlock cb = scrollbar.colors;
        cb.normalColor = uiTheme.scrollBarColor;
        cb.pressedColor = uiTheme.scrollBarColor;
        cb.highlightedColor = uiTheme.scrollBarColor;
        scrollbar.colors = cb;
        scrollbar.onValueChanged.AddListener ((float value) => {
            if(value <= 0) {
                autoScroll = true;
                lastTextPositionY = txtContent.transform.position.y;
                return;
            }

            if(lastTextPositionY - txtContent.transform.position.y >= 100) {
                autoScroll = false;
            }

            lastTextPositionY = txtContent.transform.position.y;
        });

        inputMessage = GameObject.Find ("JIVERUI/UIPanel/MainPanel/InputMessage").GetComponent<InputField> ();
        inputMessage.GetComponent<Image> ().sprite = uiTheme.inputTextBG;
        inputMessage.onEndEdit.AddListener ((string msg) => {
            Submit();
        });

        GameObject.Find ("JIVERUI/UIPanel/MainPanel/InputMessage/Placeholder").GetComponent<Text> ().color = uiTheme.inputTextPlaceholderColor;
        GameObject.Find ("JIVERUI/UIPanel/MainPanel/InputMessage/Text").GetComponent<Text> ().color = uiTheme.inputTextColor;

        btnSend = GameObject.Find ("JIVERUI/UIPanel/MainPanel/BtnSend").GetComponent<Button> ();
        btnSend.GetComponent<Image> ().sprite = uiTheme.sendButton;
        btnSend.GetComponentInChildren<Text> ().color = uiTheme.sendButtonColor;
        btnSend.onClick.AddListener (() => {
            Submit();
        });

        btnClan = GameObject.Find ("JIVERUI/UIPanel/MainPanel/BtnClan").GetComponent<Button> ();
        btnClan.GetComponent<Image> ().sprite = uiTheme.chatChannelButtonOff;
        btnClan.onClick.AddListener (() => {
            Connect ("jia_test.Clan");
            SelectTab(TAB_MODE.CLAN);
        });

        btnMainClose = GameObject.Find ("JIVERUI/UIPanel/MainPanel/BtnClose").GetComponent<Button> ();
        btnMainClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
        btnMainClose.onClick.AddListener (() => {
            uiPanel.SetActive(false);
        });

        GameObject.Find ("JIVERUI/UIPanel/ChannelPanel/TxtTitle").GetComponent<Text> ().color = uiTheme.titleColor;

        Scrollbar channelScrollbar = GameObject.Find ("JIVERUI/UIPanel/ChannelPanel/Scrollbar").GetComponent<Scrollbar>();
        cb = channelScrollbar.colors;
        cb.normalColor = uiTheme.scrollBarColor;
        cb.pressedColor = uiTheme.scrollBarColor;
        cb.highlightedColor = uiTheme.scrollBarColor;
        channelScrollbar.colors = cb;

        btnChannel = GameObject.Find ("JIVERUI/UIPanel/MainPanel/BtnChannel").GetComponent<Button> ();
        btnChannel.GetComponent<Image> ().sprite = uiTheme.chatChannelButtonOff;
        btnChannel.onClick.AddListener (() => {
            OpenChannelList();

        });

        btnChannelClose = GameObject.Find ("JIVERUI/UIPanel/ChannelPanel/BtnChannelClose").GetComponent<Button> ();
        btnChannelClose.GetComponent<Image> ().sprite = uiTheme.closeButton;
        btnChannelClose.onClick.AddListener (() => {
            channelPanel.SetActive(false);
        });

        uiPanel.SetActive (true);
        mainPanel.SetActive (true);
        channelPanel.SetActive (false);
    }