Пример #1
0
    /// <summary>
    /// 写微信授权用户信息到本地
    /// </summary>
    public void ReadWeChatAuthInfo()
    {
        string AccountConfigPath = GameDefine.AppPersistentDataPath + GameDefine.AccountInfoFile;

        INIParser IniFile = new INIParser();

        IniFile.Open(AccountConfigPath);
        string namestr = IniFile.ReadValue("WXUser", "nickname", string.Empty);

        if (!string.IsNullOrEmpty(namestr))
        {
            string imgurlstr  = IniFile.ReadValue("WXUser", "headimgurl", string.Empty);
            string unionidstr = IniFile.ReadValue("WXUser", "unionid", string.Empty);
            string sexstr     = IniFile.ReadValue("WXUser", "sex", "1");
            AuthUserInfoMap.Clear();
            AuthUserInfoMap.Add("nickname", namestr);
            AuthUserInfoMap.Add("sex", sexstr);
            AuthUserInfoMap.Add("headimgurl", imgurlstr);
            AuthUserInfoMap.Add("unionid", unionidstr);

            Debug.Log("WxUserInfo name:" + namestr + ",sex:" + sexstr + ",img:" + imgurlstr + ",unionid:" + unionidstr);
        }
        else
        {
            Debug.Log("WxUserInfo null");
        }
        IniFile.Close();
    }
Пример #2
0
    protected virtual void Awake()
    {
        try
        {
            var ini = new INIParser();
            ini.Open(Application.dataPath + "/Config.txt");
            this.InitialMoney           = ini.ReadValue("Debug", "InitialMoney", this.InitialMoney);
            this.CenterBuilding.HPLimit = ini.ReadValue("Debug", "CenterHPLimit", this.CenterBuilding.HPLimit);
            this.CurrentRound           = ini.ReadValue("Debug", "StartRound", this.CurrentRound);
        }
        catch (System.Exception) { }

        Initialize();

        try
        {
            var info = new FileInfo(Application.dataPath + "/Generator.csv");
            var text = File.ReadAllText(info.FullName, Encoding.UTF8);
            var data = FunctionExtension.CSVReader(text);
            this.CSVGeneratorsList = new List <EnemyGenerator>();
            foreach (var item in data)
            {
                this.CSVGeneratorsList.Add(EnemyGenerator.CreateEnemyGenerator(this, item));
            }
        }
        catch (System.Exception)
        {
            this.CSVGeneratorsList = null;
        }
    }
Пример #3
0
    void LoadConfigFile()
    {
        INIParser iniParser = new INIParser();

        iniParser.Open(Application.streamingAssetsPath + "/asteroid.ini");
        this.url = iniParser.ReadValue("connect", "url", "ws://localhost:19999/api/asteroid");
        this.R   = iniParser.ReadValue("scene", "radius", 20);
        iniParser.Close();
    }
Пример #4
0
    public dial load(string act)
    {
        dial newDial = new dial();

        newDial.content = ini.ReadValue(act, "text", "end");
        newDial.voice   = ini.ReadValue(act, "voice", "");
        newDial.next    = ini.ReadValue(act, "next", "");
        newDial.decide  = ini.ReadValue(act, "decide", "no");
        return(newDial);
    }
Пример #5
0
    protected ChessType(ChessTypeId chessTypeId, float default_rt, float default_mt, float default_wt)
    {
        id = (int)chessTypeId;
        INIParser iniParser = new INIParser();

        iniParser.Open(Application.streamingAssetsPath + "/ChessAttr.ini");
        ready_time = Convert.ToSingle(iniParser.ReadValue(chessTypeId.GetDescription(), nameReadyTime, default_rt));
        move_time  = Convert.ToSingle(iniParser.ReadValue(chessTypeId.GetDescription(), nameMoveTime, default_mt));
        load_time  = Convert.ToSingle(iniParser.ReadValue(chessTypeId.GetDescription(), nameLoadTime, default_wt));
        iniParser.Close();
    }
Пример #6
0
        /// <summary>
        /// Loads the current settings from the ini
        /// </summary>
        public void LoadSettings()
        {
            INIParser ini = new INIParser();

            ini.Open(settingsPath);

            disableSecondChaseCam = ini.ReadValue("Options", "Disable Close Chase Cam", disableSecondChaseCam);

            vrInterfaceOffset = JsonUtility.FromJson <Vector3>(ini.ReadValue("VR Interface", "Position Offset", JsonUtility.ToJson(vrInterfaceOffset)));
            vrInterfaceScale  = JsonUtility.FromJson <Vector3>(ini.ReadValue("VR Interface", "Scale", JsonUtility.ToJson(vrInterfaceScale)));
            vrInterfaceCurve  = (float)ini.ReadValue("VR Interface", "Curve Amount", vrInterfaceCurve);

            ini.Close();
        }
