public async void Submit()
        {
            if (string.IsNullOrEmpty(emailInputField.text))
            {
                OnError.Invoke("Email address is required.");
                return;
            }

            string regex = @"^[A-Za-z0-9\._%+-]+@[A-Za-z0-9\.-]+\.[A-Za-z]{2,4}$";

            if (!Regex.IsMatch(emailInputField.text, regex))
            {
                OnError.Invoke("Email address must be valid.");
                return;
            }

            JObject values = new JObject {
                { "email", emailInputField.text },
            };

            try {
                await passwordResetService.CreateRecord(values);
            } catch {
                OnError.Invoke("Invalid email address.");
                return;
            }

            OnSuccess.Invoke();
        }
예제 #2
0
        public void Convert(int value)
        {
            switch (convertToType)
            {
            case ConvertToType.Integer: applyInteger.Invoke(value); return;

            case ConvertToType.Float: applyFloat.Invoke(value); return;

            case ConvertToType.Boolean: applyBoolean.Invoke(value != 0); return;

            case ConvertToType.String: applyString.Invoke(value.ToString()); return;
            }
        }
        private void Update()
        {
            if (_debugFire)
            {
                _debugFire = false;

                if (!string.IsNullOrEmpty(_debugHeaderString) && !string.IsNullOrEmpty(_debugBodyString))
                {
                    OnNotificationHeader.Invoke(_debugHeaderString);
                    OnNotificationBody.Invoke(_debugBodyString);
                    OnNotification.Invoke();
                }
            }
        }
예제 #4
0
        protected override void Apply(string value)
        {
            switch (kind)
            {
            case Kind.Text:
                if (text)
                {
                    var v = value ?? "";
                    text.text    = (format == "{s}") ? v : format.Replace("{s}", v);
                    text.enabled = (!string.IsNullOrEmpty(text.text));
                }
                break;

            case Kind.ResourceSprite:
                if (image)
                {
                    image.sprite  = string.IsNullOrEmpty(value) ? null : Resources.LoadAll <Sprite>(folder ?? "").FirstOrDefault(x => x.name == value);
                    image.enabled = (image.sprite != null);
                }
                break;

            case Kind.Call:
                call.Invoke(value);
                break;
            }
        }
예제 #5
0
 public static void TryInvoke(this UnityEventString evt, string value)
 {
     if (evt != null)
     {
         evt.Invoke(value);
     }
 }
예제 #6
0
 public void ConfirmInputDeviceSN()
 {
     if (m_onSelectDevice != null)
     {
         m_onSelectDevice.Invoke(m_inputDeviceSN.text);
     }
 }
예제 #7
0
        void DoTransition(GameObject oldState, GameObject newState)
        {
            if (oldState == newState)
            {
                return;
            }

            StopAllCoroutines();

            if (oldState != null)
            {
                oldState.SetActive(false);
            }

            if (newState != null)
            {
                newState.SetActive(true);
                currentState = newState;
                OnStateChanged.Invoke(newState.name);
                var autoTransition = autoTransitions.FirstOrDefault(t => t.active && t.state == newState);
                if (autoTransition != null)
                {
                    if (autoTransition.time > 0)
                    {
                        StartCoroutine(DoTransition(autoTransition.state, autoTransition.nextState, autoTransition.time));
                    }
                    else
                    {
                        DoTransition(autoTransition.state, autoTransition.nextState);
                    }
                }
            }
        }
예제 #8
0
        public void StartEditBinding(string deviceSN)
        {
            if (m_editingDevice == deviceSN)
            {
                return;
            }

            FinishEditBindingNoEvent();

            var bindingItemIndex = m_boundDevices.IndexOf(deviceSN);

            if (bindingItemIndex < 0)
            {
                selectedRoleMap.BindDeviceToRoleValue(deviceSN, selectedRoleMap.RoleValueInfo.InvalidRoleValue);

                m_editingDevice = deviceSN;
                RefreshSelectedRoleBindings();
                RefreshRoleSelection();
            }
            else
            {
                m_editingDevice = deviceSN;
                m_bindingList[m_boundDevices.IndexOf(deviceSN)].isEditing = true;
            }

            EnableHeightLightBinding(deviceSN);

            if (m_onEditBinding != null)
            {
                m_onEditBinding.Invoke(m_editingDevice);
            }
        }
