|
|
@ -12,11 +12,14 @@ public class Card : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
int idx = 0;
|
|
|
|
int idx = 0;
|
|
|
|
int nextChangeTime = 0;
|
|
|
|
int nextChangeTime = 0;
|
|
|
|
|
|
|
|
bool updatedConfig = false;
|
|
|
|
|
|
|
|
bool writeConfigInside = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
FileUtil.WatchFile(Application.streamingAssetsPath,
|
|
|
|
|
|
|
|
"config.ini", new FileSystemEventHandler(OnIniChanged));
|
|
|
|
Config.LoadConfigFromIni();
|
|
|
|
Config.LoadConfigFromIni();
|
|
|
|
SetConfig();
|
|
|
|
SetConfig();
|
|
|
|
Config.LoadCardsInDir();
|
|
|
|
Config.LoadCardsInDir();
|
|
|
@ -24,6 +27,24 @@ public class Card : MonoBehaviour
|
|
|
|
LoadCard(Config.cardPath);
|
|
|
|
LoadCard(Config.cardPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnIniChanged(object sender, FileSystemEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (e.ChangeType != WatcherChangeTypes.Changed)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (writeConfigInside)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
writeConfigInside = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Debug.Log("Ini changed");
|
|
|
|
|
|
|
|
updatedConfig = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetConfig()
|
|
|
|
void SetConfig()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Config.fullscreen == 1)
|
|
|
|
if (Config.fullscreen == 1)
|
|
|
@ -34,13 +55,12 @@ public class Card : MonoBehaviour
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Screen.SetResolution(1280, 720, false);
|
|
|
|
Screen.SetResolution(1280, 720, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Config.cardPath == "" || Config.cardPath == "null")
|
|
|
|
if (Config.cardPath == "" || Config.cardPath == "null")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Config.cardPath = FileUtil.OpenFile();
|
|
|
|
Config.cardPath = FileUtil.OpenFile();
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
|
|
|
|
writeConfigInside = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Camera camera = GetComponent<Camera>();
|
|
|
|
Camera camera = GetComponent<Camera>();
|
|
|
|
camera.orthographicSize = Config.cameraSize;
|
|
|
|
camera.orthographicSize = Config.cameraSize;
|
|
|
|
camera.transform.position =
|
|
|
|
camera.transform.position =
|
|
|
@ -59,6 +79,7 @@ public class Card : MonoBehaviour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Config.cardPath = cardPath;
|
|
|
|
Config.cardPath = cardPath;
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
|
|
|
|
writeConfigInside = true;
|
|
|
|
nextChangeTime = (int)Time.time + Config.changeTime;
|
|
|
|
nextChangeTime = (int)Time.time + Config.changeTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -76,6 +97,16 @@ public class Card : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
void Update()
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (updatedConfig)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Config.LoadConfigFromIni();
|
|
|
|
|
|
|
|
SetConfig();
|
|
|
|
|
|
|
|
Config.LoadCardsInDir();
|
|
|
|
|
|
|
|
this.InitIdx();
|
|
|
|
|
|
|
|
this.LoadCard(Config.cardPath);
|
|
|
|
|
|
|
|
updatedConfig = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Config.autoChange == 1 && Time.time >= nextChangeTime && cntCard)
|
|
|
|
if (Config.autoChange == 1 && Time.time >= nextChangeTime && cntCard)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LoadNextCard();
|
|
|
|
LoadNextCard();
|
|
|
@ -87,6 +118,7 @@ public class Card : MonoBehaviour
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Config.cameraY += 0.1f;
|
|
|
|
Config.cameraY += 0.1f;
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
|
|
|
|
writeConfigInside = true;
|
|
|
|
Camera camera = GetComponent<Camera>();
|
|
|
|
Camera camera = GetComponent<Camera>();
|
|
|
|
Vector3 vec = camera.transform.position;
|
|
|
|
Vector3 vec = camera.transform.position;
|
|
|
|
vec.y = Config.cameraY;
|
|
|
|
vec.y = Config.cameraY;
|
|
|
@ -98,6 +130,7 @@ public class Card : MonoBehaviour
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Config.cameraY -= 0.1f;
|
|
|
|
Config.cameraY -= 0.1f;
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
Config.SaveConfigToIni();
|
|
|
|
|
|
|
|
writeConfigInside = true;
|
|
|
|
Camera camera = GetComponent<Camera>();
|
|
|
|
Camera camera = GetComponent<Camera>();
|
|
|
|
Vector3 vec = camera.transform.position;
|
|
|
|
Vector3 vec = camera.transform.position;
|
|
|
|
vec.y = Config.cameraY;
|
|
|
|
vec.y = Config.cameraY;
|
|
|
|