public Texture2D GenerateQRCode(string text, int size = 256)
{
var writer = new BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,
Options = new ZXing.Common.EncodingOptions
{
Height = size,
Width = size,
Margin = 0
}
};
Color32[] pixelData = writer.Write(text);
Texture2D texture = new Texture2D(size, size);
texture.SetPixels32(pixelData);
texture.Apply();
return texture;
} private void completeSetUp()
{
if (!string.IsNullOrEmpty(gameDatabase.getPlayerUID()))
{
if(System.Environment.MachineName != gameDatabase.getDeviceName())
{
Debug.Log("using wrong device");
//TODO notify player of mismatch and possibly block the game
}
if(currentPlayerUUID != null)
{
currentPlayerUUID.text = "PlayerId: "+gameDatabase.getPlayerUID();
isPlayerSharing = true;
}
isFirstPlaythorugh = false;
if (continueButton)
{
continueButton.SetActive(true);
}
if (critter)
{
critter.transform.localPosition = new Vector3(critter.transform.localPosition.x, 0.45f, critter.transform.localPosition.z);
}
if(critterMaterial)
{
Color colorFromHex;
if (ColorUtility.TryParseHtmlString(gameDatabase.getCritterColor(), out colorFromHex))
{
critterMaterial.color = colorFromHex;
}
}
}
else
{
isPlayerSharing = false;
if (continueButton)
{
continueButton.SetActive(false);
}
if(deleteAccountButton)
{
deleteAccountButton.SetActive(false);
}
if (critter)
{
critter.transform.localPosition = new Vector3(critter.transform.localPosition.x, -0.45f, critter.transform.localPosition.z);
}
}
}