Exemplo n.º 1
0
    //存入相关配置信息
    public static void setConfigItem(ConfigItems itemKey, string item)
    {
        string key        = itemKey.ToString();
        string theIniPath = Application.persistentDataPath + "/GalConfig.txt";

        if (!File.Exists(theIniPath))
        {
            //没有配置文件就新建一个
            createConfigFileIfNull();
        }
        int index = 0;

        for (int i = 0; i < configKey.Count; i++)
        {
            if (configKey [i] == key)
            {
                index = i;
                break;
            }
        }
        configValue [index] = item;

        //不推荐动态flash,IO操作爆炸,尤其是slider
        //flashConfig ();
    }
Exemplo n.º 2
0
    //根据key返回配置文件的相关item做判断
    public static float getConfigItem(ConfigItems item)
    {
        loadConfig();
        string key       = item.ToString();
        string getString = "";

        for (int i = 0; i < configKey.Count; i++)
        {
            if (configKey [i] == key)
            {
                getString = configValue [i];
            }
        }

        if (string.IsNullOrEmpty(getString) == false)
        {
            return((float)Convert.ToDouble(getString));
        }

        return(1f);
    }