Ejemplo n.º 1
0
        private void RenderButton1()
        {
            GUI.enabled = _hasAttachedHandlers;

            string text = " Map the attached event handler";

            if (!_hasAttachedHandlers)
            {
                text += " (no handlers found)";
            }

            //if (GUILayout.Button(GuiContentCache.Instance.EventHandlerAddButton, StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            if (GUILayout.Button(new GUIContent(text, TextureCache.Instance.EventHandlerAddButton), StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            {
                _isChosen = true;
                AddEventHandlerDialog.Instance.Data.Action = AddHandlerAction.MapExistingHandler;

                var eventHandlerScriptRetriever = new EventHandlerScriptRetriever
                {
                    Data       = AddEventHandlerDialog.Instance.Data,
                    GameObject = AddEventHandlerDialog.Instance.Adapter.gameObject
                };
                var scripts = eventHandlerScriptRetriever.Process();
                AddEventHandlerDialog.Instance.Data.Scripts = scripts;
                EventHandlerListStep.Instance.Scripts       = scripts;
                GotoSignal.Emit(1);
            }

            GUI.enabled = true;
        }
Ejemplo n.º 2
0
        private void RenderButton3()
        {
            string text = " Create new event handler in the existing script";

            if (Application.isPlaying)
            {
                text += " (requires Play mode STOP)";
            }

            //GUI.enabled = false;
            if (GUILayout.Button(new GUIContent(text, TextureCache.Instance.EventHandlerCreateButton), StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            {
                var scanCommand = new AttachExistingScriptFileScan
                {
                    Adapter            = AddEventHandlerDialog.Instance.Adapter,
                    Data               = AddEventHandlerDialog.Instance.Data,
                    CreatingNewHandler = true
                };
                _isChosen = scanCommand.Run();
                if (_isChosen)
                {
                    var eventHandlerScriptRetriever = new EventHandlerScriptRetriever
                    {
                        Data = AddEventHandlerDialog.Instance.Data,
                        //GameObject = AddEventHandlerDialog.Instance.Adapter.gameObject
                    };

                    var scripts = eventHandlerScriptRetriever.Process();

                    //Debug.Log("AddEventHandlerDialog.Instance.Data: " + AddEventHandlerDialog.Instance.Data);
                    // important:
                    //AddEventHandlerDialog.Instance.Data.Action = AddHandlerAction.CreateNewHandlerInExistingScript;
                    AddEventHandlerDialog.Instance.Data.Scripts = scripts;
                    EventHandlerListStep.Instance.Scripts       = scripts;

                    GotoSignal.Emit(2);
                }
            }
            //GUI.enabled = true;
        }
Ejemplo n.º 3
0
        private void RenderButton2()
        {
            string text = " Add the existing script + map event handler";

            if (Application.isPlaying)
            {
                text += " (requires Play mode STOP)";
            }

            if (GUILayout.Button(new GUIContent(text, TextureCache.Instance.EventHandlerScriptAddButton), StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            {
                var scanCommand = new AttachExistingScriptFileScan
                {
                    Adapter = AddEventHandlerDialog.Instance.Adapter,
                    Data    = AddEventHandlerDialog.Instance.Data
                };
                _isChosen = scanCommand.Run();
                if (_isChosen)
                {
                    var eventHandlerScriptRetriever = new EventHandlerScriptRetriever
                    {
                        Data = AddEventHandlerDialog.Instance.Data,
                        //GameObject = AddEventHandlerDialog.Instance.Adapter.gameObject
                    };
                    var scripts = eventHandlerScriptRetriever.Process();

                    var data = AddEventHandlerDialog.Instance.Data;
                    data.Scripts = scripts;
                    data.ScriptAlreadyAttached = null != data.Adapter.gameObject.GetComponent(data.ClassName); // perhaps we don't need to stop the play mode

                    EventHandlerListStep.Instance.Scripts = scripts;

                    GotoSignal.Emit(1);
                }
            }
        }
Ejemplo n.º 4
0
        private void RenderButton3()
        {
            string text = " Create new event handler in the existing script";
            if (Application.isPlaying)
                text += " (requires Play mode STOP)";

            //GUI.enabled = false;
            if (GUILayout.Button(new GUIContent(text, TextureCache.Instance.EventHandlerCreateButton), StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            {
                var scanCommand = new AttachExistingScriptFileScan
                {
                    Adapter = AddEventHandlerDialog.Instance.Adapter,
                    Data = AddEventHandlerDialog.Instance.Data,
                    CreatingNewHandler = true
                };
                _isChosen = scanCommand.Run();
                if (_isChosen)
                {
                    var eventHandlerScriptRetriever = new EventHandlerScriptRetriever
                    {
                        Data = AddEventHandlerDialog.Instance.Data,
                        //GameObject = AddEventHandlerDialog.Instance.Adapter.gameObject
                    };

                    var scripts = eventHandlerScriptRetriever.Process();

                    //Debug.Log("AddEventHandlerDialog.Instance.Data: " + AddEventHandlerDialog.Instance.Data);
                    // important:
                    //AddEventHandlerDialog.Instance.Data.Action = AddHandlerAction.CreateNewHandlerInExistingScript;
                    AddEventHandlerDialog.Instance.Data.Scripts = scripts;
                    EventHandlerListStep.Instance.Scripts = scripts;

                    GotoSignal.Emit(2);
                }
            }
            //GUI.enabled = true;
        }
Ejemplo n.º 5
0
        private void RenderButton2()
        {
            string text = " Add the existing script + map event handler";
            if (Application.isPlaying)
                text += " (requires Play mode STOP)";

            if (GUILayout.Button(new GUIContent(text, TextureCache.Instance.EventHandlerScriptAddButton), StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            {
                var scanCommand = new AttachExistingScriptFileScan
                                      {
                                          Adapter = AddEventHandlerDialog.Instance.Adapter,
                                          Data = AddEventHandlerDialog.Instance.Data
                                      };
                _isChosen = scanCommand.Run();
                if (_isChosen)
                {
                    var eventHandlerScriptRetriever = new EventHandlerScriptRetriever
                                                          {
                                                              Data = AddEventHandlerDialog.Instance.Data,
                                                              //GameObject = AddEventHandlerDialog.Instance.Adapter.gameObject
                                                          };
                    var scripts = eventHandlerScriptRetriever.Process();

                    var data = AddEventHandlerDialog.Instance.Data;
                    data.Scripts = scripts;
                    data.ScriptAlreadyAttached = null != data.Adapter.gameObject.GetComponent(data.ClassName); // perhaps we don't need to stop the play mode

                    EventHandlerListStep.Instance.Scripts = scripts;

                    GotoSignal.Emit(1);
                }
            }
        }
Ejemplo n.º 6
0
        private void RenderButton1()
        {
            GUI.enabled = _hasAttachedHandlers;

            string text = " Map the attached event handler";
            if (!_hasAttachedHandlers)
            {
                text += " (no handlers found)";
            }

            //if (GUILayout.Button(GuiContentCache.Instance.EventHandlerAddButton, StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            if (GUILayout.Button(new GUIContent(text, TextureCache.Instance.EventHandlerAddButton), StyleCache.Instance.BigButton, GUILayout.ExpandHeight(true)))
            {
                _isChosen = true;
                AddEventHandlerDialog.Instance.Data.Action = AddHandlerAction.MapExistingHandler;

                var eventHandlerScriptRetriever = new EventHandlerScriptRetriever
                {
                    Data = AddEventHandlerDialog.Instance.Data,
                    GameObject = AddEventHandlerDialog.Instance.Adapter.gameObject
                };
                var scripts = eventHandlerScriptRetriever.Process();
                AddEventHandlerDialog.Instance.Data.Scripts = scripts;
                EventHandlerListStep.Instance.Scripts = scripts;
                GotoSignal.Emit(1);
            }

            GUI.enabled = true;
        }