コード例 #1
0
ファイル: AuthorChJoint.cs プロジェクト: sknchan/LegacyRust
    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);
    }
コード例 #2
0
ファイル: AuthorCreation.cs プロジェクト: sknchan/LegacyRust
    protected bool SaveSettings()
    {
        AuthorCreationProject authorCreationProject;
        bool   flag;
        Stream stream = this.GetStream(true, "dat.asc", out authorCreationProject);

        if (stream == null)
        {
            return(false);
        }
        try
        {
            using (JSONStream jSONStream = JSONStream.CreateWriter(stream))
            {
                jSONStream.WriteObjectStart();
                jSONStream.WriteObjectStart("project");
                jSONStream.WriteText("guid", AuthorShared.PathToGUID(AuthorShared.GetAssetPath(authorCreationProject)));
                jSONStream.WriteText("name", authorCreationProject.project);
                jSONStream.WriteText("author", authorCreationProject.authorName);
                jSONStream.WriteText("scene", authorCreationProject.scene);
                jSONStream.WriteText("folder", authorCreationProject.folder);
                jSONStream.WriteObjectEnd();
                jSONStream.WriteProperty("settings");
                this.SaveSettings(jSONStream);
                jSONStream.WriteObjectEnd();
            }
            flag = true;
        }
        finally
        {
            stream.Dispose();
        }
        return(flag);
    }
コード例 #3
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);
    }
コード例 #4
0
ファイル: AuthorChJoint.cs プロジェクト: sknchan/LegacyRust
    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);
    }
コード例 #5
0
ファイル: AuthorChJoint.cs プロジェクト: sknchan/LegacyRust
    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);
    }
コード例 #6
0
ファイル: AuthorChJoint.cs プロジェクト: sknchan/LegacyRust
    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);
    }
コード例 #7
0
ファイル: AuthorPeice.cs プロジェクト: sknchan/LegacyRust
 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);
 }
コード例 #8
0
ファイル: AuthorChHit.cs プロジェクト: sknchan/LegacyRust
    private Collider CreateColliderOn(Transform instanceRoot, Transform root, Transform bone, bool mirrored)
    {
        if (!bone)
        {
            throw new ArgumentException("there was no bone");
        }
        string    str        = AuthorShared.CalculatePath(bone, root);
        Transform transforms = instanceRoot.FindChild(str);

        if (!transforms)
        {
            throw new MissingReferenceException(str);
        }
        switch (this.kind)
        {
        case HitShapeKind.Sphere:
        {
            SphereCollider center = transforms.gameObject.AddComponent <SphereCollider>();
            center.center = this.GetCenter(mirrored);
            center.radius = this.radius;
            break;
        }

        case HitShapeKind.Capsule:
        {
            CapsuleCollider capsuleCollider = transforms.gameObject.AddComponent <CapsuleCollider>();
            capsuleCollider.center    = this.GetCenter(mirrored);
            capsuleCollider.radius    = this.radius;
            capsuleCollider.height    = this.height;
            capsuleCollider.direction = this.capsuleAxis;
            break;
        }

        case HitShapeKind.Line:
        {
            throw new NotSupportedException();
        }

        case HitShapeKind.Box:
        {
            BoxCollider boxCollider = transforms.gameObject.AddComponent <BoxCollider>();
            boxCollider.center = this.GetCenter(mirrored);
            boxCollider.size   = this.size;
            break;
        }

        default:
        {
            throw new NotSupportedException();
        }
        }
        return(transforms.collider);
    }
コード例 #9
0
ファイル: AuthorPeice.cs プロジェクト: sknchan/LegacyRust
 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);
 }
コード例 #10
0
ファイル: AuthorPeice.cs プロジェクト: sknchan/LegacyRust
    public virtual AuthorShared.PeiceAction PeiceListGUI()
    {
        bool flag = (AuthorShared.SelectionContains(this.selectReference) ? true : AuthorShared.SelectionContains(this));

        AuthorShared.PeiceAction peiceAction = AuthorShared.PeiceAction.None;
        AuthorShared.BeginHorizontal(new GUILayoutOption[0]);
        AuthorPeice.ActionButton(this.peiceID, ref peiceAction, flag, AuthorShared.PeiceAction.AddToSelection, AuthorShared.PeiceAction.RemoveFromSelection, AuthorShared.Styles.peiceButtonLeft, new GUILayoutOption[0]);
        AuthorPeice.ActionButton(AuthorShared.Icon.solo, ref peiceAction, flag, AuthorShared.PeiceAction.SelectSolo, AuthorShared.Styles.peiceButtonMid, new GUILayoutOption[] { GUILayout.ExpandWidth(false) });
        Color color = GUI.contentColor;

        GUI.contentColor = Color.red;
        AuthorPeice.ActionButton(AuthorShared.Icon.delete, ref peiceAction, flag, AuthorShared.PeiceAction.Delete, AuthorShared.Styles.peiceButtonRight, new GUILayoutOption[] { GUILayout.ExpandWidth(false) });
        GUI.contentColor = color;
        AuthorShared.EndHorizontal();
        return(peiceAction);
    }
