示例#1
0
        public ReplayController(string replayFileName, States.Gameplay gameplayState)
        {
            this.gameplayState = gameplayState;
            TextAsset json = Resources.Load(replayFileName) as TextAsset;

            replayData = JsonUtility.FromJson <ReplayData>(json.ToString());

            if (replayData.mapHash != CommonData.gameWorld.mapHash)
            {
                Debug.LogWarning("Warning:  Map does not match playback data!\n" +
                                 "Replay: " + replayData.mapHash + "\n" +
                                 "Map:" + CommonData.gameWorld.mapHash);
            }
        }
        public ReplayController(string replayFileName, States.Gameplay gameplayState)
        {
            this.gameplayState = gameplayState;

            // Load binary replay file as TextAsset.  Unity supports .bytes extension.
            TextAsset asset = Resources.Load(replayFileName) as TextAsset;

            replayData = ReplayData.CreateFromStream(new System.IO.MemoryStream(asset.bytes));

            if (replayData.mapHash != CommonData.gameWorld.mapHash)
            {
                Debug.LogWarning("Warning:  Map does not match playback data!\n" +
                                 "Replay: " + replayData.mapHash + "\n" +
                                 "Map:" + CommonData.gameWorld.mapHash);
            }
        }