public void UpdateToyButtons(string mytoy, ToyType kind, bool reset) { bool vocal = false; string selected_toy = peripheral.getSelectedToy(); if (current_GUIState.state != GameState.InGame) { //Debug.Log("UpdateToyButtons is in " + current_GUIState.state + ", not in game state!\n"); return; } if (vocal) { Debug.Log("UpdateToyButtons running " + kind + "\n"); } // Debug.Log("Beep\n"); foreach (MyLabel l in current_GUIState.labels) { if (l == null || l.toytype == ToyType.Null) { continue; } if (l.toytype != kind && kind != ToyType.Null) { continue; } if (reset) { l.ResetButton(); } string name = l.content; float cost = 9999; unitStats toy = central.getToy(name); Cost toy_cost = null; if (toy != null) { toy_cost = toy.cost_type; } if (toy_cost != null) { cost = toy_cost.Amount; } if (cost == 9999) { Debug.Log("Getting name " + name + " " + l.gameObject.name + "\n"); return; } switch (canBuildToy(name, toy_cost, toy)) { case StateType.No: if (vocal) { Debug.Log("Turning off toy No " + l.content + "\n"); } l.SetActive(false); break; case StateType.NoResources: if (vocal) { Debug.Log("Turning off toy NoResources " + l.content + "\n"); } l.SetActive(true); ClearInfo(); SetRowButton(l, false, false); if (mytoy.Equals(name)) { Central.Instance.button_selected = null; // is this used??!! } break; case StateType.Yes: if (vocal) { Debug.Log("Turning on toy " + l.content + "\n"); } l.SetActive(true); if (vocal) { Debug.Log("Turning on thing " + selected_toy + " == " + name + "\n"); } if (selected_toy == name) { if (l != null) { l.SetSelected(true, true); } if (l != null) { l.SetInteractable(true); } } else { //if (l != null) l.SetSelected(true, false); if (l != null) { l.SetInteractable(true); } } break; } string[] vars = new string[2]; vars[0] = name; vars[1] = cost.ToString(); StartCoroutine("DoOnPriceUpdate", vars); } }