コード例 #11
0
ファイル: AuthorCreation.cs プロジェクト: sknchan/LegacyRust
 internal void UnregisterPeice(AuthorPeice peice)
 {
     if (this.allPeices != null && this.allPeices.IndexOf(peice) != -1)
     {
         this.OnWillUnregisterPeice(peice);
         this.allPeices.Remove(peice);
         if (this.selected != null)
         {
             this.selected.Remove(peice);
         }
         this.OnUnregisteredPeice(peice);
         if (!Application.isPlaying)
         {
             AuthorShared.SetDirty(this);
         }
     }
 }
コード例 #12
0
ファイル: AuthorPeice.cs プロジェクト: Virobeast2/RCLIENT
    public virtual AuthorShared.PeiceAction PeiceListGUI()
    {
        bool isSelected = AuthorShared.SelectionContains(this.selectReference) || AuthorShared.SelectionContains(this);

        AuthorShared.PeiceAction none = AuthorShared.PeiceAction.None;
        AuthorShared.BeginHorizontal(new GUILayoutOption[0]);
        ActionButton(this.peiceID, ref none, isSelected, AuthorShared.PeiceAction.AddToSelection, AuthorShared.PeiceAction.RemoveFromSelection, AuthorShared.Styles.peiceButtonLeft, new GUILayoutOption[0]);
        GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
        ActionButton(AuthorShared.Icon.solo, ref none, isSelected, AuthorShared.PeiceAction.SelectSolo, AuthorShared.Styles.peiceButtonMid, options);
        Color contentColor = GUI.contentColor;

        GUI.contentColor = Color.red;
        GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
        ActionButton(AuthorShared.Icon.delete, ref none, isSelected, AuthorShared.PeiceAction.Delete, AuthorShared.Styles.peiceButtonRight, optionArray2);
        GUI.contentColor = contentColor;
        AuthorShared.EndHorizontal();
        return(none);
    }
コード例 #13
0
ファイル: AuthorPeice.cs プロジェクト: sknchan/LegacyRust
 public virtual void OnListClicked()
 {
     if (AuthorShared.SelectionContains(this.selectReference) || AuthorShared.SelectionContains(this))
     {
     }
 }
コード例 #14
0
ファイル: AuthorPeice.cs プロジェクト: HexHash/LegacyRust
 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;
 }
コード例 #15
0
    public override bool PeiceInspectorGUI()
    {
        bool   flag    = base.PeiceInspectorGUI();
        string peiceID = base.peiceID;

        if (AuthorShared.StringField("Title", ref peiceID, new GUILayoutOption[0]))
        {
            base.peiceID = peiceID;
            flag         = true;
        }
        AuthorShared.EnumField("Kind", this.kind, new GUILayoutOption[0]);
        AuthorShared.PrefixLabel("Self");
        if (GUILayout.Button((GUIContent)AuthorShared.ObjectContent <AuthorChHit>(this.self, typeof(AuthorChHit)), new GUILayoutOption[0]))
        {
            AuthorShared.PingObject(this.self);
        }
        flag |= AuthorShared.PeiceField <AuthorChHit>("Connected", this, ref this.connect, typeof(AuthorChHit), GUI.skin.button, new GUILayoutOption[0]);
        flag |= AuthorShared.Toggle("Reverse Link", ref this.reverseLink, new GUILayoutOption[0]);
        flag |= AuthorShared.Vector3Field("Anchor", ref this.anchor, new GUILayoutOption[0]);
        flag |= AuthorShared.Vector3Field("Axis", ref this.axis, new GUILayoutOption[0]);
        switch (this.kind)
        {
        case Kind.Hinge:
        {
            JointLimits limits = this.limit;
            if (Field("Limits", ref limits, ref this.useLimit, ref this.limitOffset))
            {
                flag       = true;
                this.limit = limits;
            }
            break;
        }

        case Kind.Character:
        {
            flag |= AuthorShared.Vector3Field("Swing Axis", ref this.swingAxis, new GUILayoutOption[0]);
            SoftJointLimit lowTwist = this.lowTwist;
            if (Field("Low Twist", ref lowTwist, ref this.twistOffset))
            {
                flag          = true;
                this.lowTwist = lowTwist;
            }
            lowTwist = this.highTwist;
            if (Field("High Twist", ref lowTwist, ref this.twistOffset))
            {
                flag           = true;
                this.highTwist = lowTwist;
            }
            lowTwist = this.swing1;
            if (Field("Swing 1", ref lowTwist, ref this.swingOffset1))
            {
                flag        = true;
                this.swing1 = lowTwist;
            }
            lowTwist = this.swing2;
            if (Field("Swing 2", ref lowTwist, ref this.swingOffset2))
            {
                flag        = true;
                this.swing2 = lowTwist;
            }
            break;
        }
        }
        flag |= AuthorShared.FloatField("Break Force", ref this.breakForce, new GUILayoutOption[0]);
        return(flag | AuthorShared.FloatField("Break Torque", ref this.breakTorque, new GUILayoutOption[0]));
    }
