private bool Initialize()
        {
            bool result = true;

            try
            {
                _rectTransform = GetComponent <RectTransform>();
                _mainButton    = new DropDownListButton(_rectTransform.Find("MainButton").gameObject);
                _overlayRT     = _rectTransform.Find("Overlay").GetComponent <RectTransform>();
                _overlayRT.gameObject.SetActive(value: false);
                _scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent <RectTransform>();
                _scrollBarRT   = _scrollPanelRT.Find("Scrollbar").GetComponent <RectTransform>();
                _slidingAreaRT = _scrollBarRT.Find("SlidingArea").GetComponent <RectTransform>();
                _itemsPanelRT  = _scrollPanelRT.Find("Items").GetComponent <RectTransform>();
                _canvas        = GetComponentInParent <Canvas>();
                _canvasRT      = _canvas.GetComponent <RectTransform>();
                _scrollRect    = _scrollPanelRT.GetComponent <ScrollRect>();
                _scrollRect.scrollSensitivity = _rectTransform.sizeDelta.y / 2f;
                _scrollRect.movementType      = ScrollRect.MovementType.Clamped;
                _scrollRect.content           = _itemsPanelRT;
                _itemTemplate = _rectTransform.Find("ItemTemplate").gameObject;
                _itemTemplate.SetActive(value: false);
            }
            catch (NullReferenceException exception)
            {
                Debug.LogException(exception);
                Debug.LogError("Something is setup incorrectly with the dropdownlist component causing a Null Reference Exception");
                result = false;
            }
            _panelItems = new List <DropDownListButton>();
            RebuildPanel();
            RedrawPanel();
            return(result);
        }
