|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class Config
|
|
|
|
|
{
|
|
|
|
|
static INIParser ini = new INIParser();
|
|
|
|
|
public static int fullscreen = 1;
|
|
|
|
|
public static int randomCard = 1;
|
|
|
|
|
public static int autoChange = 1;
|
|
|
|
|
public static int changeTime = 600;
|
|
|
|
|
public static string cardPath = "";
|
|
|
|
|
public static float cameraSize = 7f;
|
|
|
|
|
public static float cameraX = 0f;
|
|
|
|
|
public static float cameraY = 0f;
|
|
|
|
|
public static string cardsDir;
|
|
|
|
|
public static int cardsCount;
|
|
|
|
|
public static List<string> cardsList = new List<string>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void LoadConfigFromIni()
|
|
|
|
|
{
|
|
|
|
|
ini.Open(Application.streamingAssetsPath + @"\config.ini");
|
|
|
|
|
fullscreen = ini.ReadValue("camera", "fullscreen", 1);
|
|
|
|
|
randomCard = ini.ReadValue("card", "random", 1);
|
|
|
|
|
autoChange = ini.ReadValue("card", "autochange", 1);
|
|
|
|
|
changeTime = ini.ReadValue("card", "time", 600);
|
|
|
|
|
cardPath = ini.ReadValue("card", "path", "null");
|
|
|
|
|
cameraSize = (float)ini.ReadValue("camera", "size", 7f);
|
|
|
|
|
cameraX = (float)ini.ReadValue("camera", "x", 0f);
|
|
|
|
|
cameraY = (float)ini.ReadValue("camera", "y", 0f);
|
|
|
|
|
ini.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void SaveConfigToIni()
|
|
|
|
|
{
|
|
|
|
|
ini.Open(Application.streamingAssetsPath + @"\config.ini");
|
|
|
|
|
ini.WriteValue("card", "path", cardPath);
|
|
|
|
|
ini.WriteValue("camera", "y", cameraY);
|
|
|
|
|
ini.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void LoadCardsInDir()
|
|
|
|
|
{
|
|
|
|
|
cardsList.Clear();
|
|
|
|
|
FileInfo cardFileInfo = new FileInfo(cardPath);
|
|
|
|
|
cardsDir = cardFileInfo.DirectoryName;
|
|
|
|
|
DirectoryInfo cardDirInfo = cardFileInfo.Directory;
|
|
|
|
|
foreach (FileInfo file in cardDirInfo.GetFiles())
|
|
|
|
|
{
|
|
|
|
|
cardsList.Add(cardsDir + @"\" + file.Name);
|
|
|
|
|
}
|
|
|
|
|
cardsCount = cardsList.Count;
|
|
|
|
|
}
|
|
|
|
|
}
|