public void Setup(ITextComponent component) {

			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P1) == true) component.SetText(this.text);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P15) == true) component.SetText(this.localizationKey);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P2) == true) component.SetTextColor(this.color);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P3) == true) component.SetValueFormat(this.format);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P16) == true) component.SetFullTextFormat(this.fullTextFormat);

			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P4) == true) component.SetFont(this.font);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P5) == true) component.SetFontSize(this.fontSize);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P6) == true) component.SetFontStyle(this.fontStyle);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P7) == true) component.SetLineSpacing(this.lineSpacing);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P8) == true) component.SetRichText(this.richText);

			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P9) == true) component.SetTextAlignment(this.alignment);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P10) == true) component.SetTextVerticalOverflow(this.verticalWrap);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P11) == true) component.SetTextHorizontalOverflow(this.horizontalWrap);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P12) == true) component.SetBestFitState(this.bestFit);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P13) == true) component.SetBestFitMinSize(this.bestMinSize);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P14) == true) component.SetBestFitMaxSize(this.bestMaxSize);
			
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P17) == true) component.SetValueAnimate(this.valueAnimate);
			if (this.IsChanged(ParameterFlag./*{flagPrefix}*/P18) == true) component.SetValueAnimateDuration(this.valueAnimateDuration);

		}
Example #2
0
        /// <summary>
        /// Set the feedback text with the given color and content.
        /// </summary>
        /// <param name="color">The color of the text.</param>
        /// <param name="text">The content of the text.</param>
        private void SetFeedbackText(Color color, string text)
        {
            _feedbackText.SetColor(color);
            _feedbackText.SetText(text);
            _feedbackText.SetActive(true);

            if (_feedbackHideCoroutine != null)
            {
                MonoBehaviourUtil.Instance.StopCoroutine(_feedbackHideCoroutine);
            }

            _feedbackHideCoroutine = MonoBehaviourUtil.Instance.StartCoroutine(WaitHideFeedbackText());
        }
Example #3
0
        private void OnStartButtonPressed()
        {
            // Disable feedback text leftover from other actions
            _clientFeedbackText.SetActive(false);

            var portString = _portInput.GetInput();
            int port;

            if (!int.TryParse(portString, out port))
            {
                // Let the user know that the entered port is incorrect
                _serverFeedbackText.SetColor(Color.red);
                _serverFeedbackText.SetText("Invalid port");
                _serverFeedbackText.SetActive(true);

                return;
            }

            // Input value was valid, so we can store it in the settings
            Logger.Get().Info(this, $"Saving host port {port} in global settings");
            _modSettings.HostPort = port;

            // Start the server in networkManager
            _serverManager.Start(port);

            // Disable the start button
            _startButton.SetActive(false);

            // Enable the stop button
            _stopButton.SetActive(true);

            // Let the user know that the server has been started
            _serverFeedbackText.SetColor(Color.green);
            _serverFeedbackText.SetText("Started server");
            _serverFeedbackText.SetActive(true);
        }
Example #4
0
        public void Setup(ITextComponent component)
        {
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P1) == true)
            {
                component.SetText(this.text);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P15) == true)
            {
                component.SetText(this.localizationKey);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P2) == true)
            {
                component.SetTextColor(this.color);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P3) == true)
            {
                component.SetValueFormat(this.format);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P16) == true)
            {
                component.SetFullTextFormat(this.fullTextFormat);
            }

            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P4) == true)
            {
                component.SetFont(this.font);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P5) == true)
            {
                component.SetFontSize(this.fontSize);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P6) == true)
            {
                component.SetFontStyle(this.fontStyle);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P7) == true)
            {
                component.SetLineSpacing(this.lineSpacing);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P8) == true)
            {
                component.SetRichText(this.richText);
            }

            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P9) == true)
            {
                component.SetTextAlignment(this.alignment);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P10) == true)
            {
                component.SetTextVerticalOverflow(this.verticalWrap);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P11) == true)
            {
                component.SetTextHorizontalOverflow(this.horizontalWrap);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P12) == true)
            {
                component.SetBestFitState(this.bestFit);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P13) == true)
            {
                component.SetBestFitMinSize(this.bestMinSize);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P14) == true)
            {
                component.SetBestFitMaxSize(this.bestMaxSize);
            }

            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P17) == true)
            {
                component.SetValueAnimate(this.valueAnimate);
            }
            if (this.IsChanged(ParameterFlag./*{flagPrefix}*/ P18) == true)
            {
                component.SetValueAnimateDuration(this.valueAnimateDuration);
            }
        }
