Skip to content

Commit

Permalink
SKCell v0.14.0 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyrim07 committed Oct 25, 2023
1 parent d339084 commit d6e2d54
Show file tree
Hide file tree
Showing 108 changed files with 12,916 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Assets/SKCell/CSV/SKCSVLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace SKCell
{
[AddComponentMenu("SKCell/CSVLoader")]
[AddComponentMenu("SKCell/SKCSVLoader")]
public class SKCSVLoader : MonoSingleton<SKCSVLoader>
{
protected override void Awake()
Expand Down
10 changes: 4 additions & 6 deletions Assets/SKCell/Common/SKSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ private IEnumerator LoadSceneAsyncCR(string loadingSceneName, string sceneName,

onStartLoad.Invoke();
//Load the loading scene first
async = SceneManager.LoadSceneAsync(loadingSceneName);
while (!async.isDone)
{
yield return new WaitForSecondsRealtime(0.02f);
}

SceneManager.LoadScene(loadingSceneName);
yield return new WaitForSeconds(0.05f);
onLoadingSceneLoaded.Invoke();

loadFader.SetState(SKUIPanelState.Inactive);
Expand Down Expand Up @@ -113,7 +111,7 @@ private IEnumerator LoadSceneAsyncCR(string loadingSceneName, string sceneName,

//Cast fader
loadFader.SetState(SKUIPanelState.Active);
yield return new WaitForSeconds(0.2f);
yield return new WaitForSeconds(0.18f);
//Load complete
async.allowSceneActivation = true;
onNextSceneLoaded.Invoke();
Expand Down
52 changes: 52 additions & 0 deletions Assets/SKCell/Common/SKVariableMonitor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;

namespace SKCell
{
public class SKVariableMonitor<T> where T : IEquatable<T>
{
/// <summary>
/// Called when the value of the monitored variable changes.
/// </summary>
public Action<T> onValueChanged;

private T _currentValue;
private Func<T> _valueProvider;

/// <summary>
/// Create a value monitor.
/// <para>Example: SKVariableMonitor m = new SKVariableMonitor(()=>myInt);</para>
/// </summary>
/// <param name="valueProvider"></param>
/// <exception cref="ArgumentNullException"></exception>
public SKVariableMonitor(Func<T> valueProvider)
{
if (valueProvider == null)
throw new ArgumentNullException(nameof(valueProvider));

_valueProvider = valueProvider;
_currentValue = _valueProvider();

SKCore.Tick000 += MonitorUpdate;
}

public T GetValue()
{
return _valueProvider();
}
public void Dispose()
{
SKCore.Tick000 -= MonitorUpdate;
}

private void MonitorUpdate()
{
T newValue = _valueProvider();

if (!_currentValue.Equals(newValue))
{
_currentValue = newValue;
onValueChanged?.Invoke(newValue);
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/SKCell/Common/SKVariableMonitor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/SKCell/Core/SKCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace SKCell
[AddComponentMenu("SKCell/SKCore")]
public sealed class SKCore : MonoSingleton<SKCore>
{
public const string SKCELL_VERSION = "v0.13.4";
public const string SKCELL_VERSION = "v0.14.0";

public static Action Awake000 = new Action(EmptyAction), Awake100 = new Action(EmptyAction),
Start000 = new Action(EmptyAction), Start100 = new Action(EmptyAction), Start200 = new Action(EmptyAction),
Expand Down
33 changes: 30 additions & 3 deletions Assets/SKCell/Editor/SKQuitControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,46 @@

public class SKQuitControl
{
private static DateTime? editorStartTime = null;

[InitializeOnLoadMethod]
static void InitializeOnLoadMethod()
{
if (editorStartTime == null)
{
if (EditorPrefs.GetBool("IsRecompile", false))
{
string storedTime = EditorPrefs.GetString("EditorRecompileStartTime", DateTime.Now.ToString());
editorStartTime = DateTime.Parse(storedTime);
}
else
{
editorStartTime = DateTime.Now;
EditorPrefs.SetString("EditorRecompileStartTime", editorStartTime.Value.ToString());
}
}
EditorPrefs.SetBool("IsRecompile", true);

EditorApplication.wantsToQuit -= Quit;
EditorApplication.wantsToQuit += Quit;
EditorApplication.quitting += OnEditorQuit;
}

static void OnEditorQuit()
{
EditorPrefs.SetBool("IsRecompile", false);
}

static bool Quit()
{
DateTime now = DateTime.Now;
if (EditorUtility.DisplayDialog("Are you sure to exit?", $"Take a break!\n" +
$"Current time: {now.Hour.ToString("d2")} : {now.Minute.ToString("d2")} : {now.Second.ToString("d2")}",
"Quit Unity", "Cancel")){
TimeSpan elapsedTime = now - editorStartTime.Value;

string elapsedTimeString = $"{elapsedTime.Hours.ToString("d2")}:{elapsedTime.Minutes.ToString("d2")}:{elapsedTime.Seconds.ToString("d2")}";

if (EditorUtility.DisplayDialog("Take a break !", $"You've been working for {elapsedTimeString}.\n",
"Quit Unity", "Cancel"))
{
return true;
}
return false;
Expand Down
3 changes: 3 additions & 0 deletions Assets/SKCell/Effects/SKTextAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ private void UpdateTypeWriterEffect()
}
private void ParseText()
{
if (oStr == null)
return;

oStr = oStr.Replace(@"\r", "\r");
oStr = oStr.Replace(@"\n", "\n");

Expand Down
115 changes: 115 additions & 0 deletions Assets/SKCell/Graphics/CartoonGrass.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2885297536444466575
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2885297536444466563}
- component: {fileID: 2885297536444466560}
- component: {fileID: 2885297536444466561}
- component: {fileID: 2885297536444466574}
m_Layer: 0
m_Name: CartoonGrass
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2885297536444466563
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2885297536444466575}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.46, z: -12.95}
m_LocalScale: {x: 1.4243, y: 1.4243, z: 1.4243}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2885297536444466560
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2885297536444466575}
m_Mesh: {fileID: -2432090755550338912, guid: 7a25e5447362e6d4589466b024b61060, type: 3}
--- !u!23 &2885297536444466561
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2885297536444466575}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &2885297536444466574
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2885297536444466575}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 86f9715811d19c5419d667aca46d42ac, type: 3}
m_Name:
m_EditorClassIdentifier:
updateOnPlay: 1
_TopColor: {r: 0.51, g: 1, b: 0.47, a: 1}
_BottomColor: {r: 0.04, g: 0.31, b: 0.13, a: 1}
_TintColor: {r: 0.77, g: 1, b: 0.467, a: 1}
_TintColor2: {r: 0.21, g: 0.42, b: 0.51, a: 1}
_Tint: 0.53
_Tint2: 0.77
_Bend: 0.2
_BladeWidth: 0.05
_BladeWidthRandom: 0.02
_BladeHeight: 0.52
_BladeHeightRandom: 0.22
_BladeCurve: 2
_BladeForward: 0.06
_BladeForwardRandom: 0.09
_WindFrequency: {x: 0.08, y: 0.08, z: 0, w: 0}
_WindStrength: 0.5
7 changes: 7 additions & 0 deletions Assets/SKCell/Graphics/CartoonGrass.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions Assets/SKCell/Graphics/Dissolve_0.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Shader "SKCell/Dissolve_0"
{
Properties
{
_Color ("Color Tint", Color) = (1,1,1,1)
_HighlightColor ("Highlight Color", Color) = (0.9,0.8,0.7,1)
_MainTex ("Texture", 2D) = "white" {}
_Noise ("Noise", 2D) = "white" {}
_Threshold ("Threshold", range(0,1)) = 0.5
_HighlightThreshold ("Highlight Threshold", float) =1
}
SubShader
{
Tags { "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
LOD 100

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#include "UnityCG.cginc"

struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

struct v2f
{
float2 uv : TEXCOORD0;
float2 noiseuv : TEXCOORD1;
float4 vertex : SV_POSITION;
};

sampler2D _MainTex;
sampler2D _Noise;
float4 _MainTex_ST;
float4 _Noise_ST;
fixed4 _Color;
fixed4 _HighlightColor;

float _Threshold;
float _HighlightThreshold;

v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.noiseuv = TRANSFORM_TEX(v.uv, _Noise);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv) * _Color;
fixed4 noiseTex = tex2D(_Noise,i.noiseuv);
fixed noiseDiff = pow(saturate(noiseTex.r- _Threshold)/ _HighlightThreshold, 5);
clip(noiseTex.r- _Threshold);
col = lerp(col, _HighlightColor, saturate(1 - noiseDiff)) ;
return col;
}
ENDCG
}
}
}
10 changes: 10 additions & 0 deletions Assets/SKCell/Graphics/Dissolve_0.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d6e2d54

Please sign in to comment.