Equals() public method

public Equals ( object other ) : bool
other object
return bool
Example #1
0
 static int Equals(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Color obj  = (UnityEngine.Color)ToLua.ToObject(L, 1);
         object            arg0 = ToLua.ToVarObject(L, 2);
         bool o = obj.Equals(arg0);
         LuaDLL.lua_pushboolean(L, o);
         ToLua.SetBack(L, 1, obj);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
// methods

    static bool Color_Equals__Object(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            System.Object     arg0    = (System.Object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg);
            UnityEngine.Color argThis = (UnityEngine.Color)vc.csObj;                JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(argThis.Equals(arg0)));
            JSMgr.changeJSObj(vc.jsObjID, argThis);
        }

        return(true);
    }
Example #3
0
        /// <summary>
        /// Renders a single part and adds all its children to the draw queue.
        /// Also adds its bounding box to the bounding box queue.
        /// </summary>
        /// <param name="part">Part to render</param>
        /// <param name="scrnMatrix">Screen transform</param>
        private void renderPart(Part part, Matrix4x4 scrnMatrix, bool fill)
        {
            //first off, add all the parts children to the queue
            foreach (Part child in part.children)
            {
                if (!child.Equals(part.parent))
                {
                    partQueue.Enqueue(child);
                }
            }
            
            //get the appropriate colors
            Color partColor = new Color();
            Color boxColor = new Color();

            if (customMode == null)
                {
                    if (!fill)  partColor = getPartColor(part, basicSettings.colorModeWire);
                    else        partColor = getPartColor(part, basicSettings.colorModeFill);
                }
                else
                {
                    switch (customMode.ColorModeOverride)
                    {
                        case (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC:
                            if (!fill)  partColor = getPartColor(part, basicSettings.colorModeWire);
                            else        partColor = getPartColor(part, basicSettings.colorModeFill); 
                            break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.STATIC:
                            if (!fill)  partColor = getPartColor(part, customMode.staticSettings.colorModeWire);
                            else        partColor = getPartColor(part, customMode.staticSettings.colorModeFill);  
                            break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION:
                            if (fill)   partColor = customMode.fillColorDelegate(customMode,part);
                            else partColor = customMode.wireColorDelegate(customMode, part);
                            break;
                    }
                }

            if (customMode == null)
                {
                    boxColor = getPartColor(part, basicSettings.colorModeBox);
                }
                else
                {
                    switch (customMode.ColorModeOverride)
                    {
                        case (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC:
                            boxColor = getPartColor(part, basicSettings.colorModeBox);
                            break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.STATIC:
                            boxColor = getPartColor(part, customMode.staticSettings.colorModeBox);
                            break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION:
                            boxColor = customMode.boxColorDelegate(customMode, part);
                            break;
                    }
                }
            
            if (customMode == null)
                {
                    if (basicSettings.colorModeBoxDull) {
                        boxColor.r = boxColor.r / 2;
                        boxColor.g = boxColor.g / 2;
                        boxColor.b = boxColor.b / 2;
                    }
                }
                else
                {
                    switch (customMode.ColorModeOverride)
                    {
                        case (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC:
                            if (basicSettings.colorModeBoxDull) {
                                boxColor.r = boxColor.r / 2;
                                boxColor.g = boxColor.g / 2;
                                boxColor.b = boxColor.b / 2;
                            }break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.STATIC:
                            if (customMode.staticSettings.colorModeBoxDull) {
                                boxColor.r = boxColor.r / 2;
                                boxColor.g = boxColor.g / 2;
                                boxColor.b = boxColor.b / 2;
                            }break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION:
                            if (customMode.boxColorDullDelegate(customMode)) {
                                boxColor.r = boxColor.r / 2;
                                boxColor.g = boxColor.g / 2;
                                boxColor.b = boxColor.b / 2;
                            }break;
                    }
                }
            
            if (fill) 
            {
                if (customMode == null)
                {
                    if (basicSettings.colorModeFillDull)
                    {
                        partColor.r = partColor.r / 2;
                        partColor.g = partColor.g / 2;
                        partColor.b = partColor.b / 2;
                    }
                }
                else
                {
                    switch (customMode.ColorModeOverride)
                    {
                        case (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC:
                            if (basicSettings.colorModeFillDull)
                            {
                                partColor.r = partColor.r / 2;
                                partColor.g = partColor.g / 2;
                                partColor.b = partColor.b / 2;
                            }break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.STATIC:
                            if (customMode.staticSettings.colorModeFillDull)
                            {
                                partColor.r = partColor.r / 2;
                                partColor.g = partColor.g / 2;
                                partColor.b = partColor.b / 2;
                            }break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION:
                            if (customMode.fillColorDullDelegate(customMode))
                            {
                                partColor.r = partColor.r / 2;
                                partColor.g = partColor.g / 2;
                                partColor.b = partColor.b / 2;
                            }break;
                    }
                }
                
            }
            else 
            {
                
                if (customMode == null)
                {
                    if (basicSettings.colorModeWireDull)
                    {
                        partColor.r = partColor.r / 2;
                        partColor.g = partColor.g / 2;
                        partColor.b = partColor.b / 2;
                    }
                }
                else
                {
                    switch (customMode.ColorModeOverride)
                    {
                        case (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC:
                            if (basicSettings.colorModeWireDull)
                            {
                                partColor.r = partColor.r / 2;
                                partColor.g = partColor.g / 2;
                                partColor.b = partColor.b / 2;
                            } break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.STATIC:
                            if (customMode.staticSettings.colorModeWireDull)
                            {
                                partColor.r = partColor.r / 2;
                                partColor.g = partColor.g / 2;
                                partColor.b = partColor.b / 2;
                            } break;
                        case (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION:
                            if (customMode.wireColorDullDelegate(customMode))
                            {
                                partColor.r = partColor.r / 2;
                                partColor.g = partColor.g / 2;
                                partColor.b = partColor.b / 2;
                            } break;
                    }
                }
            }
            
            //now we need to get all meshes in the part
            List<MeshFilter> meshFList = new List<MeshFilter>();
            foreach (MeshFilter mf in part.transform.GetComponentsInChildren<MeshFilter>())
            {
                meshFList.Add(mf);
            }
            
            //MeshFilter[] meshFilters = (MeshFilter[])part.FindModelComponents<MeshFilter>();
            MeshFilter[] meshFilters = meshFList.ToArray();
            //used to determine the part bounding box
            Vector3 minVec = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
            Vector3 maxVec = new Vector3(float.MinValue, float.MinValue, float.MinValue);
            foreach (MeshFilter meshF in meshFilters)
            {
                if (!(meshF.renderer == null))
                {
                    //only render those meshes that are active
                    //examples of inactive meshes seem to include
                    //parachute canopies, engine fairings...
                    
                    if (meshF.renderer.gameObject.activeInHierarchy)
                    {
                        Mesh mesh = meshF.mesh;
                        //create the trans. matrix for this mesh (also update the bounds)
                        Matrix4x4 transMatrix = genTransMatrix(meshF.transform, FlightGlobals.ActiveVessel,false);
                        updateMinMax(mesh.bounds, transMatrix, ref minVec, ref maxVec);
                        transMatrix = scrnMatrix * transMatrix;
                        //now render it
                        if(!partColor.Equals(Color.black))
                            //renderMesh(mesh, transMatrix, partColor);
                            renderMesh(mesh.triangles, mesh.vertices, transMatrix, partColor);
                    }
                }
            }

            SkinnedMeshRenderer[] skinnedMeshes = (SkinnedMeshRenderer[])part.FindModelComponents<SkinnedMeshRenderer>();
            foreach (SkinnedMeshRenderer smesh in skinnedMeshes)
            {
                if (smesh.gameObject.activeInHierarchy)
                {
                    //skinned meshes seem to be not nearly as conveniently simple
                    //luckily, I can apparently ask them to do all the work for me
                    smesh.BakeMesh(bakedMesh);
                    //create the trans. matrix for this mesh (also update the bounds)
                    Matrix4x4 transMatrix = genTransMatrix(part.transform, FlightGlobals.ActiveVessel,false);
                    updateMinMax(bakedMesh.bounds, transMatrix, ref minVec, ref maxVec);
                    transMatrix = scrnMatrix * transMatrix;
                    //now render it
                    if (!partColor.Equals(Color.black))
                        //renderMesh(bakedMesh, transMatrix, partColor);
                        renderMesh(bakedMesh.triangles, bakedMesh.vertices, transMatrix, partColor);
                }
                
            }
            bool addToTotals = false;
            if (customMode == null) addToTotals = true;
            else if (customMode.focusSubset.Count == 0) addToTotals = true;
            else if (customMode.focusSubset.Contains(part)) addToTotals = true;

            if(addToTotals)
            {
                //finally, update the vessel "bounding box"
                if (minVecG.x > minVec.x) minVecG.x = minVec.x;
                if (minVecG.y > minVec.y) minVecG.y = minVec.y;
                if (minVecG.z > minVec.z) minVecG.z = minVec.z;
                if (maxVecG.x < maxVec.x) maxVecG.x = maxVec.x;
                if (maxVecG.y < maxVec.y) maxVecG.y = maxVec.y;
                if (maxVecG.z < maxVec.z) maxVecG.z = maxVec.z;
            }
            if (!fill) 
            {
                //and draw a box around the part (later)
                rectQueue.Enqueue(new ViewerConstants.RectColor(new Rect((minVec.x), (minVec.y), (maxVec.x - minVec.x), (maxVec.y - minVec.y)), boxColor));
            }
            
            
        }