public override void OnInspectorGUI() { base.OnInspectorGUI(); if (EditorApplication.isPlaying) { return; } EditorGUILayout.BeginVertical("box"); GUIStyle stype = new GUIStyle(EditorStyles.boldLabel); EditorGUILayout.LabelField("Preview", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Play")) { _previewState = PreviewState.Play; _lastTime = (float)EditorApplication.timeSinceStartup; } if (GUILayout.Button("Pause")) { _previewState = PreviewState.Pause; } if (GUILayout.Button("Stop")) { _previewState = PreviewState.Stop; _moveTotalTime = 0; _bomb.transform.position = _bomb.originalPosition; } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
public static void PreviewEvent(EditorEventRef eventRef) { bool load = true; if (previewEventDesc != null) { Guid guid; previewEventDesc.getID(out guid); if (guid == eventRef.Guid) { load = false; } else { PreviewStop(); } } if (load) { CheckResult(System.loadBankFile(EventManager.MasterBank.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBank)); CheckResult(System.loadBankFile(eventRef.Banks[0].Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out previewBank)); CheckResult(System.getEventByID(eventRef.Guid, out previewEventDesc)); CheckResult(previewEventDesc.createInstance(out previewEventInstance)); } CheckResult(previewEventInstance.start()); previewState = PreviewState.Playing; }
public void ToolMouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.circle = new Circle(e.Location, e.Location); this.circle.ChangeState(PreviewState.GetInstance()); this.canvas.AddDrawingObject(this.circle); } }
public void ToolMouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { lineSegment = new Line(new System.Drawing.Point(e.X, e.Y)); lineSegment.Endpoint = new System.Drawing.Point(e.X, e.Y); this.lineSegment.ChangeState(PreviewState.GetInstance()); canvas.AddDrawingObject(lineSegment); } }
public static void PreviewPause() { if (previewEventInstance != null) { bool paused; CheckResult(previewEventInstance.getPaused(out paused)); CheckResult(previewEventInstance.setPaused(!paused)); previewState = paused ? PreviewState.Playing : PreviewState.Paused; } }
private bool QueryPrviewStateChanged() { bool isPrviewStateChanged = false; if (PreviewLastState != PreviewStates) { PreviewLastState = PreviewStates; isPrviewStateChanged = true; } return(isPrviewStateChanged); }
public static void PreviewEvent(EditorEventRef eventRef, Dictionary <string, float> previewParamValues) { bool load = true; if (previewEventDesc.isValid()) { Guid guid; previewEventDesc.getID(out guid); if (guid == eventRef.Guid) { load = false; } else { PreviewStop(); } } if (load) { masterBanks.Clear(); foreach (EditorBankRef masterBankRef in EventManager.MasterBanks) { FMOD.Studio.Bank masterBank; CheckResult(System.loadBankFile(masterBankRef.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBank)); masterBanks.Add(masterBank); } if (!EventManager.MasterBanks.Exists(x => eventRef.Banks.Contains(x))) { CheckResult(System.loadBankFile(eventRef.Banks[0].Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out previewBank)); } else { previewBank.clearHandle(); } CheckResult(System.getEventByID(eventRef.Guid, out previewEventDesc)); CheckResult(previewEventDesc.createInstance(out previewEventInstance)); } foreach (EditorParamRef param in eventRef.Parameters) { FMOD.Studio.PARAMETER_DESCRIPTION paramDesc; CheckResult(previewEventDesc.getParameterDescriptionByName(param.Name, out paramDesc)); param.ID = paramDesc.id; PreviewUpdateParameter(param.ID, previewParamValues[param.Name]); } CheckResult(previewEventInstance.start()); previewState = PreviewState.Playing; }
public static void PreviewStop() { if (previewEventInstance != null) { previewEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); previewEventInstance.release(); previewEventInstance = null; previewEventDesc = null; previewBank.unload(); masterBank.unload(); previewState = PreviewState.Stopped; } }
public static void PreviewStop() { if (previewEventInstance.isValid()) { previewEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); previewEventInstance.release(); previewEventInstance.clearHandle(); previewEventDesc.clearHandle(); previewBanks.ForEach(x => { x.unload(); x.clearHandle(); }); masterBanks.ForEach(x => { x.unload(); x.clearHandle(); }); previewState = PreviewState.Stopped; } }
public void updatePreviewColor(PreviewState state) { Color color = Color.white; switch (state) { case PreviewState.BUILD: color = buildColor; break; case PreviewState.NONE: color = invalidColor; break; case PreviewState.DESTROY: color = destroyColor; break; case PreviewState.UPGRADE: color = upgradeColor; break; } srs.ForEach(sr => sr.color = color); }
public static void PreviewEvent(EditorEventRef eventRef) { bool load = true; if (previewEventDesc.isValid()) { Guid guid; previewEventDesc.getID(out guid); if (guid == eventRef.Guid) { load = false; } else { PreviewStop(); } } if (load) { masterBanks.Clear(); foreach (EditorBankRef masterBankRef in EventManager.MasterBanks) { FMOD.Studio.Bank masterBank; CheckResult(System.loadBankFile(masterBankRef.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBank)); masterBanks.Add(masterBank); } if (!EventManager.MasterBanks.Exists(x => eventRef.Banks.Contains(x))) { CheckResult(System.loadBankFile(eventRef.Banks[0].Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out previewBank)); } else { previewBank.clearHandle(); } CheckResult(System.getEventByID(eventRef.Guid, out previewEventDesc)); CheckResult(previewEventDesc.createInstance(out previewEventInstance)); } CheckResult(previewEventInstance.start()); previewState = PreviewState.Playing; }
public void ToolMouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { foreach (DrawingObject obj in this.canvas.GetDrawingObjects().Reverse <DrawingObject>()) { if (obj.Intersect(e.X, e.Y) && obj.GetType() == typeof(Rectangle)) { Debug.WriteLine("Source found"); this.sourceObj = (Rectangle)obj; this.connector = new Connector(this.sourceObj); this.connector.ChangeState(PreviewState.GetInstance()); break; } } } }
public Rectangle() { this.setState(PreviewState.getInstance()); }
public Line() { this.setState(PreviewState.getInstance()); }
public static void PreviewStop() { if (previewEventInstance != null) { previewEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); previewEventInstance.release(); previewEventInstance = null; previewEventDesc = null; if (previewBank != null) { previewBank.unload(); } masterBank.unload(); masterBank = null; previewBank = null; previewState = PreviewState.Stopped; } }
public static void PreviewPause() { if (previewEventInstance != null) { bool paused; CheckResult(previewEventInstance.getPaused(out paused)); CheckResult(previewEventInstance.setPaused(!paused)); previewState = paused ? PreviewState.Playing : PreviewState.Paused; } }
public static void PreviewEvent(EditorEventRef eventRef) { bool load = true; if (previewEventDesc != null) { Guid guid; previewEventDesc.getID(out guid); if (guid == eventRef.Guid) { load = false; } else { PreviewStop(); } } if (load) { CheckResult(System.loadBankFile(EventManager.MasterBank.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBank)); if (eventRef.Banks[0] != EventManager.MasterBank) { CheckResult(System.loadBankFile(eventRef.Banks[0].Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out previewBank)); } else { previewBank = null; } CheckResult(System.getEventByID(eventRef.Guid, out previewEventDesc)); CheckResult(previewEventDesc.createInstance(out previewEventInstance)); } CheckResult(previewEventInstance.start()); previewState = PreviewState.Playing; }
private void PreviewStateChanged(PreviewState state) { Debug.Log(state); this.previewState = state; }
public DrawingObject() { ID = Guid.NewGuid(); this.ChangeState(PreviewState.GetInstance()); }
public DrawingObject() { Debug.WriteLine("Masuk ke class DrawingObject, memberikan GUID pada object"); ID = Guid.NewGuid(); this.ChangeState(PreviewState.GetInstance()); //default initial state }
public DrawingObject() { this.ChangeState(PreviewState.GetInstance()); }
public StatefullDrawingObject() { this.ChangeState(PreviewState.GetInstance()); //default initial state }
public Group() { this.objectList = new List <DrawingObject>(); this.setState(PreviewState.getInstance()); }
public DrawingObject(Pen pen) { this.pen = pen; this.drawingState = PreviewState.GetInstance(); }
public DrawingObject() { ID = Guid.NewGuid(); this.ChangeState(PreviewState.GetInstance()); //default initial state }