Пример #7
0
 private void LoadPlayer(INIParser ini)
 {
     PlayerConfig.maxHealth         = ini.ReadValue("Player", "MaxHealth", 100);
     PlayerConfig.respawnTime       = ini.ReadValue("Player", "RespawnTime", 5);
     PlayerConfig.jumpForce         = ini.ReadValue("Player", "JumpForce", 10);
     PlayerConfig.movementSmoothing = (float)ini.ReadValue("Player", "MovementSmoothing", 0.2f);
     PlayerConfig.airControl        = ini.ReadValue("Player", "AirControl", true);
     PlayerConfig.minLightIntensity = ini.ReadValue("Player", "MinLightIntensity", 0);
     PlayerConfig.maxLightIntensity = (float)ini.ReadValue("Player", "MaxLightIntensity", 0.8);
     PlayerConfig.minLightRadius    = ini.ReadValue("Player", "MinLightRadius", 1);
     PlayerConfig.maxLightRadius    = ini.ReadValue("Player", "MaxLightRadius", 4);
 }
Пример #8
0
        /// <summary>
        /// Loads the current cockpit settings from the ini
        /// </summary>
        public void LoadCockpitSettings(ShipRefs r)
        {
            INIParser ini = new INIParser();

            ini.Open(settingsPath);

            leanEnabled = ini.ReadValue("Options", "Enable Lean", leanEnabled);
            leanScaler  = (float)ini.ReadValue("Options", "Lean Scale", leanScaler);

            var shipName = r.name;

            cockpitOffset = JsonUtility.FromJson <Vector3>(ini.ReadValue(shipName, "Cockpit Offset", JsonUtility.ToJson(cockpitOffset)));
            cockpitScale  = JsonUtility.FromJson <Vector3>(ini.ReadValue(shipName, "Cockpit Scale", JsonUtility.ToJson(cockpitScale)));

            ini.Close();
        }
Пример #9
0
        public static void Load()
        {
            // Create a new INI Parser
            INIParser ini = new INIParser();

            // Open the game's setting file for reading.
            string iniFile = Game.FilePaths.settings;

            // Open the file with INI Parser
            ini.Open(iniFile);

            Debug.Log("Opening File " + iniFile);

            // Store the file contents to a string array
            string[] lines = File.ReadAllLines(iniFile);

            // Read each contents from the string array
            foreach (string line in lines)
            {
                // Ignore comment and section lines
                if (line.StartsWith("["))
                {
                    continue;
                }
                if (line.StartsWith("]"))
                {
                    continue;
                }
                if (line.StartsWith("/"))
                {
                    continue;
                }
                if (line.StartsWith("#"))
                {
                    continue;
                }
                if (line.StartsWith("!"))
                {
                    continue;
                }

                // Split string into words
                string[] words = line.Split(' ');

                // Create a new setting with the first word (the INI key for it)
                list.Add(new Setting(words[0]));
                Debug.Log($"Added {words[0]} to settings list.");
            }


            // Loop through the setting keys and assign their value.
            foreach (Setting setting in Settings.list)
            {
                setting.value = ini.ReadValue("settings", setting.key, "");
            }

            ini.Close();
        }
Пример #10
0
    public void Awake()
    {
        TextAsset text_asset = Resources.Load("SDKManager") as TextAsset;
        INIParser ini        = new INIParser();

        ini.Open(text_asset);
        CurSDK = ini.ReadValue("platform", "name", "version_poker_window");
        ini.Close();
    }
