Ejemplo n.º 1
0
 public void InitESM(NodeAddedEvent e, [Combine] InteractivityPrerequisiteNode prerequisite, [JoinByScreen, Combine, Context] DependentInteractivityNode interactableElement)
 {
     if (!prerequisite.Entity.HasComponent <InteractivityPrerequisiteESMComponent>())
     {
         InteractivityPrerequisiteESMComponent component = new InteractivityPrerequisiteESMComponent();
         prerequisite.Entity.AddComponent(component);
         EntityStateMachine esm = component.Esm;
         esm.AddState <InteractivityPrerequisiteStates.AcceptableState>();
         esm.AddState <InteractivityPrerequisiteStates.NotAcceptableState>();
         esm.ChangeState <InteractivityPrerequisiteStates.NotAcceptableState>();
     }
 }
        private void ValidateInputAfterChanging(InputFieldComponent input, ESMComponent inputStateESM, InteractivityPrerequisiteESMComponent interactivityPrerequisiteESM, int maxLength)
        {
            string str = input.Input;

            if (string.IsNullOrEmpty(str))
            {
                this.SetNotAcceptableState(interactivityPrerequisiteESM);
            }
            else
            {
                if (str.Length > maxLength)
                {
                    input.Input = str.Remove(maxLength);
                }
                interactivityPrerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.AcceptableState>();
            }
            inputStateESM.Esm.ChangeState <InputFieldStates.NormalState>();
        }
 private void SetNotAcceptableState(InteractivityPrerequisiteESMComponent prerequisiteESM)
 {
     prerequisiteESM.Esm.ChangeState <InteractivityPrerequisiteStates.NotAcceptableState>();
 }
 private void SetInvalidAndNotAccetableState(InputFieldComponent inputField, ESMComponent inputESM, string errorMessage, InteractivityPrerequisiteESMComponent interactivityPrerequisiteESM)
 {
     inputESM.Esm.ChangeState <InputFieldStates.InvalidState>();
     inputField.ErrorMessage = errorMessage;
     this.SetNotAcceptableState(interactivityPrerequisiteESM);
 }