Exemple #1
0
 public ParameterDefinition AddParameter(string parameter, string label, bool isRealized)
 {
     return(Children.AddChild(new ParameterDefinition(this, parameter, label)
     {
         IsRealized = isRealized
     }));
 }
 public MotionDefinition(IAnimationDefinition parent, Motion motion)
 {
     Name       = motion != null ? motion.name : "NULL";
     Parent     = parent;
     Motion     = motion;
     Type       = motion is BlendTree ? MotionType.BlendTree : MotionType.AnimationClip;
     IsRealized = true;
     if (motion is BlendTree blendTree)
     {
         if (!string.IsNullOrEmpty(blendTree.blendParameter))
         {
             BlendParameters.Add(
                 Children.AddChild(
                     new ParameterDefinition(this, blendTree.blendParameter, nameof(blendTree.blendParameter))));
         }
         if (!string.IsNullOrEmpty(blendTree.blendParameterY))
         {
             BlendParameters.Add(
                 Children.AddChild(
                     new ParameterDefinition(this, blendTree.blendParameterY, nameof(blendTree.blendParameterY))));
         }
         foreach (ChildMotion blendTreeChild in blendTree.children)
         {
             AddMotion(blendTreeChild.motion);
         }
     }
 }
Exemple #3
0
 public ParameterDefinition AddParameter(bool isRealized, string name)
 {
     return(Children.AddChild(new ParameterDefinition(this, name)
     {
         IsRealized = isRealized
     }));
 }
