public void visualizedData(List <SetMap> setMaps) { List <IndexOfList2D> emptyToMine = new List <IndexOfList2D>(); List <IndexOfList2D> mineToEmpty = new List <IndexOfList2D>(); foreach (var setMap in setMaps) { List2DInt mineData = Singleton.MainData.mineDatas; if (mineData[setMap.pos] == -1 && setMap.value != -1) { mineToEmpty.Add(setMap.pos); } else if (mineData[setMap.pos] != -1 && setMap.value == -1) { emptyToMine.Add(setMap.pos); } } GameObject gb = GameObject.Find("ChangeMapResult"); if (gb == null) { gb = new GameObject("ChangeMapResult"); } ShowPositions sp = gb.GetComponent <ShowPositions>(); if (sp == null) { sp = gb.AddComponent <ShowPositions>(); } sp.positionsList.Clear(); sp.positionsList.Add(new ShowPositions.PositionProperty(emptyToMine, Color.green)); sp.positionsList.Add(new ShowPositions.PositionProperty(mineToEmpty, Color.red)); return; }
void OnSceneGUI() { if (showPositions == null) { showPositions = target as ShowPositions; } foreach (var positions in showPositions.positionsList) { foreach (var pos in positions.positions) { SingletonForEditor.DrawABeaultifulButton(pos, positions.color, null); } } }
/// <summary> /// This function is called when the MonoBehaviour will be destroyed. /// </summary> public void VisualizedData() { Singleton.DestroyAllChilds(transform); Dictionary <int, GameObject> gbs = new Dictionary <int, GameObject>(); foreach (var key in searchForCa.searchResults.Keys) { GameObject gb = new GameObject(key.ToString()); gb.transform.parent = transform; gbs[key] = gb; } foreach (var keyAndValue in searchForCa.searchResults) { int resultIndex = 0; foreach (var result in keyAndValue.Value) { GameObject valueGb = new GameObject("Result " + resultIndex.ToString()); valueGb.transform.parent = gbs[keyAndValue.Key].transform; ShowPositions sp = valueGb.AddComponent <ShowPositions>(); sp.positionsList.Add(new ShowPositions.PositionProperty(result, Color.green)); resultIndex++; } } }