コード例 #16
0
ファイル: AuthorCreation.cs プロジェクト: sknchan/LegacyRust
 public virtual string RootBonePath(AuthorPeice callingPeice, Transform bone)
 {
     return(AuthorShared.CalculatePath(bone, bone.root));
 }
コード例 #17
0
ファイル: AuthorChHit.cs プロジェクト: sknchan/LegacyRust
    public override bool PeiceInspectorGUI()
    {
        bool   flag = base.PeiceInspectorGUI();
        string str  = base.peiceID;

        if (AuthorShared.StringField("Title", ref str, new GUILayoutOption[0]))
        {
            base.peiceID = str;
            flag         = true;
        }
        bool     flag1    = (!this.mirrored ? false : this.mirrored != this.bone);
        bool     flag2    = this.bone;
        BodyPart bodyPart = this.bodyPart;

        if (AuthorShared.ObjectField <Transform>("Bone", ref this.bone, AuthorShared.ObjectFieldFlags.AllowScene | AuthorShared.ObjectFieldFlags.Model | AuthorShared.ObjectFieldFlags.Instance, new GUILayoutOption[0]))
        {
            if (!flag2)
            {
                this.FigureOutDefaultBodyPart(this.bone, ref bodyPart);
            }
            flag = true;
        }
        BodyPart bodyPart1 = this.mirroredBodyPart;

        if (flag2)
        {
            bodyPart = (BodyPart)AuthorShared.EnumField("Body Part", bodyPart, new GUILayoutOption[0]);
        }
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        flag = flag | AuthorShared.ObjectField <Transform>("Mirrored Bone", ref this.mirrored, AuthorShared.ObjectFieldFlags.AllowScene | AuthorShared.ObjectFieldFlags.Model | AuthorShared.ObjectFieldFlags.Instance, new GUILayoutOption[0]);
        if (flag1)
        {
            bodyPart1 = (BodyPart)AuthorShared.EnumField("Body Part", bodyPart1, new GUILayoutOption[0]);
            AuthorShared.BeginHorizontal(new GUILayoutOption[0]);
            bool flag3 = GUILayout.Toggle(this.mirrorX, "Mirror X", new GUILayoutOption[0]);
            bool flag4 = GUILayout.Toggle(this.mirrorY, "Mirror Y", new GUILayoutOption[0]);
            bool flag5 = GUILayout.Toggle(this.mirrorZ, "Mirror Z", new GUILayoutOption[0]);
            AuthorShared.EndHorizontal();
            if (flag3 != this.mirrorX || flag4 != this.mirrorY || flag5 != this.mirrorZ)
            {
                this.mirrorX = flag3;
                this.mirrorY = flag4;
                this.mirrorZ = flag5;
                flag         = true;
            }
        }
        AuthorShared.EndVertical();
        Vector3 vector3  = this.center;
        float   single   = this.radius;
        float   single1  = this.height;
        Vector3 vector31 = this.size;
        int     num      = this.capsuleAxis;

        AuthorShared.BeginSubSection("Shape", new GUILayoutOption[0]);
        HitShapeKind hitShapeKind = (HitShapeKind)AuthorShared.EnumField("Kind", this.kind, new GUILayoutOption[0]);

        switch (this.kind)
        {
        case HitShapeKind.Sphere:
        {
            vector3 = AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            single  = Mathf.Max(AuthorShared.FloatField("Radius", this.radius, new GUILayoutOption[0]), 0.001f);
            goto case HitShapeKind.Line;
        }

        case HitShapeKind.Capsule:
        {
            vector3 = AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            single  = Mathf.Max(AuthorShared.FloatField("Radius", this.radius, new GUILayoutOption[0]), 0.001f);
            single1 = Mathf.Max(AuthorShared.FloatField("Height", this.height, new GUILayoutOption[0]), 0.001f);
            num     = Mathf.Clamp(AuthorShared.IntField("Height Axis", this.capsuleAxis, new GUILayoutOption[0]), 0, 2);
            goto case HitShapeKind.Line;
        }

        case HitShapeKind.Line:
        {
            AuthorShared.EndSubSection();
            AuthorShared.BeginSubSection("Rigidbody", new GUILayoutOption[0]);
            float single2 = Mathf.Max(AuthorShared.FloatField("Mass", this.mass, new GUILayoutOption[0]), 0.001f);
            float single3 = Mathf.Max(AuthorShared.FloatField("Drag", this.drag, new GUILayoutOption[0]), 0f);
            float single4 = Mathf.Max(AuthorShared.FloatField("Angular Drag", this.angularDrag, new GUILayoutOption[0]), 0f);
            AuthorShared.EndSubSection();
            AuthorShared.BeginSubSection("Hit Box", new GUILayoutOption[0]);
            int   num1    = this.hitPriority;
            float single5 = this.damageMultiplier;
            if (flag1 || flag2)
            {
                num1    = AuthorShared.IntField("Hit Priority", num1, new GUILayoutOption[0]);
                single5 = AuthorShared.FloatField("Damage Mult.", single5, new GUILayoutOption[0]);
            }
            AuthorShared.EndSubSection();
            bool flag6 = GUILayout.Button("Add Joint", new GUILayoutOption[0]);
            if (Event.current.type == EventType.Repaint)
            {
                this.lastPopupRect = GUILayoutUtility.GetLastRect();
            }
            if (flag6)
            {
                AuthorShared.CustomMenu(this.lastPopupRect, AuthorChHit.JointMenu.options, 0, new AuthorShared.CustomMenuProc(AuthorChHit.JointMenu.Callback), this);
            }
            if (hitShapeKind != this.kind || vector3 != this.center || vector31 != this.size || single != this.radius || single1 != this.height || num != this.capsuleAxis || single2 != this.mass || single3 != this.drag || single4 != this.angularDrag || bodyPart != this.bodyPart || bodyPart1 != this.mirroredBodyPart || this.hitPriority != num1 || single5 != this.damageMultiplier)
            {
                flag                  = true;
                this.kind             = hitShapeKind;
                this.center           = vector3;
                this.size             = vector31;
                this.radius           = single;
                this.height           = single1;
                this.capsuleAxis      = num;
                this.mass             = single2;
                this.drag             = single3;
                this.angularDrag      = single4;
                this.bodyPart         = bodyPart;
                this.mirroredBodyPart = bodyPart1;
                this.hitPriority      = num1;
                this.damageMultiplier = single5;
            }
            return(flag);
        }

        case HitShapeKind.Box:
        {
            vector3  = AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            vector31 = AuthorShared.Vector3Field("Size", this.size, new GUILayoutOption[0]);
            goto case HitShapeKind.Line;
        }

        default:
        {
            goto case HitShapeKind.Line;
        }
        }
    }
