private void Update()
 {
     if (isLocked)
     {
         stringEvent.Invoke(control.ToString() + continuousAction);
     }
 }
Esempio n. 2
0
    void Start()
    {
        allCharacters     = new List <Character>();
        initiativeTracker = new LinkedList <Character>();

        GameObject[] allCharacterObjects = GameObject.FindGameObjectsWithTag("Character");

        foreach (GameObject characterObject in allCharacterObjects)
        {
            Character character = characterObject.GetComponent <Character>();

            allCharacters.Add(character);
            addCharacterToInitiativeTracker(character);
        }

        LogWindow logWindow = GameObject.Find("LogWindow").GetComponent <LogWindow>();

        logEvent.AddListener(logWindow.DisplayIntoLogWindow);

        //Для тестирования выведем на экран трекер инициативы
        foreach (Character character in initiativeTracker)
        {
            logEvent.Invoke(character.name + "'s initiative is " + character.Initiative);
        }

        currentRound = 1;

        logEvent.Invoke("Round " + currentRound);
    }
 public void SetRecognizingMode(bool recognizingMode)
 {
     if (recognizingMode)
     {
         strokeId = 0;
         points.Clear();
     }
     else
     {
         // runs the classification algorithm
         if (points.Count > 0)
         {
             if (useTrainingSetFile)
             {
                 trainingSet = trainingSetFile.allPatterns;
             }
             var result = recognizer.Recognize(points, trainingSet);
             onRecognizedGesture?.Invoke(result);
             if (result.Match != null)
             {
                 onRecognizedName?.Invoke(result.Match.name);
             }
             else
             {
                 onRecognizedName?.Invoke("No match for gesture.");
             }
         }
     }
     isRecordingForRecognizing = recognizingMode;
 }
Esempio n. 4
0
        /// <summary>Use the comparer to execute a response using the Int Event and the Value</summary>
        /// <param name="val">Value that comes from the string event</param>
        public void ExecuteAdvanceStringEvent(string val)
        {
            switch (comparer)
            {
            case ComparerString.Equal:
                if (val == Value.Value)
                {
                    Response.Invoke(val);
                }
                break;

            case ComparerString.NotEqual:
                if (val != Value.Value)
                {
                    Response.Invoke(val);
                }
                break;

            case ComparerString.Empty:
                if (string.IsNullOrEmpty(val))
                {
                    Response.Invoke(val);
                }
                break;

            default:
                break;
            }
        }
 public void FormatFloat(float value)
 {
     if (onFormatted != null)
     {
         onFormatted.Invoke(string.Format(format, value));
     }
 }
Esempio n. 6
0
 private void SendString(object a)
 {
     if (onString != null)
     {
         onString.Invoke(string.Format(format, a));
     }
 }
    public void OnLeftHandObjectRelease(XRBaseInteractable inInteractable)
    {
        if (inInteractable == null)
        {
            return;
        }

        if (activeLeftHandPartHandler != null)
        {
            activeLeftHandPartHandler.OnPutDownFromHand();

            activeLeftHandPartHandler.HandleActiveHeldPartTypeChanged(null, null);
            activeLeftHandPartHandler = null;
        }
        if (activeRightHandPartHandler != null)
        {
            activeRightHandPartHandler.HandleActiveHeldPartTypeChanged(activeLeftHandPartHandler, activeRightHandPartHandler);
        }

        leftHandDirectInteractor.interactionLayerMask = defaultLayerMask;

        leftHandDirectInteractor.ForceClearKnownTargets();

        onObjectReleased.Invoke("left");
    }
        public void AddCombo(int addCombo, float deltaDiff, int addScore)
        {
            // print(deltaDiff);
            combo += addCombo;
            if (combo > maxCombo)
            {
                maxCombo = combo;
                onMaxComboUpdate.Invoke(maxCombo.ToString());
            }

            for (int i = 0; i < levels.values.Count; i++)
            {
                var x = levels.values[i];
                if (deltaDiff <= x.threshold)
                {
                    x.count++;
                    score += (int)(addScore * x.scorePrecentage);
                    x.onCountUpdate.Invoke(x.count.ToString());
                    UpdateScoreDisplay();
                    onComboStatusUpdate.Invoke(x.name);
                    // print(x.name);
                    return;
                }
            }

            //When no level matched
            onComboStatusUpdate.Invoke("");
        }
