Exemplo n.º 1
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();
            }
        }
        private void ResetClothesSlotExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            E_CHAR_SLOTS?slot = e.Parameter as E_CHAR_SLOTS?;
            M2SceneNode  node = ModelSceneService.Instance.MainM2SceneNode;

            if (slot != null)
            {
                node.ResetSlot(slot.Value);
                if (node.SlotHasModel(slot.Value))
                {
                    if (slot.Value == E_CHAR_SLOTS.CS_HEAD)
                    {
                        node.BuildVisibleGeosets();
                    }
                }
                else
                {
                    node.UpdateCharacter();
                }
            }

            //update property
            ShellService.Instance.PropertyContent.UpdateCharacterNode(node);
            ShellService.Instance.EquipmentsWindow.Update();
        }