Esempio n. 1
0
 public void OnJoin(TMP_InputField roomName)
 {
     NetManager.instance.JoinRoom(roomName.text);
 }
 // Update is called once per frame
 public void Load()
 {
     joinClassroom = GetComponentInChildren <Button>();
     classCode     = GetComponentInChildren <TMP_InputField>();
     usernameText  = GetComponentInChildren <TMP_Text>();
 }
 private void Start()
 {
     Troom = GameObject.Find("Sala campo de texto").GetComponent <TMP_InputField>();
 }
Esempio n. 4
0
 public void OnEndEditPixelsMoved(TMP_InputField value)
 {
     slimeMoldManager.amountPixelsMoved = int.Parse(value.text);
 }
Esempio n. 5
0
 private void Awake()
 {
     selectionMade = false;
     inputField    = GetComponentInChildren <TMP_InputField>();
 }
Esempio n. 6
0
 public void SetArtName(TMP_InputField name)
 {
     m_artName  = name.text;
     m_dateTime = System.DateTime.Now.ToString("HH:mm MMMM dd, yyyy");
 }
            private static bool Studio_Init(Studio.Studio __instance, ref InputField ____inputFieldNow, ref TMP_InputField ____inputFieldTMPNow)
            {
                if (IsStudio)
                {
                    return(true);
                }

                Traverse.Create(__instance).Property("sceneInfo").SetValue(new SceneInfo());
                __instance.cameraLightCtrl.Init();
                ____inputFieldNow    = null;
                ____inputFieldTMPNow = null;
                TreeNodeCtrl treeNodeCtrl = __instance.treeNodeCtrl;

                treeNodeCtrl.onDelete = (Action <TreeNodeObject>)Delegate.Combine(treeNodeCtrl.onDelete, new Action <TreeNodeObject>(__instance.OnDeleteNode));
                TreeNodeCtrl treeNodeCtrl2 = __instance.treeNodeCtrl;

                treeNodeCtrl2.onParentage = (Action <TreeNodeObject, TreeNodeObject>)Delegate.Combine(treeNodeCtrl2.onParentage, new Action <TreeNodeObject, TreeNodeObject>(__instance.OnParentage));

                return(false);
            }
Esempio n. 8
0
    //***********************************************************************
    //кнопка добавить/редактировать, is_new=1 если добавление, иначе редактирование текущей
    public void btn_AddEdit_Category(int is_new = 0)
    {
        popup_is_new = is_new;
        //открытие попапа
        pnl_popups_backfon.SetActive(true);
        JsonSkillsTreeNode curNode = get_CatNodeByID(curCatID);

        popup_caption.text = "Добавление новой категории";
        if (is_new != 1)
        {
            popup_caption.text = "Редактирование категории [" + curCatID.ToString() + "]";
        }

        //поле: родительская категория
        //заполнение дроп-списка в попапе, только корневыми категориями
        TMP_Dropdown  popup_parent_dropdown = pnl_form.transform.Find("pnl_parent").GetComponentInChildren <TMP_Dropdown>();
        List <string> opts = new List <string>();

        opts.Add("0: корень");
        int opt_indx = 0, //для выбора опции в drop-списке
            n        = 1; //для исчисления родителей

        foreach (JsonSkillsTreeNode node in catList)
        {
            if (node.parent_id == 0)
            {
                opts.Add(node.id.ToString() + ": " + node.name);
                if (node.id == curNode.parent_id)
                {
                    opt_indx = n;
                }
                n++;
            }
        }
        popup_parent_dropdown.ClearOptions();
        popup_parent_dropdown.AddOptions(opts);
        //выбор в списке текущей выбранной категории
        popup_parent_dropdown.value = opt_indx;


        //поле: тип ноды (категория / элемент)
        Toggle [] popup_type_toggle = pnl_form.transform.Find("pnl_type").GetComponentsInChildren <Toggle>();
        //if (curNode.is_category == 1) {}
        popup_type_toggle[0].isOn         = true;
        popup_type_toggle[0].interactable = false;
        popup_type_toggle[1].isOn         = false;
        popup_type_toggle[1].interactable = false;

        //поле: сортировка
        TMP_InputField tmptxt = pnl_form.transform.Find("pnl_sort").GetComponentInChildren <TMP_InputField>();

        tmptxt.text = (is_new != 1) ? curNode.sort.ToString() : "10";

        //поле: название
        tmptxt      = pnl_form.transform.Find("pnl_name").GetComponentInChildren <TMP_InputField>();
        tmptxt.text = (is_new != 1) ? curNode.name : "";

        //поле: изображение
        tmptxt      = pnl_form.transform.Find("pnl_image").GetComponentInChildren <TMP_InputField>();
        tmptxt.text = (is_new != 1) ? curNode.image : "";

        //поле: короткое описание
        tmptxt      = pnl_form.transform.Find("pnl_small_desc").GetComponentInChildren <TMP_InputField>();
        tmptxt.text = (is_new != 1) ? curNode.short_desc : "";
        //поле: полное описание
        tmptxt      = pnl_form.transform.Find("pnl_full_desc").GetComponentInChildren <TMP_InputField>();
        tmptxt.text = (is_new != 1) ? curNode.full_desc : "";

        //save
        var btn = pnl_popup_btm.transform.Find("btn_save").GetComponent <Button>();

        btn.onClick.RemoveAllListeners();
        btn.onClick.AddListener(delegate { btn_Save_FormCategory(); });
    }
