Ejemplo n.º 1
0
    private static bool Field(AuthorShared.Content content, ref JointSpring spring, ref bool use)
    {
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        AuthorShared.PrefixLabel(content);
        bool flag  = use;
        bool flag1 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0]));

        if (flag)
        {
            float single  = spring.spring;
            float single1 = spring.targetPosition;
            float single2 = spring.damper;
            flag1 = flag1 | AuthorShared.FloatField("Spring Force", ref single, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.FloatField("Target Position", ref single1, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.FloatField("Damper", ref single2, new GUILayoutOption[0]);
            if (use && flag1)
            {
                spring.spring         = single;
                spring.targetPosition = single1;
                spring.damper         = single2;
            }
        }
        AuthorShared.EndVertical();
        return(flag1);
    }
Ejemplo n.º 2
0
    private static bool Field(AuthorShared.Content content, ref SoftJointLimit limits, ref float offset)
    {
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        AuthorShared.PrefixLabel(content);
        float single  = limits.limit;
        float single1 = limits.spring;
        float single2 = limits.damper;
        float single3 = limits.bounciness;
        bool  flag    = AuthorShared.FloatField("Limit", ref single, new GUILayoutOption[0]);

        flag = flag | AuthorShared.FloatField("Spring", ref single1, new GUILayoutOption[0]);
        flag = flag | AuthorShared.FloatField("Damper", ref single2, new GUILayoutOption[0]);
        flag = flag | AuthorShared.FloatField("Bounciness", ref single3, new GUILayoutOption[0]);
        if (flag)
        {
            limits.limit      = single;
            limits.spring     = single1;
            limits.damper     = single2;
            limits.bounciness = single3;
        }
        Color color = GUI.contentColor;

        GUI.contentColor = color * new Color(1f, 1f, 1f, 0.3f);
        flag             = flag | AuthorShared.FloatField("Offset(visual only)", ref offset, new GUILayoutOption[0]);
        GUI.contentColor = color;
        AuthorShared.EndVertical();
        return(flag);
    }
Ejemplo n.º 3
0
    private static bool Field(AuthorShared.Content content, ref JointMotor motor, ref bool use)
    {
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        AuthorShared.PrefixLabel(content);
        bool flag  = use;
        bool flag1 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0]));

        if (flag)
        {
            float single  = motor.force;
            float single1 = motor.targetVelocity;
            bool  flag2   = motor.freeSpin;
            flag1 = flag1 | AuthorShared.FloatField("Force", ref single, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.FloatField("Target Velocity", ref single1, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.Change(ref flag2, GUILayout.Toggle(flag2, "Free Spin", new GUILayoutOption[0]));
            if (use && flag1)
            {
                motor.force          = single;
                motor.targetVelocity = single1;
                motor.freeSpin       = flag2;
            }
        }
        AuthorShared.EndVertical();
        return(flag1);
    }
Ejemplo n.º 4
0
    private static bool Field(AuthorShared.Content content, ref JointLimits limits, ref bool use, ref float offset)
    {
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        AuthorShared.PrefixLabel(content);
        bool flag  = use;
        bool flag1 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0]));

        if (flag)
        {
            float single  = limits.min;
            float single1 = limits.max;
            float single2 = limits.minBounce;
            float single3 = limits.maxBounce;
            flag1 = flag1 | AuthorShared.FloatField("Min", ref single, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.FloatField("Max", ref single1, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.FloatField("Min bounciness", ref single2, new GUILayoutOption[0]);
            flag1 = flag1 | AuthorShared.FloatField("Max bounciness", ref single3, new GUILayoutOption[0]);
            if (use && flag1)
            {
                limits.min       = single;
                limits.max       = single1;
                limits.minBounce = single2;
                limits.maxBounce = single3;
            }
            Color color = GUI.contentColor;
            GUI.contentColor = color * new Color(1f, 1f, 1f, 0.3f);
            flag1            = flag1 | AuthorShared.FloatField("Offset(visual only)", ref offset, new GUILayoutOption[0]);
            GUI.contentColor = color;
        }
        AuthorShared.EndVertical();
        return(flag1);
    }
Ejemplo n.º 5
0
    private static bool Field(AuthorShared.Content content, ref JointSpring spring, ref bool use)
    {
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        AuthorShared.PrefixLabel(content);
        bool flag  = use;
        bool flag2 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0]));

        if (flag)
        {
            float num            = spring.spring;
            float targetPosition = spring.targetPosition;
            float damper         = spring.damper;
            flag2 |= AuthorShared.FloatField("Spring Force", ref num, new GUILayoutOption[0]);
            flag2 |= AuthorShared.FloatField("Target Position", ref targetPosition, new GUILayoutOption[0]);
            flag2 |= AuthorShared.FloatField("Damper", ref damper, new GUILayoutOption[0]);
            if (use && flag2)
            {
                spring.spring         = num;
                spring.targetPosition = targetPosition;
                spring.damper         = damper;
            }
        }
        AuthorShared.EndVertical();
        return(flag2);
    }
Ejemplo n.º 6
0
 protected static bool ActionButton(AuthorShared.Content content, ref AuthorShared.PeiceAction act, bool isSelected, AuthorShared.PeiceAction action, GUIStyle style, params GUILayoutOption[] options)
 {
     if (AuthorShared.Toggle(content, isSelected, style, options) == isSelected)
     {
         return(false);
     }
     act = action;
     return(true);
 }
Ejemplo n.º 7
0
 public virtual bool PeiceInspectorGUI()
 {
     AuthorShared.BeginHorizontal(AuthorShared.Styles.gradientInlineFill, new GUILayoutOption[0]);
     GUILayout.Space(48f);
     AuthorShared.Content content = AuthorShared.ObjectContent <Transform>(base.transform, typeof(Transform));
     if (GUILayout.Button(content.image, new GUILayoutOption[] { GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false) }))
     {
         AuthorShared.PingObject(this);
     }
     GUILayout.Space(10f);
     GUILayout.Label(this.peiceID, AuthorShared.Styles.boldLabel, new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     AuthorShared.EndHorizontal();
     return(false);
 }