Пример #1
0
        private static TimedList <int, int> CollectSeekFrames([CanBeNull] ScenarioObject scenario, int formationNumber)
        {
            var result = new TimedList <int, int>();

            if (scenario == null)
            {
                return(result);
            }

            if (scenario.HasSeekFrameEvents())
            {
                var events = scenario.Scenario.WhereToArray(s => s.Type == ScenarioDataType.DanceAnimationSeekFrame);

                foreach (var ev in events)
                {
                    Debug.Assert(ev != null, nameof(ev) + " != null");

                    if (ev.Idol != formationNumber + 10)
                    {
                        continue;
                    }

                    var frameIndex  = (int)Math.Round(ev.AbsoluteTime * FrameRate.Mltd);
                    var targetFrame = ev.SeekFrame;

                    result.AddOrUpdate(frameIndex, targetFrame);
                }
            }

            return(result);
        }
Пример #2
0
        private static int CalculateSeekFrameTarget(int naturalFrameIndex, [NotNull] TimedList <int, int> seekFrameControls, ref int lastSoughtFrame, ref int seekFrameCounter)
        {
            if (seekFrameControls.TryGetCurrentValue(naturalFrameIndex, out var targetFrame))
            {
                int result;

                if (targetFrame != lastSoughtFrame)
                {
                    seekFrameCounter = 0;
                    lastSoughtFrame  = targetFrame;
                    result           = targetFrame;
                }
                else
                {
                    result = lastSoughtFrame + seekFrameCounter;
                }

                seekFrameCounter += 1;

                return(result);
            }
            else
            {
                // Use natural frame index
                return(naturalFrameIndex);
            }
        }
Пример #3
0
        public void Add(string message, NotificationType type)
        {
            HttpCookie notificationClientCookie = HttpContext.Current.Request.Cookies.Get(guidCookieName);
            Guid clientGuid = new Guid(notificationClientCookie.Value);
            if (!NotificationStore.ContainsKey(clientGuid))
                NotificationStore[clientGuid] = new TimedList<Notification>();

            NotificationStore[clientGuid].Add(new Notification(message, type));
        }
Пример #4
0
 public void SetUp()
 {
     _splitFunc = (input, duration) =>
     {
         var trimAmount = (int)(input.Length * duration);
         return(new[] { input.Substring(0, trimAmount), input.Substring(trimAmount, input.Length - trimAmount) });
     };
     _timedList = new TimedList <string>(_splitFunc);
 }