Esempio n. 9
0
 public void OnPlayerNameValueChanged(TMP_InputField playerNameInput)
 {
     PhotonNetwork.NickName = playerNameInput.text;
 }
Esempio n. 10
0
 public void OnCreateButton(TMP_InputField roomNameInput)
 {
     Network_Manager.instance.CreateRoom(roomNameInput.text);
 }
 public void OnPlayClick(TMP_InputField inputField)
 {
     CursorController.Instance.Default();
     SceneManager.LoadScene("LoadingScreen", LoadSceneMode.Single);
 }
 private void Awake()
 {
     inputField = GetComponentInChildren <TMP_InputField>();
 }
Esempio n. 13
0
 private void updateCursor(TMP_InputField input)
 {
     input.MoveTextEnd(false);
     input.selectionAnchorPosition = input.selectionFocusPosition = input.caretPosition;
 }
 public void SetNumLivesPerRound(TMP_InputField text)
 {
     GameRoundSettingsController.Instance.NumLivesPerRound = Int32.Parse(text.text);
     LevelSelectManager.Instance.RefreshRoundSettings();
 }
Esempio n. 15
0
 public PasswordPopUpViewModel()
 {
     ZIndex             = 2;
     ConfirmButton      = Get <Button>(nameof(ConfirmButton));
     PasswordInputField = Get <TMP_InputField>(nameof(PasswordInputField));
 }
Esempio n. 16
0
 private void Start()
 {
     _output = GetComponentInChildren <TextMeshProUGUI>();
     _input  = GetComponentInChildren <TMP_InputField>();
 }
Esempio n. 17
0
 private void Start()
 {
     consoleOutput = GameObject.FindGameObjectWithTag("Console Output").GetComponent <TextMeshProUGUI>();
     input         = GameObject.FindGameObjectWithTag("Script Input").GetComponent <TMP_InputField>();
 }