Exemple #4
0
 public Category AddElement(AudioElement e)
 {
     if (e.transform.parent == null || !e.transform.parent.GetComponent <Category>())
     {
         if (!categories.GetChild("Default"))
         {
             categories.AddChild(new GameObject("Default", typeof(Category)).GetComponent <Category>());
         }
         elements.AddChild(e, categories.GetChild("Default").transform);
         return(categories.GetChild("Default"));
     }
     else
     {
         elements.AddChild(e, e.transform.parent);
         return(e.transform.parent.GetComponent <Category>());
     }
 }
        /// <summary>
        /// A function which will be used to add a child and sets it's parent to this
        /// </summary>
        /// <typeparam name="K">The type of the child</typeparam>
        /// <param name="childToAdd">The child itself</param>
        /// <param name="load">A flag to indicate whether we wish to call LoadContent on the child</param>
        /// <param name="initialise">A flag to indicate whether we wish to call Initialise on the child</param>
        /// <returns></returns>
        public virtual K AddChild <K>(K childToAdd, bool load = false, bool initialise = false) where K : BaseObject
        {
            DebugUtils.AssertNotNull(childToAdd);
            DebugUtils.AssertNull(childToAdd.Parent);

            // Set the parent to be this
            childToAdd.Parent = this;

            return(Children.AddChild(childToAdd, load, initialise));
        }
        /// <summary>
        /// A function called right at the start of the game to add our player's station to this control.
        /// We load and initialise the station too and handle all parenting problems.
        /// We have a separate function, because the station is a special card and we do no want it to go through the same pipeline as the normal CardShipPairs (i.e. AddChild)
        /// </summary>
        /// <param name="stationCardPair"></param>
        public void AddStation(CardObjectPair stationCardPair)
        {
            Debug.Assert(stationCardPair is CardStationPair);

            // Do a shallow reparent - we do not want to go through AddChild because it will do unnecessary things to this station
            // Instead we have to manually do a bit of hacking
            bool dontWantToBeAddedViaAddChild = false;
            stationCardPair.ReparentTo(this, dontWantToBeAddedViaAddChild);       // This does set up our new parent however
            Children.AddChild(stationCardPair, true, true);

            stationCardPair.LocalPosition = StationPosition;
        }
 public VrcParameterDefinition AddParameter(VRCExpressionParameters.Parameter parameter)
 {
     return(Children.AddChild(ParameterFactory.Create(this, parameter)));
 }
        private async void button_Click(object sender, RoutedEventArgs e)
        {
            string errorList = "";

            if (cmb_childAcademicType.SelectedIndex == -1)
            {
                errorList += "Choose an academic type.\n";
            }
            if (cmb_childBirthOrder.SelectedIndex == -1)
            {
                errorList += "Choose child birth order.\n";
            }
            if (cmb_childEducationType.SelectedIndex == -1)
            {
                errorList += "Choose the education type.\n";
            }
            if (cmb_childGender.SelectedIndex == -1)
            {
                errorList += "Choose a gender.\n";
            }
            if (txt_childName.Text == "")
            {
                errorList += "Child name cannot be empty.\n";
            }
            if (txt_whatsAppPhone.Text == "")
            {
                errorList += "WhatsApp Number cannot be empty.\n";
            }
            if (num_childAcademicYear.Value == null || num_childAge == null)
            {
                errorList += "Numeric values cannot be null.\n";
            }
            if (txt_guardianName.Text == "")
            {
                errorList += "Guardian Name cannot be empty!\n";
            }
            if (num_childAcademicYear != null && num_childAcademicYear.Value >= 10)
            {
                errorList += "Maximum value for allowed academic year is 10";
            }

            errorList += CheckPhoneNumber(txt_whatsAppPhone);
            if (!errorList.Contains("Phone can only consist of numbers."))
            {
                errorList += CheckPhoneNumber(txt_fatherPhone);
            }
            if (!errorList.Contains("Phone can only consist of numbers."))
            {
                errorList += CheckPhoneNumber(txt_motherPhone);
            }

            if (errorList != "")
            {
                await this.ShowMessageAsync("Check the following!", errorList, MessageDialogStyle.Affirmative);

                return;
            }

            if (Globals.Children.ToList().Exists(x => x.Value.Name == txt_childName.Text || x.Value.WhatsAppPhone == txt_whatsAppPhone.Text))
            {
                if (EditedChild == null || (EditedChild != null && EditedChild.Name != txt_childName.Text))
                {
                    if (await this.ShowMessageAsync("Are you sure", "There exist a child with the same name/whatsApp number\nAre you sure you want to continue", MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Negative)
                    {
                        return;
                    }
                }
            }

            Child newChild = new Child()
            {
                Name              = txt_childName.Text,
                Age               = Convert.ToInt32(num_childAge.Value),
                GuardianName      = txt_guardianName.Text,
                GuardianType      = (rb_mother.IsChecked == true) ? 0 : 1,
                FatherPhone       = txt_fatherPhone.Text,
                MotherPhone       = txt_motherPhone.Text,
                FatherJob         = txt_fatherJob.Text,
                MotherJob         = txt_motherJob.Text,
                WhatsAppPhone     = txt_whatsAppPhone.Text,
                MotherQualifier   = txt_motherQualification.Text,
                Gender            = cmb_childGender.SelectedIndex,
                AcademicYear      = (cmb_childAcademicType.SelectedIndex * 10) + (Convert.ToInt32(num_childAcademicYear.Value)),
                EducationType     = cmb_childEducationType.SelectedIndex,
                ChildBirthOrder   = cmb_childBirthOrder.SelectedIndex,
                ChildTraits       = CalcBits(chk_traits_social, chk_traits_leading, chk_traits_edgy, chk_traits_cooperative, chk_traits_goodSpeaker),
                ChildHandling     = CalcBits(chk_problem_askHelp, chk_problem_worries, chk_problem_leaveProblem, chk_problem_solveProblem),
                ChildFreeTime     = CalcBits(chk_freeTime_drawing, chk_freeTime_games, chk_freeTime_tv, chk_freeTime_handwork),
                RegisteredCourses = new List <Class>(),
            };

            foreach (CheckedObject val in courses_listView.Items)
            {
                if (val.Checked)
                {
                    newChild.RegisteredCourses.Add(val.Class);
                }
            }

            try
            {
                if (EditedChild == null)
                {
                    Children.AddChild(newChild);
                }
                else
                {
                    newChild.Id = EditedChild.Id;
                    Children.EditChild(newChild);
                }

                //int coursesCost = 0;
                //for(int i = 0; i < newChild.RegisteredCourses.Count; i++)
                //{
                //    if (i == 0) //100% of first course
                //        coursesCost += Globals.Courses[newChild.RegisteredCourses[i].CourseId].Cost;
                //    else        //50% of every course after
                //        coursesCost += Globals.Courses[newChild.RegisteredCourses[i].CourseId].Cost/2;
                //}
                //await this.ShowMessageAsync("Courses Price", "Total price for chosen courses are: " + coursesCost + " EGP.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Globals.RefreshReferenceInformation();
            this.Close();
        }
 public TransitionDefinition AddTransition(AnimatorTransitionBase transition, StateDefinition from, StateDefinition to)
 {
     return(Children.AddChild(new TransitionDefinition(this, transition, from, to)));
 }
 public StateDefinition AddState(string name = null)
 {
     return(Children.AddChild(new StateDefinition(this, name)));
 }
Exemple #11
0
 public ParameterDefinition AddParameter(VRCExpressionsMenu.Control.Parameter parameter)
 {
     return(Children.AddChild(new ParameterDefinition(this, parameter.name)));
 }
 public MotionDefinition AddMotion(Motion motion)
 {
     return(Children.AddChild(new MotionDefinition(this, motion)));
 }
Exemple #13
0
 public ConditionDefinition AddCondition(ParameterDefinition parameter, bool whenTrue)
 {
     return(Children.AddChild(new ConditionDefinition(this, whenTrue ? AnimatorConditionMode.If : AnimatorConditionMode.IfNot, 0, parameter.Name)));
 }
Exemple #14
0
 public ConditionDefinition AddCondition(AnimatorCondition condition)
 {
     return(Children.AddChild(new ConditionDefinition(this, condition)));
 }
 public MenuControlDefinition AddControl(string name = null)
 {
     return(Children.AddChild(new MenuControlDefinition(this, name)));
 }
 public MenuControlDefinition AddControl(VRCExpressionsMenu.Control control)
 {
     return(Children.AddChild(new MenuControlDefinition(this, control)));
 }
Exemple #17
0
 public MotionDefinition AddMotion(bool isBlendTree = false, string name = null) => Children.AddChild(new MotionDefinition(this, isBlendTree, name));
 public MotionDefinition AddMotion(string name, bool isBlendTree)
 {
     return(Children.AddChild(new MotionDefinition(this, isBlendTree, name)));
 }
Exemple #19
0
 public MotionDefinition AddMotion(Motion motion) => Children.AddChild(new MotionDefinition(this, motion));
Exemple #20
0
 public MenuDefinition AddMenu(VRCExpressionsMenu menu)
 {
     return(Children.AddChild(new MenuDefinition(this, menu)));
 }
Exemple #21
0
 public VrcParameterDriverDefinition AddParameterDriverDefinition(VRCAvatarParameterDriver driver)
 {
     return(Children.AddChild(new VrcParameterDriverDefinition(this, driver)));
 }
Exemple #22
0
 public StateMachineDefinition AddStateMachine(AnimatorStateMachine stateMachine)
 {
     return(Children.AddChild(new StateMachineDefinition(this, stateMachine)));
 }
Exemple #23
0
 public AnimatorLayerDefinition AddLayer(AnimatorControllerLayer controllerLayer)
 {
     return(Children.AddChild(new AnimatorLayerDefinition(this, controllerLayer)));
 }
 private StateDefinition AddState(AnimatorState state)
 {
     return(Children.AddChild(new StateDefinition(this, state)));
 }
Exemple #25
0
 public AnimatorParameterDefinition AddParameter(AnimatorControllerParameter parameter)
 {
     return(Children.AddChild(new AnimatorParameterDefinition(this, parameter)));
 }
 public TransitionDefinition AddTransition(StateDefinition from, StateDefinition to, string name = null)
 {
     return(Children.AddChild(new TransitionDefinition(this, from, to, name)));
 }
 private AnimatorDefinition AddAnimator(AnimatorController animator, AnimatorDefinition.AnimatorType type)
 {
     return(Children.AddChild(new AnimatorDefinition(this, animator, type)));
 }