示例#1
0
        public void OnClick()
        {
            if (_popup == null)
            {
                _popup = ColorPickerPopup.Instance;
                //if still null, that means that this is the first time a Color Picker has been clicked this scene
                //which means we need to create one and assign the static instance!
                if (_popup == null)
                {
                    var newObj = Instantiate(Resources.Load("ColorPickerPopup")) as GameObject;
                    _popup = newObj.GetComponent <ColorPickerPopup>();
                    ColorPickerPopup.CreateInstance();
                }
            }

            if (_popup.Target == this)
            {
                _popup.CloseWindow();
            }
            else if (_popup.Target == null)
            {
                _popup.Initialize(this);
            }
            else
            {
                _popup.CloseWindow();
                _popup.Initialize(this);
            }
        }
示例#2
0
 public static void CreateInstance()
 {
     _instance = FindObjectOfType <ColorPickerPopup>();
 }