FromBytes() 공개 정적인 메소드

public static FromBytes ( byte b ) : GameProgress,
b byte
리턴 GameProgress,
예제 #1
0
    void ProcessCloudData(byte[] cloudData)
    {
        if (cloudData == null)
        {
            Debug.Log("No data saved to the cloud yet...");
            return;
        }
        Debug.Log("Decoding cloud data from bytes.");
        GameProgress progress = GameProgress.FromBytes(cloudData);

        Debug.Log("Merging with existing game progress.");
        mProgress.MergeWith(progress);
    }
예제 #2
0
    public byte[] OnStateConflict(int slot, byte[] local, byte[] server)
    {
        Debug.Log("Conflict callback called. Resolving conflict.");

        // decode byte arrays into game progress and merge them
        GameProgress localProgress = local == null ?
                                     new GameProgress() : GameProgress.FromBytes(local);
        GameProgress serverProgress = server == null ?
                                      new GameProgress() : GameProgress.FromBytes(server);

        localProgress.MergeWith(serverProgress);

        // resolve conflict
        return(localProgress.ToBytes());
    }