You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.9 KiB

2 years ago
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;
2 years ago
public static int randomCard = 1;
public static int autoChange = 1;
2 years ago
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");
2 years ago
fullscreen = ini.ReadValue("camera", "fullscreen", 1);
2 years ago
randomCard = ini.ReadValue("card", "random", 1);
autoChange = ini.ReadValue("card", "autochange", 1);
2 years ago
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");
2 years ago
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);
2 years ago
}
cardsCount = cardsList.Count;
}
}