Esempio n. 18
0
    //***********************************************************************
    //кнопка сохранить
    public void btn_Save_FormCategory()
    {
        // 1 получение данных с формы в node
        JsonSkillsTreeNode formNode = new JsonSkillsTreeNode();
        //поле родитель
        TMP_Dropdown popup_parent_dropdown = pnl_form.transform.Find("pnl_parent").GetComponentInChildren <TMP_Dropdown>();
        string       tmp = popup_parent_dropdown.captionText.text;

        formNode.parent_id = myUtils.SplitStringAndGetFromIndx(tmp, new char[] { ':' }, 0);

        //поле тип
        Toggle[] togls = pnl_form.transform.Find("pnl_type").GetComponentsInChildren <Toggle>();
        formNode.is_category = togls[0].isOn ? 1 : 0;
        //поле: сортировка
        TMP_InputField tmptxt = pnl_form.transform.Find("pnl_sort").GetComponentInChildren <TMP_InputField>();

        Int32.TryParse(tmptxt.text, out formNode.sort);

        //поле: название
        tmptxt        = pnl_form.transform.Find("pnl_name").GetComponentInChildren <TMP_InputField>();
        formNode.name = tmptxt.text;

        //поле: изображение
        tmptxt         = pnl_form.transform.Find("pnl_image").GetComponentInChildren <TMP_InputField>();
        formNode.image = tmptxt.text;

        //поле: короткое описание
        tmptxt = pnl_form.transform.Find("pnl_small_desc").GetComponentInChildren <TMP_InputField>();
        formNode.short_desc = tmptxt.text;

        //поле: полное описание
        tmptxt             = pnl_form.transform.Find("pnl_full_desc").GetComponentInChildren <TMP_InputField>();
        formNode.full_desc = tmptxt.text;

        Debug.Log(formNode);

        List <String> Errors = new List <string>();

        //2 проверка не пустые ли данные
        if (formNode.is_category != 1)
        {
            Errors.Add("Тип ноды должен быть категория.");
        }
        if (formNode.name.Length < 5)
        {
            Errors.Add("Название должно быть не меньше 5 символов.");
        }
        if (formNode.short_desc.Length < 10 || formNode.full_desc.Length < 10)
        {
            Errors.Add("Описание (короткое или полное) должно быть не меньше 10 символов.");
        }

        //Errors.Add("Тестовая ошибка какая-то еще какой-то текст плюс еще какой-то текст и еще текст.");

        if (Errors.Count > 0)
        {
            //найдены ошибки - показ сообщения об этом
            MessageBox.ShowMessage(() => { }, string.Join("\n", Errors.ToArray()));
        }
        else
        {
            //все ок сохранение данных и закрытие формы
            pnl_popups_backfon.SetActive(false);


            if (popup_is_new == 1)
            {
                formNode.id = 0;
            }
            else
            {
                formNode.id = curCatID;
            }
            curCatID = SkillsTreeFile.addEditCategory(formNode);
            //обновление списка и графа
            refresh_all();
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     Bugtext = gameObject.GetComponent <TMP_InputField>();
 }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        if (DataModel.CurrentFilename.Contains("running"))
        {
            DataModel.CurrentFilename        = DataModel.CurrentFilename.Substring(0, DataModel.CurrentFilename.Length - 12) + ".json";
            DataModel.CurrentRunningFilename = DataModel.CurrentRunningFilename.Substring(0, DataModel.CurrentRunningFilename.Length - 12) + ".json";
        }

        teamContainer1 = GameObject.Find("TeamContainer1");
        teamContainer2 = GameObject.Find("TeamContainer2");
        for (int i = 0; i < DataModel.NumberOfTeams; i++)
        {
            if (i % 2 == 0)
            {
                team = Instantiate(Resources.Load <GameObject>("Prefabs/Team"), teamContainer1.transform);
            }
            else
            {
                team = Instantiate(Resources.Load <GameObject>("Prefabs/Team"), teamContainer2.transform);
            }
            teamsButton.Add(team.GetComponentInChildren <Button>());
            switch (i)
            {
            case 0: c = Color.red; break;

            case 1: c = Color.blue; break;

            case 2: c = new Color(0.78f, 0f, 1f, 1f); break;

            case 3: c = Color.green; break;

            case 4: c = new Color(1f, 0.56f, 0f, 1f); break;

            case 5: c = new Color(0f, 0.85f, 1f, 1f); break;

            case 6: c = Color.magenta; break;

            case 7: c = Color.yellow; break;
            }
            ColorBlock cb = team.GetComponentInChildren <Button>().colors;
            cb.normalColor      = Color.white;
            cb.highlightedColor = Color.white;
            cb.pressedColor     = Color.white;
            team.GetComponentInChildren <Button>().colors = cb;
            foreach (Image x in team.GetComponentsInChildren <Image>())
            {
                if (x.name.Contains("Joker"))
                {
                    x.name = "Joker " + (i + 1);
                }
                if (x.name.Contains("Team"))
                {
                    x.color = c;
                }
            }
        }

        /*
         * IntroMusic setup
         */
        int music_index = Random.Range(1, 5);

        introSource        = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <AudioSource>();
        introMusic         = (AudioClip)Resources.Load("Sounds/" + DataModel.IntroMusicName + music_index);
        introSource.clip   = introMusic;
        introSource.loop   = true;
        introSource.volume = 0.4f;
        introSource.Play();

        /*
         * Initialisation of gameobjects and variables
         */
        Sprite sprite = Resources.Load <Sprite>("Images/" + DataModel.BackgroundName);

        GameObject.Find("Background").GetComponent <Image>().sprite = sprite;
        timeWritten = false;
        timer       = GameObject.Find("Timer").GetComponent <Timer>();
        TimeField   = GameObject.Find("TimerInput").GetComponent <TMP_InputField>();
        pattern     = @"^(\d$|\d{2}$|(\d|\d{2}):$|(\d|\d{2}):(\d|\d{2})$)";

        /*
         * Initialisation of texts
         */
        GameObject.Find("WaitingTime").GetComponent <TextMeshProUGUI>().text = DataModel.TextToUse["starting_time"];
        GameObject.Find("TimerInput").transform.Find("Text Area").transform.Find("Placeholder").GetComponent <TextMeshProUGUI>().text = DataModel.TextToUse["write_time"];
        GameObject.Find("Introduction").GetComponent <TextMeshProUGUI>().text = DataModel.TextToUse["welcome_game"] + DataModel.QuizName;

        for (int i = 0; i < teamsButton.Count; i++)
        {
            if (i < DataModel.NumberOfTeams)
            {
                teamsButton[i].GetComponentInChildren <TextMeshProUGUI>().text = DataModel.GetTextScoreFromTeam(i);
            }
            else
            {
                teamsButton[i].gameObject.SetActive(false);
            }
        }

        if (TimeField)
        {
            TimeField.onValidateInput = ValidateInput;
        }
    }
