Пример #1
0
        private void CustomizeLabel(Rect area, SerializedProperty property, int index)
        {
            var targ = this.serializedObject.targetObject as i_TriggerRandomElimination;

            if (!Application.isPlaying ||
                this.serializedObject.isEditingMultipleObjects ||
                targ == null)
            {
                TriggerPropertyDrawer.DrawDefaultListElementLabel(area, property, index);
            }
            else
            {
                if (targ.TargetHasBeenUsed(index))
                {
                    var r0 = new Rect(area.xMin, area.yMin, Mathf.Min(36f, area.width), EditorGUIUtility.singleLineHeight);
                    var r1 = new Rect(r0.xMax, area.yMin, Mathf.Max(0f, area.width - r0.width), EditorGUIUtility.singleLineHeight);
                    EditorGUI.LabelField(r0, index.ToString("X 00:"));
                    TriggerTargetPropertyDrawer.DrawTriggerActivationTypeDropdown(r1, property, false);
                }
                else
                {
                    TriggerPropertyDrawer.DrawDefaultListElementLabel(area, property, index);
                }
            }
        }
Пример #2
0
        public static void DrawDefaultListElementLabel(Rect area, SerializedProperty property, int index)
        {
            var r0 = new Rect(area.xMin, area.yMin, Mathf.Min(25f, area.width), EditorGUIUtility.singleLineHeight);
            var r1 = new Rect(r0.xMax, area.yMin, Mathf.Max(0f, area.width - r0.width), EditorGUIUtility.singleLineHeight);

            EditorGUI.LabelField(r0, index.ToString("00:"));
            TriggerTargetPropertyDrawer.DrawTriggerActivationTypeDropdown(r1, property, false);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            //Draw ActivationType Popup
            var r0  = new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight);
            var act = TriggerTargetPropertyDrawer.DrawTriggerActivationTypeDropdown(r0, property, true);

            //Draw Advanced
            var area = new Rect(position.xMin, r0.yMax, position.width, position.height - r0.height);

            switch (act)
            {
            case TriggerActivationType.TriggerAllOnTarget:
                this.DrawAdvanced_TriggerAll(area, property);
                break;

            case TriggerActivationType.TriggerSelectedTarget:
                this.DrawAdvanced_TriggerSelected(area, property);
                break;

            case TriggerActivationType.SendMessage:
                this.DrawAdvanced_SendMessage(area, property);
                break;

            case TriggerActivationType.CallMethodOnSelectedTarget:
                this.DrawAdvanced_CallMethodOnSelected(area, property);
                break;

            case TriggerActivationType.EnableTarget:
                this.DrawAdvanced_EnableTarget(area, property);
                break;

            case TriggerActivationType.DestroyTarget:
                this.DrawAdvanced_DestroyTarget(area, property);
                break;
            }

            EditorGUI.EndProperty();
        }