コード例 #18
0
ファイル: AuthorChJoint.cs プロジェクト: sknchan/LegacyRust
 internal void InitializeFromOwner(AuthorChHit self, AuthorChJoint.Kind kind)
 {
     this.self = self;
     this.kind = kind;
     AuthorShared.SetDirty(this);
 }
コード例 #19
0
ファイル: AuthorChJoint.cs プロジェクト: sknchan/LegacyRust
    public override bool PeiceInspectorGUI()
    {
        bool   flag = base.PeiceInspectorGUI();
        string str  = base.peiceID;

        if (AuthorShared.StringField("Title", ref str, new GUILayoutOption[0]))
        {
            base.peiceID = str;
            flag         = true;
        }
        AuthorShared.EnumField("Kind", this.kind, new GUILayoutOption[0]);
        AuthorShared.PrefixLabel("Self");
        if (GUILayout.Button(AuthorShared.ObjectContent <AuthorChHit>(this.self, typeof(AuthorChHit)), new GUILayoutOption[0]))
        {
            AuthorShared.PingObject(this.self);
        }
        flag = flag | AuthorShared.PeiceField <AuthorChHit>("Connected", this, ref this.connect, typeof(AuthorChHit), GUI.skin.button, new GUILayoutOption[0]);
        flag = flag | AuthorShared.Toggle("Reverse Link", ref this.reverseLink, new GUILayoutOption[0]);
        flag = flag | AuthorShared.Vector3Field("Anchor", ref this.anchor, new GUILayoutOption[0]);
        flag = flag | AuthorShared.Vector3Field("Axis", ref this.axis, new GUILayoutOption[0]);
        AuthorChJoint.Kind kind = this.kind;
        if (kind == AuthorChJoint.Kind.Hinge)
        {
            JointLimits jointLimit = this.limit;
            if (AuthorChJoint.Field("Limits", ref jointLimit, ref this.useLimit, ref this.limitOffset))
            {
                flag       = true;
                this.limit = jointLimit;
            }
        }
        else if (kind == AuthorChJoint.Kind.Character)
        {
            flag = flag | AuthorShared.Vector3Field("Swing Axis", ref this.swingAxis, new GUILayoutOption[0]);
            SoftJointLimit softJointLimit = this.lowTwist;
            if (AuthorChJoint.Field("Low Twist", ref softJointLimit, ref this.twistOffset))
            {
                flag          = true;
                this.lowTwist = softJointLimit;
            }
            softJointLimit = this.highTwist;
            if (AuthorChJoint.Field("High Twist", ref softJointLimit, ref this.twistOffset))
            {
                flag           = true;
                this.highTwist = softJointLimit;
            }
            softJointLimit = this.swing1;
            if (AuthorChJoint.Field("Swing 1", ref softJointLimit, ref this.swingOffset1))
            {
                flag        = true;
                this.swing1 = softJointLimit;
            }
            softJointLimit = this.swing2;
            if (AuthorChJoint.Field("Swing 2", ref softJointLimit, ref this.swingOffset2))
            {
                flag        = true;
                this.swing2 = softJointLimit;
            }
        }
        flag = flag | AuthorShared.FloatField("Break Force", ref this.breakForce, new GUILayoutOption[0]);
        flag = flag | AuthorShared.FloatField("Break Torque", ref this.breakTorque, new GUILayoutOption[0]);
        return(flag);
    }
