Exemple #1
0
        /// <summary>
        /// Creates the new object.
        /// </summary>
        /// <param name="pos">The position.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="emotion">The emotion.</param>
        /// <param name="action">The action.</param>
        /// <returns>The new object</returns>
        public CharacterViewModel CreateNewObject(VRPosition pos, int id, int emotion, int action)
        {
            string color = this.RandomGRB();
            CharacterViewModel character = new CharacterViewModel(pos, id, emotion, action, color);
            CharacterView view = new CharacterView(character);

            this.LinkMVVM(view, character);
            return character;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CharacterView" /> class.
        /// </summary>
        /// <param name="model">The model.</param>
        public CharacterView(CharacterViewModel model)
        {
            this.InitializeComponent();

            this.model = model;
            this.bg.Width = SizeEnum.IconSize;
            this.bg.Height = SizeEnum.IconSize;

            this.MainIcon.Width = SizeEnum.IconSize;
            this.MainIcon.Height = SizeEnum.IconSize;
            ImageSource source = ImageMap.GetImage(ImageEnum.CharacterIcon.ToString());
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = source;
            this.MainIcon.Fill = brush;

            this.SetSubIcon(this.EmotionIcon, 0);
            this.SetSubIcon(this.ActionIcon, -180);
        }
Exemple #3
0
        public void CharacterTest()
        {
            JObject character = new JObject();
            character.Add("Id", 1);
            character.Add("x", 200);
            character.Add("y", 300);
            character.Add("Emotion", 3);
            character.Add("Action", 4);

            CharacterViewModel c1 = new CharacterViewModel(new VRPosition(100, 200), 1, 1, 1, "Black");
            Dictionary<int, CharacterViewModel> characters = handler.Characters;
            characters.Add(c1.Id, c1);
            handler.Characters = characters;
            handler.Handle(character);
            CharacterViewModel c2 = new CharacterViewModel(new VRPosition(200, 300), 1, 3, 4, "Black");

            Assert.AreEqual(c1.ToString(), c2.ToString());
        }
Exemple #4
0
 public void GetBackgroundColorTest()
 {
     CharacterViewModel character = new CharacterViewModel(new VRPosition(100, 100), id, 1, 1, "#000000");
     Assert.AreEqual("#000000", character.BackgroundColor);
 }
Exemple #5
0
        public void SetUp()
        {
            factory = new CharacterFactory();

            id = 2;

            viewModel = factory.CreateNewObject(new VRPosition(100, 100), id, 1, 1);
        }