Пример #1
0
        void _listView_PreviewDrop(object sender, DragEventArgs args)
        {
            args.Handled = true;

            string fileName = IsSingleFile(args);

            if (fileName == null)
            {
                return;
            }

            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            if (node == null)
            {
                return;
            }

            StreamReader reader = new StreamReader(fileName);

            while (!reader.EndOfStream)
            {
                string txt = reader.ReadLine();
                int    id;
                if (Int32.TryParse(txt, out id))
                {
                    int slot;
                    node.TakeItem(id, out slot);
                }
            }

            reader.Dispose();
            node.UpdateCharacter();
            SlotItems.GetAllSlotItems(node);
        }
Пример #2
0
        private void ItemContent_ItemSelected(object sender, Item item)
        {
            int         slot = 0;
            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            if (node != null && node.Type == M2Type.MT_CHARACTER && !node.IsNpc)
            {
                node.TakeItem(item.Id, out slot);

                ModelEditorService.Instance.ShowModelPart(node);
                ModelEditorService.Instance.ShowEditPart(node);
                ModelEditorService.Instance.SetWireFrame(node);

                if (node.SlotHasModel((E_CHAR_SLOTS)slot))
                {
                    if (slot == (int)E_CHAR_SLOTS.CS_HEAD)
                    {
                        node.BuildVisibleGeosets();
                    }
                }
                else
                {
                    node.UpdateCharacter();
                }

                //update property
                ShellService.Instance.PropertyContent.UpdateCharacterNode(node);
                ShellService.Instance.EquipmentsWindow.Update();
            }
        }
Пример #3
0
        private void WeaponContent_ItemSelected(object sender, Item item)
        {
            int         slot = 0;
            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            if (node != null && node.Type == M2Type.MT_CHARACTER && !node.IsNpc)
            {
                node.TakeItem(item.Id, out slot);
                ModelEditorService.Instance.ShowModelPart(node);
                ModelEditorService.Instance.ShowEditPart(node);
                ModelEditorService.Instance.SetWireFrame(node);

                //update property
                ShellService.Instance.PropertyContent.UpdateCharacterNode(node);
                ShellService.Instance.EquipmentsWindow.Update();
            }
        }
Пример #4
0
        private void btImport_Click(object sender, RoutedEventArgs e)
        {
            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            if (node == null)
            {
                return;
            }

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter           = "text|*.txt|All Files|*.*";
            dlg.InitialDirectory = Environment.CurrentDirectory;
            bool?ret = dlg.ShowDialog(ShellService.Instance.MainWindow);

            if (ret.HasValue && ret.Value)
            {
                StreamReader reader = new StreamReader(dlg.FileName);

                while (!reader.EndOfStream)
                {
                    string txt = reader.ReadLine();
                    int    id;
                    if (Int32.TryParse(txt, out id))
                    {
                        int slot;
                        node.TakeItem(id, out slot);
                    }
                }

                reader.Dispose();

                node.UpdateCharacter();
                SlotItems.GetAllSlotItems(node);
            }
        }