Esempio n. 1
0
        /// <summary>
        /// タイムラインを埋める
        /// </summary>
        /// <returns></returns>
        private AsyncSubject <Unit> FillTimelines()
        {
            AsyncSubject <Unit> subject = new AsyncSubject <Unit>();
            var size = SCHEDULE_SIZE - _timelineSchedule.Count();

            if (size != 0)
            {
                List <TimelineSerializableData> addLists = new List <TimelineSerializableData>();
                for (int i = 0; i < size; i++)
                {
                    var id = TimeLineForward();
                    addLists.Add(_timelineData[id]);
                }
                _timelineView.AddCards(addLists).Subscribe(_ =>
                {
                    subject.OnNext(Unit.Default);
                    subject.OnCompleted();
                });
            }
            else
            {
                ObservableUtils.AsyncSubjectTimeZeroCompleted(subject);
            }

            return(subject);
        }
Esempio n. 2
0
        public static AsyncSubject <Unit> SkillByAi(AiSelectSkillResultSerializableData ai, BattlerSerializable fromBattler)
        {
            AsyncSubject <Unit> subject = new AsyncSubject <Unit>();

            if (ai == null)
            {
                ObservableUtils.AsyncSubjectTimeZeroCompleted(subject);
            }
            else
            {
                var skill = SkillsDicionary.GetSkillById(ai.SkillId);
                if (SkillsDicionary.IsAll(skill))
                {
                    List <BattlerSerializable> toBattlers = new List <BattlerSerializable>();
                    ai.TargetUniqIds.ForEach(x => { toBattlers.Add(BattlerDictionary.GetBattlerByUniqId(x)); });
                    SkillToAll(ai.SkillId, fromBattler, toBattlers).Subscribe(_ =>
                    {
                        subject.OnNext(Unit.Default);
                        subject.OnCompleted();
                    });
                }
                else
                {
                    var uniqId          = ai.TargetUniqIds.First();
                    var toBattler       = BattlerDictionary.GetBattlerByUniqId(uniqId);
                    var targetTransform = BattleDictionary.GetTransformByUniqId(uniqId);
                    SkillToSingle(ai.SkillId, fromBattler, toBattler).Subscribe(_ =>
                    {
                        subject.OnNext(Unit.Default);
                        subject.OnCompleted();
                    });
                }
            }
            return(subject);
        }
Esempio n. 3
0
        public AsyncSubject <Unit> NextFloor()
        {
            var model = DungeonDataModel.Instance;

            FloorTextUpdate();
            AsyncSubject <Unit> subject = new AsyncSubject <Unit>();

            if (model.Location.y != 0 && model.Location.y + 5 < model.DungeonFloorSize)
            {
                var map = GameObject.Find("Map").GetComponent <Transform>();
                //map.DOLocalMoveY(map.localPosition.y - 0.75f, 0.5f).Play().OnComplete(() =>
                map.DOLocalMoveY(map.localPosition.y - 1.115f, 0.5f).Play().OnComplete(() =>
                {
                    subject.OnNext(Unit.Default);
                    subject.OnCompleted();
                });
            }
            else
            {
                ObservableUtils.AsyncSubjectTimeZeroCompleted(subject);
            }
            return(subject);
        }
Esempio n. 4
0
        /// <summary>
        /// タイムラインスケジュールから対象バトラーを削除する
        /// </summary>
        /// <returns></returns>
        public AsyncSubject <Unit> TimelineScheduleRemove()
        {
            AsyncSubject <Unit> subject   = new AsyncSubject <Unit>();
            List <int>          deleteIds = new List <int>();

            _timelineData.ForEach(x =>
            {
                if (BattlerDictionary.IsDeadByUniqId(x.uniqId))
                {
                    deleteIds.AddRange(_timelineSchedule.FindAll(id => id == x.id));
                    _timelineSchedule.RemoveAll(id => id == x.id);
                }
            });

            if (deleteIds.Count != 0)
            {
                _timelineView.RemoveSchedule(deleteIds).Subscribe(_ =>
                {
                    FillTimelines().Subscribe(__ =>
                    {
                        subject.OnNext(Unit.Default);
                        subject.OnCompleted();
                    });
                });
            }
            else
            {
                ObservableUtils.AsyncSubjectTimeZeroCompleted(subject);
            }

            return(subject);

            /*
             * AsyncSubject<Unit> subject = new AsyncSubject<Unit>();
             * if (battlers.Count != 0)
             * {
             *  List<int> deleteIds = new List<int>();
             *  battlers.ForEach(battler =>
             *  {
             *      var timeline = _timelineData.Find(x => BattlerDictionary.GetBattlerForUniqId(x.uniqId) == battler);
             *      if (timeline != null)
             *      {
             *          deleteIds.Add(timeline.id);
             *          _timelineSchedule.RemoveAll(x => x == timeline.id);
             *      }
             *  });
             *
             *  if (deleteIds.Count != 0)
             *  {
             *      _timelineView.RemoveSchedule(deleteIds).Subscribe(_ =>
             *      {
             *          FillTimelines().Subscribe(__ =>
             *          {
             *              subject.OnNext(Unit.Default);
             *              subject.OnCompleted();
             *          });
             *      });
             *  }
             *  else
             *      ObservableUtils.AsyncSubjectTimeZeroCompleted(subject);
             * }
             * else
             *  ObservableUtils.AsyncSubjectTimeZeroCompleted(subject);
             *
             * return subject;
             */
        }