Inheritance: IMarkable, INotifyPropertyChanged, ISearchable, ITagStickable
        public CharacterSateliteViewModel(SateliteViewer viewer, CharacterModel model)
        {
            _view = viewer;
            _parent = model;

            _view.Closed += _view_Closed;
            _parent.PropertyChanged += _parent_PropertyChanged;
            _view.OnJumpEvent += _view_OnJumpEvent;
            EventAggregator.DeleteIMarkableHandler += OnIMarkableDeleted;
        }
        public static void AddCharacterMark(int head, int tail, CharacterModel model)
        {
            var charaMark = new CharacterMark();
            charaMark.Brush = model.MarkBrush;
            charaMark.CharacterId = model.Id;
            charaMark.HeadCharIndex = head;
            charaMark.TailCharIndex = tail;
            charaMark.Parent = model;

            ModelsComposite.MarkManager.AddMark(charaMark);
        }
        /// <summary>
        /// 新しい登場人物を追加する
        /// </summary>
        /// <param name="addModel">追加する登場人物</param>
        /// <returns>作成した登場人物</returns>
        public CharacterModel AddCharacter(CharacterModel addModel)
        {
            var manager = ModelsComposite.CharacterManager;

            manager.AddModel(addModel);

            EventAggregator.OnModelDataChanged(this, new ModelValueChangedEventArgs());
            EventAggregator.OnAddIMarkable(this, new AddIMarkableModelEventArgs(addModel));

            return addModel;
        }
Ejemplo n.º 4
0
 public static bool IsDisplayable(CharacterModel chara, string[] filterWords)
 {
     string chainedAll = chara.ToSearchString();
     for (int i = 0; i < filterWords.Count(); i++)
     {
         if (!chainedAll.Contains(filterWords[i]))
         {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 登場人物の軸を作る
 /// </summary>
 private static TimelineAxis GenerateAxisFromChara(CharacterModel chara)
 {
     return new TimelineAxis()
     {
         Id = chara.Id,
         HeaderName = chara.Symbol,
         Width = 140,
         IsDisplayed = true,
         IsUnbound = false,
         DrawBrush = (SolidColorBrush)chara.ColorBrush,
         SourceObject = chara
     };
 }
        public static SateliteViewer Generate(CharacterModel model)
        {
            var viewer = new SateliteViewer(Application.Current.MainWindow);
            var viewModel = new CharacterSateliteViewModel(viewer, model);

            viewer.LeftButtonLabel = "名前";
            viewer.TopButtonLabel = "ステータス";
            viewer.RightButtonLabel = "自由記入欄";
            viewer.BottomButtonLabel = "未使用";

            viewer.RelatedModel = model;
            viewer.TopLeftGridElement = new NameGrid() { DataContext = viewModel };
            viewer.TopRightGridElement = new StatusGrid() { DataContext = viewModel };
            viewer.BottomRightGridElement = new RemarkGrid() { DataContext = viewModel };
            viewer.BottomLeftGridElement = new NotUsedGrid() { DataContext = viewModel };

            return viewer;
        }
        public static void AddCharacterMark(string text, int index, CharacterModel model)
        {
            int headLineIndex = GetLineHead(text, index);
            int tailLineIndex = GetLineTail(text, index);
            int headBracketIndex;
            int tailBracketIndex;

            bool hasHeadBracket = HasBracketHead(text, headLineIndex, index, out headBracketIndex);
            bool hasTailBracket = HasBracketTail(text, headBracketIndex, text.Length - 1, GetTailBracket(text[headBracketIndex]), out tailBracketIndex);

            if (hasHeadBracket && hasTailBracket)
            {
                AddCharacterMark(headBracketIndex, tailBracketIndex, model);
            }
            else
            {
                AddCharacterMark(headLineIndex, tailLineIndex, model);
            }
        }
Ejemplo n.º 8
0
        public CharacterModel GetNewModel()
        {
            var model = new CharacterModel();
            model.Age = "";
            model.FirstName = "";
            model.FirstNameRuby = "";
            model.Gender = GenderEnum.Male;
            model.Id = GetUniqueId();
            model.LastName = "名前のない人";
            model.LastNameRuby = "";
            model.ColorBrush = new SolidColorBrush(Color.FromArgb(255, 200, 0, 0));
            model.MiddleName = "";
            model.MiddleNameRuby = "";
            model.NameOrder = NameOrderEnum.FamilyPersonelBracketMiddle;
            model.NickName = "";
            model.RelationWithHero = "";
            model.Remarks = "";
            model.Species = "";
            model.Symbol = "";

            return model;
        }
        public void RemoveParticipants(CharacterModel chara)
        {
            List<TimelineEventModel> removeModels = new List<TimelineEventModel>();

            foreach (var model in ModelCollection)
            {
                if (model.Participants.Contains(chara.Id))
                {
                    model.Participants.Remove(chara.Id);
                }

                if (model.Participants.Count() == 0)
                {
                    removeModels.Add(model);
                }
            }

            foreach (var item in removeModels)
            {
                ModelCollection.Remove(item);
            }
        }
Ejemplo n.º 10
0
        public void CopyWithoutId(CharacterModel src)
        {
            this.Age = src.Age;
            this.ColorBrush = src.ColorBrush;
            this.FirstName = src.FirstName;
            this.FirstNameRuby = src.FirstNameRuby;
            this.Gender = src.Gender;
            this.LastName = src.LastName;
            this.LastNameRuby = src.LastNameRuby;
            this.MiddleName = src.MiddleName;
            this.MiddleNameRuby = src.MiddleNameRuby;
            this.NameOrder = src.NameOrder;
            this.NickName = src.NickName;
            this.RelationWithHero = src.RelationWithHero;
            this.Remarks = src.Remarks;
            this.Species = src.Species;
            this.Symbol = src.Symbol;
            this.Tags.Clear();

            foreach (var tagId in src.Tags)
            {
                this.Tags.Add(tagId);
            }

            this._deepPhycheModel.Copy(src.DeepPhycheModel);
        }
 private void ChangeIsAppearedCharacterStoryModel(CharacterModel chara, bool isAppeared)
 {
     var charaStories = ModelsComposite.CharacterStoryModelManager.FindModel(SelectingModel.Id);
     var charaStoryModel = charaStories.FindModel(chara.Id);
     if (isAppeared)
     {
         if (charaStoryModel != null)
         {
             return;
         }
         var model = ModelsComposite.CharacterStoryModelManager.GetNewModel(chara.Id, SelectingModel.Id);
         charaStories.AddModel(model);
     }
     else
     {
         if (charaStoryModel == null)
         {
             return;
         }
         charaStories.RemoveModel(charaStoryModel);
     }
 }
        public void RemoveModel(CharacterModel model)
        {
            foreach (var mgr in _modelCollection)
            {
                var relationModel = mgr.FindModel(model.Id);
                if (relationModel == null)
                {
                    continue;
                }

                mgr.RemoveModel(relationModel);
            }
        }
        public void Select(CharacterModel model)
        {
            int selectIndex = -1;
            if(model != null)
            {
                selectIndex = CharacterModelCollection.IndexOf(model);
            }

            SelectingIndex = selectIndex;
        }