Ejemplo n.º 1
0
        public void SetMascot(Mascot Mascot)
        {
            Menu.Items.Clear();
            foreach (Voice v in Mascot.Voices)
            {
                MenuItem mi = new MenuItem()
                {
                    Header = v.Message
                };
                mi.Click += (sender, e) =>
                {
                    PlayMethod?.Invoke(v);
                };
                Menu.Items.Add(mi);
            }
            Menu.Items.Add(new Separator());

            Menu.Items.Add(FollowItem);
            Menu.Items.Add(WalkItem);
            Menu.Items.Add(StayItem);

            Menu.Items.Add(new Separator());

            Menu.Items.Add(LockMascotItem);
            Menu.Items.Add(CloseWindowItem);
        }
Ejemplo n.º 2
0
 private void MascotL_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         if (MascotL.SelectedItem != null)
         {
             Mascot       mascot = (Mascot)MascotL.SelectedItem;
             MascotEditor editor = new MascotEditor(mascot);
             editor.ShowDialog();
         }
     }
 }
Ejemplo n.º 3
0
        public MascotEditor(Mascot Mascot)
        {
            InitializeComponent();
            DataContext = this;
            MascotMenu  = MascotV.ContextMenu.Items[0] as MenuItem;

            this.Mascot = Mascot;
            foreach (Voice v in Mascot.Voices)
            {
                Sentences.Add(v);
            }

            MascotV.MascotSources.Add(new BitmapImage(new Uri(Mascot.ImageFilePath)));

            Sentences.CollectionChanged += Sentences_CollectionChanged;
            MascotMenu.ItemsSource       = Sentences.Where((v) => v.OnManual).ToList();
        }
Ejemplo n.º 4
0
        private void MascotV_Clicked(object sender, EventArgs e)
        {
            Mascot mascot = prof.Mascots[MascotV.CurrentMascotIndex];

            if (!MascotV.IsEnableRotation)
            {
                var col = mascot.Voices.Where((v) => v.OnClick).ToList();
                if (col.Count > 0)
                {
                    Random rnd = new Random();
                    Voice  v   = col[rnd.Next(0, col.Count)];
                    PlayVoice(v);
                }
            }
            else
            {
                ContextMenuManager.SetMascot(mascot);
            }
        }
Ejemplo n.º 5
0
        void InitHandlers(DesktopMascot Window, Profile Profile, Mascot Mascot)
        {
            FollowItem.Click += (sender, e) => BehaviorChanged(Profile, MascotBehavior.Follow);
            WalkItem.Click   += (sender, e) => BehaviorChanged(Profile, MascotBehavior.Walk);
            StayItem.Click   += (sender, e) => BehaviorChanged(Profile, MascotBehavior.None);

            FollowItem.IsChecked = Profile.Behavior == MascotBehavior.Follow;
            WalkItem.IsChecked   = Profile.Behavior == MascotBehavior.Walk;
            StayItem.IsChecked   = Profile.Behavior == MascotBehavior.None;

            {
                LockMascotItem.IsChecked = Profile.Locked;
                CheckableAssociate(LockMascotItem, (c) =>
                {
                    Profile.Locked = c;
                    Window.MascotV.IsEnableRotation = !Profile.Locked;
                });
            }
            {
                CloseWindowItem.Click += (sender, e) => Window.Close();
            }
        }
Ejemplo n.º 6
0
 public MascotContextMenuManager(DesktopMascot Window, Profile Profile, Mascot Mascot)
 {
     SetMascot(Mascot);
     InitHandlers(Window, Profile, Mascot);
 }