internal Player(string name, Color color, ColorName colorName) { Name = name; Color = color; ColorName = colorName; Tokens = 0; }
public static Color FindNearestKnown(this Color c) { var best = new ColorName { Name = null }; foreach (string colorName in Enum.GetNames(typeof(KnownColor))) { Color known = Color.FromName(colorName); int dist = Math.Abs(c.R - known.R) + Math.Abs(c.G - known.G) + Math.Abs(c.B - known.B); if (best.Name == null || dist < best.Distance) { best.Color = known; best.Name = colorName; best.Distance = dist; } } return best.Color; }
protected static Color TriggerTypeIconColor(ColorName directionColorName) { return(DGUI.Colors.IconColor(directionColorName)); }
protected void DrawSockets(Node node, List <Socket> sockets, GUIStyle directionIconStyle, string directionTitle, ColorName directionColorName) { if (sockets.Count == 0) { return; } DrawSmallTitleWithBackground(directionIconStyle, directionTitle, directionColorName); GUILayout.Space(DGUI.Properties.Space()); for (int i = 0; i < sockets.Count; i++) { Socket socket = sockets[i]; GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginHorizontal(GUILayout.Height(kNodeLineHeight)); { DrawSocketIndex(i, directionColorName); GUILayout.BeginVertical(); { DrawSocketState(socket, socket.AcceptsMultipleConnections); if (DrawCurveModifier(node, socket, ShowCurveModifier)) { NodeUpdated = true; } } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); GUILayout.Space(DGUI.Properties.Space()); } }
public static Color GetColorByName(string name) { return(ColorName.TryGetValue(name, out var result) ? result : Color.Zero); }
private Color PrimaryAccentColor(ColorName colorName) { return(DGUI.Utility.IsProSkin ? DGUI.Colors.GetDColor(colorName).Light : DGUI.Colors.GetDColor(colorName).Dark); }
private Color NodeGlowColor(ColorName colorName) { return(DGUI.Utility.IsProSkin ? DGUI.Colors.GetDColor(colorName).Dark : DGUI.Colors.GetDColor(colorName).Normal); }
public void PorCorrecao(ColorName color) { if (color == ColorName.Branco) PorCorrecao(Color.White); else if (color == ColorName.Preto) PorCorrecao(Color.Black); }
internal void Reset() { color = Color.CornflowerBlue; colorName = ColorName.Empty; }
public static bool Draw(GUIStyle style, ColorName iconColorName, float rowHeight, float iconSize) { return(Draw(style, Colors.IconColor(iconColorName), rowHeight, iconSize)); }
public static bool Draw(Rect rect, GUIStyle style, ColorName iconColorName) { return(Draw(rect, style, Colors.IconColor(iconColorName))); }
public static bool DrawToolbarButton(string text, GUIStyle normalStyle, GUIStyle selectedStyle, bool selected, ColorName colorName, ColorName textColorName, params GUILayoutOption[] options) { Color initialColor = GUI.color; GUI.color = Colors.GetDColor(colorName).Normal; bool result = GUILayout.Button(new GUIContent(text), Colors.ColorTextOfGUIStyle(selected ? selectedStyle : normalStyle, textColorName), options); GUI.color = initialColor; return(result); }
public static bool DrawToolbarButton(string text, GUIStyle normalStyle, GUIStyle selectedStyle, bool selected, ColorName colorName, params GUILayoutOption[] options) { return(DrawToolbarButton(text, normalStyle, selectedStyle, selected, colorName, colorName, options)); }
public void PorCor(ColorName color) { if (color == ColorName.Blue) PorCor(Color.Blue); else if (color == ColorName.Cyan) PorCor(Color.Cyan); else if (color == ColorName.Green) PorCor(Color.Green); else if (color == ColorName.Pink) PorCor(Color.Pink); else if (color == ColorName.Red) PorCor(Color.Red); else if (color == ColorName.Yellow) PorCor(Color.Yellow); }
protected static void DrawBigTitleWithBackground(GUIStyle iconStyle, string label, ColorName backgroundColorName, ColorName textColorName) { DGUI.Doozy.DrawTitleWithIconAndBackground(iconStyle, label.ToUpperInvariant(), Size.XL, kBigTitleHeight, backgroundColorName, textColorName); }
protected static void DrawSmallTitle(GUIStyle iconStyle, string label, ColorName colorName) { DGUI.Doozy.DrawTitleWithIcon(iconStyle, label, Size.M, kSmallTitleHeight, colorName); }
public static bool Close(float rowHeight = -1, ColorName colorName = ColorName.Red) { return(Draw(Styles.GetStyle(Styles.StyleName.IconButtonClose), colorName, rowHeight)); }
internal void Reset() { colorName = ColorName.Empty; color = Color.White; }
public static bool Play(float rowHeight = -1, ColorName colorName = ColorName.White) { return(Draw(Styles.GetStyle(Styles.StyleName.IconButtonPlaySound), colorName, rowHeight)); }
private void UpdateColors() { m_nodeGlowColor = Color.black.WithAlpha(GUI.color.a * NodySettings.Instance.NodeGlowOpacity); m_nodeBodyColor = DGUI.Utility.IsProSkin ? Color.black.Lighter() : Color.white.Darker(); var accentColorName = ColorName.Gray; ColorName headerTextColorName = DGUI.Utility.IsProSkin ? ColorName.UnityLight : ColorName.UnityDark; if (IsActive) { accentColorName = DGUI.Colors.ActionColorName; headerTextColorName = accentColorName; } else if (Node.HasErrors) { accentColorName = ColorName.Red; headerTextColorName = accentColorName; } else if (!EditorApplication.isPlayingOrWillChangePlaymode) { switch (Node.NodeType) { case NodeType.SubGraph: { accentColorName = DGUI.Colors.SubGraphNodeColorName; headerTextColorName = accentColorName; break; } case NodeType.Start: { accentColorName = DGUI.Colors.StartNodeColorName; headerTextColorName = accentColorName; break; } case NodeType.Enter: { accentColorName = DGUI.Colors.EnterNodeColorName; headerTextColorName = accentColorName; break; } case NodeType.Exit: { accentColorName = DGUI.Colors.ExitNodeColorName; headerTextColorName = accentColorName; break; } } } m_primaryAccentColor = DGUI.Colors.TextColor(accentColorName, true); m_headerTextAndIconColor = DGUI.Colors.TextColor(headerTextColorName, true); m_nodeOutlineColor = DGUI.Colors.TextColor(accentColorName, true); m_nodeOutlineColor.a = GUI.color.a * (IsSelected ? 0.8f : IsActive ? 1f : 0f); m_nodeBodyColor.a = GUI.color.a * (IsSelected ? 1f : NodySettings.Instance.NodeBodyOpacity); m_nodeHeaderAndFooterBackgroundColor = IsActive ? DGUI.Utility.IsProSkin ? DGUI.Colors.GetDColor(accentColorName).Dark : DGUI.Colors.GetDColor(accentColorName).Normal : DGUI.Utility.IsProSkin ? DGUI.Colors.GetDColor(accentColorName).Dark : !Node.HasErrors && (EditorApplication.isPlayingOrWillChangePlaymode || Node.NodeType == NodeType.General) ? DGUI.Colors.GetDColor(accentColorName).Light.Lighter().Lighter() : DGUI.Colors.GetDColor(accentColorName).Light; m_nodeHeaderAndFooterBackgroundColor.a = GUI.color.a * (IsSelected ? 1f : 0.8f); //NODE PING COLOR if (EditorApplication.isPlaying) { if (Node.Ping) { m_ping.value = true; m_ping.target = false; Node.Ping = false; } if (m_ping.faded > 0) { m_nodeGlowColor = Color.LerpUnclamped(m_nodeGlowColor, NodeActiveGlowColor, m_ping.faded); m_nodeOutlineColor = Color.LerpUnclamped(m_nodeOutlineColor, Node.HasErrors ? NodeErrorOutlineColor : NodeActiveOutlineColor, m_ping.faded); m_nodeHeaderAndFooterBackgroundColor = Color.LerpUnclamped(m_nodeHeaderAndFooterBackgroundColor, NodeActiveHeaderAndFooterColor, m_ping.faded); m_primaryAccentColor = Color.LerpUnclamped(m_primaryAccentColor, PrimaryActiveAccentColor, m_ping.faded); m_headerTextAndIconColor = Color.LerpUnclamped(m_headerTextAndIconColor, PrimaryActiveAccentColor, m_ping.faded); } } else if (IsActive || Node.Ping || m_ping.faded > 0) { IsActive = false; Node.Ping = false; m_ping.value = false; m_ping.target = false; } }
public static bool Plus(float rowHeight = -1, ColorName colorName = ColorName.Green) { return(Draw(Styles.GetStyle(Styles.StyleName.IconButtonPlus), colorName, rowHeight)); }
private Color NodeOutlineColor(ColorName colorName) { return(DGUI.Colors.IconColor(colorName, true)); }
public static bool Unlink(float rowHeight = -1, ColorName colorName = ColorName.White) { return(Draw(Styles.GetStyle(Styles.StyleName.IconButtonUnlink), colorName, rowHeight)); }
private void DrawInputData() { DGUI.Doozy.DrawTitleWithIconAndBackground(Styles.GetStyle(Styles.StyleName.IconFaKeyboard), UILabels.Key, Size.L, DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2), ComponentColorName, ComponentColorName); GUILayout.Space(DGUI.Properties.Space()); var inputMode = (InputMode)m_inputMode.enumValueIndex; ColorName backgroundColorName = DGUI.Colors.GetBackgroundColorName(inputMode != InputMode.None, ComponentColorName); ColorName textColorName = DGUI.Colors.GetTextColorName(inputMode != InputMode.None, ComponentColorName); m_alternateExpanded.target = inputMode != InputMode.None; DGUI.Line.Draw(false, () => { DGUI.Line.Draw(false, backgroundColorName, () => { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(UILabels.InputMode, Size.S, textColorName, DGUI.Properties.SingleLineHeight); EditorGUI.BeginChangeCheck(); DGUI.Property.Draw(m_inputMode, backgroundColorName, DGUI.Properties.SingleLineHeight); if (EditorGUI.EndChangeCheck()) { DGUI.Properties.ResetKeyboardFocus(); } }); }, () => { switch (inputMode) { case InputMode.KeyCode: GUILayout.Space(DGUI.Properties.Space()); DGUI.Line.Draw(false, ComponentColorName, () => { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(UILabels.KeyCode, Size.S, ComponentColorName, DGUI.Properties.SingleLineHeight); DGUI.Property.Draw(m_keyCode, ComponentColorName, DGUI.Properties.SingleLineHeight); GUILayout.Space(DGUI.Properties.Space()); }); break; case InputMode.VirtualButton: GUILayout.Space(DGUI.Properties.Space()); DGUI.Line.Draw(false, ComponentColorName, () => { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(UILabels.VirtualButton, Size.S, ComponentColorName, DGUI.Properties.SingleLineHeight); DGUI.Property.Draw(m_virtualButtonName, ComponentColorName, DGUI.Properties.SingleLineHeight); GUILayout.Space(DGUI.Properties.Space()); }); break; } } ); if (DGUI.FadeOut.Begin(m_alternateExpanded, false)) { GUILayout.Space(DGUI.Properties.Space()); DGUI.Line.Draw(false, () => { DGUI.Toggle.Checkbox.Draw(m_enableAlternateInputs, UILabels.AlternateInput, ComponentColorName, true, false); }, () => { bool enabled = GUI.enabled; GUI.enabled = m_enableAlternateInputs.boolValue; backgroundColorName = !m_enableAlternateInputs.boolValue ? DGUI.Colors.DisabledBackgroundColorName : ComponentColorName; textColorName = !m_enableAlternateInputs.boolValue ? DGUI.Colors.DisabledTextColorName : ComponentColorName; switch (inputMode) { case InputMode.KeyCode: GUILayout.Space(DGUI.Properties.Space()); DGUI.Line.Draw(false, backgroundColorName, () => { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(UILabels.AlternateKeyCode, Size.S, textColorName, DGUI.Properties.SingleLineHeight); DGUI.Property.Draw(m_keyCodeAlt, backgroundColorName, DGUI.Properties.SingleLineHeight); GUILayout.Space(DGUI.Properties.Space()); }); break; case InputMode.VirtualButton: GUILayout.Space(DGUI.Properties.Space()); DGUI.Line.Draw(false, backgroundColorName, () => { GUILayout.Space(DGUI.Properties.Space(2)); DGUI.Label.Draw(UILabels.AlternateVirtualButton, Size.S, textColorName, DGUI.Properties.SingleLineHeight); DGUI.Property.Draw(m_virtualButtonNameAlt, backgroundColorName, DGUI.Properties.SingleLineHeight); GUILayout.Space(DGUI.Properties.Space()); }); break; } GUI.enabled = enabled; } ); } DGUI.FadeOut.End(m_alternateExpanded, false); }
public static bool Cancel(Rect rect, ColorName colorName = ColorName.Red) { return(Draw(rect, Styles.GetStyle(Styles.StyleName.IconButtonCancel), colorName)); }
private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.FileName = null; openFileDialog1.Filter = "Excel2007~2013文件(.xlsx)|*xlsx|Excel97~2003文件(.xls)|*.xls"; if (openFileDialog1.ShowDialog() != DialogResult.OK) { return; } DataTable dt = excelControl.datafromexceltable("sevenData", openFileDialog1); dataGridView1.DataSource = dt; infoX = dataX(); infoY = dataY(dt); space = spaceY(dt); spaceMax = space.Max(); spaceMin = space.Min(); spaceExtra = spaceMax - spaceMin; proportionY = 750 / spaceExtra;//比例值 Graphics g = this.CreateGraphics(); ColorName colorName = (ColorName)comboBox1.SelectedItem; Brush brush = new SolidBrush(colorName.Color); Pen mypenBlue = new Pen(brush, 1); //线条 Pen mypenRed = new Pen(Color.Red, 1); //线条 Pen mypenDash = new Pen(Color.Gray, 1); //线条 mypenDash.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom; mypenDash.DashPattern = new float[] { 5, 5 }; //设置字体颜色 Font font = new System.Drawing.Font("Arial", 9, FontStyle.Regular); //绘制横向线条 Space SpaceMultile = (Space)comboBox2.SelectedItem; mulit = SpaceMultile.Multiple; g.Clear(this.BackColor); int y = 50; for (int i = 0; i < infoY.Length; i++) { if (i > 0) { y = y + (int)(proportionY * (space[i - 1] - space[i])); } g.DrawLine(mypenBlue, 80, y, 760, y); //y轴上对应的标记 g.DrawString(infoY[i].ToString(), font, Brushes.Red, 10, y - 5); //设置文字内容及输出位置 } //绘制纵向线条 int x = 120; for (int i = 0; i < 17; i++) { g.DrawLine(mypenBlue, x, 50, x, y); x = x + 40; } x = 80; for (int i = 0; i < 17 * 5; i++) { g.DrawLine(mypenDash, x, 50, x, y); x = x + 8; } //x轴上对应的标记 x = 110; for (int i = 0; i < 17; i++) { Xview = mulit * int.Parse(infoX[i]); g.DrawString(Xview.ToString(), font, Brushes.Red, x, y); //设置文字内容及输出位置 x = x + 40; } ////y轴上对应的标记 //y = 50; //for (int i = 0; i < infoY.Length; i++) //{ // y = y + 15; //} Point startPoint = new Point(80, y); Point endPointX = new Point(800, y); Point endPointY = new Point(80, 20); Point endPointXtop = new Point(780, y - 10); Point endPointXbottom = new Point(780, y + 10); Point endPointYtop = new Point(70, 40); Point endPointYbottom = new Point(90, 40); //X轴 g.DrawLine(mypenRed, startPoint, endPointX); g.DrawLine(mypenRed, endPointX, endPointXtop); g.DrawLine(mypenRed, endPointX, endPointXbottom); g.DrawString("(t/s)", font, Brushes.Red, 800, y + 10); //Y轴 g.DrawLine(mypenRed, startPoint, endPointY); g.DrawLine(mypenRed, endPointY, endPointYtop); g.DrawLine(mypenRed, endPointY, endPointYbottom); g.DrawString("(s/km)", font, Brushes.Red, 30, 25); }
public static bool Minus(Rect rect, ColorName colorName = ColorName.Red) { return(Draw(rect, Styles.GetStyle(Styles.StyleName.IconButtonMinus), colorName)); }
protected static Color ConnectionTypeIconColor(ColorName directionColorName) { return(DGUI.Colors.GetDColor(directionColorName).Normal); }
public static bool Play(Rect rect, ColorName colorName = ColorName.White) { return(Draw(rect, Styles.GetStyle(Styles.StyleName.IconButtonPlaySound), colorName)); }
protected static Color FieldsColor(ColorName directionColorName) { return(DGUI.Colors.PropertyColor(directionColorName)); }
public static bool Plus(Rect rect, ColorName colorName = ColorName.Green) { return(Draw(rect, Styles.GetStyle(Styles.StyleName.IconButtonPlus), colorName)); }
protected static void DrawSmallTitleWithBackground(GUIStyle iconStyle, string label, ColorName colorName) { DGUI.Doozy.DrawTitleWithIconAndBackground(iconStyle, label.ToUpperInvariant(), Size.M, kSmallTitleHeight, colorName, colorName); }
public static bool Stop(Rect rect, ColorName colorName = ColorName.White) { return(Draw(rect, Styles.GetStyle(Styles.StyleName.IconButtonStop), colorName)); }
// =================================================================================== // PARAMETERS ------------------------------------------------------------------------ /// <summary> /// Selects the color property to change. /// </summary> /// <param name="p_colorName"> /// The propertyName/colorName to change (see Unity's <see cref="Material.SetColor"/> if you don't know how it works), /// set via the <see cref="PlugSetColor.ColorName"/> enum. /// </param> public PlugSetColor Property(ColorName p_colorName) { return Property(p_colorName.ToString()); }
public static void Draw(Rect rect, GUIStyle icon, ColorName colorName) { Draw(rect, icon, Colors.IconColor(colorName)); }
public static Color GetColorFromName(ColorName colorName) { return Colors[colorName]; }
public static void Draw(GUIStyle icon, float iconSize, ColorName colorName) { Draw(icon, iconSize, Colors.IconColor(colorName)); }
public Color(ColorName name) { _color = (byte) name; }
private void DrawOptions() { ColorName backgroundColorName = DGUI.Colors.ActionColorName; ColorName textColorName = DGUI.Colors.ActionColorName; DrawBigTitleWithBackground(Styles.GetStyle(Styles.StyleName.IconAction), UILabels.Actions, backgroundColorName, textColorName); GUILayout.Space(DGUI.Properties.Space(2)); GetInfoMessage(ERROR_NO_GAME_EVENT).Draw(TargetNode.ErrorNoGameEvent, InspectorWidth); GetInfoMessage(ERROR_NO_SCENE_NAME).Draw(TargetNode.ErrorNoSceneName, InspectorWidth); GetInfoMessage(ERROR_BAD_BUILD_INDEX).Draw(TargetNode.ErrorBadBuildIndex, InspectorWidth); EditorGUILayout.BeginHorizontal(); { DGUI.Property.Draw(m_waitFor, UILabels.WaitFor, backgroundColorName, textColorName); if (TargetNode.WaitFor != WaitNode.WaitType.Time) { GUILayout.Space(DGUI.Properties.Space()); string anyLabel = string.Empty; switch (TargetNode.WaitFor) { case WaitNode.WaitType.GameEvent: anyLabel = UILabels.AnyGameEvent; break; case WaitNode.WaitType.SceneLoad: case WaitNode.WaitType.SceneUnload: case WaitNode.WaitType.ActiveSceneChange: anyLabel = UILabels.AnyScene; break; case WaitNode.WaitType.UIView: DGUI.Property.Draw(m_uiViewTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName); GUILayout.Space(DGUI.Properties.Space()); if ((UIViewBehaviorType)m_uiViewTriggerAction.enumValueIndex == UIViewBehaviorType.Unknown) { m_uiViewTriggerAction.enumValueIndex = (int)UIViewBehaviorType.Show; } anyLabel = UILabels.AnyUIView; break; case WaitNode.WaitType.UIButton: DGUI.Property.Draw(m_uiButtonTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName); GUILayout.Space(DGUI.Properties.Space()); anyLabel = UILabels.AnyUIButton; break; case WaitNode.WaitType.UIDrawer: DGUI.Property.Draw(m_uiDrawerTriggerAction, UILabels.TriggerAction, backgroundColorName, textColorName); GUILayout.Space(DGUI.Properties.Space()); anyLabel = UILabels.AnyUIDrawer; break; } DGUI.Toggle.Switch.Draw(m_anyValue, anyLabel, textColorName, true, false); if (m_anyValue.boolValue) { backgroundColorName = DGUI.Colors.DisabledBackgroundColorName; textColorName = DGUI.Colors.DisabledTextColorName; } } } EditorGUILayout.EndHorizontal(); GUILayout.Space(DGUI.Properties.Space()); EditorGUILayout.BeginHorizontal(); { // ReSharper disable once SwitchStatementMissingSomeCases switch (TargetNode.WaitFor) { case WaitNode.WaitType.Time: DGUI.Toggle.Switch.Draw(m_randomDuration, UILabels.RandomDuration, textColorName, true, false); GUILayout.Space(DGUI.Properties.Space()); if (TargetNode.RandomDuration) { DGUI.Property.Draw(m_durationMin, UILabels.Min, backgroundColorName, textColorName); GUILayout.Space(DGUI.Properties.Space()); DGUI.Property.Draw(m_durationMax, UILabels.Max, backgroundColorName, textColorName); } else { DGUI.Property.Draw(m_duration, UILabels.Duration, backgroundColorName, textColorName); } break; case WaitNode.WaitType.GameEvent: GUI.enabled = !TargetNode.AnyValue; DGUI.Property.Draw(m_gameEvent, UILabels.GameEvent, backgroundColorName, textColorName, TargetNode.ErrorNoGameEvent); GUI.enabled = true; break; case WaitNode.WaitType.SceneLoad: case WaitNode.WaitType.SceneUnload: case WaitNode.WaitType.ActiveSceneChange: GUI.enabled = !TargetNode.AnyValue; DGUI.Property.Draw(m_getSceneBy, UILabels.GetSceneBy, backgroundColorName, textColorName, DGUI.Properties.DefaultFieldWidth * 2); GUILayout.Space(DGUI.Properties.Space()); // ReSharper disable once SwitchStatementMissingSomeCases switch (TargetNode.GetSceneBy) { case GetSceneBy.Name: DGUI.Property.Draw(m_sceneName, UILabels.SceneName, backgroundColorName, textColorName, TargetNode.ErrorNoSceneName); break; case GetSceneBy.BuildIndex: DGUI.Property.Draw(m_sceneBuildIndex, UILabels.SceneBuildIndex, backgroundColorName, textColorName, TargetNode.ErrorBadBuildIndex); break; } GUI.enabled = true; break; case WaitNode.WaitType.UIView: GUI.enabled = !TargetNode.AnyValue; DGUI.Database.DrawItemsDatabaseSelector(serializedObject, m_viewCategory, UILabels.ViewCategory, m_viewName, UILabels.ViewName, UIViewDatabase, backgroundColorName); GUI.enabled = true; break; case WaitNode.WaitType.UIButton: GUI.enabled = !TargetNode.AnyValue; DGUI.Database.DrawItemsDatabaseSelector(serializedObject, m_buttonCategory, UILabels.ButtonCategory, m_buttonName, UILabels.ButtonName, UIButtonDatabase, backgroundColorName); GUI.enabled = true; break; case WaitNode.WaitType.UIDrawer: GUI.enabled = !TargetNode.AnyValue; DGUI.Database.DrawItemsDatabaseSelectorForGeneralCategoryOnly(UIDrawer.DefaultDrawerCategory, m_drawerName, UILabels.DrawerName, m_customDrawerName, UIDrawerDatabase, backgroundColorName); GUI.enabled = true; break; } } EditorGUILayout.EndHorizontal(); }