Esempio n. 9
0
        protected override void OnHandleResponse(WitResponseNode response)
        {
            var text = response["text"].Value;

            if (useRegex)
            {
                if (null == regex)
                {
                    regex = new Regex(searchText, RegexOptions.Compiled | RegexOptions.IgnoreCase);
                }

                var match = regex.Match(text);
                if (match.Success)
                {
                    if (exactMatch && match.Value == text)
                    {
                        onUtteranceMatched?.Invoke(text);
                    }
                    else
                    {
                        onUtteranceMatched?.Invoke(text);
                    }
                }
            }
            else if (exactMatch && text.ToLower() == searchText.ToLower())
            {
                onUtteranceMatched?.Invoke(text);
            }
            else if (text.ToLower().Contains(searchText.ToLower()))
            {
                onUtteranceMatched?.Invoke(text);
            }
        }
Esempio n. 10
0
        protected void Debuging(string Log)
        {
            if (debug)
            {
                Debug.Log(Log);
            }

            OnDebug.Invoke(Log);
        }
Esempio n. 11
0
 //Event Handlers:
 private void HandleSpatialAlignmentNotification(string from)
 {
     if (!alignedPeers.Contains(from))
     {
         //save and report alignment:
         alignedPeers.Add(from);
         OnPeerAligned.Invoke(from);
     }
 }
Esempio n. 12
0
 public void Close()
 {
     gameObject.SetActive(false);
     if (_triggerEventOnClose)
     {
         OnEndEdit.Invoke(currentText);
     }
     OnKeyboardActivated.Invoke(false);
 }
Esempio n. 13
0
        public void BreakCombo()
        {
            statsSystem.AddMissed(1);
            statsSystem.combo = 0;

            onComboUpdate.Invoke("");

            isShowing = false;
            onVisibilityChange.Invoke(isShowing);
        }
Esempio n. 14
0
 void SendChangedEvent()
 {
     if (_wholeNumber)
     {
         onStringChanged.Invoke(((int)(_f * _mult)).ToString());
     }
     else
     {
         onStringChanged.Invoke((_f * _mult).ToString());
     }
 }
Esempio n. 15
0
 public void ConvertFloatToString(float value)
 {
     if (string.IsNullOrEmpty(format))
     {
         onFloatToString?.Invoke(value.ToString());
     }
     else
     {
         onFloatToString?.Invoke(value.ToString(format));
     }
 }
Esempio n. 16
0
 public void Compare()
 {
     if (firstValue.Value == secondValue.Value || (string.IsNullOrEmpty(firstValue.Value) && string.IsNullOrEmpty(secondValue.Value)))
     {
         onEqual.Invoke(firstValue.Value);
     }
     else
     {
         onDiffrent.Invoke(firstValue.Value);
     }
 }
Esempio n. 17
0
    private void SelectSommeil(SommeilModel sommeil)
    {
        if (hasResultEvent)
        {
            _onResult.Invoke(sommeil.nom);
        }

        m_currentSommeil = sommeil;

        m_gameLoopController.OnSelectCard(sommeil);
    }
Esempio n. 18
0
 public void SetValue(string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         onValueChanged.Invoke(key.Value.ToString());
     }
     else
     {
         key.Value = (Key)Enum.Parse(typeof(Key), value);
         onValueChanged.Invoke(value);
     }
 }
Esempio n. 19
0
    void Start()
    {
#if WINDOWS_UWP
        keyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default, false, false, false, false, titleText);
#else
        //Just for testing in the editor
        if (keyboardDone != null)
        {
            keyboardDone.Invoke("127.0.0.1");
        }
#endif
    }
