Exemplo n.º 1
0
        public void SavePlayerRecord()
        {
            Debug.Log("保存玩家记录!");
            BaseState currentState = stateMachine.CurrentState;

            PlayerRecord playerRecord = new PlayerRecord();

            playerRecord.markPlayerList     = markManager.MarkPlayerList;
            playerRecord.varPlayerNameList  = new List <string>(markManager.ValuePlayerDict.Keys);
            playerRecord.varPlayerValueList = new List <float>(markManager.ValuePlayerDict.Values);

            var           pastScriptDict           = pastScriptManager.PastScriptDict;
            List <string> pastScriptNameList       = new List <string>();
            List <int>    pastScriptLineNumberList = new List <int>();

            foreach (string key in pastScriptDict.Keys)
            {
                int lineNumber = pastScriptDict[key];
                pastScriptNameList.Add(key);
                pastScriptLineNumberList.Add(lineNumber);
            }
            playerRecord.pastScriptNameList       = pastScriptNameList;
            playerRecord.pastScriptLineNumberList = pastScriptLineNumberList;

            recordManager.SavePlayerRecord(playerRecord);
        }
Exemplo n.º 2
0
        public void LoadPlayerRecord()
        {
            Debug.Log("读取玩家记录!");
            PlayerRecord playerRecord = recordManager.PlayerRecord;

            markManager.LoadPlayerRecord(playerRecord.markPlayerList, playerRecord.varPlayerNameList, playerRecord.varPlayerValueList);
            pastScriptManager.LoadPlayerRecord(playerRecord.pastScriptNameList, playerRecord.pastScriptLineNumberList);
        }
Exemplo n.º 3
0
        public void SavePlayerRecord(PlayerRecord newPlayerRecord)
        {
            if (newPlayerRecord == null)
            {
                throw new System.Exception("PlayerRecordManager SavePlayerRecord");
            }
            string json = JsonUtility.ToJson(newPlayerRecord);

            PlayerRecord = new PlayerRecord();
            JsonUtility.FromJsonOverwrite(json, PlayerRecord);
            PachiGrimoire.I.FileManager.SavePlayerRecord(json);
        }
Exemplo n.º 4
0
        public bool LoadPlayerRecordData(string playerRecordJSON)
        {
            Debug.Log("playerRecordJSON");
            Debug.Log(playerRecordJSON);
            PlayerRecord = new PlayerRecord();
            if (playerRecordJSON == null)
            {
                // 保存一个默认的玩家记录数据
                SavePlayerRecord(PlayerRecord);
                return(false);
            }

            JsonUtility.FromJsonOverwrite(playerRecordJSON, PlayerRecord);
            return(true);
        }