public void DrawAdHocSubActivities(AdHocActivity activity) { GUI.BeginGroup(new Rect(15, 80, Server.SCREEN_WIDTH, Server.SCREEN_HEIGHT-100)); Matrix4x4 backupMatrix = GUI.matrix; Rect poolRect = new Rect(Server.SCREEN_WIDTH/2-720/2, 15, 720, 500); GUI.Box(new Rect(poolRect), "", "Lane"); GUIUtility.RotateAroundPivot(270f, new Vector2(Screen.width/2-720/2, 500+15)); if (GUI.Button(new Rect(Screen.width/2-720/2, 500+15, 500, 30), "Activity " + activity.PrID + ": " + activity.Name, "PoolLabel")) { } GUI.matrix = backupMatrix; foreach (Primitive prim in activity.lane.Elements) { Activity a = prim as Activity; Rect primitiveRect = new Rect(prim.x-75, prim.y-25, 150, 50); string actStyle; if (Server.CurrentSubPrimitive != null && prim.PrID == Server.CurrentSubPrimitive.PrID) actStyle = "ActivitySel"; else actStyle = "Activity"; if (GUI.Button(primitiveRect, a.Name, actStyle)) Server.CurrentSubPrimitive = a; } GUI.EndGroup(); }
public void DrawAdHocSubActivities(AdHocActivity activity) { Matrix4x4 backupMatrix = GUI.matrix; Rect poolRect = new Rect(SCREEN_WIDTH/2-720/2, 15, 720, 500); GUI.Box(new Rect(poolRect), "", "Lane"); GUIUtility.RotateAroundPivot(270f, new Vector2(Screen.width/2-720/2, 500+15)); if (GUI.Button(new Rect(Screen.width/2-720/2, 500+15, 500, 30), "Activity " + activity.PrID + ": " + activity.Name, "PoolLabel")) { } GUI.matrix = backupMatrix; foreach (Primitive prim in activity.lane.Elements) { Activity a = prim as Activity; Rect primitiveRect = new Rect(prim.x-75, prim.y-25, 150, 50); string actStyle = ""; if (prim.PrID == Manager.InspectorSubPrimitive.PrID || (clickSource != null && prim.PrID == clickSource.PrID) || (clickTarget != null && prim.PrID == clickTarget.PrID) && EnableProcessEdition) actStyle = "ActivitySel"; else actStyle = "Activity"; if (GUI.Button(primitiveRect, a.Name, actStyle)) { PaintEditName.changeCondition = PaintEditName.changeName = PaintEditName.changeSubName = false; Manager.InspectorSubPrimitive = a; subPrimitiveName = a.Name; } if (primitiveRect.Contains(UnityEngine.Event.current.mousePosition) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetMouseButtonUp(0) && EnableProcessEdition) { Activity subActivity = Manager.InspectorSubPrimitive as Activity; subPrimitiveName = subActivity.Name; PaintEditName.primitiveRect = primitiveRect; PaintEditName.changeSubName = true; } if (UnityEngine.Event.current.type == EventType.KeyUp && UnityEngine.Event.current.keyCode == KeyCode.Delete && prim.PrID == Manager.InspectorSubPrimitive.PrID && EnableProcessEdition) { LanguageConstructor.RemoveSubPrimitive(Manager.CurrentProcess.PID, Manager.CurrentScreen == GameManager.GameScreen.AdHocCreation ? -1 : Manager.CurrentVersion.PVID, Manager.CurrentLane.PrID, Manager.InspectorPrimitive.PrID, Manager.InspectorSubPrimitive.PrID); } } }
public void NewAdHocActivityAck(string status, string player, int PID, int PVID, int LaneID, int PrID, string name, float x, float y, bool update) { try { ValidateAcknowledge(status, IOExceptions[6]); if (!ProcessExists(PID, PVID) || (update && !Painter.UpdateMode)) return; Lane lane = Painter.Manager.GameState.GetLane(PID, PVID, LaneID); AdHocActivity activity = new AdHocActivity(PrID, name, x, y); lane.Elements.Add(activity); Painter.Manager.InspectorPrimitive = activity; } catch (InvalidOperationException ioe) { Debug.Log(ioe.StackTrace); } }
public void NewAdHocActivity(string player, int PID, int PVID, int LaneID, int PrID, string name, float x, float y) { try { AdHocActivity activity; if (PrID == -1) activity = new AdHocActivity(); else activity = new AdHocActivity(PrID, name); Lane lane = State.GetLane(PID, PVID, LaneID); if (x == -1) { if (lane.Elements.Count == 0) { activity.x = 200; activity.y = lane.y; } else if (lane.Elements[lane.Elements.Count-1] is Event && !(lane.Elements[lane.Elements.Count-1] as Event).categ.Equals(Event.Categ.Merge)) { activity.x = 200; activity.y = lane.y; } else { activity.x = lane.Elements[lane.Elements.Count-1].x + 170; activity.y = lane.y; } } else { activity.x = x; activity.y = y; } lane.Elements.Add(activity); networkView.RPC("NewAdHocActivityAck", RPCMode.Others, "Success", player, PID, PVID, LaneID, activity.PrID, activity.Name, activity.x, activity.y, false); Console.Log.Add("<b>Added ad-hoc activity</b> to process " + PID + "."); } catch (InvalidOperationException ioe) { Debug.Log(ioe.StackTrace); networkView.RPC("NewAdHocActivityAck", RPCMode.Others, "Failure", player, PID, PVID, LaneID, -1, -1, "", (float)-1, (float)-1, false); } }