Beispiel #1
0
        void commonItem_Click(object sender, MouseEventArgs e)
        {
            lock (hcsm.MultiBoard)
            {
                ImageViewer item = (ImageViewer)sender;
                switch (item.Name)
                {
                case "Foothold":
                    if (!hcsm.MultiBoard.AssertLayerSelected())
                    {
                        return;
                    }
                    hcsm.EnterEditMode(ItemTypes.Footholds);
                    hcsm.MultiBoard.SelectedBoard.Mouse.SetFootholdMode();
                    hcsm.MultiBoard.Focus();
                    break;

                case "Rope":
                    if (!hcsm.MultiBoard.AssertLayerSelected())
                    {
                        return;
                    }
                    hcsm.EnterEditMode(ItemTypes.Ropes);
                    hcsm.MultiBoard.SelectedBoard.Mouse.SetRopeMode();
                    hcsm.MultiBoard.Focus();
                    break;

                case "Chair":
                    hcsm.EnterEditMode(ItemTypes.Chairs);
                    hcsm.MultiBoard.SelectedBoard.Mouse.SetChairMode();
                    hcsm.MultiBoard.Focus();
                    break;

                case "Tooltip":
                    hcsm.EnterEditMode(ItemTypes.Footholds);
                    hcsm.MultiBoard.SelectedBoard.Mouse.SetTooltipMode();
                    hcsm.MultiBoard.Focus();
                    break;

                case "Clock":
                    hcsm.EnterEditMode(ItemTypes.Misc);
                    hcsm.MultiBoard.SelectedBoard.Mouse.SetClockMode();
                    hcsm.MultiBoard.Focus();
                    break;
                }
                item.IsActive = true;
            }
        }
 private void lifeListBox_SelectedValueChanged(object sender, EventArgs e)
 {
     lock (hcsm.MultiBoard)
     {
         lifePictureBox.Image = new Bitmap(1, 1);
         if (lifeListBox.SelectedItem == null)
         {
             return;
         }
         if (reactorRButton.Checked)
         {
             ReactorInfo info = Program.InfoManager.Reactors[(string)lifeListBox.SelectedItem];
             lifePictureBox.Image = new Bitmap(info.Image);
             hcsm.EnterEditMode(ItemTypes.Reactors);
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(info);
         }
         else if (npcRButton.Checked)
         {
             string  id   = ((string)lifeListBox.SelectedItem).Substring(0, ((string)lifeListBox.SelectedItem).IndexOf(" - "));
             NpcInfo info = WzInfoTools.GetNpcInfoById(id);
             if (info == null)
             {
                 lifePictureBox.Image = null;
                 return;
             }
             if (info.Height == 1 && info.Width == 1)
             {
                 info.Image = global::HaCreator.Properties.Resources.placeholder;
             }
             lifePictureBox.Image = new Bitmap(info.Image);
             hcsm.EnterEditMode(ItemTypes.NPCs);
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(info);
         }
         else if (mobRButton.Checked)
         {
             string  id   = ((string)lifeListBox.SelectedItem).Substring(0, ((string)lifeListBox.SelectedItem).IndexOf(" - "));
             MobInfo info = WzInfoTools.GetMobInfoById(id);
             if (info == null)
             {
                 lifePictureBox.Image = null;
                 return;
             }
             lifePictureBox.Image = new Bitmap(info.Image);
             hcsm.EnterEditMode(ItemTypes.Mobs);
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(info);
         }
     }
 }
        /// <summary>
        /// On click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bgItem_Click(object sender, MouseEventArgs e)
        {
            ImageViewer    imageViewer = sender as ImageViewer;
            BackgroundInfo bgInfo      = (BackgroundInfo)((ImageViewer)sender).Tag;

            if (e.Button == MouseButtons.Left)
            {
                lock (hcsm.MultiBoard)
                {
                    hcsm.EnterEditMode(ItemTypes.Backgrounds);
                    hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo(bgInfo);
                    hcsm.MultiBoard.Focus();
                    ((ImageViewer)sender).IsActive = true;
                }
            }
            else // right click
            {
                if (bgInfo.Type == BackgroundInfoType.Spine) // only shows an animation preview window if its a spine object.
                {
                    ContextMenu cm = new ContextMenu();

                    MenuItem menuItem = new MenuItem();
                    menuItem.Text   = "Preview";
                    menuItem.Tag    = bgInfo;
                    menuItem.Click += new EventHandler(delegate(object sender_, EventArgs e_)
                    {
                        MenuItem menuItem_     = sender_ as MenuItem;
                        BackgroundInfo bgInfo_ = menuItem_.Tag as BackgroundInfo;

                        WzImageProperty spineAtlasProp = bgInfo_.WzImageProperty.WzProperties.FirstOrDefault(
                            wzprop => wzprop is WzStringProperty && ((WzStringProperty)wzprop).IsSpineAtlasResources);

                        if (spineAtlasProp != null)
                        {
                            WzStringProperty stringObj = (WzStringProperty)spineAtlasProp;
                            Thread thread = new Thread(() =>
                            {
                                try
                                {
                                    WzSpineAnimationItem item = new WzSpineAnimationItem(stringObj);

                                    // Create xna window
                                    SpineAnimationWindow Window = new SpineAnimationWindow(item);
                                    Window.Run();
                                }
                                catch (Exception ex)
                                {
                                }
                            });
                            thread.Start();
                            thread.Join();
                        }
                    });
                    cm.MenuItems.Add(menuItem);

                    cm.Show(imageViewer, new Point(0, 50));
                }
            }
        }
