Example #1
0
 public static void addColor(ColorVariable ColorVariable)
 {
     if (!ColorOptions.DefaultColorDict.ContainsKey(ColorVariable.identity))
     {
         ColorOptions.DefaultColorDict.Add(ColorVariable.identity, ColorVariable);
     }
 }
Example #2
0
 public ColorVariable(ColorVariable option)
 {
     identity     = option.identity;
     name         = option.name;
     color        = option.color;
     origColor    = option.origColor;
     disableAlpha = option.disableAlpha;
 }
Example #3
0
        // Token: 0x06000031 RID: 49 RVA: 0x00003944 File Offset: 0x00001B44
        public static void addColor(ColorVariable ColorVariable)
        {
            bool flag  = !ColorOptions.DefaultColorDict.ContainsKey(ColorVariable.identity);
            bool flag2 = flag;

            if (flag2)
            {
                ColorOptions.DefaultColorDict.Add(ColorVariable.identity, ColorVariable);
            }
        }
Example #4
0
        public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height)
        {
            ColorVariable c = (ColorVariable)this.serializedObject.targetObject;

            Texture2D t = new Texture2D(width, height);

            Color[] colors = new Color[width * height];
            for (int i = 0; i < colors.Length; i++)
            {
                colors[i] = c.value;
            }
            t.SetPixels(colors);
            return(t);
        }