Exemple #2
0
 static public int get_txt(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.DropDownListButton self = (UnityEngine.UI.Extensions.DropDownListButton)checkSelf(l);
         pushValue(l, self.txt);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
 static public int set_txt(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.DropDownListButton self = (UnityEngine.UI.Extensions.DropDownListButton)checkSelf(l);
         UnityEngine.UI.Text v;
         checkType(l, 2, out v);
         self.txt = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #4
0
        public bool Initialize()
        {
            //if (Application.loadedLevelName.Equals ("AsignaNivel")) {
            //	asignaScript = tempObj.GetComponent<AsignaNivel> ();
            //} else {
            //tempScript = tempObj.GetComponent<InterfazMedico> ();
            //}
            //asignaScript=tempObj.GetComponent<AsignaNivel>();
            bool success = true;

            try
            {
                _rectTransform = GetComponent <RectTransform>();
                _mainButton    = new DropDownListButton(_rectTransform.FindChild("MainButton").gameObject);

                _overlayRT = _rectTransform.FindChild("Overlay").GetComponent <RectTransform>();
                _overlayRT.gameObject.SetActive(false);


                _scrollPanelRT = _overlayRT.FindChild("ScrollPanel").GetComponent <RectTransform>();
                _scrollBarRT   = _scrollPanelRT.FindChild("Scrollbar").GetComponent <RectTransform>();
                _slidingAreaRT = _scrollBarRT.FindChild("SlidingArea").GetComponent <RectTransform>();
                //  scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
                _itemsPanelRT = _scrollPanelRT.FindChild("Items").GetComponent <RectTransform>();
                //itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();

                _canvas   = GetComponentInParent <Canvas>();
                _canvasRT = _canvas.GetComponent <RectTransform>();

                _scrollRect = _scrollPanelRT.GetComponent <ScrollRect>();
                _scrollRect.scrollSensitivity = _rectTransform.sizeDelta.y / 2;
                _scrollRect.movementType      = ScrollRect.MovementType.Clamped;
                _scrollRect.content           = _itemsPanelRT;


                _itemTemplate = _rectTransform.FindChild("ItemTemplate").gameObject;
                _itemTemplate.SetActive(false);
            }
            catch (System.NullReferenceException ex)
            {
                Debug.LogException(ex);
                Debug.LogError("Something is setup incorrectly with the dropdownlist component causing a Null Refernece Exception");
                success = false;
            }

            _panelItems = new List <DropDownListButton>();

            RebuildPanel();
            RedrawPanel();
            return(success);
        }
Exemple #5
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.UI.Extensions.DropDownListButton o;
         UnityEngine.GameObject a1;
         checkType(l, 2, out a1);
         o = new UnityEngine.UI.Extensions.DropDownListButton(a1);
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        private bool Initialize()
        {
            bool success = true;

            try
            {
                _rectTransform = GetComponent <RectTransform>();
                _mainButton    = new DropDownListButton(_rectTransform.Find("MainButton").gameObject);
                _rectTransform.Find("MainButton").gameObject.GetComponent <Button>().onClick.AddListener(() => ToggleDropdownPanel(true));
                _overlayRT = _rectTransform.Find("Overlay").GetComponent <RectTransform>();
                _overlayRT.gameObject.GetComponent <Button>().onClick.AddListener(() => ToggleDropdownPanel(true));
                _overlayRT.gameObject.SetActive(false);


                _scrollPanelRT = _overlayRT.Find("ScrollPanel").GetComponent <RectTransform>();
                _scrollBarRT   = _scrollPanelRT.Find("Scrollbar").GetComponent <RectTransform>();
                _slidingAreaRT = _scrollBarRT.Find("SlidingArea").GetComponent <RectTransform>();
                //  scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
                _itemsPanelRT = _scrollPanelRT.Find("Items").GetComponent <RectTransform>();
                //itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();

                _canvas   = GetComponentInParent <Canvas>();
                _canvasRT = _canvas.GetComponent <RectTransform>();

                _scrollRect = _scrollPanelRT.GetComponent <ScrollRect>();
                _scrollRect.scrollSensitivity = _rectTransform.sizeDelta.y / 2;
                _scrollRect.movementType      = ScrollRect.MovementType.Clamped;
                _scrollRect.content           = _itemsPanelRT;


                _itemTemplate = _rectTransform.Find("ItemTemplate").gameObject;
                _itemTemplate.SetActive(false);
            }
            catch (System.NullReferenceException ex)
            {
                Debug.LogException(ex);
                Debug.LogError("Something is setup incorrectly with the dropdownlist component causing a Null Refernece Exception");
                success = false;
            }

            _panelItems = new List <DropDownListButton>();

            RebuildPanel();
            RedrawPanel();
            return(success);
        }
Exemple #7
0
		private bool Initialize()
		{
			bool success = true;
			try
			{
				_rectTransform = GetComponent<RectTransform>();
				_mainButton = new DropDownListButton(_rectTransform.FindChild("MainButton").gameObject);

				_overlayRT = _rectTransform.FindChild("Overlay").GetComponent<RectTransform>();
				_overlayRT.gameObject.SetActive(false);


				_scrollPanelRT = _overlayRT.FindChild("ScrollPanel").GetComponent<RectTransform>();
				_scrollBarRT = _scrollPanelRT.FindChild("Scrollbar").GetComponent<RectTransform>();
				_slidingAreaRT = _scrollBarRT.FindChild("SlidingArea").GetComponent<RectTransform>();
				//  scrollHandleRT = slidingAreaRT.FindChild("Handle").GetComponent<RectTransform>();
				_itemsPanelRT = _scrollPanelRT.FindChild("Items").GetComponent<RectTransform>();
				//itemPanelLayout = itemsPanelRT.gameObject.GetComponent<LayoutGroup>();

				_canvas = GetComponentInParent<Canvas>();
				_canvasRT = _canvas.GetComponent<RectTransform>();

				_scrollRect = _scrollPanelRT.GetComponent<ScrollRect>();
				_scrollRect.scrollSensitivity = _rectTransform.sizeDelta.y / 2;
				_scrollRect.movementType = ScrollRect.MovementType.Clamped;
				_scrollRect.content = _itemsPanelRT;


				_itemTemplate = _rectTransform.FindChild("ItemTemplate").gameObject;
				_itemTemplate.SetActive(false);
			}
			catch (System.NullReferenceException ex)
			{
				Debug.LogException(ex);
				Debug.LogError("Something is setup incorrectly with the dropdownlist component causing a Null Refernece Exception");
				success = false;
			}

			_panelItems = new List<DropDownListButton>();

			RebuildPanel();
			RedrawPanel();
			return success;
		}