예제 #9
0
 // Invoke handlers for Custom Unity Events
 public void Invoke <T>(T arg0)
 {
     if (Event == null)
     {
         return;
     }
     if (Event.UnityEventType == typeof(UnityEventGameObject) && arg0 is GameObject gameObject)
     {
         responseGameObject.Invoke(gameObject);
     }
     else if (Event.UnityEventType == typeof(UnityEventTransform) && arg0 is Transform transform)
     {
         responseTransform.Invoke(transform);
     }
     else if (Event.UnityEventType == typeof(UnityEventInt) && arg0 is int intValue)
     {
         responseInt.Invoke(intValue);
     }
     else if (Event.UnityEventType == typeof(UnityEventFloat) && arg0 is float floatValue)
     {
         responseFloat.Invoke(floatValue);
     }
     else if (Event.UnityEventType == typeof(UnityEventBool) && arg0 is bool boolValue)
     {
         responseBool.Invoke(boolValue);
     }
     else if (Event.UnityEventType == typeof(UnityEventString) && arg0 is string stringValue)
     {
         responseString.Invoke(stringValue);
     }
 }
예제 #10
0
        public async void Submit()
        {
            errorText.gameObject.SetActive(false);
            messageText.gameObject.SetActive(false);
            submitButton.enabled = false;

            try {
                if (record == null)
                {
                    await CreateRecord();
                }
                else
                {
                    await UpdateRecord();
                }
            } catch (ValidationException ex) {
                string error = ex.Message;

                errorText.text = error;
                errorText.gameObject.SetActive(true);
                submitButton.enabled = true;

                OnError.Invoke(error);
                return;
            }

            messageText.text = "Record updated successfully.";
            messageText.gameObject.SetActive(true);
            submitButton.enabled = true;

            OnSuccess.Invoke();
        }
    private void SpeechRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args)
    {
        string word = args.text;

        ResultedText.text = "You said: <b>" + word + "</b>";

        OnPhraseRecognized.Invoke(word);
    }
예제 #12
0
        public void ValueChanged(string value)
        {
            _rootText.text = value;
            _value         = value;
            _onValueChanged.Invoke(value);

            HideList();
        }
예제 #13
0
 public void Refresh()
 {
     //Invoke OnChange
     if (OnChange != null && localizeData != null)
     {
         OnChange.Invoke(localizeData.value);
     }
 }
예제 #14
0
    private void UpdateSequence()
    {
        for (int i = 0; i < _countSwipe; i++)
        {
            _currentSwipeSequence.Add(swipesType[Random.Range(0, swipesType.Count)]);
        }

        UpdateUI.Invoke(_currentSwipeSequence);
    }
예제 #15
0
    public static void TriggerEvent(string eventName, string param)
    {
        UnityEventString thisEvent = null;

        if (instance.eventParamDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(param);
        }
    }
예제 #16
0
    public bool TriggerAnnotateEndSensorBookmarkEvent(string bookmarkName)
    {
        if (AnnotateEndSensorBookmarkEvent != null)
        {
            AnnotateEndSensorBookmarkEvent.Invoke(bookmarkName);
            return(true);
        }

        return(false);
    }
예제 #17
0
 void Start()
 {
     foreach (BtnFooter btn in btn_footer_list)
     {
         btn.btn.onClick.AddListener(() =>
         {
             HandleFooterButton.Invoke(btn.GetFooterName());
         });
     }
 }
예제 #18
0
    public void CollectReward(int Index)
    {
        int    count = _Game.mRewards.Count;
        int    id1 = (Index + count - 1) % count;  MiniGame_Reward r1 = _Game.mRewards [id1];
        int    id2 = Index;                        MiniGame_Reward r2 = _Game.mRewards [id2];
        int    id3 = (Index + 1) % count;      MiniGame_Reward r3 = _Game.mRewards [id3];
        string result = string.Format("{0}({1}), {2}({3}), {4}({5})", id1, r1.name, id2, r2.name, id3, r3.name);

        _OnResult.Invoke(result);
    }
예제 #19
0
        private void OnEnable()
        {
            if (m_StringVariable == null)
            {
                Debug.LogWarning($"No variable assigned to {name}.", this);
                return;
            }

            OnEvent.Invoke(m_StringVariable.Value);
            m_StringVariable.Changed += OnEvent.Invoke;
        }
        public async void Delete()
        {
            try {
                await userService.DeleteRecord(userModel._id);
            } catch (HttpException ex) {
                OnError.Invoke(ex.Message);
                return;
            }

            OnSuccess.Invoke();
        }
예제 #21
0
 private void OnEndEdit(string text)
 {
     if (!allowEmpty && string.IsNullOrEmpty(text))
     {
         return;
     }
     if (onlyIfEnterPressed && !Input.GetKey(KeyCode.Return))
     {
         return;
     }
     onSubmit.Invoke(text);
 }
