当前位置: 首页>>代码示例>>C#>>正文


C# Part.SetHighlightColor方法代码示例

本文整理汇总了C#中Part.SetHighlightColor方法的典型用法代码示例。如果您正苦于以下问题:C# Part.SetHighlightColor方法的具体用法?C# Part.SetHighlightColor怎么用?C# Part.SetHighlightColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part.SetHighlightColor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetPartHighlight

        public static void SetPartHighlight(Part part, Color color)
        {
            try
            {

                if (part != null)
                {
                    part.SetHighlightColor(color);
                    part.SetHighlight(true);
                }
            }
            catch (Exception ex)
            {
                Debug.Log(" in SetPartHighlight. Error: {0} \r\n\r\n{1}"+ ex.Message+ ex.StackTrace);
            }
        }
开发者ID:philotical,项目名称:ResourceRecovery,代码行数:16,代码来源:FlightRefuelController.cs

示例2: SetPartGlow

        private void SetPartGlow(Part part, bool active)
        {
            if (active) {

            part.SetHighlightColor(Color.magenta);
            part.SetHighlightType(Part.HighlightType.AlwaysOn);
            part.SetHighlight(true, true);

              } else {
            /*        part.SetHighlightColor(Color.red);
                part.SetHighlightType(Part.HighlightType.OnMouseOver);
                part.SetHighlight(false);*/
              }
              /*      foreach (Part child in part.children)
              SetPartGlow(part, active); */
        }
开发者ID:zachwillms,项目名称:MunarIndustries,代码行数:16,代码来源:CameraFilterThermal.cs

