This commit is contained in:
monitor1394
2022-05-22 22:17:38 +08:00
parent 003f4da9de
commit bafe032bb9
391 changed files with 3718 additions and 2774 deletions

View File

@@ -1,4 +1,3 @@
using UnityEngine;
namespace XCharts.Runtime
@@ -17,7 +16,7 @@ namespace XCharts.Runtime
{
Color color;
ColorUtility.TryParseHtmlString(hexColorStr, out color);
return (Color32)color;
return (Color32) color;
}
}
}

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
@@ -24,20 +23,19 @@ namespace XCharts.Runtime
private static string s_SecondDateFormatter = "HH:mm:ss";
//private static string s_DateFormatter = "yyyy-MM-dd HH:mm:ss";
public static int GetTimestamp()
{
return (int)(DateTime.Now - k_DateTime1970).TotalSeconds;
return (int) (DateTime.Now - k_DateTime1970).TotalSeconds;
}
public static int GetTimestamp(DateTime time)
{
return (int)(time - k_DateTime1970).TotalSeconds;
return (int) (time - k_DateTime1970).TotalSeconds;
}
public static DateTime GetDateTime(int timestamp)
{
long span = ((long)timestamp) * 10000000;
long span = ((long) timestamp) * 10000000;
return k_DateTime1970.Add(new TimeSpan(span));
}
@@ -50,15 +48,15 @@ namespace XCharts.Runtime
}
else if (range >= DateTimeUtil.ONE_MONTH * DateTimeUtil.MIN_TIME_SPLIT_NUMBER)
{
dateString = dateTime.Month == 1
? dateTime.ToString(s_YearDateFormatter)
: XCSettings.lang.GetMonthAbbr(dateTime.Month);
dateString = dateTime.Month == 1 ?
dateTime.ToString(s_YearDateFormatter) :
XCSettings.lang.GetMonthAbbr(dateTime.Month);
}
else if (range >= DateTimeUtil.ONE_DAY * DateTimeUtil.MIN_TIME_SPLIT_NUMBER)
{
dateString = dateTime.Day == 1
? XCSettings.lang.GetMonthAbbr(dateTime.Month)
: XCSettings.lang.GetDay(dateTime.Day);
dateString = dateTime.Day == 1 ?
XCSettings.lang.GetMonthAbbr(dateTime.Month) :
XCSettings.lang.GetDay(dateTime.Day);
}
else if (range >= DateTimeUtil.ONE_HOUR * DateTimeUtil.MIN_TIME_SPLIT_NUMBER)
{
@@ -87,6 +85,7 @@ namespace XCharts.Runtime
list.Clear();
var range = maxTimestamp - minTimestamp;
if (range <= 0) return;
if (splitNumber <= 0) splitNumber = 1;
var dtMin = DateTimeUtil.GetDateTime(minTimestamp);
var dtMax = DateTimeUtil.GetDateTime(maxTimestamp);
if (range >= ONE_YEAR * MIN_TIME_SPLIT_NUMBER)

View File

@@ -16,7 +16,7 @@ namespace XCharts.Runtime
{
var flag = false;
var num = 0;
foreach (var buildTargetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
foreach (var buildTargetGroup in (BuildTargetGroup[]) Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
{
@@ -39,7 +39,7 @@ namespace XCharts.Runtime
{
var flag = false;
var num = 0;
foreach (var buildTargetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
foreach (var buildTargetGroup in (BuildTargetGroup[]) Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
{
@@ -73,8 +73,8 @@ namespace XCharts.Runtime
var method1 = type.GetMethod("GetTargetStringFromBuildTargetGroup", BindingFlags.Static | BindingFlags.NonPublic);
var method2 = typeof(PlayerSettings).GetMethod("GetPlatformName", BindingFlags.Static | BindingFlags.NonPublic);
if (method1 == null || method2 == null) return true;
var str1 = (string)method1.Invoke(null, new object[] { group });
var str2 = (string)method2.Invoke(null, new object[] { group });
var str1 = (string) method1.Invoke(null, new object[] { group });
var str2 = (string) method2.Invoke(null, new object[] { group });
if (string.IsNullOrEmpty(str1))
{
return !string.IsNullOrEmpty(str2);

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
using UnityEngine;
@@ -50,4 +49,4 @@ namespace XCharts.Runtime
return true;
}
}
}
}

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
@@ -26,7 +25,7 @@ namespace XCharts.Runtime
public static int InvokeListCount(object obj, FieldInfo field)
{
var list = field.GetValue(obj);
return (int)list.GetType().GetProperty("Count").GetValue(list, null);
return (int) list.GetType().GetProperty("Count").GetValue(list, null);
}
public static void InvokeListAdd(object obj, FieldInfo field, object item)
@@ -45,10 +44,9 @@ namespace XCharts.Runtime
{
var list = field.GetValue(obj);
var item = list.GetType().GetProperty("Item").GetValue(list, new object[] { i });
return (T)item;
return (T) item;
}
public static void InvokeListAddTo<T>(object obj, FieldInfo field, Action<T> callback)
{
var list = field.GetValue(obj);
@@ -57,7 +55,7 @@ namespace XCharts.Runtime
for (int i = 0; i < count; i++)
{
var item = listType.GetProperty("Item").GetValue(list, new object[] { i });
callback((T)item);
callback((T) item);
}
}
@@ -88,9 +86,9 @@ namespace XCharts.Runtime
{
var properties = type.GetProperties();
var customList = typeof(List<>).MakeGenericType((properties[properties.Length - 1]).PropertyType);
returnObj = (IList)Activator.CreateInstance(customList);
var list = (IList)returnObj;
foreach (var item in ((IList)obj))
returnObj = (IList) Activator.CreateInstance(customList);
var list = (IList) returnObj;
foreach (var item in ((IList) obj))
{
if (item == null)
continue;

View File

@@ -1,7 +1,6 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
@@ -62,7 +61,7 @@ namespace XCharts.Runtime
public static T GetAttribute<T>(this Type type, bool check = true) where T : Attribute
{
if (type.IsDefined(typeof(T), false))
return (T)type.GetCustomAttributes(typeof(T), false)[0];
return (T) type.GetCustomAttributes(typeof(T), false) [0];
else
{
if (check)
@@ -73,7 +72,7 @@ namespace XCharts.Runtime
public static T GetAttribute<T>(this MemberInfo type, bool check = true) where T : Attribute
{
if (type.IsDefined(typeof(T), false))
return (T)type.GetCustomAttributes(typeof(T), false)[0];
return (T) type.GetCustomAttributes(typeof(T), false) [0];
else
{
if (check)