예제 #1
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (ThicknessMode != null)
         {
             hashCode = hashCode * 59 + ThicknessMode.GetHashCode();
         }
         if (Thickness != null)
         {
             hashCode = hashCode * 59 + Thickness.GetHashCode();
         }
         if (LenMode != null)
         {
             hashCode = hashCode * 59 + LenMode.GetHashCode();
         }
         if (Len != null)
         {
             hashCode = hashCode * 59 + Len.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (XAnchor != null)
         {
             hashCode = hashCode * 59 + XAnchor.GetHashCode();
         }
         if (XPad != null)
         {
             hashCode = hashCode * 59 + XPad.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (YAnchor != null)
         {
             hashCode = hashCode * 59 + YAnchor.GetHashCode();
         }
         if (YPad != null)
         {
             hashCode = hashCode * 59 + YPad.GetHashCode();
         }
         if (OutlineColor != null)
         {
             hashCode = hashCode * 59 + OutlineColor.GetHashCode();
         }
         if (OutlineWidth != null)
         {
             hashCode = hashCode * 59 + OutlineWidth.GetHashCode();
         }
         if (BorderColor != null)
         {
             hashCode = hashCode * 59 + BorderColor.GetHashCode();
         }
         if (BorderWidth != null)
         {
             hashCode = hashCode * 59 + BorderWidth.GetHashCode();
         }
         if (BgColor != null)
         {
             hashCode = hashCode * 59 + BgColor.GetHashCode();
         }
         if (TickMode != null)
         {
             hashCode = hashCode * 59 + TickMode.GetHashCode();
         }
         if (NTicks != null)
         {
             hashCode = hashCode * 59 + NTicks.GetHashCode();
         }
         if (Tick0 != null)
         {
             hashCode = hashCode * 59 + Tick0.GetHashCode();
         }
         if (DTick != null)
         {
             hashCode = hashCode * 59 + DTick.GetHashCode();
         }
         if (TickVals != null)
         {
             hashCode = hashCode * 59 + TickVals.GetHashCode();
         }
         if (TickText != null)
         {
             hashCode = hashCode * 59 + TickText.GetHashCode();
         }
         if (Ticks != null)
         {
             hashCode = hashCode * 59 + Ticks.GetHashCode();
         }
         if (TickLabelPosition != null)
         {
             hashCode = hashCode * 59 + TickLabelPosition.GetHashCode();
         }
         if (TickLen != null)
         {
             hashCode = hashCode * 59 + TickLen.GetHashCode();
         }
         if (TickWidth != null)
         {
             hashCode = hashCode * 59 + TickWidth.GetHashCode();
         }
         if (TickColor != null)
         {
             hashCode = hashCode * 59 + TickColor.GetHashCode();
         }
         if (ShowTickLabels != null)
         {
             hashCode = hashCode * 59 + ShowTickLabels.GetHashCode();
         }
         if (TickFont != null)
         {
             hashCode = hashCode * 59 + TickFont.GetHashCode();
         }
         if (TickAngle != null)
         {
             hashCode = hashCode * 59 + TickAngle.GetHashCode();
         }
         if (TickFormat != null)
         {
             hashCode = hashCode * 59 + TickFormat.GetHashCode();
         }
         if (TickFormatStops != null)
         {
             hashCode = hashCode * 59 + TickFormatStops.GetHashCode();
         }
         if (TickPrefix != null)
         {
             hashCode = hashCode * 59 + TickPrefix.GetHashCode();
         }
         if (ShowTickPrefix != null)
         {
             hashCode = hashCode * 59 + ShowTickPrefix.GetHashCode();
         }
         if (TickSuffix != null)
         {
             hashCode = hashCode * 59 + TickSuffix.GetHashCode();
         }
         if (ShowTickSuffix != null)
         {
             hashCode = hashCode * 59 + ShowTickSuffix.GetHashCode();
         }
         if (SeparateThousands != null)
         {
             hashCode = hashCode * 59 + SeparateThousands.GetHashCode();
         }
         if (ExponentFormat != null)
         {
             hashCode = hashCode * 59 + ExponentFormat.GetHashCode();
         }
         if (MinExponent != null)
         {
             hashCode = hashCode * 59 + MinExponent.GetHashCode();
         }
         if (ShowExponent != null)
         {
             hashCode = hashCode * 59 + ShowExponent.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (TickValsSrc != null)
         {
             hashCode = hashCode * 59 + TickValsSrc.GetHashCode();
         }
         if (TickTextSrc != null)
         {
             hashCode = hashCode * 59 + TickTextSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #2
0
        public bool Equals([AllowNull] ColorBar other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((ThicknessMode == other.ThicknessMode && ThicknessMode != null && other.ThicknessMode != null && ThicknessMode.Equals(other.ThicknessMode)) &&
                   (Thickness == other.Thickness && Thickness != null && other.Thickness != null && Thickness.Equals(other.Thickness)) &&
                   (LenMode == other.LenMode && LenMode != null && other.LenMode != null && LenMode.Equals(other.LenMode)) &&
                   (Len == other.Len && Len != null && other.Len != null && Len.Equals(other.Len)) &&
                   (X == other.X && X != null && other.X != null && X.Equals(other.X)) &&
                   (XAnchor == other.XAnchor && XAnchor != null && other.XAnchor != null && XAnchor.Equals(other.XAnchor)) &&
                   (XPad == other.XPad && XPad != null && other.XPad != null && XPad.Equals(other.XPad)) &&
                   (Y == other.Y && Y != null && other.Y != null && Y.Equals(other.Y)) &&
                   (YAnchor == other.YAnchor && YAnchor != null && other.YAnchor != null && YAnchor.Equals(other.YAnchor)) &&
                   (YPad == other.YPad && YPad != null && other.YPad != null && YPad.Equals(other.YPad)) &&
                   (OutlineColor == other.OutlineColor && OutlineColor != null && other.OutlineColor != null && OutlineColor.Equals(other.OutlineColor)) &&
                   (OutlineWidth == other.OutlineWidth && OutlineWidth != null && other.OutlineWidth != null && OutlineWidth.Equals(other.OutlineWidth)) &&
                   (BorderColor == other.BorderColor && BorderColor != null && other.BorderColor != null && BorderColor.Equals(other.BorderColor)) &&
                   (BorderWidth == other.BorderWidth && BorderWidth != null && other.BorderWidth != null && BorderWidth.Equals(other.BorderWidth)) &&
                   (BgColor == other.BgColor && BgColor != null && other.BgColor != null && BgColor.Equals(other.BgColor)) &&
                   (TickMode == other.TickMode && TickMode != null && other.TickMode != null && TickMode.Equals(other.TickMode)) &&
                   (NTicks == other.NTicks && NTicks != null && other.NTicks != null && NTicks.Equals(other.NTicks)) &&
                   (Tick0 == other.Tick0 && Tick0 != null && other.Tick0 != null && Tick0.Equals(other.Tick0)) &&
                   (DTick == other.DTick && DTick != null && other.DTick != null && DTick.Equals(other.DTick)) &&
                   (Equals(TickVals, other.TickVals) || TickVals != null && other.TickVals != null && TickVals.SequenceEqual(other.TickVals)) &&
                   (Equals(TickText, other.TickText) || TickText != null && other.TickText != null && TickText.SequenceEqual(other.TickText)) &&
                   (Ticks == other.Ticks && Ticks != null && other.Ticks != null && Ticks.Equals(other.Ticks)) &&
                   (TickleN == other.TickleN && TickleN != null && other.TickleN != null && TickleN.Equals(other.TickleN)) &&
                   (TickWidth == other.TickWidth && TickWidth != null && other.TickWidth != null && TickWidth.Equals(other.TickWidth)) &&
                   (TickColor == other.TickColor && TickColor != null && other.TickColor != null && TickColor.Equals(other.TickColor)) &&
                   (ShowTickLabels == other.ShowTickLabels && ShowTickLabels != null && other.ShowTickLabels != null && ShowTickLabels.Equals(other.ShowTickLabels)) &&
                   (TickFont == other.TickFont && TickFont != null && other.TickFont != null && TickFont.Equals(other.TickFont)) &&
                   (TickAngle == other.TickAngle && TickAngle != null && other.TickAngle != null && TickAngle.Equals(other.TickAngle)) &&
                   (TickFormat == other.TickFormat && TickFormat != null && other.TickFormat != null && TickFormat.Equals(other.TickFormat)) &&
                   (Equals(TickFormatStops, other.TickFormatStops) || TickFormatStops != null && other.TickFormatStops != null && TickFormatStops.SequenceEqual(other.TickFormatStops)) &&
                   (TickPrefix == other.TickPrefix && TickPrefix != null && other.TickPrefix != null && TickPrefix.Equals(other.TickPrefix)) &&
                   (ShowTickPrefix == other.ShowTickPrefix && ShowTickPrefix != null && other.ShowTickPrefix != null && ShowTickPrefix.Equals(other.ShowTickPrefix)) &&
                   (TickSuffix == other.TickSuffix && TickSuffix != null && other.TickSuffix != null && TickSuffix.Equals(other.TickSuffix)) &&
                   (ShowTickSuffix == other.ShowTickSuffix && ShowTickSuffix != null && other.ShowTickSuffix != null && ShowTickSuffix.Equals(other.ShowTickSuffix)) &&
                   (SeparateThousands == other.SeparateThousands && SeparateThousands != null && other.SeparateThousands != null && SeparateThousands.Equals(other.SeparateThousands)) &&
                   (ExponentFormat == other.ExponentFormat && ExponentFormat != null && other.ExponentFormat != null && ExponentFormat.Equals(other.ExponentFormat)) &&
                   (ShowExponent == other.ShowExponent && ShowExponent != null && other.ShowExponent != null && ShowExponent.Equals(other.ShowExponent)) &&
                   (Title == other.Title && Title != null && other.Title != null && Title.Equals(other.Title)) &&
                   (TickValsSrc == other.TickValsSrc && TickValsSrc != null && other.TickValsSrc != null && TickValsSrc.Equals(other.TickValsSrc)) &&
                   (TickTextSrc == other.TickTextSrc && TickTextSrc != null && other.TickTextSrc != null && TickTextSrc.Equals(other.TickTextSrc)));
        }
예제 #3
0
 protected override void Initialize()
 {
     Effect.Parameters["TextColor"].SetValue(TextColor.ToVector4());
     Effect.Parameters["OutlineColor"].SetValue(OutlineColor.ToVector4());
     Effect.Parameters["AAColor"].SetValue(AAColor.ToVector4());
 }
예제 #4
0
        /// <inheritdoc />
        public bool Equals([AllowNull] ColorBar other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ThicknessMode == other.ThicknessMode ||
                     ThicknessMode != null &&
                     ThicknessMode.Equals(other.ThicknessMode)
                     ) &&
                 (
                     Thickness == other.Thickness ||
                     Thickness != null &&
                     Thickness.Equals(other.Thickness)
                 ) &&
                 (
                     LenMode == other.LenMode ||
                     LenMode != null &&
                     LenMode.Equals(other.LenMode)
                 ) &&
                 (
                     Len == other.Len ||
                     Len != null &&
                     Len.Equals(other.Len)
                 ) &&
                 (
                     X == other.X ||
                     X != null &&
                     X.Equals(other.X)
                 ) &&
                 (
                     XAnchor == other.XAnchor ||
                     XAnchor != null &&
                     XAnchor.Equals(other.XAnchor)
                 ) &&
                 (
                     XPad == other.XPad ||
                     XPad != null &&
                     XPad.Equals(other.XPad)
                 ) &&
                 (
                     Y == other.Y ||
                     Y != null &&
                     Y.Equals(other.Y)
                 ) &&
                 (
                     YAnchor == other.YAnchor ||
                     YAnchor != null &&
                     YAnchor.Equals(other.YAnchor)
                 ) &&
                 (
                     YPad == other.YPad ||
                     YPad != null &&
                     YPad.Equals(other.YPad)
                 ) &&
                 (
                     OutlineColor == other.OutlineColor ||
                     OutlineColor != null &&
                     OutlineColor.Equals(other.OutlineColor)
                 ) &&
                 (
                     OutlineWidth == other.OutlineWidth ||
                     OutlineWidth != null &&
                     OutlineWidth.Equals(other.OutlineWidth)
                 ) &&
                 (
                     BorderColor == other.BorderColor ||
                     BorderColor != null &&
                     BorderColor.Equals(other.BorderColor)
                 ) &&
                 (
                     BorderWidth == other.BorderWidth ||
                     BorderWidth != null &&
                     BorderWidth.Equals(other.BorderWidth)
                 ) &&
                 (
                     BgColor == other.BgColor ||
                     BgColor != null &&
                     BgColor.Equals(other.BgColor)
                 ) &&
                 (
                     TickMode == other.TickMode ||
                     TickMode != null &&
                     TickMode.Equals(other.TickMode)
                 ) &&
                 (
                     NTicks == other.NTicks ||
                     NTicks != null &&
                     NTicks.Equals(other.NTicks)
                 ) &&
                 (
                     Tick0 == other.Tick0 ||
                     Tick0 != null &&
                     Tick0.Equals(other.Tick0)
                 ) &&
                 (
                     DTick == other.DTick ||
                     DTick != null &&
                     DTick.Equals(other.DTick)
                 ) &&
                 (
                     Equals(TickVals, other.TickVals) ||
                     TickVals != null && other.TickVals != null &&
                     TickVals.SequenceEqual(other.TickVals)
                 ) &&
                 (
                     Equals(TickText, other.TickText) ||
                     TickText != null && other.TickText != null &&
                     TickText.SequenceEqual(other.TickText)
                 ) &&
                 (
                     Ticks == other.Ticks ||
                     Ticks != null &&
                     Ticks.Equals(other.Ticks)
                 ) &&
                 (
                     TickLabelPosition == other.TickLabelPosition ||
                     TickLabelPosition != null &&
                     TickLabelPosition.Equals(other.TickLabelPosition)
                 ) &&
                 (
                     TickLen == other.TickLen ||
                     TickLen != null &&
                     TickLen.Equals(other.TickLen)
                 ) &&
                 (
                     TickWidth == other.TickWidth ||
                     TickWidth != null &&
                     TickWidth.Equals(other.TickWidth)
                 ) &&
                 (
                     TickColor == other.TickColor ||
                     TickColor != null &&
                     TickColor.Equals(other.TickColor)
                 ) &&
                 (
                     ShowTickLabels == other.ShowTickLabels ||
                     ShowTickLabels != null &&
                     ShowTickLabels.Equals(other.ShowTickLabels)
                 ) &&
                 (
                     TickFont == other.TickFont ||
                     TickFont != null &&
                     TickFont.Equals(other.TickFont)
                 ) &&
                 (
                     TickAngle == other.TickAngle ||
                     TickAngle != null &&
                     TickAngle.Equals(other.TickAngle)
                 ) &&
                 (
                     TickFormat == other.TickFormat ||
                     TickFormat != null &&
                     TickFormat.Equals(other.TickFormat)
                 ) &&
                 (
                     Equals(TickFormatStops, other.TickFormatStops) ||
                     TickFormatStops != null && other.TickFormatStops != null &&
                     TickFormatStops.SequenceEqual(other.TickFormatStops)
                 ) &&
                 (
                     TickPrefix == other.TickPrefix ||
                     TickPrefix != null &&
                     TickPrefix.Equals(other.TickPrefix)
                 ) &&
                 (
                     ShowTickPrefix == other.ShowTickPrefix ||
                     ShowTickPrefix != null &&
                     ShowTickPrefix.Equals(other.ShowTickPrefix)
                 ) &&
                 (
                     TickSuffix == other.TickSuffix ||
                     TickSuffix != null &&
                     TickSuffix.Equals(other.TickSuffix)
                 ) &&
                 (
                     ShowTickSuffix == other.ShowTickSuffix ||
                     ShowTickSuffix != null &&
                     ShowTickSuffix.Equals(other.ShowTickSuffix)
                 ) &&
                 (
                     SeparateThousands == other.SeparateThousands ||
                     SeparateThousands != null &&
                     SeparateThousands.Equals(other.SeparateThousands)
                 ) &&
                 (
                     ExponentFormat == other.ExponentFormat ||
                     ExponentFormat != null &&
                     ExponentFormat.Equals(other.ExponentFormat)
                 ) &&
                 (
                     MinExponent == other.MinExponent ||
                     MinExponent != null &&
                     MinExponent.Equals(other.MinExponent)
                 ) &&
                 (
                     ShowExponent == other.ShowExponent ||
                     ShowExponent != null &&
                     ShowExponent.Equals(other.ShowExponent)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     TickValsSrc == other.TickValsSrc ||
                     TickValsSrc != null &&
                     TickValsSrc.Equals(other.TickValsSrc)
                 ) &&
                 (
                     TickTextSrc == other.TickTextSrc ||
                     TickTextSrc != null &&
                     TickTextSrc.Equals(other.TickTextSrc)
                 ));
        }
        public override Pool <ProjectileData> .Node FireProjectile(Vector2 direction, float leakedTime)
        {
            Pool <ProjectileData> .Node node = new Pool <ProjectileData> .Node();

            Direction = direction;
            RefreshGroups();

            if (!AutoFire)
            {
                if (Interval > 0)
                {
                    return(node);
                }
                else
                {
                    Interval = CoolOffTime;
                }
            }

            for (int g = 0; g < GroupCount; g++)
            {
                if (Projectiles.AvailableCount >= SpokeCount)
                {
                    float rotation = 0;
                    bool  left     = true;

                    for (int n = 0; n < SpokeCount; n++)
                    {
                        node = Projectiles.Get();

                        node.Item.Position   = transform.position;
                        node.Item.Speed      = Speed;
                        node.Item.Scale      = Scale;
                        node.Item.TimeToLive = TimeToLive;
                        node.Item.Gravity    = Gravity;
                        if (UseFollowTarget && FollowTargetType == FollowTargetType.LockOnShot && Target != null)
                        {
                            Groups[g].Direction = (Target.transform.position - transform.position).normalized;
                        }
                        node.Item.Color           = Color.Evaluate(0);
                        node.Item.Acceleration    = Acceleration;
                        node.Item.FollowTarget    = UseFollowTarget;
                        node.Item.FollowIntensity = FollowIntensity;
                        node.Item.Target          = Target;

                        if (left)
                        {
                            node.Item.Velocity = Speed * Rotate(Groups[g].Direction, rotation).normalized;
                            rotation          += SpokeSpacing;
                        }
                        else
                        {
                            node.Item.Velocity = Speed * Rotate(Groups[g].Direction, -rotation).normalized;
                        }

                        // Setup outline if we have one
                        if (ProjectilePrefab.Outline != null && DrawOutlines)
                        {
                            Pool <ProjectileData> .Node outlineNode = ProjectileOutlines.Get();

                            outlineNode.Item.Position = node.Item.Position;
                            outlineNode.Item.Scale    = node.Item.Scale + OutlineSize;
                            outlineNode.Item.Color    = OutlineColor.Evaluate(0);

                            node.Item.Outline = outlineNode;
                        }

                        // Keep track of active projectiles
                        PreviousActiveProjectileIndexes[ActiveProjectileIndexesPosition] = node.NodeIndex;
                        ActiveProjectileIndexesPosition++;
                        if (ActiveProjectileIndexesPosition < ActiveProjectileIndexes.Length)
                        {
                            PreviousActiveProjectileIndexes[ActiveProjectileIndexesPosition] = -1;
                        }
                        else
                        {
                            Debug.Log("Error: Projectile was fired before list of active projectiles was refreshed.");
                        }

                        UpdateProjectile(ref node, leakedTime);

                        left = !left;
                    }

                    if (Groups[g].InvertRotation)
                    {
                        Groups[g].Direction = Rotate(Groups[g].Direction, -RotationSpeed);
                    }
                    else
                    {
                        Groups[g].Direction = Rotate(Groups[g].Direction, RotationSpeed);
                    }
                }
            }

            return(node);
        }
예제 #6
0
 public void SetOutlineColor(OutlineColor color)
 {
     GetComponent <cakeslice.Outline>().color = (int)color;
 }
예제 #7
0
 // reading my comments, are you now, mister pipe0481?
 // note that this method is much slower than SetOutlinesColor due to the GetComponent()s
 public static void SetObjectsOutlineColor(GameObject[] ReadingMyCodeAreYouNowMisterPipe0481, OutlineColor HeThrustsDeeperIntoMeThanHeEverHasBeforeIFeelItEverywhereMyBackArcsMyToesCurlMyEyesWidenIPullHimCloserToMeFeelTheTightMusclesUnderHisSkinBreatheInHisScentImGaspingForBreathHeLooksMeInTheEyesWithThatSlyGrinOfHisThatILoveSoMuchHeKnowsImCloseSuddenlyHePressesHisFaceIntoMyChestHisMouthOverMyLeftNipplePleasureCoursesThroughMeLikeElectricityEmanatingFromHisLipsHisTongueMyEyesRollBackInMyHeadAndIMoanInEcstasyMyBodyConvulsesWithAnEarthShatteringOrgasmItWasTooMuchMyHeartStopsTheParamedicsDontGetThereInTime)
 {
     foreach (GameObject ObjectWithOutline in ReadingMyCodeAreYouNowMisterPipe0481)
     {
         SetObjectOutlineColor(ObjectWithOutline, HeThrustsDeeperIntoMeThanHeEverHasBeforeIFeelItEverywhereMyBackArcsMyToesCurlMyEyesWidenIPullHimCloserToMeFeelTheTightMusclesUnderHisSkinBreatheInHisScentImGaspingForBreathHeLooksMeInTheEyesWithThatSlyGrinOfHisThatILoveSoMuchHeKnowsImCloseSuddenlyHePressesHisFaceIntoMyChestHisMouthOverMyLeftNipplePleasureCoursesThroughMeLikeElectricityEmanatingFromHisLipsHisTongueMyEyesRollBackInMyHeadAndIMoanInEcstasyMyBodyConvulsesWithAnEarthShatteringOrgasmItWasTooMuchMyHeartStopsTheParamedicsDontGetThereInTime);
     }
 }
예제 #8
0
    void OnGUI()
    {
        /*GUI Elements*/
        skin.box.normal.background = backgroundColor;//modify the UI skin

        //GUI Fields
        gameObject = (GameObject) EditorGUILayout.ObjectField("Object", gameObject, typeof(GameObject), true);
        path = EditorGUILayout.TextField("Sprite Location", path);
        size = EditorGUILayout.IntField("Width", size);
        objColor = EditorGUILayout.ColorField("Background Color", objColor);
        spriteType = (SpriteType)EditorGUILayout.EnumPopup("Sprite Type", spriteType);
        outline = EditorGUILayout.Toggle("Outline", outline);
        overrideColor = EditorGUILayout.Toggle("Override Color", overrideColor);

        //GUI fields for outlining
        if(outline)
        {
            outlineWidth = EditorGUILayout.IntField("Outline Width", outlineWidth);
            outlineColor = (OutlineColor)EditorGUILayout.EnumPopup("Outline Color", outlineColor);
            EditorGUILayout.HelpBox("Currently there is a bug in the UnityEngine where custom colors result in unexpected errors in the Texture2D", MessageType.Warning);

            //DEBUG
            /*
            if(bugTest)
            {
                debugColor = EditorGUILayout.ColorField("Outline Color", debugColor);
            }
            else
            {
                outlineColor = (OutlineColor)EditorGUILayout.EnumPopup("Outline Color", outlineColor);
                EditorGUILayout.HelpBox("Currently there is a bug in the UnityEngine where custom colors result in unexpected errors in the Texture2D", MessageType.Warning);
            }
             * */
        }

        //GUI field for overriding the color
        if(overrideColor)
        {
            newColor = EditorGUILayout.ColorField("Diffuse Color", newColor);
        }

        //If you change the color the background will show the change
        if(objColor != prevColor)
        {
            SetBackground();
        }

        //Create a new editor if the object changes
        if(gameObject != null)
        {
            CheckEditor();//Check to see if a new editor needs to be created

            //GUI fields
            objName = EditorGUILayout.TextField("Name", objName);
            gameObjectEditor.OnPreviewGUI(GUILayoutUtility.GetRect(Mathf.Min(size, 256), Mathf.Min(size, 256)), skin.box);//Render the window

            //Converts the background color to a clear color then converts it to a sprite
            if(GUILayout.Button("Render to Sprite"))
            {
                Texture2D renderImage = Render();

                if(outline)
                    Outline(renderImage);

                //Save and write the file
                Save(renderImage);
            }

            //DEBUG BUTTON FOR UNITY BUG
            //bugTest = EditorGUILayout.Toggle("Test for Unity Bug", bugTest);
        }

        //Set the prev object
        if(prevObject != gameObject)
            prevObject = gameObject;
    }
예제 #9
0
    public static Outline[] OutlineObjectAndReturnTheNewOutlines(GameObject OutlineThis, OutlineColor outlinecolor = OutlineColor.green)
    {
        MeshRenderer[] renderers = OutlineThis.GetComponentsInChildren <MeshRenderer>();

        if (renderers.Length > MaxComplexityToCalculateOutlinesFor)
        {
            ThingBeingPlacedExceedsMaxOutliningComplexity = true;
            return(new Outline[] { renderers[0].gameObject.AddComponent <Outline>() });
        }

        ThingBeingPlacedExceedsMaxOutliningComplexity = false;
        Outline[] outlines = new Outline[renderers.Length];
        for (int i = 0; i < renderers.Length; i++)
        {
            outlines[i] = renderers[i].gameObject.AddComponent <Outline>(); // note that a gameobject can only ever contain one mesh renderer, so there will not be duplicates
            SetOutlineColor(outlines[i], outlinecolor);
        }

        return(outlines);
    }
예제 #10
0
        public override void Draw(BaseScreen.Resources screenResources, SmartSpriteBatch spriteBatch, ScreenAbstractor screen, float opacity, FloatRectangle?clip = null, Texture2D bgTexture = null, Vector2?scrollOffset = null)
        {
            string txt = Text.Value();

            if (!string.IsNullOrWhiteSpace(Symbol.Value()))
            {
                MDL2Symbols symbol = (MDL2Symbols)Enum.Parse(typeof(MDL2Symbols), Symbol.Value());
                txt = symbol.AsChar();
            }

            if (FontName.Value != null)
            {
                this.ActualSize = DrawFontAsset(spriteBatch, screen, opacity, txt, FontColor.Value(),
                                                ActualPosition, FontSize.Value(), LineHeight.Value(), FontName.Value(), PseudoAntiAlias.Value(), WordWrap.Value(),
                                                Justification.Value(), FontMargin.Value(), Margin.Value(), OutlineColor.Value(), Clip, bgTexture, scrollOffset, CaretPos.Value(),
                                                MultiLine.Value(), ScissorRect);
            }


            if (Position.Value.Height == 0)
            {
                autoSize = true;
            }

            if (autoSize)
            {
                this.Position.Value = new FloatRectangle(Position.Value.X, Position.Value.Y, Position.Value.Width, ActualSize.Y);
            }
        }
예제 #11
0
    void OnGUI()
    {
        /*GUI Elements*/
        skin.box.normal.background = backgroundColor;        //modify the UI skin

        //GUI Fields
        gameObject    = (GameObject)EditorGUILayout.ObjectField("Object", gameObject, typeof(GameObject), true);
        path          = EditorGUILayout.TextField("Sprite Location", path);
        size          = EditorGUILayout.IntField("Width", size);
        objColor      = EditorGUILayout.ColorField("Background Color", objColor);
        spriteType    = (SpriteType)EditorGUILayout.EnumPopup("Sprite Type", spriteType);
        outline       = EditorGUILayout.Toggle("Outline", outline);
        overrideColor = EditorGUILayout.Toggle("Override Color", overrideColor);

        //GUI fields for outlining
        if (outline)
        {
            outlineWidth = EditorGUILayout.IntField("Outline Width", outlineWidth);
            outlineColor = (OutlineColor)EditorGUILayout.EnumPopup("Outline Color", outlineColor);
            EditorGUILayout.HelpBox("Currently there is a bug in the UnityEngine where custom colors result in unexpected errors in the Texture2D", MessageType.Warning);

            //DEBUG

            /*
             * if(bugTest)
             * {
             *      debugColor = EditorGUILayout.ColorField("Outline Color", debugColor);
             * }
             * else
             * {
             *      outlineColor = (OutlineColor)EditorGUILayout.EnumPopup("Outline Color", outlineColor);
             *      EditorGUILayout.HelpBox("Currently there is a bug in the UnityEngine where custom colors result in unexpected errors in the Texture2D", MessageType.Warning);
             * }
             * */
        }

        //GUI field for overriding the color
        if (overrideColor)
        {
            newColor = EditorGUILayout.ColorField("Diffuse Color", newColor);
        }


        //If you change the color the background will show the change
        if (objColor != prevColor)
        {
            SetBackground();
        }

        //Create a new editor if the object changes
        if (gameObject != null)
        {
            CheckEditor();            //Check to see if a new editor needs to be created

            //GUI fields
            objName = EditorGUILayout.TextField("Name", objName);
            gameObjectEditor.OnPreviewGUI(GUILayoutUtility.GetRect(Mathf.Min(size, 256), Mathf.Min(size, 256)), skin.box);//Render the window

            //Converts the background color to a clear color then converts it to a sprite
            if (GUILayout.Button("Render to Sprite"))
            {
                Texture2D renderImage = Render();

                if (outline)
                {
                    Outline(renderImage);
                }

                //Save and write the file
                Save(renderImage);
            }

            //DEBUG BUTTON FOR UNITY BUG
            //bugTest = EditorGUILayout.Toggle("Test for Unity Bug", bugTest);
        }

        //Set the prev object
        if (prevObject != gameObject)
        {
            prevObject = gameObject;
        }
    }
 private static void SetOutlineColorOfObjectsInvolvedWithPlacing(OutlineColor color)
 {
     StuffPlacer.SetObjectsOutlineColor(ObjectsInvolvedWithPlacing, color);
 }
예제 #13
0
파일: Grenier.cs 프로젝트: Altreon/RA-Awale
 void Awake()
 {
     storage      = GetComponent <StoredSeeds>();
     outlineColor = GetComponent <OutlineColor>();
 }