Esempio n. 1
0
 public void SetProfile(GaugeTargetProfile value)
 {
     profile = value;
 }
Esempio n. 2
0
 private void MainSectionTargetsContainer(GaugeTarget.Target current, SerializedProperty currentProperty)
 {
     LabelWidth(50);
     if (Asset(ref current.profile, currentProperty.FindPropertyRelative("profile"), name: current.name))
     {
         GaugeTargetProfile profile = current.profile;
         profile.name = current.name;
         profile.overrideMinorTicks = current.overrideMinorTicks;
         if (profile.overrideMinorTicks)
         {
             profile.minorTicks = current.minorTicks;
         }
         profile.overrideMajorTicks = current.overrideMajorTicks;
         if (profile.overrideMajorTicks)
         {
             profile.SetMajorTicksUnlinked(current.majorTicks);
         }
         profile.overrideOverrides = current.overrides.Count != 0;
         if (profile.overrideOverrides)
         {
             profile.SetOverridesUnlinked(current.overrides);
         }
     }
     Subsection("Editor", () => Container("Range Generation", () =>
     {
         OpenHorizontal();
         {
             PropertyContainer1(currentProperty.FindPropertyRelative("from"), group: true, design: 3);
             PropertyContainer1(currentProperty.FindPropertyRelative("to"), group: true, design: 3);
             PropertyContainer1(currentProperty.FindPropertyRelative("count"), group: true, width: 24, design: 3);
         }
         CloseHorizontal();
         OpenHorizontal();
         {
             if (PressButton("Generate", EditorContents.info, "In a standalone build you have to call GenerateRange() on it."))
             {
                 Undo.RecordObject(target, "Inspector");
                 current.GenerateRange(current.from, current.to, current.count, current.integerizeRange);
                 serializedObject.Update();
             }
             GUI.enabled = GUI.enabled && current.majorTicks.Count != 0;
             if (PressButton("Clear"))
             {
                 Undo.RecordObject(target, "Inspector");
                 current.majorTicks.Clear();
                 serializedObject.Update();
             }
             GUI.enabled = true;
         }
         CloseHorizontal();
     }, labelContent: () =>
     {
         FieldWidth(1);
         LabelWidth(2);
         Property(string.Empty, currentProperty.FindPropertyRelative("integerizeRange"));
         FieldWidth();
         LabelWidth();
     }, toggleProperty: currentProperty.FindPropertyRelative("rangeGeneration"), generalState: current.overrideMajorTicks && (!current.profile || current.profile && !current.profile.overrideMajorTicks), design: 4));
     OpenVerticalSubsection();
     {
         GUI.enabled = !current.profile;
         LabelWidth(44);
         Property(currentProperty.FindPropertyRelative("name"));
         GUI.enabled = true;
         LabelWidth(49);
         PropertyContainer1(currentProperty.FindPropertyRelative("gauge"));
         LabelWidth(53);
         Selection(currentProperty.FindPropertyRelative("source"));
         LabelWidth(82);
         PropertyContainer2(currentProperty.FindPropertyRelative("overrideMinorTicks"), currentProperty.FindPropertyRelative("minorTicks"), state: !current.profile || current.profile && !current.profile.overrideMinorTicks);
         LabelWidth();
         Container1(currentProperty.FindPropertyRelative("majorTicks"), current.majorTicks, toggleProperty: currentProperty.FindPropertyRelative("overrideMajorTicks"), @default: current.majorTicks.Count.ToString(), state: !current.profile || current.profile && !current.profile.overrideMajorTicks);
         currentGauge          = current.gauge;
         currentTargetProperty = currentProperty;
         Container2(currentProperty.FindPropertyRelative("overrides"), current.overrides, primary: MainSectionTargetsContainerOverridesContainer, state: !current.profile || current.profile && !current.profile.overrideOverrides);
     }
     CloseVertical();
 }