public virtual void Init() { for (int i = 0; i < drivers.Count; i++) { Sub_Toy_Button_Driver driver = drivers[i]; map[driver.type] = i; if (driver.button_map.Keys.Count > 0) { continue; } foreach (Toy_Button button in driver.buttons) { Button b = button.gameObject.GetComponent <Button>(); if (b != null) { driver.button_map.Add(button, b); if (button.my_button == null || button.my_button.GetInstanceID() != b.GetInstanceID()) { Debug.LogError("MISCONFIG OF MY_BUTTON ON " + button.gameObject.name + "\n"); } } } } Peripheral.onDreamsChanged += onDreamsChanged; }
protected void SetAll(bool s) { // Debug.Log("Set all " + s + "\n"); Sub_Toy_Button_Driver sub = drivers[current_driver]; if (s) { Peripheral.Instance.ChangeTime(TimeScale.Pause); } if (!s && sub.panel.active) { Peripheral.Instance.ChangeTime(TimeScale.Resume); } sub.panel.SetActive(s); if (sub.hero_panel != null && parent != null) { sub.hero_panel.SetActive(parent.toy_type == ToyType.Hero); } //if (s == false){ if (sub.info_panel != null) { sub.info_panel.SetActive(false); } //if (sub.sell_panel != null) sub.sell_panel.SetActive(false); // } if (!s) { setSelectedButton(null); } }
protected bool SetDriver(RuneType type) { if (map.ContainsKey(type)) { if (map[type] != current_driver) { Sub_Toy_Button_Driver sub = drivers[current_driver]; sub.panel.SetActive(false); if (sub.hero_panel != null) { sub.hero_panel.SetActive(false); } if (sub.info_panel != null) { sub.info_panel.SetActive(false); } } current_driver = map[type]; return(true); } return(false); }