using System;
using UnityEngine;
using UnityEngine.Tilemaps;
using UnityEngine.UI;
public partial class ClickTest : MonoBehaviour
{
public void UpdateGrayscale()
{
for (int i = 0; i < this.xMax; i++)
{
for (int j = 0; j < this.yMax; j++)
{
Vector3Int position = new Vector3Int(i, j, 0);
int saved = this.savedGridValues[i, j];
int target = this.mainGridValues[i, j];
bool isEmpty = saved == -1;
bool isCorrect = saved == target;
bool isWrong = !isEmpty && !isCorrect;
bool isSelectedTarget = target == this.selectedColourID;
Color color;
if (isCorrect)
{
color = this.crossLevel.colours[saved - 1];
}
else if (isSelectedTarget)
{
color = Color.grey;
}
else if (!isEmpty)
{
color = this.crossLevel.colours[saved - 1];
if (this.crossLevel.grayscale)
{
color = color.CheckGrayScale(this.crossLevel);
}
if (this.crossLevel.highContrast >= 2 && isWrong)
{
color = Color.white;
}
}
else
{
color = Color.white;
}
color.r = this.Clamp(color.r, 0.2f, 1f);
color.g = this.Clamp(color.g, 0.2f, 1f);
color.b = this.Clamp(color.b, 0.2f, 1f);
this.tilemap.SetTileFlags(position, TileFlags.None);
this.tilemap.SetColor(position, color);
}
}
}
}
Read 13 times, last 19 days ago
MicroBin Public Server 1 - v2.0.4 - Running on a Raspberry Pi 4