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); }
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); }
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; } } }
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])); }