public void showWindow(WindowsTypes valueType, GameObject value) { if (currentWindowType == valueType) { return; } GameObject currentWindow = null; windowsDict.TryGetValue(valueType, out currentWindow); if (currentWindow == null) { return; } currentWindowType = valueType; GameObject currentGameObject = value; currentWindow.SetActive(true); Vector3 itemPosition = value.transform.position; Vector2 screenPosition = RectTransformUtility.WorldToScreenPoint(Camera.main, itemPosition); screenPosition.y += 150; currentWindow.transform.position = screenPosition; //switch for current Script UpgradeMenuScript upgradeMenuScript = currentWindow.GetComponent <UpgradeMenuScript>(); upgradeMenuScript.setData(currentGameObject); }
/// <summary> /// Jeżeli chcesz edytowac bieżące pytanie /// </summary> /// <param name="windowType"></param> /// <param name="testId"></param> /// <param name="questionId"></param> public AddEditQuestionVM(WindowsTypes windowType, int testId, int questionId) { previousWindowType = windowType; TestId = testId; QuestionId = questionId; prepare(); SelectedQuestion = repo.GetQuestionById(QuestionId.Value); }
public void hideWindow(WindowsTypes valueType) { GameObject currentWindow = null; windowsDict.TryGetValue(valueType, out currentWindow); if (currentWindow == null) { return; } currentWindow.SetActive(false); if (currentWindowType == valueType) { currentWindowType = WindowsTypes.EMPTY; } }
/// <summary> /// Jeżeli dodajesz całkiem nowe pytanie /// </summary> /// <param name="windowType"></param> /// <param name="testId"></param> public AddEditQuestionVM(WindowsTypes windowType, int testId) { previousWindowType = windowType; TestId = testId; prepare(); }
void Start() { setDict(); currentWindowType = WindowsTypes.EMPTY; upgradeMenu.SetActive(false); }