public void DisableSkill(EffectType type) { SpecialSkill skill = _getSkill(type); if (skill == null) { return; } my_panel.UpdatePanel(); SpecialSkillSaver saver = new SpecialSkillSaver(); saver.type = type; setInventory(saver, false); Noisemaker.Instance.Click(ClickType.Cancel); }
public Temporary(GenericPanel panel, WishType type, float _percent, float _time, string label_name, bool has_label) { percent = _percent; remaining_time = _time; if (has_label) { getLabel(panel); label.content = label_name; label.gameObject.name = label_name; Sprite sp = Resources.Load("GUI/Inventory/" + type.ToString() + "_image", typeof(Sprite)) as Sprite; label.image.sprite = sp; panel.AddLabel(label, true, true); panel.UpdatePanel(); Blink(); } else { Debug.Log("Has no label!\n"); } }
public void UpdatePanel(Island_Button button) { if (button == null && selected_island == null) { return; } if (button != null && selected_island != null && button.gameObject.GetInstanceID() == selected_island.gameObject.GetInstanceID()) { return; } if (button == null) { selected_island = null; selected_island_image.gameObject.SetActive(false); my_panel.gameObject.SetActive(false); return; } //if (selected_island != null && button.gameObject.GetInstanceID() != selected_island.gameObject.GetInstanceID()) ResetSelected(); selected_island = button; bool temp_ok = false; temp_ok = (selected_island.island_type == IslandType.Permanent || (selected_island.island_type == IslandType.Temporary && Monitor.Instance.SetAllowedRange("sensible_city"))); int ok_buttons = 0; EagleEyes.Instance.UpdateToyButtons("blah", ToyType.Normal, true); foreach (MyLabel label in my_panel.list) { if (!label.AmIActive()) { label.SetHidden(true); continue; } unitStats stats = Central.Instance.getToy(label.runetype, label.toytype); if (stats != null) { if (stats.island_type != IslandType.Either && stats.island_type != selected_island.island_type) { label.SetHidden(true); label.ShowButtons(false); continue; } if (stats.island_type == IslandType.Temporary) { if (!temp_ok) { label.SetHidden(true); label.ShowButtons(false); continue; } string ok = selected_island.verify_toy_for_distance(label.content); if (ok.Equals("TOOFAR")) { label.SetHidden(true); label.ShowButtons(false); continue; } } //if (label.button.IsInteractable()){ label.SetHidden(false); label.ShowButtons(true); ok_buttons++; /* * }else{ * label.SetHidden(true); * label.ShowButtons(false); * }*/ } } Vector3 set_to = button.transform.position; if (ok_buttons > 0) { my_panel.transform.position = set_to; my_panel.gameObject.SetActive(true); my_panel.radius = (ok_buttons <= 6) ? 1.2f : (ok_buttons == 7) ? 1.35f : (ok_buttons == 8) ? 1.5f : 1.6f; my_panel.spacing = 2f * Mathf.PI * my_panel.radius / ok_buttons; my_panel.UpdatePanel(); // if (Monitor.Instance != null) Monitor.Instance.my_spyglass.PointSpyglass(button.transform.position,.20f); selected_island_image.gameObject.SetActive(true); selected_island_image.transform.position = set_to; } else { selected_island_image.gameObject.SetActive(false); Noisemaker.Instance.Play("island_too_far"); ShowNoResourcesPopup(set_to); } }
void PlaceButtons(string state, bool bg, List <MenuButton> buttons) { int i = buttons.Count; if (bg) { PlaceElement("mainmenu_bg"); } else { PlaceElement("mainmenu_transparent_bg"); PlaceElement("mainmenu_button_bg"); } #if UNITY_EDITOR PlaceElement("mainmenu_simulator"); #endif foreach (MenuButton b in buttons) { switch (b) { case MenuButton.Start: PlaceElement("mainmenu_play"); i--; break; case MenuButton.Continue: PlaceElement("mainmenu_continue"); i--; break; case MenuButton.LoadSnapshot: switch (Central.Instance.state) { case GameState.InGame: if (Central.Instance.game_saver.getCurrentGame().getSaveState(SaveStateType.MidLevel).isValid()) { PlaceElement("mainmenu_restartwave"); } SaveState goback2 = Central.Instance.game_saver.getCurrentGame().getMidLevelState(SaveWhen.GoBack2); if (goback2 != null && goback2.isValid()) { PlaceElement("mainmenu_goback2waves"); } SaveState goback1 = Central.Instance.game_saver.getCurrentGame().getMidLevelState(SaveWhen.GoBack1); if (goback1 != null && goback1.isValid()) { PlaceElement("mainmenu_goback1wave"); } break; case GameState.MainMenu: PlaceElement("mainmenu_play"); break; default: Debug.Log("Trying to place MenuButton LoadSnapshot during an invalid GameState " + Central.Instance.state + "\n"); break; } i--; break; case MenuButton.LoadStartLevelSnapshot: PlaceElement("mainmenu_restartlevel"); i--; break; case MenuButton.SaveGamePanel: //PlaceElement("mainmenu_savegame_panel"); Central.Instance.game_saver.EnableMe(true); i--; break; case MenuButton.Quit: PlaceElement("mainmenu_quit"); i--; break; case MenuButton.QuitCorner: PlaceElement("mainmenu_quit_corner"); i--; break; case MenuButton.Settings: PlaceElement("mainmenu_sound"); //PlaceElement("mainmenu_settings"); //PlaceElement("mainmenu_settings_panel"); //my_settings_panel.DisablePanel(); i--; break; case MenuButton.Rewards: #if UNITY_EDITOR PlaceElement("mainmenu_rewards"); PlaceElement("mainmenu_rewards_panel"); rewards_scroll_driver.DisableMe(); #endif i--; break; case MenuButton.ToMap: PlaceElement("mainmenu_to_map"); PlaceElement("mainmenu_confirm_to_map"); DisplayConfirmPanel(MenuButton.ToMap, false); i--; break; case MenuButton.ToMainMenu: PlaceElement("mainmenu_to_mainmenu"); i--; break; } } mainMenuPanel.UpdatePanel(); }