Пример #11
0
    void LoadSettingsConfig()
    {
        if (Directory.Exists(skinDirectory))
        {
            // Load in all settings
            INIParser iniparse = new INIParser();

            iniparse.Open(skinDirectory + "\\settings.ini");
            System.Text.RegularExpressions.Regex hexRegex = new System.Text.RegularExpressions.Regex("#[a-fA-F0-9]{8,8}");

            for (int i = 0; i < customSkin.sustain_mats.Length; ++i)
            {
                string hex = iniparse.ReadValue("Sustain Colors", i.ToString(), "#00000000");
                if (hex.Length == 9 && hexRegex.IsMatch(hex))    // # r g b a
                {
                    try
                    {
                        int r = int.Parse(new string(new char[] { hex[1], hex[2] }), System.Globalization.NumberStyles.HexNumber);
                        int g = int.Parse(new string(new char[] { hex[3], hex[4] }), System.Globalization.NumberStyles.HexNumber);
                        int b = int.Parse(new string(new char[] { hex[5], hex[6] }), System.Globalization.NumberStyles.HexNumber);
                        int a = int.Parse(new string(new char[] { hex[7], hex[8] }), System.Globalization.NumberStyles.HexNumber);

                        if (a > 0)
                        {
                            customSkin.sustain_mats[i]      = new Material(sustainResources.sustainColours[i]);
                            customSkin.sustain_mats[i].name = i.ToString();
                            customSkin.sustain_mats[i].SetColor("_Color", new Color(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f));
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.LogError(e.Message);
                    }
                }

                //iniparse.WriteValue("Sustain Colors", i.ToString(), customSkin.sustain_colors[i].GetHex());
            }

            iniparse.Close();

            iniparse.Open(skinDirectory + "\\settings.ini");

            for (int i = 0; i < customSkin.sustain_mats.Length; ++i)
            {
                if (customSkin.sustain_mats[i])
                {
                    iniparse.WriteValue("Sustain Colors", i.ToString(), "#" + customSkin.sustain_mats[i].GetColor("_Color").GetHex());
                }
                else
                {
                    iniparse.WriteValue("Sustain Colors", i.ToString(), "#00000000");
                }
            }

            iniparse.Close();
        }
    }
    // Use this for initialization
    void Start()
    {
        string configFile;

        if (CharacterConfigurationLoader.getConfigFileNameFromPlayerPrefs && PlayerPrefs.HasKey(CharacterConfigurationLoader.configFilePlayerPrefsString))
        {
            configFile = PlayerPrefs.GetString(CharacterConfigurationLoader.configFilePlayerPrefsString);
        }
        else
        {
            configFile = CharacterConfigurationLoader.configFile;
        }
        INIParser ini = new INIParser();

        ini.Open(Application.dataPath + '/' + configFile);
        gameObject.GetComponent <AudioSource>().enabled = ini.ReadValue("Global", "EnableMusic", 1) != 0;
        gameObject.GetComponent <AudioSource>().volume  = (float)ini.ReadValue("Global", "MusicVolume", 0.0);
        ini.Close();
    }
Пример #13
0
    public void loadINIFile(string data, bool loadFromFile = false)
    {
        var ini = new INIParser();

        if (loadFromFile)
        {
            ini.Open(data);
        }
        else
        {
            ini.OpenFromString(data);
        }

        MakeField(ini.ReadValue("Map", "width", 0), ini.ReadValue("Map", "height", 0));
        importCells(ini.ReadValue("Map", "cells", ""));
        ini.Close();
        g.cameraController.SetState(State.GamePlay);
        Trigger(Channel.Map.Loaded);
    }
Пример #14
0
 protected override void Start()
 {
     base.Start();
     index = 2;
     mType = TYPE.SWORD;
     INIParser ini = new INIParser();
     TextAsset configAsset = Resources.Load("Config/config.ini") as TextAsset;
     ini.Open(configAsset);
     mVelocityThreshold = (float)ini.ReadValue("sword", "velocity_threshold", 0.0);
 }
Пример #15
0
    // Read [VALUE] from [FILE], under [SECTION], at the entry identifed with [KEY].  If no value can be read, return [DEFAULTVALUE].
    // Credit: https://www.assetstore.unity3d.com/en/#!/content/23706
    public string readIni(string section, string key, string defaultValue)
    {
        INIParser ini = new INIParser();

        ini.Open(iniFile);
        string value = ini.ReadValue(section, key, defaultValue);

        ini.Close();

        Debug.Log("Received value: '" + value + "' from " + section + ", " + key);
        return(value);
    }
Пример #16
0
    public static void Read()
    {
        string path = Path.Combine(Application.dataPath, "..", INIPath);

        if (!File.Exists(path))
        {
            Init();
        }

        INIParser ini = new INIParser();

        ini.Open(path);

        configs[Keys.UseTest]       = ini.ReadValue(INISection, "UseTest", false);
        configs[Keys.UseBot]        = ini.ReadValue(INISection, "UseBot", true);
        configs[Keys.ProxyObserve]  = ini.ReadValue(INISection, "ProxyObserve", false);
        configs[Keys.WaitInGame]    = ini.ReadValue(INISection, "WaitInGame", false);
        configs[Keys.AutoUpdate]    = ini.ReadValue(INISection, "AutoUpdate", true);
        configs[Keys.UpdateAddress] = ini.ReadValue(INISection, "UpdateAddress", "http://39.105.200.223:81/thd2/bots/script.pak");


        ini.Close();

        path = Path.Combine(Application.dataPath, "..", "proxy.ini");
        if (!File.Exists(path))
        {
            File.WriteAllText(path, Constance.DefaultProxySetting);
        }
    }
        private void Awake()
        {
            ini = new INIParser();

            ini.Open(Application.dataPath + "\\StreamingAssets" + "\\ini\\debug.txt");
            int boo = ini.ReadValue("App", "isInDebugMode", 0);

            ipAddress    = ini.ReadValue("App", "IPaddress", "http://127.0.0.1/");
            PHP_filePath = ini.ReadValue("App", "PHP_filePath", "PhotoBooth/PhotoBooth.php");
            PHP_url      = ipAddress + PHP_filePath;
            if (boo == 0)
            {
                isInDebugMode = false;
            }
            else
            {
                isInDebugMode = true;
            }
            Debug.Log("isindebugmode: " + ipAddress);

            ini.Close();
        }
Пример #18
0
        /// <summary>
        /// <para>Eng. Init option data with option ini file. </para>
        /// <para>Kor. 옵션 정보 ini을 가져와 초기화합니다. </para>
        /// </summary>
        public void ReadOptionData()
        {
            INIParser _iniParser = new INIParser();

            if (File.Exists(Application.dataPath + "/option.ini"))
            {   // if, file has exists
                _iniParser.Open(Application.dataPath + "/option.ini");

                // -------------- Graphic --------------

                SetOptiondataResolution(_iniParser.ReadValue("Graphic", "ResolutionWidth", Screen.currentResolution.width),
                                        _iniParser.ReadValue("Graphic", "ResolutionHeight", Screen.currentResolution.height));
                _optionData.FullscreenModeIndex = _iniParser.ReadValue("Graphic", "FullscreenMode", 0);
                _optionData.QualityIndex        = _iniParser.ReadValue("Graphic", "Quality", QualitySettings.GetQualityLevel());

                // -------------- Sound --------------

                _optionData.BGMVolume    = _iniParser.ReadValue("Sound", "BGM", 1f);
                _optionData.EffectVolume = _iniParser.ReadValue("Sound", "Effect", 1f);

                // -------------- Game --------------

                _optionData.DialogueSpeedIndex = _iniParser.ReadValue("Game", "DialogueSpeed", 0);

                // -------------- End --------------

                _iniParser.Close();
            }
            else
            {
                _iniParser.Open(Application.dataPath + "/option.ini");

                // -------------- Graphic --------------
                _optionData._resolution          = Screen.currentResolution;
                _optionData._fullscreenModeIndex = ConvertFullscreenModeToIndex(Screen.fullScreenMode);
                _optionData._qualityIndex        = QualitySettings.GetQualityLevel();

                // -------------- Sound --------------

                _optionData._bgmVolume    = InGameManager.GetInstance()._sceneBGM.volume;
                _optionData._effectVolume = InGameManager.GetInstance()._scriptSoundEffect.volume;

                // -------------- Game --------------

                _optionData._dialogueSpeedIndex = InGameManager.GetInstance().DialogueSpeed;

                // -------------- End --------------

                _iniParser.Close();

                SaveOptionData();
            }
        }
Пример #19
0
    /// <summary>
    /// 读取本地资源版本号
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    string ReadLocalResConfig()
    {
        string localResVerPath = GameDefine.AppPersistentDataPath + GameDefine.LocalResVersionFile;

        INIParser IniFile = new INIParser();

        IniFile.Open(localResVerPath);
        string localResVerstr = IniFile.ReadValue("AppConfig", "LocalResVer", string.Empty);

        bAppFirstRun = IniFile.ReadValue("AppConfig", "AppFirstRun", true);
        IniFile.Close();


        //检测文件是否存在

        /*if (!File.Exists(localResVerPath))
         * {
         *  Debug.Log("ReadLocalResourceVersion no file ");
         *  return null;
         * }
         * //使用流的形式读取
         * StreamReader sr = null;
         * try
         * {
         *  sr = File.OpenText(localResVerPath);
         * }
         * catch (Exception)
         * {
         *  //路径与名称未找到文件则直接返回
         *  return null;
         * }
         *
         * string localResVerstr = sr.ReadLine();
         * Debug.Log("ReadLocalResourceVersion:" + localResVerstr);
         * sr.Close();
         * sr.Dispose();*/
        return(localResVerstr);
    }
Пример #20
0
    public static void AddCloneHeroIniTags(Song song, INIParser ini, float songLengthSeconds)
    {
        AddTagFn AddTagIfNonExistant = (string key, string defaultVal) => {
            string realKey = key.Trim() + " ";
            ini.WriteValue(INI_SECTION_HEADER, realKey, ini.ReadValue(INI_SECTION_HEADER, realKey, PrefixSpaceToINIValue(defaultVal)));
        };

        AddDefaultIniTags(song, ini, songLengthSeconds);

        foreach (var tag in chTags)
        {
            AddTagIfNonExistant(tag.Key, tag.Value);
        }
    }
Пример #21
0
    public static void AddDefaultIniTags(Song song, INIParser ini, float songLengthSeconds)
    {
        Metadata metaData            = song.metaData;
        AddTagFn AddTagIfNonExistant = (string key, string defaultVal) => {
            ini.WriteValue(INI_SECTION_HEADER, key.Trim() + " ", ini.ReadValue(INI_SECTION_HEADER, key, PrefixSpaceToINIValue(defaultVal)));
        };

        AddTagIfNonExistant("name", song.name);
        AddTagIfNonExistant("artist", metaData.artist);
        AddTagIfNonExistant("album", metaData.album);
        AddTagIfNonExistant("genre", metaData.genre);
        AddTagIfNonExistant("year", metaData.year);
        AddTagIfNonExistant("song_length", ((int)(songLengthSeconds * 1000)).ToString());
        AddTagIfNonExistant("charter", metaData.charter);
    }
Пример #22
0
        /// <summary>
        /// 读取SDKManager.xml
        /// </summary>
        public void initSDKMgrXML()
        {
            if (_isSDKXMLInited)
            {
                return;
            }

            TextAsset text_asset = Resources.Load("SDKManager") as TextAsset;
            INIParser ini        = new INIParser();

            ini.Open(text_asset);
            CurSDK = ini.ReadValue("platform", "name", "version_poker_window");
            if (!string.IsNullOrEmpty(JARUtilTools.Channel_Name))
            {
                CurSDK = JARUtilTools.Channel_Name;
                Debug.Log("JARUtilTools.CurChannel========>" + CurSDK);
            }
            else
            {
                Debug.Log("JARUtilTools.CurChannel is null    !!!!!!!!!!!!");
            }
            Q_ID = ini.ReadValue(CurSDK, "qid", 0);
            if (!string.IsNullOrEmpty(JARUtilTools.Channel_QID))
            {
                int.TryParse(JARUtilTools.Channel_QID, out Q_ID);
            }
            S_QID = ini.ReadValue(CurSDK, "sqid", 0);
            if (!string.IsNullOrEmpty(JARUtilTools.Channel_SQID))
            {
                int.TryParse(JARUtilTools.Channel_SQID, out S_QID);
            }
            bAppStore = ini.ReadValue(CurSDK, "appstore", false);
            string xmlFile = ini.ReadValue(CurSDK, "xmlfile", "SDKManager.xml");

            APKName = ini.ReadValue(CurSDK, "apkname", "BuYu_Official");
            if (!string.IsNullOrEmpty(JARUtilTools.Channel_ApkName))
            {
                APKName = JARUtilTools.Channel_ApkName;
            }
            if (CurSDK != "version_poker_android_out_test" && CurSDK != "version_poker_android_in_test")
            {
#if UNITY_IOS
                url_paths = string.Format("http://update.game3336.com/VERSION_POKER/{0}/{1}", "version_poker_ios_appstore", xmlFile);
#else
                url_paths = string.Format("http://update.game3336.com/VERSION_POKER/{0}/{1}", "version_poker_android_official", xmlFile);
#endif
            }
            else
            {
                url_paths = string.Format("http://update.game3336.com/VERSION_POKER/{0}/{1}", CurSDK, xmlFile);
            }
            ini.Close();

            _isSDKXMLInited = true;
        }
    void Start()
    {
        string configFile;

        if (CharacterConfigurationLoader.getConfigFileNameFromPlayerPrefs && PlayerPrefs.HasKey(CharacterConfigurationLoader.configFilePlayerPrefsString))
        {
            configFile = PlayerPrefs.GetString(CharacterConfigurationLoader.configFilePlayerPrefsString);
        }
        else
        {
            configFile = CharacterConfigurationLoader.configFile;
        }
        INIParser ini = new INIParser();

        ini.Open(Application.dataPath + '/' + configFile);
        float itemScaleVal = (float)ini.ReadValue("Global", "ItemScale", 5.0);

        itemScale = new Vector3(itemScaleVal, itemScaleVal, itemScaleVal);
        ini.Close();
    }
Пример #24
0
    /// <summary>
    /// 读取服务器资源和程序版本号
    /// </summary>
    /// <param name="path"></param>
    /// <returns></returns>
    private void LoadServerResVersionConfig()
    {
        UnityWebRequest www = UnityWebRequest.Get(GameDefine.LuancherURL + GameDefine.ServerResVersionFile);

        www.Send();

        while (!www.isDone)
        {
        }

        // Show results as text
        string verstr = www.downloadHandler.text;

        www.Dispose();

        INIParser ini = new INIParser();

        ini.OpenFromString(verstr);
        string IosReviewAppVer = ini.ReadValue("SvrResVer", "ReviewAppVer", "");
        string luancherurl     = ini.ReadValue("SvrResVer", "FormalLuancher", "");

        //当前是否审核版本
        if (!string.IsNullOrEmpty(IosReviewAppVer) && IosReviewAppVer.CompareTo(Application.version) == 0)
        {
            IsReviewVersion = true;
        }
        //如果不是审核版本且有指向则需连接正式luancher服上获取更新字段
        if (!IsReviewVersion && !string.IsNullOrEmpty(luancherurl))
        {
            UnityWebRequest www1 = UnityWebRequest.Get(luancherurl + "SerResVersion.data");
            www1.Send();

            while (!www1.isDone)
            {
            }
            verstr = www1.downloadHandler.text;
            www1.Dispose();
            ini.OpenFromString(verstr);
            GameDefine.LuancherURL = luancherurl;
        }
        m_SvrResVerStr = ini.ReadValue("SvrResVer", "ResVer", "");
        m_SvrAppVerStr = ini.ReadValue("SvrResVer", "AppVer", "");
        m_ServerIP     = ini.ReadValue("SvrResVer", "SvrIP", "");
        m_ServerPort   = ini.ReadValue("SvrResVer", "SvrPort", 16201);
        ini.Close();


        Debug.Log("Res:" + m_SvrResVerStr + ",ApkVer:" + m_SvrAppVerStr + " SerIP:" + m_ServerIP);
    }
Пример #25
0
    // Use this for initialization

    public void loadList(string fileName, string sectionName)
    {
        cards = new List <card> ();
        INIParser ini      = new INIParser();
        TextAsset fileData = Resources.Load(fileName) as TextAsset;

        ini.Open(fileData);

        for (int i = 0; i < 100; i++)
        {
            string line = ini.ReadValue(sectionName, i.ToString(), "-1");
            if (line == "-1")
            {
                break;
            }
            string[] tokens = line.Split(',');
            cards.Add(new card(tokens [0], tokens [1]));
        }
        ini.Close();
    }
Пример #26
0
    /// <summary>
    /// 读取应用程序版本号
    /// </summary>
    private void ReadAppVersion()
    {
        string    appconfigfilepath = GameCommon.GetAppStreamingAssetPath() + "AppConfig.ini";
        INIParser ini = new INIParser();

        if (Application.platform == RuntimePlatform.Android)
        {
            WWW www = new WWW(appconfigfilepath);
            while (!www.isDone)
            {
            }
            ini.OpenFromString(www.text);
            www.Dispose();
        }
        else
        {
            ini.Open(appconfigfilepath);
        }
        m_strAppVersion = ini.ReadValue("Config", "AppVer", "1.0");
        ini.Close();
    }
Пример #27
0
    private static void InitList()
    {
        string    iniPath = Application.dataPath + "/Resources/SDKManager.bytes";
        INIParser ini     = new INIParser();

        ini.Open(iniPath);
        List <string> sections = ini.GetAllSections();

        _listPlatform.Clear();
        _dicEnumSelect.Clear();
        bSelectAll = false;
        for (int k = 0; k < sections.Count; k++)
        {
            if (ini.IsKeyExists(sections[k], "apkname"))
            {
                string apk_name = ini.ReadValue(sections[k], "apkname", sections[k]);
                _listPlatform.Add(sections[k], apk_name);
                _dicEnumSelect.Add(sections[k], false);
            }
        }
        ini.Close();
    }
Пример #28
0
        /// <summary>
        /// Loads the mods settings from the ini file.
        /// </summary>
        private void LoadSettings()
        {
            if (!File.Exists(IniLocation))
            {
                CreateSettings();
                return;
            }

            INIParser ini = new INIParser();

            ini.Open(IniLocation);

            CustomShieldActive  = ini.ReadValue("Settings", "Mod Active", CustomShieldActive);
            UseTeamColor        = ini.ReadValue("Settings", "Use Team Color", UseTeamColor);
            CustomShieldColor.r = (float)ini.ReadValue("Settings", "Custom Shield Color R", CustomShieldColor.r);
            CustomShieldColor.g = (float)ini.ReadValue("Settings", "Custom Shield Color G", CustomShieldColor.g);
            CustomShieldColor.b = (float)ini.ReadValue("Settings", "Custom Shield Color B", CustomShieldColor.b);
            CustomShieldColor.a = (float)ini.ReadValue("Settings", "Custom Shield Color A", CustomShieldColor.a);

            ini.Close();
        }
Пример #29
0
    void Authenticate()
    {
        INIParser ini = new INIParser();

        if (System.IO.File.Exists(Application.persistentDataPath + "/config.ini"))
        {
            ini.Open(Application.persistentDataPath + "/config.ini");
            username      = ini.ReadValue("vCenter", "username", "*****@*****.**");
            password      = ini.ReadValue("vCenter", "password", "VMware1!");
            hostUrl       = ini.ReadValue("vCenter", "hosturl", "https://*****:*****@vsphere.local");
            ini.WriteValue("vCenter", "password", "VMware1!");
            ini.WriteValue("vCenter", "hosturl", "https://VC01");
            username = ini.ReadValue("vCenter", "username", "*****@*****.**");
            password = ini.ReadValue("vCenter", "password", "VMware1!");
            hostUrl  = ini.ReadValue("vCenter", "hosturl", "https://localhost:8082");
        }
        ini.Close();

        HttpWebRequest request = CreatePostRequest("/rest/com/vmware/cis/session");
        String         encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));

        request.Headers.Add("Authorization", "Basic " + encoded);
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        if ((int)response.StatusCode == 200)
        {
            cookie = response.Headers["Set-Cookie"];
            cookie = cookie.Substring(cookie.IndexOf('=') + 1);
            cookie = cookie.Substring(0, cookie.IndexOf(';'));
        }
    }
    public static void Load(string configFilepath, string controllerBindingsFilepath)
    {
        INIParser iniparse = new INIParser();

        try
        {
            Debug.Log("Loading game settings");

            iniparse.Open(configFilepath);

            // Check for valid fps values
            targetFramerate         = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Framerate", 120);
            hyperspeed              = (float)iniparse.ReadValue(SECTION_NAME_SETTINGS, "Hyperspeed", 5.0f);
            highwayLength           = (float)iniparse.ReadValue(SECTION_NAME_SETTINGS, "Highway Length", 0);
            audioCalibrationMS      = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Audio calibration", 0);
            clapCalibrationMS       = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Clap calibration", 0);
            clapProperties          = (ClapToggle)iniparse.ReadValue(SECTION_NAME_SETTINGS, "Clap", c_defaultClapVal);
            extendedSustainsEnabled = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Extended sustains", false);
            clapEnabled             = false;
            sustainGapEnabled       = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Sustain Gap", false);
            sustainGapStep          = new Step((int)iniparse.ReadValue(SECTION_NAME_SETTINGS, "Sustain Gap Step", (int)16));
            notePlacementMode       = (NotePlacementMode)iniparse.ReadValue(SECTION_NAME_SETTINGS, "Note Placement Mode", (int)NotePlacementMode.Default);
            gameplayStartDelayTime  = (float)iniparse.ReadValue(SECTION_NAME_SETTINGS, "Gameplay Start Delay", 3.0f);
            resetAfterPlay          = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Reset After Play", false);
            resetAfterGameplay      = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Reset After Gameplay", false);
            customBgSwapTime        = iniparse.ReadValue(SECTION_NAME_SETTINGS, "Custom Background Swap Time", 30);
            gameplayStartDelayTime  = Mathf.Clamp(gameplayStartDelayTime, 0, 3.0f);
            gameplayStartDelayTime  = (float)(System.Math.Round(gameplayStartDelayTime * 2.0f, System.MidpointRounding.AwayFromZero) / 2.0f); // Check that the gameplay start delay time is a multiple of 0.5 and is

            // Audio levels
            vol_master = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Master", 0.5f);
            vol_song   = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Music Stream", 1.0f);
            vol_guitar = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Guitar Stream", 1.0f);
            vol_bass   = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Bass Stream", 1.0f);
            vol_rhythm = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Rhythm Stream", 1.0f);
            vol_drum   = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Drum Stream", 1.0f);
            audio_pan  = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "Audio Pan", 0.0f);
            sfxVolume  = (float)iniparse.ReadValue(SECTION_NAME_AUDIO, "SFX", 1.0f);

            // Need to fix old config values
            if ((int)clapProperties > (((int)ClapToggle.SECTION << 1) - 1))
            {
                clapProperties = (ClapToggle)c_defaultClapVal;
            }
        }
        catch (System.Exception e)
        {
            Debug.LogError("Error encountered when trying to load game settings. " + e.Message);
        }
        finally
        {
            iniparse.Close();
        }

        try
        {
            // Populate with all default controls first
            controls.LoadFromSaveData(InputManager.Instance.defaultControls);

            if (File.Exists(controllerBindingsFilepath))
            {
                // Override with custom controls if they exist.
                Debug.Log("Loading input settings");
                string controlsJson = File.ReadAllText(controllerBindingsFilepath);
                controls.LoadFromSaveData(JsonUtility.FromJson <MSChartEditorInput.MSChartEditorActionContainer>(controlsJson));
            }
        }
        catch (System.Exception e)
        {
            Debug.LogError("Unable to load saved controls. " + e.Message);
        }
    }