Esempio n. 21
0
 void Awake()
 {
     _input = GetComponent <TMP_InputField> ();
     _input.onValueChanged.AddListener(OnInputValueChanged);
     _input.onEndEdit.AddListener(OnInputEnded);
 }
Esempio n. 22
0
 // Start is called before the first frame update
 void Start()
 {
     energy       = 100;
     death        = GameObject.Find("DeathInput").GetComponent <TMP_InputField>();
     reproduction = GameObject.Find("ReproductionInput").GetComponent <TMP_InputField>();
 }
Esempio n. 23
0
 // Void Start and Update
 void Start()
 {
     input = GetComponent <TMP_InputField>();
 }
Esempio n. 24
0
    public Order ManuallyCreateOrder(TMP_Dropdown colourPreference, TMP_Dropdown meatVegPref, TMP_InputField spicy, TMP_InputField chunky)
    {
        Order newOrder = new Order();

        //newOrder.mainSoup = GetSoupFromDropdown(soup.value, soup);
        newOrder.colourPreference = gameManager.colourManager.blue;

        try
        {
            newOrder.spicyness = float.Parse(spicy.text);
        }
        catch
        {
            newOrder.spicyness = 0;
            Debug.Log("Entered spicyness value was not a number.");
        }
        try
        {
            newOrder.chunkiness = float.Parse(chunky.text);
        }
        catch
        {
            newOrder.chunkiness = 0;
            Debug.Log("Entered chunkiness value was not a number.");
        }


        if (meatVegPref.value == 0)
        {
            newOrder.noMeat = false;
            newOrder.noVeg  = false;
        }
        else if (meatVegPref.value == 1)
        {
            newOrder.noMeat = true;
            newOrder.noVeg  = false;
        }
        else if (meatVegPref.value == 2)
        {
            newOrder.noVeg  = true;
            newOrder.noMeat = false;
        }

        return(newOrder);
    }
