VPet/VPet-Simulator.Core/Handle/Function.cs

76 lines
2.3 KiB
C#
Raw Normal View History

2023-07-01 07:46:08 +00:00
using LinePutScript.Dictionary;
using System;
2023-01-10 10:43:32 +00:00
using System.Windows;
using System.Windows.Media;
2022-12-13 07:10:18 +00:00
namespace VPet_Simulator.Core
{
2023-12-29 19:37:41 +00:00
public static partial class Function
2022-12-13 07:10:18 +00:00
{
2024-02-28 14:02:28 +00:00
/// <summary>
/// HEX值转颜色
/// </summary>
/// <param name="HEX">HEX值</param>
/// <returns>颜色</returns>
public static Color HEXToColor(string HEX) => (Color)ColorConverter.ConvertFromString(HEX);
/// <summary>
/// 颜色转HEX值
/// </summary>
/// <param name="color">颜色</param>
/// <returns>HEX值</returns>
public static string ColorToHEX(Color color) => "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2");
2022-12-13 07:10:18 +00:00
public static Random Rnd = new Random();
2023-01-10 10:43:32 +00:00
/// <summary>
/// 获取资源笔刷
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static Brush ResourcesBrush(BrushType name)
{
2024-02-28 14:02:28 +00:00
return (Brush)Application.Current.Resources[name.ToString()];
2023-01-10 10:43:32 +00:00
}
public enum BrushType
{
Primary,
PrimaryTrans,
PrimaryTrans4,
PrimaryTransA,
PrimaryTransE,
PrimaryLight,
PrimaryLighter,
PrimaryDark,
PrimaryDarker,
PrimaryText,
Secondary,
SecondaryTrans,
SecondaryTrans4,
SecondaryTransA,
SecondaryTransE,
SecondaryLight,
SecondaryLighter,
SecondaryDark,
SecondaryDarker,
SecondaryText,
DARKPrimary,
DARKPrimaryTrans,
DARKPrimaryTrans4,
DARKPrimaryTransA,
DARKPrimaryTransE,
DARKPrimaryLight,
DARKPrimaryLighter,
DARKPrimaryDark,
DARKPrimaryDarker,
DARKPrimaryText,
}
2023-07-01 07:46:08 +00:00
///// <summary>
///// 翻译文本
///// </summary>
///// <param name="TranFile">翻译文件</param>
///// <param name="Name">翻译内容</param>
///// <returns>翻译后的文本</returns>
//public static string Translate(this LPS_D TranFile, string Name) => TranFile.GetString(Name, Name);
2022-12-13 07:10:18 +00:00
}
}