예제 #1
0
        public void Start()
        {
            //Set Server IP in info label
            GameObject lowerDetailTextGameObject = playerSettingsPanel.RequireGameObject("LowerDetail/Text");

            lowerDetailTextGameObject.GetComponent <Text>().text = $"IP адрес сервера\n{ServerIp}";

            //Initialize elements from preferences
            activePlayerPreference = preferencesManager.GetPreference(ServerIp);

            float hue;
            float saturation;
            float vibrance;

            Color playerColor = new Color(activePlayerPreference.RedAdditive, activePlayerPreference.GreenAdditive, activePlayerPreference.BlueAdditive);

            Color.RGBToHSV(playerColor, out hue, out saturation, out vibrance);
            uGUI_ColorPicker colorPicker = playerSettingsPanel.GetComponentInChildren <uGUI_ColorPicker>();

            colorPicker.SetHSB(new Vector3(hue, 1f, vibrance));

            GameObject playerNameInputFieldGameObject = playerSettingsPanel.RequireGameObject("InputField");

            uGUI_InputField playerNameInputField = playerNameInputFieldGameObject.GetComponent <uGUI_InputField>();

            playerNameInputField.text = activePlayerPreference.PlayerName;

            StartMultiplayerClient();
        }
예제 #2
0
        private void FocusPlayerNameTextbox()
        {
            GameObject      playerNameInputFieldGameObject = playerSettingsPanel.RequireGameObject("InputField");
            uGUI_InputField playerNameInputField           = playerNameInputFieldGameObject.GetComponent <uGUI_InputField>();

            playerNameInputField.ActivateInputField();
        }
예제 #3
0
        //Player name text box
        private void InitializePlayerNameInputElement()
        {
            GameObject    playerNameInputFieldGameObject = playerSettingsPanel.RequireGameObject("InputField");
            RectTransform inputFieldRectTransform        = (RectTransform)playerNameInputFieldGameObject.transform;

            inputFieldRectTransform.anchoredPosition = new Vector2(inputFieldRectTransform.anchoredPosition.x, inputFieldRectTransform.anchoredPosition.y - 15f);

            playerNameInputField = playerNameInputFieldGameObject.GetComponent <uGUI_InputField>();
            playerNameInputField.selectionColor = Color.white;

            GameObject inputFieldPlaceholder = inputFieldRectTransform.RequireGameObject("Placeholder");

            inputFieldPlaceholder.GetComponent <Text>().text = Language.main.Get("Nitrox_EnterName");
        }
예제 #4
0
        //Player name textbox
        private static void InitializePlayerNameInputElement(GameObject playerSettingsPanel)
        {
            GameObject    playerNameInputFieldGameObject = playerSettingsPanel.RequireGameObject("InputField");
            RectTransform inputFieldRectTransform        = (RectTransform)playerNameInputFieldGameObject.transform;

            inputFieldRectTransform.anchoredPosition = new Vector2(inputFieldRectTransform.anchoredPosition.x, inputFieldRectTransform.anchoredPosition.y - 15f);

            uGUI_InputField playerNameInputField = playerNameInputFieldGameObject.GetComponent <uGUI_InputField>();

            playerNameInputField.selectionColor = Color.white;

            GameObject inputFieldPlaceholder     = inputFieldRectTransform.RequireGameObject("Placeholder");
            Text       inputFieldPlaceholderText = inputFieldPlaceholder.GetComponent <Text>();

            inputFieldPlaceholderText.text = "Введите имя игрока";
        }
예제 #5
0
            protected virtual void Start()
            {
                $"StorageLabelFixers.Fixer: Start (type: {GetType()})".logDbg();
                inputField = GetComponent <IStorageLabel>()?.label.signInput.inputField;
                labelInfo  = GetComponent <IStorageLabelInfo>();

                if (!inputField)
                {
                    Destroy(this);
                    return;
                }

                text          = inputField.textComponent;
                textTransform = text.transform as RectTransform;

                inputField.characterLimit = labelInfo.maxCharCount;
                text.GetComponent <ContentSizeFitter>().enabled = false;

                RectTransformExtensions.SetSize(textTransform, labelInfo.size.x, labelInfo.size.y);
#if GAME_SN
                text.alignment      = TextAnchor.MiddleCenter;
                inputField.lineType = InputField.LineType.MultiLineSubmit;
#elif GAME_BZ
                text.alignment      = TMPro.TextAlignmentOptions.Midline;
                inputField.lineType = TMPro.TMP_InputField.LineType.MultiLineSubmit;
#endif
                inputField.onValueChanged.AddListener(valueListener);
                UWE.CoroutineHost.StartCoroutine(_updateLabel());

                IEnumerator _updateLabel()
                {
                    // skip two frames to wait for initialization
                    yield return(null);

                    yield return(null);

                    valueListener(null);
                }
            }