Esempio n. 1
0
        static void OnMouseEnterPart(Part hoverPart)
        {
            if (hoverPart == partToAttach)
            {
                return;
            }

            if (allowMount)
            {
                ModuleKISPartMount pMount = hoverPart.GetComponent <ModuleKISPartMount>();
                if (pMount)
                {
                    // Set current attach node
                    AttachNode an = attachNodes.Find(f => f.id == pMount.mountedPartNode);
                    if (an != null)
                    {
                        attachNodeIndex = attachNodes.IndexOf(an);
                        SetPointerVisible(false);
                    }
                    else
                    {
                        SetPointerVisible(true);
                    }
                    // Init attach node
                    foreach (KeyValuePair <AttachNode, List <string> > mount in pMount.GetMounts())
                    {
                        if (!mount.Key.attachedPart)
                        {
                            KIS_Shared.AssignAttachIcon(hoverPart, mount.Key, colorMountOk, "KISMount");
                        }
                    }
                }
            }
            if (allowStack && currentAttachNode.nodeType != AttachNode.NodeType.Surface)
            {
                var variant = VariantsUtils.GetCurrentPartVariant(hoverPart);
                if (variant != null)
                {
                    VariantsUtils.ApplyVariantOnAttachNodes(hoverPart, variant);
                }
                foreach (var an in KIS_Shared.GetAvailableAttachNodes(hoverPart, needSrf: false))
                {
                    KIS_Shared.AssignAttachIcon(hoverPart, an, colorStack);
                }
            }
            SendPointerState(pointerTarget, PointerState.OnMouseEnterPart, hoverPart, null);
        }
Esempio n. 2
0
 static void OnMouseEnterPart(Part hoverPart)
 {
     if (hoverPart == partToAttach)
     {
         return;
     }
     if (allowMount)
     {
         ModuleKISPartMount pMount = hoverPart.GetComponent <ModuleKISPartMount>();
         if (pMount)
         {
             // Set current attach node
             AttachNode an = attachNodes.Find(f => f.id == pMount.mountedPartNode);
             if (an != null)
             {
                 attachNodeIndex = attachNodes.FindIndex(f => f.id == pMount.mountedPartNode);
                 if (pointer)
                 {
                     UnityEngine.Object.Destroy(pointer);
                 }
             }
             // Init attach node
             foreach (KeyValuePair <AttachNode, List <string> > mount in pMount.GetMounts())
             {
                 if (!mount.Key.attachedPart)
                 {
                     KIS_Shared.AssignAttachIcon(hoverPart, mount.Key, colorMountOk, "KISMount");
                 }
             }
         }
     }
     if (allowStack && GetCurrentAttachNode().nodeType != AttachNode.NodeType.Surface)
     {
         foreach (AttachNode an in hoverPart.attachNodes)
         {
             if (!an.attachedPart)
             {
                 KIS_Shared.AssignAttachIcon(hoverPart, an, colorStack);
             }
         }
     }
     SendPointerState(pointerTarget, PointerState.OnMouseEnterPart, hoverPart, null);
 }