示例3: SetPartHighlight

        internal static void SetPartHighlight(Part part, Color color)
        {
            try
            {

                if (part != null)
                {
                    part.SetHighlightColor(color);
                    part.SetHighlight(true, false);
                    part.highlightType = Part.HighlightType.AlwaysOn;
                }
            }
            catch (Exception ex)
            {
                Utilities.LogMessage(string.Format(" in  SetPartHighlight.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }
开发者ID:Shavenbeard,项目名称:ShipManifest,代码行数:17,代码来源:SMHighlighter.cs

示例4: SetPartHighlight

        private void SetPartHighlight(Part part, Color color)
        {
            if (part == null)
                return;

            if (!part.HighlightActive)
                part.SetHighlight(true, false);

            part.highlightType = Part.HighlightType.AlwaysOn;
            part.SetHighlightColor(color);
            MonoBehaviour.print("SetPartHighlight " + color);
        }
开发者ID:sarbian,项目名称:CrewManifest,代码行数:12,代码来源:ManifestController.cs

示例5: HighlightParent

        public void HighlightParent(Part Parent)
        {
            if (null == Parent) { return; }
            Debug.LogError("SAFix.HighlightParent()");

            Parent.SetHighlightColor(Color.blue);
            Parent.SetHighlight(true, false);

            if (null == Parent.symmetryCounterparts) { return; }

            for (int IndexSiblings = 0; IndexSiblings < Parent.symmetryCounterparts.Count; IndexSiblings++)
            {
                Part Sibling = Parent.symmetryCounterparts[IndexSiblings];
                Sibling.SetHighlightColor(Color.cyan);
                Sibling.SetHighlight(true, true);
            }
        }
开发者ID:cpcallen,项目名称:KSP-Stock-Bug-Fix-Modules,代码行数:17,代码来源:SymmetryActionFix.cs

示例6: RemoveHighlight

        public void RemoveHighlight(Part HighlightPart)
        {
            if (null == HighlightPart) { return; }
            Debug.LogError("SAFix.RemoveHighlight()");

            HighlightPart.SetHighlightColor();
            HighlightPart.SetHighlight(false, false);

            if (null == HighlightPart.symmetryCounterparts) { return; }

            for (int IndexSiblings = 0; IndexSiblings < HighlightPart.symmetryCounterparts.Count; IndexSiblings++)
            {
                Part Sibling = HighlightPart.symmetryCounterparts[IndexSiblings];
                Sibling.SetHighlightColor();
                Sibling.SetHighlight(false, true);
            }
        }
开发者ID:cpcallen,项目名称:KSP-Stock-Bug-Fix-Modules,代码行数:17,代码来源:SymmetryActionFix.cs

示例7: HighlightPartAndChildren

        // Recurse through a branch and highlight the parts based on main vs. sibling branches
        // isParent = true means that the part is the first for a given branch (main or sibling branch)
        // isMainBranch = true means that the part is in the main moused over branch
        // Activate = true turns on highligting, false turns it off
        public void HighlightPartAndChildren(Part HighlightPart, bool isParent, bool isMainBranch, bool Activate)
        {
            if (null == HighlightPart) { return; }

            Color HighlightColor = Color.white;

            //if (true == inParentBranch) // In main parent branch
            //{
            //    if (true == isParent)
            //    {
            //        HighlightColor = Color.blue;
            //    }
            //    else
            //    {
            //        HighlightColor = Color.magenta;
            //    }
            //}
            //else // In sibling branch
            //{
            //    if (true == isParent)
            //    {
            //        HighlightColor = Color.blue;
            //    }
            //    else
            //    {
            //        HighlightColor = Color.cyan;
            //    }
            //}

            if (true == isMainBranch) // In main  branch
            {
               HighlightColor = Color.green;
            }
            else
            {
                HighlightColor = Color.blue;
            }
            if (true != isParent) // Subdue Children
            {
                HighlightColor *= 0.667f;
            }

            if (true == Activate)
            {
                HighlightPart.SetHighlightColor(HighlightColor);
            }
            else
            {
                HighlightPart.SetHighlightColor();
            }
            HighlightPart.SetHighlight(Activate, false);

            // highlight any children parts
            if (null != HighlightPart.children)
            {
                for (int IndexChildren = 0; IndexChildren < HighlightPart.children.Count; IndexChildren++)
                {
                    Part Child = HighlightPart.children[IndexChildren];
                    HighlightPartAndChildren(Child, false, isMainBranch, Activate);
                }
            }

            if (false == isParent || false == isMainBranch)
            {
                return; // If not the main branch parent, do not touch counterparts
            }
            if (null != HighlightPart.symmetryCounterparts)
            {
                for (int IndexSibling = 0; IndexSibling < HighlightPart.symmetryCounterparts.Count; IndexSibling++)
                {
                    Part Sibling = HighlightPart.symmetryCounterparts[IndexSibling];
                    if (true == isParent)
                    {
                        HighlightPartAndChildren(Sibling, isParent, false, Activate);
                    }

                }
            }
        }
开发者ID:cpcallen,项目名称:KSP-Stock-Bug-Fix-Modules,代码行数:83,代码来源:SymmetryActionFix.cs

示例8: SetPartHighlight

        public static void SetPartHighlight(Part part, Color color)
        {
            try
            {

                if (part != null)
                {
                    part.SetHighlightColor(color);
                    part.SetHighlight(true);
                }
            }
            catch (Exception ex)
            {
                ManifestUtilities.LogMessage(string.Format(" in  SetPartHighlight.  Error:  {0} \r\n\r\n{1}", ex.Message, ex.StackTrace), "Error", true);
            }
        }
开发者ID:ragzilla,项目名称:ShipManifest,代码行数:16,代码来源:ManifestController.cs

示例9: SetPartHighlight

 private void SetPartHighlight(Part part, Color color)
 {
     if (part != null)
     {
         part.SetHighlightColor(color);
         part.SetHighlight(true);
     }
 }
开发者ID:vXSovereignXv,项目名称:CrewManifest,代码行数:8,代码来源:ManifestController.cs

示例10: OnMouseDetachEnterPart

        void OnMouseDetachEnterPart(Part part)
        {
            if (!detachActive) return;
            detachOk = false;
            if (!HighLogic.LoadedSceneIsFlight) return;
            if (KISAddonPointer.isRunning) return;
            if (hoverInventoryGui()) return;
            if (draggedPart) return;
            ModuleKISPartDrag pDrag = part.GetComponent<ModuleKISPartDrag>();
            ModuleKISItem item = part.GetComponent<ModuleKISItem>();
            ModuleKISPartMount parentMount = null;
            if (part.parent) parentMount = part.parent.GetComponent<ModuleKISPartMount>();

            // Do nothing if part is EVA
            if (part.vessel.isEVA)
            {
                return;
            }

            // Check part distance
            if (!HasActivePickupInRange(part))
            {
                KISAddonCursor.CursorEnable("KIS/Textures/tooFar", "Too far", "(Move closer to the part)");
                return;
            }

            // Check if part is static attached
            if (item)
            {
                if (item.staticAttached)
                {
                    ModuleKISPickup pickupModule = GetActivePickupNearest(part, canStaticAttachOnly: true);
                    if ((item.allowStaticAttach == 1) || (pickupModule && item.allowStaticAttach == 2))
                    {
                        part.SetHighlightColor(XKCDColors.Periwinkle);
                        part.SetHighlight(true, false);
                        KISAddonCursor.CursorEnable("KIS/Textures/detachOk", "Detach from ground", '(' + part.partInfo.title + ')');
                        detachOk = true;
                        return;
                    }
                    else
                    {
                        if (FlightGlobals.ActiveVessel.isEVA)
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(This part can't be detached from the ground without a tool)");
                            return;
                        }
                        else
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach from ground function is not supported on this part)");
                            return;
                        }
                    }
                }
            }

            // Check if part can be detached
            if (!parentMount)
            {
                if (part.children.Count > 0 || part.parent)
                {
                    //Part with a child or a parent
                    if (item)
                    {
                        if (item.allowPartAttach == 0)
                        {
                            KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't detach", "(This part can't be detached)");
                            return;
                        }
                        else if (item.allowPartAttach == 2)
                        {
                            ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                            if (!pickupModule)
                            {
                                if (FlightGlobals.ActiveVessel.isEVA)
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(Part can't be detached without a tool)");
                                    return;
                                }
                                else
                                {
                                    KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach function is not supported on this part)");
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
                        if (!pickupModule)
                        {
                            if (FlightGlobals.ActiveVessel.isEVA)
                            {
                                KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed", "(Part can't be detached without a tool)");
                                return;
                            }
                            else
                            {
                                KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported", "(Detach function is not supported on this part)");
//.........这里部分代码省略.........
开发者ID:khr15714n,项目名称:KIS,代码行数:101,代码来源:KISAddonPickup.cs

示例11: ColorPart

        private void ColorPart( Part part, Color color )
        {
            if ( !_managedParts.ContainsKey( part ) )
            {
                if ( _useCustomShader )
                {
                    List<SavedMaterial> savedMaterials = new List<SavedMaterial>();
                    Renderer[] renderers = part.FindModelComponents<Renderer>();

                    if ( renderers.Length > 0 )
                    {
                        for ( int i = 0; i < renderers.Length; ++i )
                        {
                            savedMaterials.Insert( i, new SavedMaterial() { Shader = renderers[i].sharedMaterial.shader, Color = renderers[i].sharedMaterial.GetColor( "_Color" ) } );
                            renderers[i].sharedMaterial.shader = _material.shader;
                            renderers[i].sharedMaterial.SetColor( "_Color", color );
                        }

                        _managedParts.Add( part, savedMaterials );
                    }
                }
                else
                {
                    part.SetHighlight( true, false );
                    part.SetHighlightColor( color );
                    part.SetHighlightType( Part.HighlightType.AlwaysOn );
                }
            }
        }
开发者ID:shepheb,项目名称:KSP,代码行数:29,代码来源:IntakeBuildAid.cs

示例12: WindowGUI


//.........这里部分代码省略.........
                             GUILayout.Label(
                                 string.Format("{0} @ {1} of {2}", current.resourceName,
                                               current.amount.ToString("F"), current.maxAmount.ToString("F")),
                                 new GUILayoutOption[]
                                     {
                                         GUILayout.ExpandWidth(true)
                                     });
                             bool flag3 = false;
                             bool flag4 = transfersFrom[resType].Contains(current);
                             if (transfersTo[resType].Contains(current))
                             {
                                 flag3 = true;
                             }
                             if (GUILayout.Toggle(flag3, "In", GUI.skin.button, new GUILayoutOption[]
                                 {
                                     GUILayout.Width(75f)
                                 }) != flag3)
                             {
                                 if (!flag3)
                                 {
                                     transfersTo[resType].Add(current);
                                     if (transfersFrom[resType].Contains(current))
                                     {
                                         transfersFrom[resType].Remove(current);
                                     }
                                 }
                                 else
                                 {
                                     transfersTo[resType].Remove(current);
                                 }
                             }
                             if (GUILayout.Toggle(flag4, "Out", GUI.skin.button, new GUILayoutOption[]
                                 {
                                     GUILayout.Width(75f)
                                 }) != flag4)
                             {
                                 if (!flag4)
                                 {
                                     transfersFrom[resType].Add(current);
                                     if (transfersTo[resType].Contains(current))
                                     {
                                         transfersTo[resType].Remove(current);
                                     }
                                 }
                                 else
                                 {
                                     transfersFrom[resType].Remove(current);
                                 }
                             }
                             GUILayout.EndHorizontal();
                             if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
                             {
                                 if (highlighted != current.part)
                                 {
                                     if (highlighted != null)
                                     {
                                         highlighted.SetHighlightDefault();
                                         highlighted.SetHighlight(false);
                                         highlighted = null;
                                     }
                                     highlighted = current.part;
                                     highlighted.SetHighlightColor(Color.blue);
                                     highlighted.SetHighlight(true);
                                 }
                                 flag = true;
                             }
                         }
                         GUILayout.EndVertical();
                     }
                     else
                     {
                         if (activeResource == resType)
                         {
                             activeResource = 0;
                         }
                     }
                 }
             }
             GUILayout.EndVertical();
         }
         else
         {
             if (curVessel == activeGuiVessel)
             {
                 activeGuiVessel = 0u;
             }
         }
     }
     GUILayout.EndScrollView();
     transferRunning = GUILayout.Toggle(transferRunning, (transferRunning ? "Stop" : "Start") + " Transfer",
                                        GUI.skin.button, new GUILayoutOption[]
                                            {
                                                GUILayout.ExpandWidth(true)
                                            });
     GUI.DragWindow();
     if (flag || highlighted == null) return;
     highlighted.SetHighlightDefault();
     highlighted.SetHighlight(false);
     highlighted = null;
 }
开发者ID:andyleap,项目名称:VFMFuelPanel,代码行数:101,代码来源:FuelPanelPanel.cs

示例13: OnMouseDetachEnterPart

        void OnMouseDetachEnterPart(Part part)
        {
            if (!detachActive) {
              return;
            }
            detachOk = false;
            if (!HighLogic.LoadedSceneIsFlight
            || KISAddonPointer.isRunning
            || hoverInventoryGui()
            || draggedPart) {
              return;
            }

            // Don't separate kerbals with their parts. They have a reason to be attached.
            if (part.name == "kerbalEVA" || part.name == "kerbalEVAfemale") {
              KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't detach",
                                  "(This kerbanaut looks too attached to the part)");
              return;
            }

            ModuleKISPartDrag pDrag = part.GetComponent<ModuleKISPartDrag>();
            ModuleKISItem item = part.GetComponent<ModuleKISItem>();
            ModuleKISPartMount parentMount = null;
            if (part.parent) {
              parentMount = part.parent.GetComponent<ModuleKISPartMount>();
            }

            // Do nothing if part is EVA
            if (part.vessel.isEVA) {
              return;
            }

            // Check part distance
            if (!HasActivePickupInRange(part)) {
              KISAddonCursor.CursorEnable("KIS/Textures/tooFar", "Too far", "(Move closer to the part)");
              return;
            }

            // Check if part is static attached
            if (item) {
              if (item.staticAttached) {
            ModuleKISPickup pickupModule = GetActivePickupNearest(part, canStaticAttachOnly: true);
            if ((item.allowStaticAttach == ModuleKISItem.ItemAttachMode.AllowedAlways)
            || (pickupModule
                && item.allowStaticAttach == ModuleKISItem.ItemAttachMode.AllowedWithKisTool)) {
              part.SetHighlightColor(XKCDColors.Periwinkle);
              part.SetHighlight(true, false);
              KISAddonCursor.CursorEnable("KIS/Textures/detachOk", "Detach from ground",
                                      '(' + part.partInfo.title + ')');
              detachOk = true;
            } else {
              if (FlightGlobals.ActiveVessel.isEVA) {
            KISAddonCursor.CursorEnable(
                "KIS/Textures/needtool", "Tool needed",
                "(This part can't be detached from the ground without a tool)");
              } else {
            KISAddonCursor.CursorEnable(
                "KIS/Textures/forbidden", "Not supported",
                "(Detach from ground function is not supported on this part)");
              }
            }
              }
            }

            // Check if part can be detached
            if (!parentMount) {
              if (part.children.Count > 0 || part.parent) {
            //Part with a child or a parent
            if (item) {
              if (item.allowPartAttach == ModuleKISItem.ItemAttachMode.Disabled) {
            KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Can't detach",
                                        "(This part can't be detached)");
              } else if (item.allowPartAttach == ModuleKISItem.ItemAttachMode.AllowedWithKisTool) {
            ModuleKISPickup pickupModule = GetActivePickupNearest(part, canPartAttachOnly: true);
            if (!pickupModule) {
              if (FlightGlobals.ActiveVessel.isEVA) {
                KISAddonCursor.CursorEnable("KIS/Textures/needtool", "Tool needed",
                                            "(Part can't be detached without a tool)");
              } else {
                KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Not supported",
                                            "(Detach function is not supported on this part)");
              }
            }
              }
              return;
            }
            if (!CheckCanDetach(part)) {
              return;
            }
              } else {
            // Part without childs and parent
            return;
              }
            }

            // Check if part is a root
            if (!part.parent) {
              KISAddonCursor.CursorEnable("KIS/Textures/forbidden", "Root part",
                                  "(Cannot detach a root part)");
              return;
//.........这里部分代码省略.........
开发者ID:Kerbas-ad-astra,项目名称:KIS,代码行数:101,代码来源:KISAddonPickup.cs


注:本文中的Part.SetHighlightColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。