海拔图和小地图

This commit is contained in:
lishuo committed 2021-03-28 18:17:15 +08:00
1 parent 45801dff22
commit c5bd9daba2
521 files changed
+1985033 -439

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using UnityEngine;
namespace XCharts
{
public static class ColorUtil
{
public static readonly Color32 clearColor32 = new Color32(0, 0, 0, 0);
public static readonly Vector2 zeroVector2 = Vector2.zero;
/// <summary>
/// Convert the html string to color.
/// 将字符串颜色值转成Color。
/// </summary>
/// <param name="hexColorStr"></param>
/// <returns></returns>
public static Color32 GetColor(string hexColorStr)
{
Color color;
ColorUtility.TryParseHtmlString(hexColorStr, out color);
return (Color32)color;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4260c3b8fdaff435a8bc10375b812bd8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System;
using UnityEngine;
namespace XCharts
{
public static class DateTimeUtil
{
private static readonly DateTime k_DateTime1970 = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
public static int GetTimestamp()
{
return (int)(DateTime.Now - k_DateTime1970).TotalSeconds;
}
public static int GetTimestamp(DateTime time)
{
return (int)(time - k_DateTime1970).TotalSeconds;
}
public static DateTime GetDateTime(int timestamp)
{
long span = ((long)timestamp) * 10000000;
return k_DateTime1970.Add(new TimeSpan(span));
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0f0ac80f189a04b5c826f40c8bc8af64
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,95 @@
#if UNITY_EDITOR
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace XCharts
{
public static class DefineSymbolsUtil
{
private static readonly StringBuilder s_StringBuilder = new StringBuilder();
public static void AddGlobalDefine(string symbol)
{
var flag = false;
var num = 0;
foreach (var buildTargetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
{
var symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup);
symbols = symbols.Replace(" ", "");
if (Array.IndexOf(symbols.Split(';'), symbol) != -1) continue;
flag = true;
num++;
var defines = symbols + (symbols.Length > 0 ? ";" + symbol : symbol);
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, defines);
}
}
if (flag)
{
Debug.LogFormat("Added global define symbol \"{0}\" to {1} BuildTargetGroups.", symbol, num);
}
}
public static void RemoveGlobalDefine(string symbol)
{
var flag = false;
var num = 0;
foreach (var buildTargetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
{
var symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Split(';');
if (Array.IndexOf(symbols, symbol) == -1) continue;
flag = true;
num++;
s_StringBuilder.Length = 0;
foreach (var str in symbols)
{
if (!str.Equals(symbol))
{
if (s_StringBuilder.Length > 0) s_StringBuilder.Append(";");
s_StringBuilder.Append(str);
}
}
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, s_StringBuilder.ToString());
}
}
if (flag)
{
Debug.LogFormat("Removed global define symbol \"{0}\" to {1} BuildTargetGroups.", symbol, num);
}
}
private static bool IsValidBuildTargetGroup(BuildTargetGroup group)
{
if (group == BuildTargetGroup.Unknown) return false;
var type = Type.GetType("UnityEditor.Modules.ModuleManager, UnityEditor.dll");
if (type == null) return true;
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 });
if (string.IsNullOrEmpty(str1))
{
return !string.IsNullOrEmpty(str2);
}
else
{
return true;
}
}
}
}
#endif
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 91545951242fa441eb1a9bba3a6ad5a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
/************************************************/
/* */
/* Copyright (c) 2018 - 2021 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/************************************************/
using System.Collections.Generic;
using UnityEngine;
namespace XCharts
{
public static class PropertyUtil
{
public static bool SetColor(ref Color currentValue, Color newValue)
{
if (currentValue.r == newValue.r && currentValue.g == newValue.g && currentValue.b == newValue.b && currentValue.a == newValue.a)
return false;
currentValue = newValue;
return true;
}
public static bool SetColor(ref Color32 currentValue, Color32 newValue)
{
if (currentValue.r == newValue.r && currentValue.g == newValue.g && currentValue.b == newValue.b && currentValue.a == newValue.a)
return false;
currentValue = newValue;
return true;
}
public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct
{
if (EqualityComparer<T>.Default.Equals(currentValue, newValue))
return false;
currentValue = newValue;
return true;
}
public static bool SetClass<T>(ref T currentValue, T newValue, bool notNull = false) where T : class
{
if (notNull)
{
if (newValue == null)
{
Debug.LogError("can not be null.");
return false;
}
}
if ((currentValue == null && newValue == null) || (currentValue != null && currentValue.Equals(newValue)))
return false;
currentValue = newValue;
return true;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b1f52eadd805d43aea47947fb81e761f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: