Example #1
0
 public void ConvertToDto(ActivityDto dto, ActivityHolder activity)
 {
     ConvertToModelDto(dto, activity);
     dto.Date   = activity.Date;
     dto.Id     = activity.Id;
     dto.IsDone = activity.IsDone;
 }
Example #2
0
        public void ConvertToDto(ActivityDto dto, ActivityHolder activity, IEnumerable <TaskDto> tasks)
        {
            ConvertToDto(dto, activity);
            var task = tasks.Where(x => x.Id == dto.Id).SingleOrDefault();

            if (task != null)
            {
                dto.Task = task;
            }
        }
Example #3
0
        public void ConvertFromDto(ActivityHolder activity, ActivityDto dto, IEnumerable <TaskHolder> tasks)
        {
            ConvertFromDto(activity, dto);
            var task = tasks.Where(x => x.Id == dto.Id).SingleOrDefault();

            if (task != null)
            {
                activity.Task = task;
            }
        }
        void UpdateRichPresence(ActivityHolder activityHolder)
        {
            ActivityHolder prev = activity;

            activity = activityHolder;

            if (!activity.Equals(prev) || !initialized)
            {
                Debug.Log("DiscordRichPresence: About to update presence");
                activityManager.UpdateActivity(activity.GetActivity(), (result) =>
                {
                    Debug.Log(string.Format("DiscordRichPresence: Result is ({0})", result));
                });
            }
        }
Example #5
0
        private void UpdateHolders(ICollection <ActivityHolder> activities, IEnumerable <ActivityDto> dtos)
        {
            foreach (var dto in dtos)
            {
                var activityHolderToUpdate = activities.Where(x => x.Id == dto.Id).SingleOrDefault();
                if (activityHolderToUpdate == null)
                {
                    activityHolderToUpdate = new ActivityHolder();
                    activities.Add(activityHolderToUpdate);
                }
                if (activityHolderToUpdate.Task == null)
                {
                    activityHolderToUpdate.Task = new TaskHolder();
                }

                if (dto.Task != null)
                {
                    _holdersConversionService.ConvertFromDto(activityHolderToUpdate.Task, dto.Task);
                }
                _holdersConversionService.ConvertFromDto(activityHolderToUpdate, dto);
            }
        }
 void Awake()
 {
     Debug.Log("DiscordRichPresence: Plugin Awake");
     lastUpdateTime = Time.time;
     activity       = new IdleActivity(Utils.GetUnixTime(), GameScenes.LOADING);
 }
Example #7
0
 public void ConvertFromDto(ActivityHolder activity, ActivityDto dto)
 {
     ConvertFromModelDto(activity, dto);
     activity.Date   = dto.Date;
     activity.IsDone = dto.IsDone;
 }