Esempio n. 20
0
 public void ParseGestureChoice(Result gestureResult)
 {
     Debug.Log(gestureResult);
     //Debug.Log(string.Format("Gesture [{0}] {1}", gestureResult.Match.name, gestureResult.Score));
     if (gestureResult.Match == null)
     {
         onParsedGesture?.Invoke("No match for gesture.");
     }
     else
     {
         onParsedGesture?.Invoke(string.Format("Gesture [{0}] {1}", gestureResult.Match.name, gestureResult.Score));
     }
 }
Esempio n. 21
0
 private void InitCallback()
 {
     if (FB.IsInitialized)
     {
         // Signal an app activation App Event
         FB.ActivateApp();
     }
     else
     {
         // Show error message
         onLoginFail.Invoke("Failed to Initialize the Facebook SDK");
     }
 }
Esempio n. 22
0
        public void StringEventTest()
        {
            var    e       = new StringEvent();
            string counter = "";

            e.AddListener((val) => counter += "-" + val);
            Assert.AreEqual(counter, "");
            e.Invoke("1");
            Assert.AreEqual(counter, "-1");
            e.Invoke("22");
            e.Invoke("33");
            Assert.AreEqual(counter, "-1-22-33");
        }
Esempio n. 23
0
    public IEnumerator TransferStatusCoroutine(string serialNumber)
    {
        yield return(new WaitForSeconds(1));

        yield return(SmartContracts.QueryTransferStatus(serialNumber, (success) =>
        {
            Debug.Log(success);
            TransferStatusHandler.Invoke(success);
        }, (fail) =>
        {
            Debug.LogError(fail);
            TransferStatusErrorHandler.Invoke(fail);
        }));
    }
        protected virtual void DoInvoke()
        {
            switch (invokeType)
            {
            default:
            case InvokeType.Static:
                staticEvent.Invoke();
                break;

            case InvokeType.DynamicBoolean:
                booleanEvent.Invoke(booleanParameter.Value);
                break;

            case InvokeType.DynamicInteger:
                integerEvent.Invoke(integerParameter.Value);
                break;

            case InvokeType.DynamicFloat:
                floatEvent.Invoke(floatParameter.Value);
                break;

            case InvokeType.DynamicString:
                stringEvent.Invoke(stringParameter.Value);
                break;
            }
        }
 public void StartTranslate()
 {
     StartCoroutine(GoogleTranslate(SourceText, AccessToken, translatedText =>
     {
         OnTranslatedTextReceived?.Invoke(translatedText);
     }));
 }
    public void InputGameObject(GameObject input)
    {
        string output = input.tag;

        //Debug.Log("tag" + output);
        OutputTag.Invoke(output);
    }
        void Start()
        {
#if UNITY_EDITOR
            dict.onChange += (k, a, b) => { UpdateValueStringWithDictionary(); };
#endif
            dict.onChange += (k, a, b) => {
                if (dictionaryTostringChangeListener.GetPersistentEventCount() > 0)
                {
                    string s = dict.Stringify(true);
                    //Debug.Log(s);
                    dictionaryTostringChangeListener.Invoke(s);
                }
            };
            dict.FunctionAssignIgnore();
#if TEST
            string[] mainStats = new string[] { "str", "con", "dex", "int", "wis", "cha" };
            int[]    scores    = { 8, 8, 18, 12, 9, 14 };
            for (int i = 0; i < mainStats.Length; ++i)
            {
                dict[mainStats[i]] = scores[i];
            }
            for (int i = 0; i < mainStats.Length; ++i)
            {
                string s = mainStats[i];
                dict.Set("_" + s, () => CalcStatModifier(s));
            }
            AddTo("cha", 4);
#endif
            dict.NotifyStart();
        }
Esempio n. 28
0
 public void Execute()
 {
     if (_stringEvent != null)
     {
         _stringEvent.Invoke(_string);
     }
 }
Esempio n. 29
0
 private void OnFailed(string obj)
 {
     if (downloadFailed != null)
     {
         downloadFailed.Invoke(obj);
     }
 }
Esempio n. 30
0
 // Start is called before the first frame update
 private void Start()
 {
     if (PlayerPrefs.HasKey("playerName"))
     {
         playerNameGet?.Invoke("Welcome Back," + PlayerPrefs.GetString("playerName"));
     }
 }