IEnumerator repainter() { if (states == null || states.Length < 8) { states = new int[8]; } for (int i = 0; i < 8; i++) { APCManager.setNote((int)lastColumn - 1, i, 0); int nextColor = 0; if (mono.isActiveAndEnabled) { if (states[i] == 1) { nextColor = (int)availableColor; } else if (states[i] == 2) { nextColor = (int)activeColor; } } APCManager.setNote((int)column - 1, i, nextColor); yield return(null); } lastColumn = column; }
IEnumerator ClearColumn(int clmn) { for (int i = 0; i < 8; i++) { APCManager.setNote(clmn - 1, i, 0); yield return(null); } }
void OnEnable() { if (mappings == null) { mappings = new APCMapping[9]; } instance = this; }/* public static void OnMappingEnable(APCMapping source)
void unmap(int index) { if (mappings[index] == null) { return; } mappings[index].column = APCColumn.None; APCManager.startColummClean((int)lastColumn); }
public void OnValidate(MonoBehaviour source) { if (mappings == null) { mappings = new APCMapping[9]; } if (mono == null) { mono = source; } if (lastColumn != column) { for (int i = 0; i < mappings.Length; i++) { if (mappings[i] == this) { mappings[i] = null; } } if (mappings[(int)column] != null && mappings[(int)column] != this) { unmap((int)column); } mappings[(int)column] = this; APCManager.refreshBottm(); } if (availableColor == APCManager.APCColors.Blank) { availableColor = APCManager.APCColors.Green; } if (activeColor == APCManager.APCColors.Blank) { activeColor = APCManager.APCColors.Orange; } /* for (int i = 0; i < mappings.Length; i++) * { * // s += "// " + i + " - " + (mappings[i] == null ? "#" : mappings[i].mononame); * s += " . " + (mappings[i] == null ? " " : mappings[i].mononame); * * } * Debug.Log(s, mono.gameObject);*/ Repaint(); }