Example #5
0
    public static bool ColorButton(float width, ColorVariable color, float height = 25f, params GUILayoutOption[] options)
    {
        List <GUILayoutOption> list = options.ToList <GUILayoutOption>();

        list.Add(GUILayout.Height(height));
        list.Add(GUILayout.Width(width));
        Rect rect = GUILayoutUtility.GetRect(width, height, list.ToArray());

        Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
        Rect rect2  = new Rect(rect.x + 4f, rect.y + 4f, rect.height - 8f, rect.height - 8f);
        bool result = GUI.Button(MenuUtilities.Inline(rect, 1), "" + color.name, Prefab._ButtonStyle);

        Drawing.DrawRect(rect2, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(MenuUtilities.Inline(rect2, 1), MenuComponent._OutlineBorderLightGray, null);
        Drawing.DrawRect(MenuUtilities.Inline(rect2, 2), color.color, null);
        return(result);
    }
Example #6
0
        public static bool ColorButton(float width, ColorVariable color, float height = 25, params GUILayoutOption[] options)
        {
            List <GUILayoutOption> parameters = options.ToList();

            parameters.Add(GUILayout.Height(height));
            parameters.Add(GUILayout.Width(width));
            Rect area = GUILayoutUtility.GetRect(width, height, parameters.ToArray());

            Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack);
            Rect preview = new Rect(area.x + 4, area.y + 4, area.height - 8, area.height - 8);
            bool pressed = GUI.Button(MenuUtilities.Inline(area), "      " + color.name, _ButtonStyle);

            Drawing.DrawRect(preview, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(preview), MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(MenuUtilities.Inline(preview, 2), color.color);
            return(pressed);
        }
Example #7
0
        /// <summary>
        /// Set a ColorVariable with the given tag.
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public void SetColor(string tag, Color value)
        {
            foreach (var variable in ColorVariables)
            {
                if (variable.Tag == tag)
                {
                    variable.Value = value;
                    return;
                }
            }
            //Not found
            var newVariable = new ColorVariable();

            newVariable.Tag   = tag;
            newVariable.Value = value;
            ColorVariables.Add(newVariable);
        }
Example #8
0
 		public void EditorSetVariableData(ColorVariable global, ColorVariableInstanced instanced, Color constant,
 			AssignmentType type, IDTokenHolder tokenHolder)
 		{
 			_assignmentType = type;
 			EditorSetTokenHolder(tokenHolder);
 			
 			switch (type)
 			{
 				case AssignmentType.Constant:
 					_constantValue = constant;
 					break;
 				case AssignmentType.GlobalVariable:
 					_globalVariable = global;
 					break;
 				case AssignmentType.PersonalVariable:
 					_instancedVariable = instanced;
 					break;
 			}
 		}
Example #9
0
 public void RandomizeColor(ColorVariable target)
 {
     target.SetValue(Random.ColorHSV());
 }
Example #10
0
 public ColorData(Color v)
 {
     colorVal = v;
     colorRef = null;
 }
Example #11
0
 public void SetValue(ColorVariable value)
 {
     CurrentValue = value.CurrentValue;
 }
        // Token: 0x060001F3 RID: 499 RVA: 0x00012908 File Offset: 0x00010B08
        public void OnGUI()
        {
            Player mainPlayer = OptimizationVariables.MainPlayer;
            bool   flag       = mainPlayer == null;
            object obj;

            if (flag)
            {
                obj = null;
            }
            else
            {
                PlayerEquipment equipment = mainPlayer.equipment;
                obj = ((equipment != null) ? equipment.useable : null);
            }
            UseableGun useableGun = obj as UseableGun;
            bool       flag2      = useableGun == null || TrajectoryComponent.spying || !WeaponOptions.EnableBulletDropPrediction || !Provider.modeConfigData.Gameplay.Ballistics;
            bool       flag3      = flag2;

            if (flag3)
            {
                bool flag4 = TrajectoryComponent.Highlighted != null;
                bool flag5 = flag4;
                if (flag5)
                {
                    TrajectoryComponent.RemoveHighlight(TrajectoryComponent.Highlighted);
                    TrajectoryComponent.Highlighted = null;
                }
            }
            else
            {
                RaycastHit     raycastHit;
                List <Vector3> list   = TrajectoryComponent.PlotTrajectory(useableGun, out raycastHit, 255);
                bool           flag6  = Vector3.Distance(list.Last <Vector3>(), OptimizationVariables.MainPlayer.look.aim.position) > useableGun.equippedGunAsset.range;
                ColorVariable  color  = ColorUtilities.getColor("_TrajectoryPredictionInRange");
                ColorVariable  color2 = ColorUtilities.getColor("_TrajectoryPredictionOutOfRange");
                bool           flag7  = WeaponOptions.HighlightBulletDropPredictionTarget && raycastHit.collider != null;
                bool           flag8  = flag7;
                if (flag8)
                {
                    Transform  transform  = raycastHit.transform;
                    GameObject gameObject = null;
                    bool       flag9      = DamageTool.getPlayer(transform) != null;
                    bool       flag10     = flag9;
                    if (flag10)
                    {
                        gameObject = DamageTool.getPlayer(transform).gameObject;
                    }
                    else
                    {
                        bool flag11 = DamageTool.getZombie(transform) != null;
                        bool flag12 = flag11;
                        if (flag12)
                        {
                            gameObject = DamageTool.getZombie(transform).gameObject;
                        }
                        else
                        {
                            bool flag13 = DamageTool.getAnimal(transform) != null;
                            bool flag14 = flag13;
                            if (flag14)
                            {
                                gameObject = DamageTool.getAnimal(transform).gameObject;
                            }
                            else
                            {
                                bool flag15 = DamageTool.getVehicle(transform) != null;
                                bool flag16 = flag15;
                                if (flag16)
                                {
                                    gameObject = DamageTool.getVehicle(transform).gameObject;
                                }
                            }
                        }
                    }
                    bool flag17 = gameObject != null;
                    bool flag18 = flag17;
                    if (flag18)
                    {
                        Highlighter highlighter = gameObject.GetComponent <Highlighter>() ?? gameObject.AddComponent <Highlighter>();
                        bool        flag19      = !highlighter.enabled;
                        bool        flag20      = flag19;
                        if (flag20)
                        {
                            highlighter.occluder = true;
                            highlighter.overlay  = true;
                            highlighter.ConstantOnImmediate(flag6 ? color2 : color);
                        }
                        bool flag21 = TrajectoryComponent.Highlighted != null && highlighter != TrajectoryComponent.Highlighted;
                        bool flag22 = flag21;
                        if (flag22)
                        {
                            TrajectoryComponent.RemoveHighlight(TrajectoryComponent.Highlighted);
                        }
                        TrajectoryComponent.Highlighted = highlighter;
                    }
                    else
                    {
                        bool flag23 = TrajectoryComponent.Highlighted != null;
                        bool flag24 = flag23;
                        if (flag24)
                        {
                            TrajectoryComponent.RemoveHighlight(TrajectoryComponent.Highlighted);
                            TrajectoryComponent.Highlighted = null;
                        }
                    }
                }
                else
                {
                    bool flag25 = !WeaponOptions.HighlightBulletDropPredictionTarget && TrajectoryComponent.Highlighted != null;
                    bool flag26 = flag25;
                    if (flag26)
                    {
                        TrajectoryComponent.RemoveHighlight(TrajectoryComponent.Highlighted);
                        TrajectoryComponent.Highlighted = null;
                    }
                }
                ESPComponent.GLMat.SetPass(0);
                GL.PushMatrix();
                GL.LoadProjectionMatrix(OptimizationVariables.MainCam.projectionMatrix);
                GL.modelview = OptimizationVariables.MainCam.worldToCameraMatrix;
                GL.Begin(2);
                GL.Color(flag6 ? color2 : color);
                foreach (Vector3 v in list)
                {
                    GL.Vertex(v);
                }
                GL.End();
                GL.PopMatrix();
            }
        }
Example #13
0
        // Token: 0x0600024A RID: 586 RVA: 0x00016AD0 File Offset: 0x00014CD0
        public static void Tab()
        {
            bool flag  = ColorOptions.selectedOption == null;
            bool flag2 = flag;

            if (flag2)
            {
                ColorOptions.previewselected = ColorOptions.preview;
            }
            Prefab.ScrollView(new Rect(0f, 0f, 250f, 436f), "Цвета", ref ColorsTab.ColorScroll, delegate()
            {
                GUILayout.Space(10f);
                List <KeyValuePair <string, ColorVariable> > list = ColorOptions.ColorDict.ToList <KeyValuePair <string, ColorVariable> >();
                list.Sort((KeyValuePair <string, ColorVariable> pair1, KeyValuePair <string, ColorVariable> pair2) => string.Compare(pair1.Value.name, pair2.Value.name, StringComparison.Ordinal));
                for (int i = 0; i < list.Count; i++)
                {
                    ColorVariable color = ColorUtilities.getColor(list[i].Value.identity);
                    bool flag3          = Prefab.ColorButton(205f, color, 25f, Array.Empty <GUILayoutOption>());
                    bool flag4          = flag3;
                    if (flag4)
                    {
                        ColorOptions.selectedOption  = color.identity;
                        ColorOptions.previewselected = new ColorVariable(color);
                        ColorsTab.LastColorPreview1  = color.color;
                    }
                    GUILayout.Space(3f);
                }
                bool flag5 = Prefab.Button("Восстановить по умолчанию", 205f, 25f, Array.Empty <GUILayoutOption>());
                bool flag6 = flag5;
                if (flag6)
                {
                    for (int j = 0; j < list.Count; j++)
                    {
                        ColorVariable color2 = ColorUtilities.getColor(list[j].Value.identity);
                        color2.color         = color2.origColor;
                        MenuComponent.SetGUIColors();
                        ColorOptions.selectedOption = null;
                        ColorsTab.LastColorPreview1 = ColorOptions.preview.color;
                    }
                }
                GUILayout.Space(10f);
            }, 20, Array.Empty <GUILayoutOption>());
            Rect previewRect = new Rect(255f, 0f, 211f, 120f);

            Prefab.MenuArea(previewRect, "Предпросмотр", delegate
            {
                Rect rect = new Rect(5f, 20f, previewRect.width - 10f, previewRect.height - 25f);
                Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
                Drawing.DrawRect(MenuUtilities.Inline(rect, 1), MenuComponent._OutlineBorderLightGray, null);
                Rect rect2 = MenuUtilities.Inline(rect, 2);
                Drawing.DrawRect(new Rect(rect2.x, rect2.y, rect2.width / 2f, rect2.height), ColorsTab.LastColorPreview1, null);
                Drawing.DrawRect(new Rect(rect2.x + rect2.width / 2f, rect2.y, rect2.width / 2f, rect2.height), ColorOptions.previewselected, null);
            });
            Prefab.MenuArea(new Rect(previewRect.x, previewRect.y + previewRect.height + 5f, previewRect.width, 436f - previewRect.height - 5f), ColorOptions.previewselected.name, delegate
            {
                GUILayout.BeginArea(new Rect(10f, 20f, previewRect.width - 10f, 205f));
                ColorOptions.previewselected.color.r = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.r, "R: ", 30, 0, 255));
                ColorOptions.previewselected.color.r = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.r, 185)));
                GUILayout.FlexibleSpace();
                ColorOptions.previewselected.color.g = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.g, "G: ", 30, 0, 255));
                ColorOptions.previewselected.color.g = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.g, 185)));
                GUILayout.FlexibleSpace();
                ColorOptions.previewselected.color.b = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.b, "B: ", 30, 0, 255));
                ColorOptions.previewselected.color.b = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.b, 185)));
                GUILayout.FlexibleSpace();
                bool flag3 = !ColorOptions.previewselected.disableAlpha;
                bool flag4 = flag3;
                if (flag4)
                {
                    ColorOptions.previewselected.color.a = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.a, "A: ", 30, 0, 255));
                    ColorOptions.previewselected.color.a = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.a, 185)));
                }
                else
                {
                    Prefab.TextField(ColorOptions.previewselected.color.a, "A: ", 30, 0, 255);
                    Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.a, 185);
                }
                GUILayout.Space(100f);
                GUILayout.EndArea();
                GUILayout.Space(160f);
                GUILayout.FlexibleSpace();
                bool flag5 = Prefab.Button("Отменить", 180f, 25f, Array.Empty <GUILayoutOption>());
                bool flag6 = flag5;
                if (flag6)
                {
                    ColorOptions.selectedOption = null;
                    ColorsTab.LastColorPreview1 = ColorOptions.preview.color;
                }
                GUILayout.Space(3f);
                bool flag7 = Prefab.Button("Восстановить", 180f, 25f, Array.Empty <GUILayoutOption>());
                bool flag8 = flag7;
                if (flag8)
                {
                    ColorUtilities.setColor(ColorOptions.previewselected.identity, ColorOptions.previewselected.origColor);
                    ColorOptions.previewselected.color = ColorOptions.previewselected.origColor;
                    MenuComponent.SetGUIColors();
                }
                GUILayout.Space(3f);
                bool flag9  = Prefab.Button("Применить", 180f, 25f, Array.Empty <GUILayoutOption>());
                bool flag10 = flag9;
                if (flag10)
                {
                    ColorUtilities.setColor(ColorOptions.previewselected.identity, ColorOptions.previewselected.color);
                    MenuComponent.SetGUIColors();
                    ColorsTab.LastColorPreview1 = ColorOptions.previewselected.color;
                }
                GUILayout.Space(30f);
            });
        }
Example #14
0
 public void SetColor(ColorVariable color)
 {
     ColorValue = color.ColorValue;
 }