Beispiel #4
0
 void bgItem_Click(object sender, MouseEventArgs e)
 {
     lock (hcsm.MultiBoard)
     {
         hcsm.EnterEditMode(ItemTypes.Backgrounds);
         hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo((BackgroundInfo)((ImageViewer)sender).Tag);
         hcsm.MultiBoard.Focus();
         ((ImageViewer)sender).IsActive = true;
     }
 }
Beispiel #5
0
 void portal_MouseDown(object sender, MouseEventArgs e)
 {
     lock (hcsm.MultiBoard)
     {
         hcsm.EnterEditMode(ItemTypes.Portals);
         hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo((PortalInfo)((ImageViewer)sender).Tag);
         hcsm.MultiBoard.Focus();
         ((ImageViewer)sender).IsActive = true;
     }
 }
Beispiel #6
0
 private void objItem_Click(object sender, MouseEventArgs e)
 {
     lock (hcsm.MultiBoard)
     {
         if (!hcsm.MultiBoard.AssertLayerSelected())
         {
             return;
         }
         hcsm.EnterEditMode(ItemTypes.Objects);
         hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo((ObjectInfo)((ImageViewer)sender).Tag);
         hcsm.MultiBoard.Focus();
         ((ImageViewer)sender).IsActive = true;
     }
 }
Beispiel #7
0
 void tileItem_Click(object sender, MouseEventArgs e)
 {
     lock (hcsm.MultiBoard)
     {
         ImageViewer item = (ImageViewer)sender;
         if (!hcsm.MultiBoard.AssertLayerSelected())
         {
             return;
         }
         Layer layer = hcsm.MultiBoard.SelectedBoard.SelectedLayer;
         if (layer.tS != null)
         {
             TileInfo infoToAdd = null;
             if (ApplicationSettings.randomTiles)
             {
                 infoToAdd = ((TileInfo[])item.Tag)[0];
             }
             else
             {
                 infoToAdd = (TileInfo)item.Tag;
             }
             if (infoToAdd.tS != layer.tS)
             {
                 if (MessageBox.Show("This action will change the layer's tS. Proceed?", "Layer tS Change", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != System.Windows.Forms.DialogResult.Yes)
                 {
                     return;
                 }
                 List <UndoRedoAction> actions = new List <UndoRedoAction>();
                 actions.Add(UndoRedoManager.LayerTSChanged(layer, layer.tS, infoToAdd.tS));
                 layer.ReplaceTS(infoToAdd.tS);
                 hcsm.MultiBoard.SelectedBoard.UndoRedoMan.AddUndoBatch(actions);
             }
         }
         hcsm.EnterEditMode(ItemTypes.Tiles);
         if (ApplicationSettings.randomTiles)
         {
             hcsm.MultiBoard.SelectedBoard.Mouse.SetRandomTilesMode((TileInfo[])item.Tag);
         }
         else
         {
             hcsm.MultiBoard.SelectedBoard.Mouse.SetHeldInfo((TileInfo)item.Tag);
         }
         hcsm.MultiBoard.Focus();
         item.IsActive = true;
     }
 }