コード例 #20
0
ファイル: AuthorCreation.cs プロジェクト: sknchan/LegacyRust
    public virtual void ExecuteCommand(AuthorShared.PeiceCommand cmd)
    {
        UnityEngine.Debug.Log(cmd.action, cmd.peice);
        switch (cmd.action)
        {
        case AuthorShared.PeiceAction.AddToSelection:
        {
            UnityEngine.Object   obj = cmd.peice.selectReference;
            UnityEngine.Object[] allSelectedObjects = AuthorShared.GetAllSelectedObjects();
            Array.Resize <UnityEngine.Object>(ref allSelectedObjects, (int)allSelectedObjects.Length + 1);
            allSelectedObjects[(int)allSelectedObjects.Length - 1] = obj;
            AuthorShared.SetAllSelectedObjects(allSelectedObjects);
            break;
        }

        case AuthorShared.PeiceAction.RemoveFromSelection:
        {
            UnityEngine.Object   obj1     = cmd.peice.selectReference;
            UnityEngine.Object[] objArray = AuthorShared.GetAllSelectedObjects();
            int num = 0;
            for (int i = 0; i < (int)objArray.Length; i++)
            {
                if (objArray[i] != obj1 && objArray[i] != cmd.peice)
                {
                    int num1 = num;
                    num            = num1 + 1;
                    objArray[num1] = objArray[i];
                }
            }
            if (num < (int)objArray.Length)
            {
                Array.Resize <UnityEngine.Object>(ref objArray, num);
                AuthorShared.SetAllSelectedObjects(objArray);
            }
            break;
        }

        case AuthorShared.PeiceAction.SelectSolo:
        {
            AuthorShared.SetAllSelectedObjects(new UnityEngine.Object[] { cmd.peice.selectReference });
            break;
        }

        case AuthorShared.PeiceAction.Delete:
        {
            bool?nullable = AuthorShared.Ask(string.Concat(new object[] { "You want to delete ", cmd.peice.peiceID, "? (", cmd.peice, ")" }));
            if ((!nullable.HasValue ? false : nullable.Value))
            {
                cmd.peice.Delete();
            }
            break;
        }

        case AuthorShared.PeiceAction.Dirty:
        {
            AuthorShared.SetDirty(cmd.peice);
            break;
        }

        case AuthorShared.PeiceAction.Ping:
        {
            AuthorShared.PingObject(cmd.peice);
            break;
        }
        }
    }