Пример #5
0
        private static TimedList <int, Vector4[]> CollectFormationChanges([CanBeNull] ScenarioObject scenario, AppealType appealType)
        {
            var result = new TimedList <int, Vector4[]>();

            if (scenario == null)
            {
                return(result);
            }

            if (scenario.HasFormationChangeEvents())
            {
                var events = scenario.Scenario.WhereToArray(s => s.Type == ScenarioDataType.FormationChange);

                foreach (var ev in events)
                {
                    Debug.Assert(ev != null, nameof(ev) + " != null");

                    // Layer=0: applied to all appeal variants (including no appeal)
                    // Layer>0: applied to that appeal only
                    if (ev.Layer == 0 || ev.Layer == (int)appealType)
                    {
                        var formations = ev.Formation;
                        Debug.Assert(formations != null && formations.Length > 0);

                        var frameIndex = (int)Math.Round(ev.AbsoluteTime * FrameRate.Mltd);

                        var f = new Vector4[formations.Length];

                        for (var i = 0; i < formations.Length; i += 1)
                        {
                            var v = formations[i];
                            f[i] = new Vector4(v.X, v.Y, v.Z, v.W);
                        }

                        result.AddOrUpdate(frameIndex, f);
                    }
                }
            }

            return(result);
        }
        private async void BtnSubmitExercise_Clicked(object sender, EventArgs e)
        {
            try
            {
                _objAddExerciseWorkoutRequest.UserId    = Convert.ToInt32(Settings.UserID);
                _objAddExerciseWorkoutRequest.WorkOutId = Convert.ToInt32(Workoutid);
                _objAddExerciseWorkoutRequest.mainList  = new List <MainList>();
                _objHeaderModel.TokenCode = Settings.TokenCode;
                RapList    rl = new RapList();
                MainList   ml = new MainList();
                WeightList wl = new WeightList();
                LevelList  ll = new LevelList();
                TimedList  tl = new TimedList();


                ml.SetsNumber     = NumberofSets;
                ml.ExerciseName   = XFTxtboxExerciseName.Text;
                ml.ExerciseTypeId = WorkOutType;
                if (Settings.WeightName != null)
                {
                    ml.ImperialType = "Weight";
                }
                else
                {
                    ml.ImperialType = "Distance";
                }

                foreach (StackLayout child in GridSets.Children)
                {
                    Entry  entryWeight = (Entry)((Frame)child.Children[0]).Content;
                    string valueWeight = entryWeight.Text;

                    Entry  rep      = (Entry)((Frame)child.Children[3]).Content;
                    string valueRep = rep.Text;
                    if (WorkOutType == Convert.ToInt32(WorkoutSets.Sets_x_Reps_with_weight))
                    {
                        wl.TotalRaps    = Convert.ToInt32(valueRep);
                        wl.TotalWeight  = Convert.ToInt32(valueWeight);
                        wl.ImperialType = Settings.WeightName;
                        ml.weightList.Add(wl);
                        _objAddExerciseWorkoutRequest.mainList.Add(ml);
                    }
                    else if (WorkOutType == Convert.ToInt32(WorkoutSets.Sets_x_Reps_with_Level))
                    {
                        ll.TotalRaps    = Convert.ToInt32(valueRep);
                        ll.TotalWeight  = Convert.ToInt32(valueWeight);
                        ll.ImperialType = Settings.DistanceName;
                        ml.levelList.Add(ll);
                        _objAddExerciseWorkoutRequest.mainList.Add(ml);
                    }

                    else if (WorkOutType == Convert.ToInt32(WorkoutSets.Timed_Sets_seconds))
                    {
                        tl.TimedSet = Convert.ToInt32(valueRep);
                        ml.timedList.Add(tl);
                        _objAddExerciseWorkoutRequest.mainList.Add(ml);
                    }

                    else if (WorkOutType == Convert.ToInt32(WorkoutSets.Sets_x_Reps))
                    {
                        rl.RepsSets = Convert.ToInt32(valueRep);
                        ml.rapList.Add(rl);
                        _objAddExerciseWorkoutRequest.mainList.Add(ml);
                    }

                    else if (WorkOutType == Convert.ToInt32(WorkoutSets.Distance_x_Time))
                    {
                        ml.distance.RepsSetsTime = Convert.ToInt32(valueRep);
                        ml.DistanceInKm          = Convert.ToInt32(valueWeight);
                        _objAddExerciseWorkoutRequest.mainList.Add(ml);
                    }

                    else if (WorkOutType == Convert.ToInt32(WorkoutSets.Free_Text))
                    {
                        ml.textList.Text = (valueWeight);
                        ml.Text          = valueWeight;
                        _objAddExerciseWorkoutRequest.mainList.Add(ml);
                    }
                }

                _objAddExerciseWorkoutResponse = await _apiService.AddExerciseWorkoutPostAsync(new Get_API_Url().CommonBaseApi(_baseUrl), true, _objHeaderModel, _objAddExerciseWorkoutRequest);

                if (_objAddExerciseWorkoutResponse.StatusCode == 200)
                {
                    await Navigation.PopAsync(true);

                    //await Navigation.PopAsync(true);
                    DependencyService.Get <IToast>().Show(_objAddExerciseWorkoutResponse.Message);
                }
                else
                {
                    DependencyService.Get <IToast>().Show(_objAddExerciseWorkoutResponse.Message);
                }

                //if (_objAddWorkoutResponse.StatusCode == 200)
                //{
                //    DependencyService.Get<IToast>().Show(_objAddWorkoutResponse.Message);
                //    WorkoutId = _objAddWorkoutResponse.WorkoutId;
                //}
                //else
                //{
                //    DependencyService.Get<IToast>().Show(_objAddWorkoutResponse.Message);
                //}
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
            }
        }