Пример #31
0
        public Card(int index, INIParser ini)
        {
            Index = index;
            Name  = ini.ReadValue(Index.ToString(), "name", "error");
            YES   = ini.ReadValue(Index.ToString(), "Y", "error");
            NO    = ini.ReadValue(Index.ToString(), "N", "error");
            float YH = (float)ini.ReadValue(Index.ToString(), "YH", 0.0);
            float YS = (float)ini.ReadValue(Index.ToString(), "YS", 0.0);
            float YD = (float)ini.ReadValue(Index.ToString(), "YD", 0.0);
            float YP = (float)ini.ReadValue(Index.ToString(), "YP", 0.0);

            YESValue = new Vector4(YS, YH, YP, YD);
            float NH = (float)ini.ReadValue(Index.ToString(), "NH", 0.0);
            float NS = (float)ini.ReadValue(Index.ToString(), "NS", 0.0);
            float ND = (float)ini.ReadValue(Index.ToString(), "ND", 0.0);
            float NP = (float)ini.ReadValue(Index.ToString(), "NP", 0.0);

            NOValue = new Vector4(NS, NH, NP, ND);
        }
Пример #32
0
    public static void LoadGameSettings()
    {
        // create the file if it doesn't already exist
        if (!File.Exists(GameSettings.GetDirectory() + "settings.ini"))
            SaveGameSettings();

        INIParser ini = new INIParser();
        ini.Open(GameSettings.GetDirectory() + "settings.ini");
        {
            GameSettings.GS_RESOLUTION.x = ini.ReadValue("Display", "Screen Width", Screen.width);
            GameSettings.GS_RESOLUTION.y = ini.ReadValue("Display", "Screen Height", Screen.height);
            GameSettings.GS_FULLSCREEN = ini.ReadValue("Display", "Fullscreen", GameSettings.GS_FULLSCREEN);
            GameSettings.GS_FRAMECAP = ini.ReadValue("Display", "Framecap", GameSettings.GS_FRAMECAP);

            GameSettings.GS_DRAWDISTANCE = ini.ReadValue("Rendering", "Draw Distance", GameSettings.GS_DRAWDISTANCE);
            GameSettings.GS_BLOOM = ini.ReadValue("Rendering", "Bloom", GameSettings.GS_BLOOM);
            GameSettings.GS_FXAA = ini.ReadValue("Rendering", "FXAA", GameSettings.GS_FXAA);
            GameSettings.GS_CRT  = ini.ReadValue("Rendering", "CRT", GameSettings.GS_CRT);
            GameSettings.GS_VAPORWAVE = ini.ReadValue("Rendering", "Vape", GameSettings.GS_VAPORWAVE);

            AudioSettings.VOLUME_MAIN= ini.ReadValue("Audio", "Master Volume", Mathf.RoundToInt(AudioSettings.VOLUME_MAIN));
            AudioSettings.VOLUME_SFX = ini.ReadValue("Audio", "SFX Volume", Mathf.RoundToInt(AudioSettings.VOLUME_SFX));
            AudioSettings.VOLUME_VOICES = ini.ReadValue("Audio", "Voices Volume", Mathf.RoundToInt(AudioSettings.VOLUME_VOICES));
            AudioSettings.VOLUME_MUSIC = ini.ReadValue("Audio", "Music Volume", Mathf.RoundToInt(AudioSettings.VOLUME_MUSIC));
        }
        ini.Close();
    }
