Ejemplo n.º 1
0
        void Update()
        {
            //Phase One ADD GMC
            if(_menuController != null && _addingMenuController)
            {
                if (!EditorApplication.isCompiling)
                {
                    try
                    {
                        _GMC = (GenericMenuController)UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(_menuController, "Assets/Editor/MenuCreator.cs (94,51)", _menuController.name + GameDataInfo.GetMenuClassBaseSuffix);
                    }
                    catch (System.Exception ex)
                    {
                        Debug.Log(ex.ToString());
                    }

                    finally
                    {
                        if (_GMC != null)
                        {
                            _addingMenuController = false;
                            _addingInterface3D    = true;
                        }
                    }
                }
            }

            //Phase two Add Interface3Dbutton
            if (_addingInterface3D && !_lockCreation){

                int totalOptions = _menuOptions.Length;
                _lockCreation = true;
                Debug.Log("Locking");
                GameObject[] optionObjects = new GameObject[totalOptions];
                UnityEngine.Object parentAsObj = PrefabUtility.InstantiatePrefab(_menuController);
                AssetDatabase.Refresh();
                GameObject parent = (GameObject)parentAsObj;

                for(int i = 0; i < totalOptions; ++i)
                {

                    optionObjects[i]         = new GameObject();
                    optionObjects[i].name    = _menuOptions[i];

                    Interface3DButton   button =   optionObjects[i].AddComponent<Interface3DButton>();

                    if(_useCustomTextures[i])
                    {
                        if(_optionTextures != null)
                        {
                            button.textures = _optionTextures[i];
                            button.GetComponent<GUITexture>().texture = button.textures.normal;
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Button Textures not found!",
                                                        "Option [" + _menuOptions[i] + "]",
                                                        "Shit", "f**k");
                            Texture2D temp = new Texture2D(32, 32);
                            button.GetComponent<GUITexture>().texture = temp;
                        }

                    }
                    button.useBackgroundColors = _useBackgroundColors[i];

                    optionObjects[i].transform.parent = parent.transform;

                    //try
                    //{
                    //    if (_useCustomTextures[i])
                    //    {
                    //        button.textures.UseTextures(true);
                    //        but
                    //    }
                    //}
                    //catch (System.Exception ex)
                    //{
                    //    Debug.Log("Couldn't Add Textures Try again later?" + ex.ToString());
                    //}
                }
                _addingInterface3D = false;
                _lockCreation = false;

                PsiEngine.GameDataInfo.CreateNewPrefab(parent, PsiEngine.GameDataInfo.GetMenuPrefabPath(parent.name));
            }
        }
Ejemplo n.º 2
0
 private void OnFinished()
 {
     _GMC = null;
     _menuController = null;
     _useBackgroundColors = null;
     _hasBackground = null;
     _useCustomTextures = null;
     _menuOptions = null;
     _optionTextures = null;
 }