Esempio n. 25
0
 bool ColorField(TMP_InputField field, bool result)
 {
     Debug.LogFormat("Result is {0} for {1}", result, field.name);
     colorizer.ColorInputField(field, result);
     return(result);
 }
Esempio n. 26
0
 public void OnCreate(TMP_InputField roomName)
 {
     NetManager.instance.CreateRoom(roomName.text);
 }
Esempio n. 27
0
 private void Awake()
 {
     searchField = GetComponent <TMP_InputField>();
 }
Esempio n. 28
0
 public void OnPlayerNameUpdate(TMP_InputField name)
 {
     PhotonNetwork.NickName = name.text;
 }
Esempio n. 29
0
 //on edit begin reset colors
 public void AddOnSelectHandler(TMP_InputField inputField)
 {
     inputField.onSelect.AddListener((text) => OnSelect(inputField));
 }
Esempio n. 30
0
 void Start()
 {
     //Componentを扱えるようにする
     inputField = inputField.GetComponent <TMP_InputField> ();
     text       = text.GetComponent <TextMeshProUGUI> ();
 }
    public override void gaxb_complete()
    {
        base.gaxb_complete ();

        // At this point, our gameObject is our "text" game object.  We want to maneuver things around
        // until its like:
        // --> TMPro - Input Field
        //   --> Text Area
        //      --> Placeholder
        //      --> Text

        // 0) first, swap out our TMPro text and replace our gameObject with one with the text field
        GameObject textGameObject = gameObject;

        // Next, we create a new gameObject, and put the Text-created gameObject inside me
        gameObject = new GameObject ("<TMP_InputField/>", typeof(RectTransform));
        gameObject.transform.SetParent (textGameObject.transform.parent, false);
        UpdateRectTransform ();

        // 0.5) Create a game object for the field
        inputField = new PUGameObject();
        inputField.title = "TMP_InputField";
        inputField.SetFrame (0, 0, 0, 0, 0, 0, "stretch,stretch");
        inputField.LoadIntoPUGameObject (this);

        // 1) create the hierarchy of stuff under me
        textArea = new PUGameObject();
        textArea.title = "Text Area";
        textArea.SetFrame (0, 0, 0, 0, 0, 0, "stretch,stretch");
        textArea.LoadIntoPUGameObject (inputField);

        // 2) placeholder
        if (placeholder != null) {
            placeholderText = new PUTMPro ();
            placeholderText.title = "Placeholder";
            placeholderText.value = this.placeholder;
            placeholderText.LoadIntoPUGameObject (textArea);

            placeholderText.textGUI.OverflowMode = this.textGUI.OverflowMode;

            placeholderText.textGUI.alignment = this.textGUI.alignment;
            placeholderText.textGUI.font = this.textGUI.font;
            placeholderText.textGUI.fontSize = this.textGUI.fontSize;
            placeholderText.textGUI.fontStyle = this.textGUI.fontStyle;
            placeholderText.textGUI.color = this.textGUI.color - new Color(0,0,0,0.5f);
            placeholderText.textGUI.lineSpacing = this.textGUI.lineSpacing;

            placeholderText.gameObject.FillParentUI ();
        }

        // 3) text
        text = new PUGameObject();
        text.SetFrame (0, 0, 0, 0, 0, 0, "stretch,stretch");
        text.LoadIntoPUGameObject (textArea);

        GameObject.Destroy (text.gameObject);
        text.gameObject = textGameObject;

        // Move the text to be the child of the input field
        textGameObject.name = "Text";
        textGameObject.transform.SetParent (textArea.rectTransform, false);
        textGameObject.FillParentUI ();
        (textGameObject.transform as RectTransform).pivot = Vector2.zero;

        // now that we have the hierarchy, fille out the input field
        field = inputField.gameObject.AddComponent<TMP_InputField> ();

        field.transition = Selectable.Transition.None;

        field.targetGraphic = inputField.gameObject.AddComponent<InvisibleHitGraphic> ();
        field.textViewport = textArea.rectTransform;
        field.textComponent = textGUI;

        if (asteriskChar != null) {
            field.asteriskChar = asteriskChar.Value;
        }

        if (contentType == PlanetUnity2.InputFieldContentType.standard) {
            field.contentType = TMP_InputField.ContentType.Standard;
        } else if (contentType == PlanetUnity2.InputFieldContentType.autocorrected) {
            field.contentType = TMP_InputField.ContentType.Autocorrected;
        } else if (contentType == PlanetUnity2.InputFieldContentType.integer) {
            field.contentType = TMP_InputField.ContentType.IntegerNumber;
        } else if (contentType == PlanetUnity2.InputFieldContentType.number) {
            field.contentType = TMP_InputField.ContentType.DecimalNumber;
        } else if (contentType == PlanetUnity2.InputFieldContentType.alphanumeric) {
            field.contentType = TMP_InputField.ContentType.Alphanumeric;
        } else if (contentType == PlanetUnity2.InputFieldContentType.name) {
            field.contentType = TMP_InputField.ContentType.Name;
        } else if (contentType == PlanetUnity2.InputFieldContentType.email) {
            field.contentType = TMP_InputField.ContentType.EmailAddress;
        } else if (contentType == PlanetUnity2.InputFieldContentType.password) {
            field.contentType = TMP_InputField.ContentType.Password;
            field.inputType = TMP_InputField.InputType.Password;
        } else if (contentType == PlanetUnity2.InputFieldContentType.pin) {
            field.contentType = TMP_InputField.ContentType.Pin;
        } else if (contentType == PlanetUnity2.InputFieldContentType.custom) {
            field.contentType = TMP_InputField.ContentType.Custom;

            field.onValidateInput += ValidateInput;
        }

        if (lineType == PlanetUnity2.InputFieldLineType.single) {
            field.lineType = TMP_InputField.LineType.SingleLine;
        } else if (lineType == PlanetUnity2.InputFieldLineType.multiSubmit) {
            field.lineType = TMP_InputField.LineType.MultiLineSubmit;
        } else if (lineType == PlanetUnity2.InputFieldLineType.multiNewline) {
            field.lineType = TMP_InputField.LineType.MultiLineNewline;
        }

        if (characterLimit != null) {
            field.characterLimit = (int)characterLimit;
        }

        if (selectionColor != null) {
            field.selectionColor = selectionColor.Value;
        }

        // This is probably not the best way to do this, but 4.60.f1 removed the onSubmit event
        field.onEndEdit.AddListener ((value) => {
            if(onValueChanged != null){
                NotificationCenter.postNotification (Scope (), this.onValueChanged, NotificationCenter.Args("sender", this));
            }
        });

        foreach (Object obj in gameObject.GetComponentsInChildren<DetectTextClickTMPro>()) {
            GameObject.Destroy (obj);
        }

        if (this.value == null) {
            this.value = "";
        }

        field.text = this.value;

        if (placeholder != null) {
            field.placeholder = placeholderText.textGUI;
        }
    }