示例#1
0
    protected void DrawResetButton()
    {
        if (GUILayout.Button(_resetButton, EditorStyles.toolbarButton, _resetButtonWidth))
        {
            IPPickerBase picker = ( IPPickerBase )target;

            if (picker.cycler == null)
            {
                picker.cycler = picker.gameObject.GetComponentInChildren(typeof(IPCycler)) as IPCycler;
            }

            picker.cycler.EditorInit();
            picker.cycler.SendMessageUpwards("RebuildWidgets", SendMessageOptions.DontRequireReceiver);                //sendmessage upwards from cycler in case there are multiple pickers
        }
    }
    void Start()
    {
        if (observedPicker == null)
        {
            observedPicker = gameObject.GetComponent(typeof(IPPickerBase)) as IPPickerBase;
        }

        if (observedPicker == null)
        {
            Debug.LogError("Needs an IPPicker!");
            return;
        }

        _cycler = observedPicker.cycler;
        if (_cycler == null)
        {
            Debug.LogError("No Cycler!");
        }

        SetDelegates();

        if (notifyOnSelectionChange && onSelectionChangeNotification.notifyInStart)
        {
            Notify(onSelectionChangeNotification);
        }

        if (notifyOnSelectionStarted && onStartedNotification.notifyInStart)
        {
            Notify(onStartedNotification);
        }

        if (notifyOnCenterOnChildStarted && onCenterOnChildNotification.notifyInStart)
        {
            Notify(onCenterOnChildNotification);
        }

        if (notifyOnPickerStopped && onStoppedNotification.notifyInStart)
        {
            Notify(onStoppedNotification);
        }

        if (notifyOnDragExit && onExitNotification.notifyInStart)
        {
            Notify(onExitNotification);
        }
    }