public static void DrawWallPreview(Rect r, LevelProfile lp) { int x; int y; GUI.enabled = false; for (x = 0; x < lp.width - 1; x++) { for (y = 0; y < lp.height; y++) { if (lp.GetWallV(x, y) && lp.GetSlot(x, y) && lp.GetSlot(x + 1, y)) { DrawWallButton(x, y, "V", r, lp); } } } for (x = 0; x < lp.width; x++) { for (y = 0; y < lp.height - 1; y++) { if (lp.GetWallH(x, y) && lp.GetSlot(x, y) && lp.GetSlot(x, y + 1)) { DrawWallButton(x, y, "H", r, lp); } } } GUI.enabled = true; }
void DrawSlot() { for (int x = 0; x < profile.width; x++) { for (int y = 0; y < profile.height; y++) { if (teleportID != -Vector2.right) { if (DrawSlotButtonTeleport(x, y, rect, profile)) { if (x == teleportID.x && y == teleportID.y) { profile.SetTeleport(Mathf.CeilToInt(teleportID.x), Mathf.CeilToInt(teleportID.y), 0); } else { profile.SetTeleport(Mathf.CeilToInt(teleportID.x), Mathf.CeilToInt(teleportID.y), y * 12 + x + 1); } teleportID = -Vector2.right; } continue; } if (DrawSlotButton(x, y, rect, profile)) { switch (toolID) { case "Slots": profile.SetSlot(x, y, !profile.GetSlot(x, y)); break; case "Generators": profile.SetGenerator(x, y, !profile.GetGenerator(x, y)); break; case "Teleports": teleportID = new Vector2(x, y); break; case "Sugar Drop": profile.SetSugarDrop(x, y, !profile.GetSugarDrop(x, y)); break; } } } } DrawWallPreview(rect, profile); }
void DrawSlot() { help = "Transparent slot - slot which is absent"; for (int x = 0; x < profile.width; x++) { for (int y = 0; y < profile.height; y++) { if (DrawSlotButton(x, y, rect, profile)) { profile.SetSlot(x, y, !profile.GetSlot(x, y)); } } } DrawWallPreview(rect, profile); }
bool DrawSlotButtonTeleport(int x, int y, Rect r, LevelProfile lp) { if (!lp.GetSlot(x, y)) { return(false); } defaultColor = GUI.backgroundColor; Color color = Color.cyan; if (teleportID.x == x && teleportID.y == y) { color = Color.magenta; } if (lp.GetTeleport(Mathf.FloorToInt(teleportID.x), Mathf.FloorToInt(teleportID.y)) == 12 * y + x + 1) { color = Color.yellow; } string label = ""; bool btn = false; GUI.backgroundColor = color; btn = GUI.Button(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect), cellSize, cellSize), label, slotStyle); if (lp.GetSlot(x, y) && lp.GetGenerator(x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) - 2, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "G", iconStyle); } if (lp.GetSlot(x, y) && lp.GetTeleport(x, y) > 0) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + 10, r.yMin + y * (cellSize + slotOffect) - 2, cellSize - 12, 10), "T:" + lp.GetTeleport(x, y).ToString(), iconStyle); } if (lp.GetSlot(x, y)) { GUI.backgroundColor = transparentColor; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect) + cellSize - 10, 20, 10), (y * 12 + x + 1).ToString(), slotStyle); } GUI.backgroundColor = defaultColor; return(btn); }
bool DrawSlotButton(int x, int y, Rect r, LevelProfile lp) { defaultColor = GUI.backgroundColor; Color color = Color.white; string label = ""; bool btn = false; int chip = lp.GetChip(x, y); if (!lp.GetSlot(x, y)) { color *= 0; } GUI.backgroundColor = color; btn = GUI.Button(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect), cellSize, cellSize), label, slotStyle); float cursor = -2; if (lp.GetSlot(x, y) && lp.GetGenerator(x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "G", iconStyle); cursor += 10 + 2; } if (lp.GetSlot(x, y) && lp.GetTeleport(x, y) > 0) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, cellSize - 12, 10), "T:" + lp.GetTeleport(x, y).ToString(), iconStyle); } if (lp.GetSlot(x, y)) { GUI.backgroundColor = transparentColor; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect) + cellSize - 10, 20, 10), (y * 12 + x + 1).ToString(), slotStyle); } GUI.backgroundColor = defaultColor; return(btn); }
public static void DrawSlotPreview(Rect r, LevelProfile lp) { int x; int y; GUI.enabled = false; for (x = 0; x < lp.width; x++) { for (y = 0; y < lp.height; y++) { if (lp.GetSlot(x, y)) { DrawSlotButton(x, y, r, lp); } } } GUI.enabled = true; }
static bool DrawSlotButton(int x, int y, Rect r, LevelProfile lp) { defaultColor = GUI.color; Color color = defaultColor; string label = ""; bool btn = false; if (!lp.GetSlot(x, y)) { color *= transparentColor; } else { if (lp.GetBlock(x, y) == 0 && lp.GetChip(x, y) > 0) { if (lp.GetChip(x, y) > lp.chipCount) { lp.SetChip(x, y, lp.chipCount); } color *= chipColor[lp.GetChip(x, y) - 1]; } if (lp.GetBlock(x, y) == 0 && lp.GetChip(x, y) == -1 && lp.GetPowerup(x, y) == 0) { color *= unpressedColor; } if (lp.GetBlock(x, y) == 0 && lp.GetPowerup(x, y) > 0) { label += (label.Length == 0 ? "" : "\n"); label += powerupLabel[lp.GetPowerup(x, y) - 1]; } if (lp.GetBlock(x, y) > 0) { label += (label.Length == 0 ? "" : "\n") + "B:" + lp.GetBlock(x, y).ToString(); } if (lp.GetJelly(x, y) > 0) { label += (label.Length == 0 ? "" : "\n") + "J:" + lp.GetJelly(x, y).ToString(); } } GUI.color = color; btn = GUI.Button(new Rect(r.xMin + x * (30 + slotOffect), r.yMin + y * (30 + slotOffect), 30, 30), label, slotStyle); GUI.color = defaultColor; return(btn); }
void DrawSlot() { for (int x = 0; x < profile.width; x++) { for (int y = 0; y < profile.height; y++) { // if (teleportID != -Vector2.right) { // if (DrawSlotButtonTeleport(x, y, rect, profile)) { // if (x == teleportID.x && y == teleportID.y) // profile.SetTeleport(Mathf.CeilToInt(teleportID.x), Mathf.CeilToInt(teleportID.y), 0); // else // profile.SetTeleport(Mathf.CeilToInt(teleportID.x), Mathf.CeilToInt(teleportID.y), y * 12 + x + 1); // teleportID = -Vector2.right; // } // continue; // } if (DrawSlotButton(x, y, rect, profile)) { switch (toolID) { case "Slots": profile.SetSlot(x, y, !profile.GetSlot(x, y)); break; case "Generators": profile.SetGenerator(x, y, !profile.GetGenerator(x, y)); break; case "Teleports": teleportID = new Vector2(x, y); break; } } } } }
bool DrawSlotButton(int x, int y, Rect r, LevelProfile lp) { defaultColor = GUI.backgroundColor; Color color = Color.white; string label = ""; bool btn = false; int block = lp.GetBlock(x, y); int jelly = lp.GetJelly(x, y); int chip = lp.GetChip(x, y); if (!lp.GetSlot(x, y)) { color *= 0; } else { if (block == 0) { if (chip == 9) { color *= stoneColor; lp.SetPowerup(x, y, 0); } else if (chip > 0) { if (chip > lp.chipCount) { lp.SetChip(x, y, -1); } color *= chipColor[chip - 1]; } } if (block == 5) { if (chip > 0) { if (chip > lp.chipCount) { lp.SetChip(x, y, -1); } color *= chipColor[chip - 1]; } } if (block == 0 && chip == -1 && lp.GetPowerup(x, y) == 0) { color *= unpressedColor; } if (block == 0 && lp.GetPowerup(x, y) > 0) { label += (label.Length == 0 ? "" : "\n"); label += powerupLabel[lp.GetPowerup(x, y) - 1]; } if (block > 0 && block <= 3) { label += (label.Length == 0 ? "" : "\n") + "B:" + block.ToString(); } if (block == 4) { label += (label.Length == 0 ? "" : "\n") + "Weed"; } if (block == 5) { label += (label.Length == 0 ? "" : "\n") + "Brch"; } if (jelly > 0 && lp.target == FieldTarget.Jelly) { label += (label.Length == 0 ? "" : "\n") + "J:" + jelly.ToString(); } } GUI.backgroundColor = color; btn = GUI.Button(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect), cellSize, cellSize), label, slotStyle); float cursor = -2; if (lp.GetSlot(x, y) && lp.GetGenerator(x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "G", iconStyle); cursor += 10 + 2; } if (lp.target == FieldTarget.SugarDrop && lp.GetSlot(x, y) && lp.GetSugarDrop(x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "S", iconStyle); cursor += 10 + 2; } if (lp.GetSlot(x, y) && lp.GetTeleport(x, y) > 0) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, cellSize - 12, 10), "T:" + lp.GetTeleport(x, y).ToString(), iconStyle); } if (lp.GetSlot(x, y)) { GUI.backgroundColor = transparentColor; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect) + cellSize - 10, 20, 10), (y * 12 + x + 1).ToString(), slotStyle); } GUI.backgroundColor = defaultColor; return(btn); }
bool DrawSlotButtonTeleport(int x, int y, Rect r, LevelProfile lp) { if (!lp.GetSlot(x, y)) return false; defaultColor = GUI.backgroundColor; Color color = Color.cyan; if (teleportID.x == x && teleportID.y == y) color = Color.magenta; if (lp.GetTeleport(Mathf.FloorToInt(teleportID.x), Mathf.FloorToInt(teleportID.y)) == 12 * y + x + 1) color = Color.yellow; string label = ""; bool btn = false; GUI.backgroundColor = color; btn = GUI.Button (new Rect (r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect), cellSize, cellSize), label, slotStyle); if (lp.GetSlot(x, y) && lp.GetGenerator (x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) - 2, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "G", iconStyle); } if (lp.GetSlot(x, y) && lp.GetTeleport (x, y) > 0) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + 10, r.yMin + y * (cellSize + slotOffect) - 2, cellSize - 12, 10), "T:" + lp.GetTeleport (x, y).ToString(), iconStyle); } if (lp.GetSlot (x, y)) { GUI.backgroundColor = transparentColor; GUI.Box (new Rect (r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect) + cellSize - 10, 20, 10), (y * 12 + x + 1).ToString (), slotStyle); } GUI.backgroundColor = defaultColor; return btn; }
bool DrawSlotButton(int x, int y, Rect r, LevelProfile lp) { defaultColor = GUI.backgroundColor; Color color = Color.white; string label = ""; bool btn = false; int block = lp.GetBlock (x, y); int jelly = lp.GetJelly (x, y); int chip = lp.GetChip (x, y); if (!lp.GetSlot(x, y)) color *= 0; else { if (block == 0) { if (chip == 9) { color *= buttonColor; lp.SetPowerup(x, y, 0); } else if (chip > 0) { if (chip > lp.chipCount) lp.SetChip(x, y, -1); color *= chipColor[chip - 1]; } } if (block == 5) { if (chip > 0) { if (chip > lp.chipCount) lp.SetChip(x, y, -1); color *= chipColor[chip - 1]; } } if (block == 0 && chip == -1 && lp.GetPowerup(x, y) == 0) { color *= unpressedColor; } if (block == 0 && lp.GetPowerup(x, y) > 0) { label += (label.Length == 0 ? "" : "\n"); label += powerupLabel[lp.GetPowerup(x, y)]; } if (block > 0 && block <= 3) label += (label.Length == 0 ? "" : "\n") + "B:" + block.ToString(); if (block == 4) label += (label.Length == 0 ? "" : "\n") + "Weed"; if (block == 5) label += (label.Length == 0 ? "" : "\n") + "Brch"; if (jelly > 0 && lp.target == FieldTarget.Jelly) { label += (label.Length == 0 ? "" : "\n"); switch (jelly) { case 1: label += "JS"; break; case 2: label += "JT"; break; } } } GUI.backgroundColor = color; btn = GUI.Button(new Rect(r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect), cellSize, cellSize), label, slotStyle); float cursor = -2; if (lp.GetSlot(x, y) && lp.GetGenerator (x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "G", iconStyle); cursor += 10 + 2; } if (lp.target == FieldTarget.SugarDrop && lp.GetSlot(x, y) && lp.GetSugarDrop(x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), "S", iconStyle); cursor += 10 + 2; } if (lp.GetSlot(x, y)) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, 10, 10), gravityLabel[profile.GetGravity(x, y)], iconStyle); cursor += 10 + 2; } if (lp.GetSlot(x, y) && lp.GetTeleport (x, y) > 0) { GUI.backgroundColor = Color.black; GUI.Box(new Rect(r.xMin + x * (cellSize + slotOffect) + cursor, r.yMin + y * (cellSize + slotOffect) - 2, cellSize - 12, 10), "T:" + lp.GetTeleport (x, y).ToString(), iconStyle); } if (lp.GetSlot (x, y)) { GUI.backgroundColor = transparentColor; GUI.Box (new Rect (r.xMin + x * (cellSize + slotOffect), r.yMin + y * (cellSize + slotOffect) + cellSize - 10, 20, 10), (y * 12 + x + 1).ToString (), slotStyle); } GUI.backgroundColor = defaultColor; return btn; }
public void DrawSlotPreview(Rect r, LevelProfile lp) { int x; int y; GUI.enabled = false; for (x = 0; x < lp.width; x++) for (y = 0; y < lp.height; y++) if (lp.GetSlot(x, y)) DrawSlotButton(x, y, r, lp); GUI.enabled = true; }
public static void DrawWallPreview(Rect r, LevelProfile lp) { int x; int y; GUI.enabled = false; for (x = 0; x < lp.width-1; x++) for (y = 0; y < lp.height; y++) if (lp.GetWallV(x,y) && lp.GetSlot(x,y) && lp.GetSlot(x+1,y)) DrawWallButton(x, y, "V", r, lp); for (x = 0; x < lp.width; x++) for (y = 0; y < lp.height-1; y++) if (lp.GetWallH(x,y) && lp.GetSlot(x,y) && lp.GetSlot(x,y+1)) DrawWallButton(x, y, "H", r, lp); GUI.enabled = true; }