Пример #33
0
    public static void LoadGameSettings()
    {
        if (!File.Exists(GameSettings.GetDirectory() + "settings.ini"))
            SaveGameSettings();

        INIParser ini = new INIParser();
        ini.Open(GameSettings.GetDirectory() + "settings.ini"); {
            GameSettings.GS_RESOLUTION.x = ini.ReadValue("Display", "Screen Width", Screen.width);
            GameSettings.GS_RESOLUTION.y = ini.ReadValue("Display", "Screen Height", Screen.height);
            GameSettings.GS_FULLSCREEN = ini.ReadValue("Display", "Fullscreen", GameSettings.GS_FULLSCREEN);
            GameSettings.GS_FRAMECAP = ini.ReadValue("Display", "Framecap", GameSettings.GS_FRAMECAP);

            GameSettings.GS_DRAWDISTANCE = ini.ReadValue("Rendering", "Draw Distance", GameSettings.GS_DRAWDISTANCE);
            GameSettings.GS_BLOOM = ini.ReadValue("Rendering", "Bloom", GameSettings.GS_BLOOM);
            GameSettings.GS_DYNAMICRESOLUTION = ini.ReadValue("Rendering", "Dynamic Resolution", GameSettings.GS_DYNAMICRESOLUTION);
            GameSettings.GS_AA = ini.ReadValue("Rendering", "AA", GameSettings.GS_AA);
            GameSettings.GS_AO = ini.ReadValue("Rendering", "AO", GameSettings.GS_AO);
            GameSettings.GS_CAMERADAMAGE = ini.ReadValue("Rendering", "CAMDMG", GameSettings.GS_CAMERADAMAGE);
            GameSettings.GS_TONEMAPPING = ini.ReadValue("Rendering", "TONEMAP", GameSettings.GS_TONEMAPPING);

            AudioSettings.VOLUME_MAIN = (float)ini.ReadValue("Audio", "Master Volume", AudioSettings.VOLUME_MAIN);
            AudioSettings.VOLUME_SFX = (float)ini.ReadValue("Audio", "SFX Volume", AudioSettings.VOLUME_SFX);
            AudioSettings.VOLUME_VOICES = (float)ini.ReadValue("Audio", "Voices Volume", AudioSettings.VOLUME_VOICES);
            AudioSettings.VOLUME_MUSIC = (float)ini.ReadValue("Audio", "Music Volume", AudioSettings.VOLUME_MUSIC);

            AudioSettings.customMusicEnabled = ini.ReadValue("Audio", "Custom Music", AudioSettings.customMusicEnabled);

            GameSettings.IN_VIBRATION = ini.ReadValue("Control Settings", "Vibration", GameSettings.IN_VIBRATION);

            GameSettings.G_DEFAULTCAMERA = ini.ReadValue("Gameplay", "Default Camera", GameSettings.G_DEFAULTCAMERA);
            GameSettings.G_COUNTDOWNTYPE = ini.ReadValue("Gameplay", "Countdown Mode", GameSettings.G_COUNTDOWNTYPE);
            GameSettings.G_TRACKINTROVOICES = ini.ReadValue("Gameplay", "Intro Voices", GameSettings.G_TRACKINTROVOICES);
            GameSettings.G_MIRROR = ini.ReadValue("Gameplay", "Mirror", GameSettings.G_MIRROR);
            GameSettings.G_LANGUAGE = (Enumerations.E_LANGUAGE)ini.ReadValue("Gameplay", "Language", (int)GameSettings.G_LANGUAGE);

            GameSettings.G_CUSTOMHUDCOLOR.r = (float)ini.ReadValue("Gameplay", "Custom HUD Color R", GameSettings.G_CUSTOMHUDCOLOR.r);
            GameSettings.G_CUSTOMHUDCOLOR.g = (float)ini.ReadValue("Gameplay", "Custom HUD Color G", GameSettings.G_CUSTOMHUDCOLOR.g);
            GameSettings.G_CUSTOMHUDCOLOR.b = (float)ini.ReadValue("Gameplay", "Custom HUD Color B", GameSettings.G_CUSTOMHUDCOLOR.b);
            GameSettings.G_CUSTOMHUDCOLOR.a = (float)ini.ReadValue("Gameplay", "Custom HUD Color A", GameSettings.G_CUSTOMHUDCOLOR.a);
        }
        ini.Close();
    }