Exemplo n.º 1
0
    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();
    }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
 public static void PreviewPause()
 {
     if (previewEventInstance != null)
     {
         bool paused;
         CheckResult(previewEventInstance.getPaused(out paused));
         CheckResult(previewEventInstance.setPaused(!paused));
         previewState = paused ? PreviewState.Playing : PreviewState.Paused;
     }
 }
Exemplo n.º 6
0
        private bool QueryPrviewStateChanged()
        {
            bool isPrviewStateChanged = false;

            if (PreviewLastState != PreviewStates)
            {
                PreviewLastState     = PreviewStates;
                isPrviewStateChanged = true;
            }
            return(isPrviewStateChanged);
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
 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;
     }
 }
Exemplo n.º 9
0
 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);
    }
Exemplo n.º 11
0
        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;
        }
Exemplo n.º 12
0
        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;
                    }
                }
            }
        }
Exemplo n.º 13
0
 public Rectangle()
 {
     this.setState(PreviewState.getInstance());
 }
Exemplo n.º 14
0
 public Line()
 {
     this.setState(PreviewState.getInstance());
 }
Exemplo n.º 15
0
 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;
     }
 }
Exemplo n.º 16
0
 public static void PreviewPause()
 {
     if (previewEventInstance != null)
     {
         bool paused;
         CheckResult(previewEventInstance.getPaused(out paused));
         CheckResult(previewEventInstance.setPaused(!paused));
         previewState = paused ? PreviewState.Playing : PreviewState.Paused;
     }
 }
Exemplo n.º 17
0
        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;
 }
Exemplo n.º 19
0
 public DrawingObject()
 {
     ID = Guid.NewGuid();
     this.ChangeState(PreviewState.GetInstance());
 }
Exemplo n.º 20
0
 public DrawingObject()
 {
     Debug.WriteLine("Masuk ke class DrawingObject, memberikan GUID pada object");
     ID = Guid.NewGuid();
     this.ChangeState(PreviewState.GetInstance()); //default initial state
 }
Exemplo n.º 21
0
 public DrawingObject()
 {
     this.ChangeState(PreviewState.GetInstance());
 }
Exemplo n.º 22
0
 public StatefullDrawingObject()
 {
     this.ChangeState(PreviewState.GetInstance()); //default initial state
 }
Exemplo n.º 23
0
 public Group()
 {
     this.objectList = new List <DrawingObject>();
     this.setState(PreviewState.getInstance());
 }
Exemplo n.º 24
0
 public DrawingObject(Pen pen)
 {
     this.pen          = pen;
     this.drawingState = PreviewState.GetInstance();
 }
Exemplo n.º 25
0
 public DrawingObject()
 {
     ID = Guid.NewGuid();
     this.ChangeState(PreviewState.GetInstance()); //default initial state
 }