public static XKGlobalData GetInstance() { if (Instance == null) { Instance = new XKGlobalData(); Instance.InitInfo(); #if UNITY_STANDALONE_WIN if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath); } #endif if (HandleJsonObj == null) { HandleJsonObj = HandleJson.GetInstance(); } //return Instance; string startCoinInfo = HandleJsonObj.ReadFromFileXml(FileName, "START_COIN"); if (startCoinInfo == null || startCoinInfo == "") { startCoinInfo = "1"; HandleJsonObj.WriteToFileXml(FileName, "START_COIN", startCoinInfo); } GameNeedCoin = Convert.ToInt32(startCoinInfo); string modeGame = HandleJsonObj.ReadFromFileXml(FileName, "GAME_MODE"); if (modeGame == null || modeGame == "") { modeGame = "1"; HandleJsonObj.WriteToFileXml(FileName, "GAME_MODE", modeGame); } IsFreeMode = modeGame == "0" ? true : false; GameDiff = HandleJsonObj.ReadFromFileXml(FileName, "GAME_DIFFICULTY"); if (GameDiff == null || GameDiff == "") { GameDiff = "1"; HandleJsonObj.WriteToFileXml(FileName, "GAME_DIFFICULTY", GameDiff); } //string val = HandleJsonObj.ReadFromFileXml(FileName, "GameAudioVolume"); //if (val == null || val == "") { // val = "7"; // HandleJsonObj.WriteToFileXml(FileName, "GameAudioVolume", val); //} string val = "10"; GameAudioVolume = Convert.ToInt32(val); //val = HandleJsonObj.ReadFromFileXml(FileName, "GameVersionPlayer"); //if (val == null || val == "") { // val = "0"; //四人版本. // HandleJsonObj.WriteToFileXml(FileName, "GameVersionPlayer", val); //} val = "0"; //四人版本. GameVersionPlayer = Convert.ToInt32(val); Instance.InitIsPrintCaiPiao(); Instance.InitCoinToCard(); Instance.InitTotalOutPrintCards(); Instance.InitTotalInsertCoins(); Instance.InitZhanCheCaiChi(); Instance.InitDaoJuCaiChi(); Instance.InitJPBossCaiChi(); Instance.InitCaiPiaoPrintState(); } return(Instance); }