Example #5
0
        private void OnConnectButtonPressed()
        {
            // Disable feedback text leftover from other actions
            _clientFeedbackText.SetActive(false);

            var address = _addressInput.GetInput();

            Logger.Get().Info(this, $"Connect button pressed, address: {address}");

            if (address.Length == 0)
            {
                // Let the user know that the address is empty
                _clientFeedbackText.SetColor(Color.red);
                _clientFeedbackText.SetText("Address is empty");
                _clientFeedbackText.SetActive(true);

                return;
            }

            var portString = _portInput.GetInput();
            int port;

            if (!int.TryParse(portString, out port))
            {
                // Let the user know that the entered port is incorrect
                _clientFeedbackText.SetColor(Color.red);
                _clientFeedbackText.SetText("Invalid port");
                _clientFeedbackText.SetActive(true);

                return;
            }

            var username = _usernameInput.GetInput();

            if (username.Length == 0 || username.Length > 20)
            {
                if (username.Length > 20)
                {
                    _clientFeedbackText.SetText("Username too long");
                }
                else if (username.Length == 0)
                {
                    _clientFeedbackText.SetText("Username is empty");
                }

                // Let the user know that the username is too long
                _clientFeedbackText.SetColor(Color.red);
                _clientFeedbackText.SetActive(true);

                return;
            }

            // Input values were valid, so we can store them in the settings
            Logger.Get().Info(this, $"Saving join address {address} in global settings");
            Logger.Get().Info(this, $"Saving join port {port} in global settings");
            Logger.Get().Info(this, $"Saving join username {username} in global settings");
            _modSettings.JoinAddress = address;
            _modSettings.JoinPort    = port;
            _modSettings.Username    = username;

            // Disable the connect button while we are trying to establish a connection
            _connectButton.SetActive(false);

            _clientManager.Connect(address, port, username);
        }
			public void Setup(ITextComponent component) {
				
				if (this.IsChanged(ParameterFlag.AP1) == true) component.SetText(this.text);
				if (this.IsChanged(ParameterFlag.AP2) == true) component.SetTextColor(this.color);
				if (this.IsChanged(ParameterFlag.AP3) == true) component.SetValueFormat(this.format);
	
				if (this.IsChanged(ParameterFlag.AP4) == true) component.SetFont(this.font);
				if (this.IsChanged(ParameterFlag.AP5) == true) component.SetFontSize(this.fontSize);
				if (this.IsChanged(ParameterFlag.AP6) == true) component.SetFontStyle(this.fontStyle);
				if (this.IsChanged(ParameterFlag.AP7) == true) component.SetLineSpacing(this.lineSpacing);
				if (this.IsChanged(ParameterFlag.AP8) == true) component.SetRichText(this.richText);
	
				if (this.IsChanged(ParameterFlag.AP9) == true) component.SetTextAlignment(this.alignment);
				if (this.IsChanged(ParameterFlag.AP10) == true) component.SetTextVerticalOverflow(this.verticalWrap);
				if (this.IsChanged(ParameterFlag.AP11) == true) component.SetTextHorizontalOverflow(this.horizontalWrap);
				if (this.IsChanged(ParameterFlag.AP12) == true) component.SetBestFitState(this.bestFit);
				if (this.IsChanged(ParameterFlag.AP13) == true) component.SetBestFitMinSize(this.bestMinSize);
				if (this.IsChanged(ParameterFlag.AP14) == true) component.SetBestFitMaxSize(this.bestMaxSize);
	
			}