예제 #22
0
        private void Update()
        {
            if (variable == null)
            {
                return;
            }
            if (lastFrameValue != variable.Value)
            {
                onValueChanged.Invoke(variable.Value);
            }

            lastFrameValue = variable.Value;
        }
예제 #23
0
        public async void Submit()
        {
            if (string.IsNullOrEmpty(emailInputField.text))
            {
                OnError.Invoke("Email address is required.");
                return;
            }

            if (string.IsNullOrEmpty(passwordInputField.text))
            {
                OnError.Invoke("Password is required.");
                return;
            }

            try {
                await loginService.CreateWithCredentials(emailInputField.text, passwordInputField.text);
            } catch {
                OnError.Invoke("Invalid email address or password.");
                return;
            }

            OnSuccess.Invoke();
        }
    // Update is called once per frame
    void Update()
    {
        float recalc_w = Mathf.Clamp(trans.rect.width * RPM / MaxRPM, 0, trans.rect.width);
        float recalc_h = Mathf.Clamp(trans.rect.height * (Torque * 10) / MaxTorqueRecalc, 0, trans.rect.height);

        pointer.localPosition = new Vector3((int)recalc_w, (int)recalc_h);

        float tempeff = rgb.r[(int)recalc_w, (int)recalc_h] *
                        (1 - rgb.g[(int)recalc_w, (int)recalc_h]) *
                        (1 - rgb.b[(int)recalc_w, (int)recalc_h]);

        EfficiencyOut?.Invoke(eff[(int)recalc_w, (int)recalc_h].ToString("F2"));
        motorAxle.MaterialColor = texture.GetPixel((int)RPM, (int)(Torque * MaxTorqueRatio));
    }
예제 #25
0
        private void OnExitDevice(uint deviceIndex)
        {
            var deviceSN = VRModule.GetCurrentDeviceState(deviceIndex).serialNumber;

            m_inputDeviceSN.text = string.Empty;
            CheckInputDeviceSN(string.Empty);

            m_modelIcon.gameObject.SetActive(false);

            if (m_onMouseExitDevice != null)
            {
                m_onMouseExitDevice.Invoke(deviceSN);
            }
        }
예제 #26
0
        private void Show()
        {
            shown = true;

            if (showTransitions != null)
            {
                showTransitions.Begin();
            }

            if (onShow != null)
            {
                onShow.Invoke(tooltip.Text);
            }
        }
        public async void Submit()
        {
            if (string.IsNullOrEmpty(passwordInputField.text))
            {
                OnError.Invoke("Password is required.");
                return;
            }

            if (passwordInputField.text != passwordConfirmationInputField.text)
            {
                OnError.Invoke("Passwords do not match.");
                return;
            }

            JObject values = new JObject {
                { "email", emailInputField.text },
                { "password", passwordInputField.text },
                { "username", usernameInputField.text }
            };

            try {
                await userService.CreateRecord(values);
            } catch (ValidationException ex) {
                OnError.Invoke(ex.Message);
                return;
            }

            try {
                await loginService.CreateWithCredentials(emailInputField.text, passwordInputField.text);
            } catch (HttpException) {
                OnError.Invoke("User created successfully, but login failed. Please try logging in again.");
                return;
            }

            OnSuccess.Invoke();
        }
예제 #28
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Return))
     {
         if (inputField.text.Length > 0)
         {
             onReturn.Invoke(inputField.text);
             inputField.text = "";
             inputField.ActivateInputField();
         }
         if (focusWithEnterKey)
         {
             inputField.ActivateInputField();
         }
     }
 }
예제 #29
0
    public void Initialize(MasterDungeonParam _master)
    {
        //Debug.Log(_master.dungeon_label);
        m_strDungeonId    = _master.dungeon_id;
        m_txtName.text    = _master.dungeon_label;
        m_txtOutline.text = _master.outline;

        int iBest = DataManager.Instance.GetBestFloor(_master.dungeon_id);

        m_txtFloor.text = string.Format("{0}/{1}", iBest, _master.floor_max);

        btn.onClick.AddListener(() =>
        {
            OnEvent.Invoke(m_strDungeonId);
        });
    }
예제 #30
0
        private void OnEnterDevice(uint deviceIndex)
        {
            var deviceState = VRModule.GetCurrentDeviceState(deviceIndex);
            var deviceSN    = deviceState.serialNumber;

            m_inputDeviceSN.text = deviceSN;
            CheckInputDeviceSN(deviceSN);

            m_modelIcon.gameObject.SetActive(true);
            BindingInterfaceSpriteManager.SetupDeviceIcon(m_modelIcon, deviceState.deviceModel, true);

            if (m_onMouseEnterDevice != null)
            {
                m_onMouseEnterDevice.Invoke(deviceSN);
            }
        }