public override void RenderInspectorGui(ParkitectObj parkitectObj) { Category = EditorGUILayout.TextField("Category: ", Category); SubCategory = EditorGUILayout.TextField("Sub-Category: ", SubCategory); base.RenderInspectorGui(parkitectObj); }
public override void RenderSceneGui(ParkitectObj parkitectObj) { //Debug.Log (parkitectObj.Prefab.transform.GetInstanceID ()); //Debug.Log (parkitectObj.getGameObjectRef(true).transform.GetInstanceID ()); List <GameObject> seats = new List <GameObject>(); Utility.FindAllChildrenWithName(parkitectObj.GetGameObjectRef(true).transform, SEAT, seats); Handles.color = Color.white; Handles.zTest = CompareFunction.LessEqual; for (int x = 0; x < seats.Count; x++) { if (seats [x] != null) { var transform = seats [x].transform; Handles.SphereCap(200, transform.position, transform.rotation, 0.05f); Vector3 vector = transform.position - transform.up * 0.02f + transform.forward * 0.078f - transform.right * 0.045f; Handles.SphereCap(201, vector, transform.rotation, 0.03f); Vector3 vector2 = transform.position - transform.up * 0.02f + transform.forward * 0.078f + transform.right * 0.045f; Handles.SphereCap(202, vector2, transform.rotation, 0.03f); Vector3 center = transform.position + transform.up * 0.305f + transform.forward * 0.03f; Handles.SphereCap(203, center, transform.rotation, 0.1f); Vector3 center2 = vector + transform.forward * 0.015f - transform.up * 0.07f; Handles.SphereCap(204, center2, transform.rotation, 0.02f); Vector3 center3 = vector2 + transform.forward * 0.015f - transform.up * 0.07f; Handles.SphereCap(205, center3, transform.rotation, 0.02f); } } base.RenderSceneGui(parkitectObj); }
public override void RenderInspectorGui(ParkitectObj parkitectObj) { //ModManager.asset.Shader = (ParkitectObject.Shaders)EditorGUILayout.EnumPopup("Shader", ModManager.asset.Shader); IsRecolorable = EditorGUILayout.BeginToggleGroup("Recolorable", IsRecolorable); if (IsRecolorable) { GUILayout.BeginVertical(); try { ColorCount = Mathf.RoundToInt(EditorGUILayout.Slider("Color Count: ", ColorCount, 1, 4)); for (int x = 0; x < ColorCount; x++) { Colors[x] = EditorGUILayout.ColorField("Color " + x, Colors[x]); } } catch (Exception) { } GUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); base.RenderInspectorGui(parkitectObj); }
public void Deserialize(Dictionary <String, object> entries) { if (entries.ContainsKey("ModName")) { ModName = (string)entries["ModName"]; } if (entries.ContainsKey("Description")) { Description = (string)entries["Description"]; } Debug.Log("Loading Mod: " + ModName); foreach (var e in (List <object>)entries["ParkitectObjects"]) { Dictionary <string, object> entry = e as Dictionary <string, object>; Type type = ParkitectObj.FindByParkitectObjectByTag((string)entry["Tag"]); if (type == null) { Debug.Log("Can't Find ParkitectObject For Tag: " + entry["Tag"]); } else { ParkitectObj o = (ParkitectObj)CreateInstance(type); o.DeSerialize(entry); ParkitectObjs.Add(o); } } }
public override void RenderInspectorGui(ParkitectObj parkitectObj) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Create 1 Seats")) { GameObject seat1 = new GameObject(SEAT); seat1.transform.parent = parkitectObj.GetGameObjectRef(true).transform; seat1.transform.localPosition = new Vector3(0, 0.1f, 0); seat1.transform.localRotation = Quaternion.Euler(Vector3.zero); } if (GUILayout.Button("Create 2 Seat")) { GameObject seat1 = new GameObject(SEAT); GameObject seat2 = new GameObject(SEAT); seat1.transform.parent = parkitectObj.GetGameObjectRef(true).transform; seat2.transform.parent = parkitectObj.GetGameObjectRef(true).transform; seat1.transform.localPosition = new Vector3(0.1f, 0.1f, 0); seat1.transform.localRotation = Quaternion.Euler(Vector3.zero); seat2.transform.localPosition = new Vector3(-0.1f, 0.1f, 0); seat2.transform.localRotation = Quaternion.Euler(Vector3.zero); } GUILayout.EndHorizontal(); base.RenderInspectorGui(parkitectObj); }
public override void Decorate(GameObject go, GameObject hider, ParkitectObj parkitectObj, AssetBundle bundle) { BuildableObject component = go.GetComponent <BuildableObject>(); component.price = Price; component.setDisplayName(InGameName); }
public override Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { return(new Dictionary <string, object> { { "Category", Category }, { "SubCategory", SubCategory } }); }
public override Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { return(new Dictionary <string, object> { { "InGameName", InGameName }, { "Price", Price } }); }
public override void RenderInspectorGui(ParkitectObj parkitectObj) { Grid = EditorGUILayout.Toggle("GridSnap: ", Grid); SnapCenter = EditorGUILayout.Toggle("SnapCenter: ", SnapCenter); HeightDelta = Mathf.RoundToInt(EditorGUILayout.Slider("Height delta: ", HeightDelta, 0.05f, 1) * 200f) / 200f; GridSubdivision = Mathf.RoundToInt(EditorGUILayout.Slider("Grid subdivision: ", GridSubdivision, 1, 9)); base.RenderInspectorGui(parkitectObj); }
public override Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { return(new Dictionary <string, object> { { "SnapCenter", SnapCenter }, { "Snap", Snap }, { "Grid", Grid }, { "HeightDelta", HeightDelta }, { "GridSubdivisons", GridSubdivision } }); }
public void Load(ParkitectObj parkitectObj) { decorators = parkitectObj.decorators; Prefab = parkitectObj.Prefab; Key = parkitectObj.Key; for (int x = 0; x < decorators.Count; x++) { decorators[x].Load(this); } }
public override void RenderInspectorGui(ParkitectObj parkitectObj) { Event e = Event.current; scrollPos2 = EditorGUILayout.BeginScrollView(scrollPos2, "GroupBox", GUILayout.Height(100)); for (int i = 0; i < BoundingBoxes.Count; i++) { Color gui = GUI.color; if (BoundingBoxes[i] == selected) { GUI.color = Color.red; } if (GUILayout.Button("BoudingBox" + (i + 1))) { if (e.button == 1) { BoundingBoxes.RemoveAt(i); return; } if (selected == BoundingBoxes[i]) { selected = null; return; } selected = BoundingBoxes[i]; } GUI.color = gui; } EditorGUILayout.EndScrollView(); if (GUILayout.Button("Add BoudingBox")) { BoundingBoxes.Add(new SPBoundingBox()); } string caption = "Enable Editing"; if (enableEditing) { caption = "Disable Editing"; } if (GUILayout.Button(caption)) { enableEditing = !enableEditing; } if (enableEditing) { GUILayout.Label("Hold S - Snap to 0.25"); } base.RenderInspectorGui(parkitectObj); }
public override void Decorate(GameObject go, GameObject hider, ParkitectObj parkitectObj, AssetBundle bundle) { if (IsRecolorable) { CustomColors customColors = go.AddComponent <CustomColors>(); List <Color> final = new List <Color>(); for (int x = 0; x < ColorCount; x++) { final.Add(Colors[x]); } customColors.setColors(final.ToArray()); } }
public override Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { List <object> boxes = new List <object> (); foreach (var b in BoundingBoxes) { boxes.Add(b.Serialize()); } return(new Dictionary <string, object> { { "BoundingBoxes", boxes } }); }
public override void Decorate(GameObject go, GameObject hider, ParkitectObj parkitectObj, AssetBundle bundle) { BuildableObject buildableObject = go.GetComponent <BuildableObject>(); if (!String.IsNullOrEmpty(SubCategory)) { buildableObject.categoryTag = Category + "/" + SubCategory; } else { buildableObject.categoryTag = Category; } }
public override Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { List <object> wp = new List <object>(); for (int i = 0; i < Waypoints.Count; i++) { wp.Add(Waypoints[i].Serialize()); } return(new Dictionary <string, object>() { { "Waypoints", wp } }); }
public override Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { List <object> c = new List <object>(); for (int x = 0; x < ColorCount; x++) { c.Add(Utility.SerializeColor(Colors[x])); } return(new Dictionary <string, object> { { "Colors", c }, { "IsRecolorable", IsRecolorable } }); }
private void drawBox(ParkitectObj parkitectObj) { foreach (SPBoundingBox box in BoundingBoxes) { Vector3 diff = box.Bounds.max - box.Bounds.min; Vector3 diffX = new Vector3(diff.x, 0, 0); Vector3 diffY = new Vector3(0, diff.y, 0); Vector3 diffZ = new Vector3(0, 0, diff.z); Color fill = Color.white; fill.a = 0.025f; Color outer = Color.gray; if (enableEditing && box == selected) { fill = Color.magenta; fill.a = 0.1f; outer = Color.black; } // left drawPlane(box.Bounds.min, box.Bounds.min + diffZ, box.Bounds.min + diffZ + diffY, box.Bounds.min + diffY, fill, outer, parkitectObj); //back drawPlane(box.Bounds.min, box.Bounds.min + diffX, box.Bounds.min + diffX + diffY, box.Bounds.min + diffY, fill, outer, parkitectObj); //right drawPlane(box.Bounds.max, box.Bounds.max - diffY, box.Bounds.max - diffY - diffZ, box.Bounds.max - diffZ, fill, outer, parkitectObj); //forward drawPlane(box.Bounds.max, box.Bounds.max - diffY, box.Bounds.max - diffY - diffX, box.Bounds.max - diffX, fill, outer, parkitectObj); //up drawPlane(box.Bounds.max, box.Bounds.max - diffX, box.Bounds.max - diffX - diffZ, box.Bounds.max - diffZ, fill, outer, parkitectObj); //down drawPlane(box.Bounds.min, box.Bounds.min + diffX, box.Bounds.min + diffX + diffZ, box.Bounds.min + diffZ, fill, outer, parkitectObj); if (enableEditing && box == selected) { box.Bounds.min = handleModifyValue(box.Bounds.min, parkitectObj.Prefab.transform.InverseTransformPoint(Handles.PositionHandle(parkitectObj.Prefab.transform.TransformPoint(box.Bounds.min), Quaternion.LookRotation(Vector3.left, Vector3.down)))); box.Bounds.max = handleModifyValue(box.Bounds.max, parkitectObj.Prefab.transform.InverseTransformPoint(Handles.PositionHandle(parkitectObj.Prefab.transform.TransformPoint(box.Bounds.max), Quaternion.LookRotation(Vector3.forward)))); Handles.Label(parkitectObj.Prefab.transform.position + box.Bounds.min, box.Bounds.min.ToString("F2")); Handles.Label(parkitectObj.Prefab.transform.position + box.Bounds.max, box.Bounds.max.ToString("F2")); } } }
public override void Decorate(GameObject go, GameObject hider, ParkitectObj parkitectObj, AssetBundle bundle) { Waypoints w = go.AddComponent <Waypoints>(); foreach (var t in Waypoints) { Waypoint waypoint = new Waypoint { connectedTo = t.connectedTo, isOuter = t.isOuter, isRabbitHoleGoal = t.isRabbitHoleGoal, localPosition = t.localPosition }; Debug.Log("added waypoint" + t.localPosition); w.waypoints.Add(waypoint); } }
public Dictionary <string, object> Serialize() { var payload = new Dictionary <string, object>(); List <Dictionary <string, object> > items = new List <Dictionary <string, object> >(); foreach (var t in ParkitectObjs) { Dictionary <string, object> e = t.Serialize(); e.Add("Tag", ParkitectObj.GetTagFromParkitectObject(t.GetType())); items.Add(e); } payload.Add("ParkitectObjects", items); payload.Add("ModName", ModName); payload.Add("Description", Description); return(payload); }
public override void RenderSceneGui(ParkitectObj parkitectObj) { GameObject gameObject = parkitectObj.GetGameObjectRef(false); if (gameObject) { var min = SnapCenter ? -2.5f : -3f; var max = SnapCenter ? 2.5f : 3f; for (float x = min; x <= max; x += 1 / GridSubdivision) { Handles.DrawLine(gameObject.transform.position + new Vector3(x, 0, min), gameObject.transform.position + new Vector3(x, 0, max)); } for (float z = min; z <= max; z += 1 / GridSubdivision) { Handles.DrawLine(gameObject.transform.position + new Vector3(min, 0, z), gameObject.transform.position + new Vector3(max, 0, z)); } } base.RenderSceneGui(parkitectObj); }
public override void RenderSceneGui(ParkitectObj parkitectObj) { drawBox(parkitectObj); if (!enableEditing) { return; } // EditorUtility.SetDirty(PMM); Tools.current = Tool.None; int controlID = GUIUtility.GetControlID(GetHashCode(), FocusType.Passive); switch (Event.current.type) { case EventType.Layout: HandleUtility.AddDefaultControl(controlID); break; case EventType.KeyDown: if (Event.current.keyCode == KeyCode.S) { snap = true; } break; case EventType.KeyUp: if (Event.current.keyCode == KeyCode.S) { snap = false; } break; } base.RenderInspectorGui(parkitectObj); }
public virtual Dictionary <string, object> Serialize(ParkitectObj parkitectObj) { return(null); }
public override void Load(ParkitectObj parkitectObj) { base.Load(parkitectObj); }
public override void RenderInspectorGui(ParkitectObj parkitectObj) { InGameName = EditorGUILayout.TextField("In Game name: ", InGameName); Price = EditorGUILayout.FloatField("Price: ", Price); base.RenderInspectorGui(parkitectObj); }
public override void RenderInspectorGui(ParkitectObj parkitectObj) { GameObject sceneTransform = parkitectObj.GetGameObjectRef(false); if (sceneTransform == null) { return; } //FlatrideDecorator flatRideDecorator = parkitectObj.GetDecorator (typeof(FlatrideDecorator)); string caption = "Enable Editing Waypoints"; if (EnableEditing) { caption = "Disable Editing Waypoints"; } if (EnableEditing) { GUI.color = Color.green; } bool currentEnableEditing = EnableEditing; if (GUILayout.Button(caption)) { SelectedWaypoint = null; EnableEditing = !EnableEditing; } if (EnableEditing) { GUI.color = Color.white; } if (currentEnableEditing != EnableEditing) { if (EnableEditing) { currentTool = Tools.current; Tools.current = Tool.None; } else { Tools.current = currentTool; } } if (EnableEditing) { GUILayout.Label("S - Snap to axis of connected waypoints"); HelperPlaneY = EditorGUILayout.FloatField("Helper Plane Y", HelperPlaneY); if (GUILayout.Button("Add Waypoint")) { addWaypoint(sceneTransform.transform); } if (GUILayout.Button("Rotate 90°")) { rotateWaypoints(sceneTransform.transform); } if (GUILayout.Button("Clear all")) { Waypoints.Clear(); } } base.RenderInspectorGui(parkitectObj); }
public override void RenderSceneGui(ParkitectObj parkitectObj) { GameObject sceneTransform = parkitectObj.GetGameObjectRef(false); if (sceneTransform == null) { return; } GUIStyle labelStyle = new GUIStyle(); labelStyle.normal.textColor = Color.black; if (EnableEditing) { switch (Event.current.type) { case EventType.Layout: break; case EventType.KeyDown: if (Event.current.keyCode == KeyCode.S) { Snap = true; } break; case EventType.KeyUp: if (Event.current.keyCode == KeyCode.C) { if (_state != State.CONNECT) { _state = State.CONNECT; } else { _state = State.NONE; } } else if (Event.current.keyCode == KeyCode.R) { removeSelectedWaypoint(); } /*else if (Event.current.keyCode == KeyCode.A) * { * addWaypoint(sceneTransform.transform); * }*/ else if (Event.current.keyCode == KeyCode.O && SelectedWaypoint != null) { SelectedWaypoint.isOuter = !SelectedWaypoint.isOuter; } else if (Event.current.keyCode == KeyCode.I && SelectedWaypoint != null) { SelectedWaypoint.isRabbitHoleGoal = !SelectedWaypoint.isRabbitHoleGoal; } else if (Event.current.keyCode == KeyCode.S) { Snap = false; } SceneView.RepaintAll(); HandleUtility.Repaint(); break; } } int i = 0; foreach (SPWaypoint waypoint in Waypoints) { if (waypoint == SelectedWaypoint) { Handles.color = Color.red; } else if (waypoint.isOuter) { Handles.color = Color.green; } else if (waypoint.isRabbitHoleGoal) { Handles.color = Color.blue; } else { Handles.color = Color.yellow; } Vector3 worldPos = waypoint.localPosition + sceneTransform.transform.position; Handles.zTest = CompareFunction.LessEqual; if (Handles.Button(worldPos, Quaternion.identity, HandleUtility.GetHandleSize(worldPos) * 0.2f, HandleUtility.GetHandleSize(worldPos) * 0.2f, Handles.SphereCap)) { if (EnableEditing) { handleClick(waypoint); } } Handles.color = Color.blue; foreach (int connectedIndex in waypoint.connectedTo) { Handles.zTest = CompareFunction.Always; Handles.DrawLine(worldPos, Waypoints[connectedIndex].localPosition + sceneTransform.transform.position); } Handles.Label(worldPos, "#" + i, labelStyle); i++; } if (SelectedWaypoint != null) { Vector3 worldPos = SelectedWaypoint.localPosition + sceneTransform.transform.position; if (_state == State.CONNECT) { Handles.Label(worldPos, "\nConnecting...", labelStyle); } else { Vector3 newPos = Handles.PositionHandle(SelectedWaypoint.GetWorldPosition(sceneTransform.transform), Quaternion.identity); SelectedWaypoint.localPosition = handleSnap(newPos, SelectedWaypoint); SelectedWaypoint.localPosition = handleSnap(newPos, SelectedWaypoint); Handles.Label(worldPos, "\n(C)onnect\n(R)emove\n(O)uter\nRabb(i)t Hole", labelStyle); } } base.RenderSceneGui(parkitectObj); }
public virtual void RenderInspectorGUI() { Name = EditorGUILayout.TextField("Name", Name); Price = EditorGUILayout.FloatField("Price ", Price); ParkitectObj[] pkObjects = ModPayload.Instance.ParkitectObjs.Where(x => x.Prefab != null).ToArray(); ParkitectObj pkObject = pkObjects.SingleOrDefault(x => x.Key == Key); int index = -1; if (pkObject == null) { Key = ""; } else { index = Array.IndexOf(pkObjects, pkObject); } index = EditorGUILayout.Popup("object", index, pkObjects.Select(x => x.Prefab.name + " (" + x.GetObjectTag() + ")").ToArray()); if (index < pkObjects.Length && index >= 0) { Key = pkObjects[index].Key; } ProductType = (ProductType)EditorGUILayout.EnumPopup("Product Type", ProductType); if (ProductType == ProductType.ON_GOING || ProductType == ProductType.CONSUMABLE) { HandSide = (HandSide)EditorGUILayout.EnumPopup("Hand Side", HandSide); IsTwoHanded = EditorGUILayout.Toggle("Is Two Handed", IsTwoHanded); IsInterestingToLookAt = EditorGUILayout.Toggle("Is Interesting To Look At", IsInterestingToLookAt); } switch (ProductType) { case ProductType.ON_GOING: { Duration = EditorGUILayout.IntField("Duration ", Duration); RemoveWhenDepleted = EditorGUILayout.Toggle("Remove When Depleted", RemoveWhenDepleted); DestroyWhenDepleted = EditorGUILayout.Toggle("Destroy When Depleted", DestroyWhenDepleted); } break; case ProductType.CONSUMABLE: { ConsumeAnimation = (ConsumeAnimation)EditorGUILayout.EnumPopup("Consume Animation ", ConsumeAnimation); Temprature = (Temperature)EditorGUILayout.EnumPopup("Temprature ", Temprature); Portions = EditorGUILayout.IntField("Portions ", Portions); } break; case ProductType.WEARABLE: { BodyLocation = (Body)EditorGUILayout.EnumPopup("Body Location ", BodyLocation); SeasonalPrefrence = (Seasonal)EditorGUILayout.EnumPopup("Seasonal Prefrence ", SeasonalPrefrence); TempreaturePrefrence = (Temperature)EditorGUILayout.EnumPopup("Tempreature Prefrence", TempreaturePrefrence); HideHair = EditorGUILayout.Toggle("Hide Hair", HideHair); HideOnRide = EditorGUILayout.Toggle("Hide On Ride", HideOnRide); } break; } DrawIngredients(); }
public virtual void Decorate(GameObject go, GameObject hider, ParkitectObj parkitectObj, AssetBundle bundle) { }
private void drawPlane(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, Color fill, Color outer, ParkitectObj PO) { Handles.DrawSolidRectangleWithOutline(new[] { PO.Prefab.transform.TransformPoint(p1), PO.Prefab.transform.TransformPoint(p2), PO.Prefab.transform.TransformPoint(p3), PO.Prefab.transform.TransformPoint(p4) }, fill, outer); }