Beispiel #1
0
 public void recolorClose()
 {
     if (guiObject != null)
     {
         gui.closeGui();
         gui = null;
         GameObject.Destroy(guiObject);
     }
 }
Beispiel #2
0
        public void recolorGUIEvent()
        {
            bool open = true;

            if (guiObject != null)
            {
                //apparently delegates can/do use reference/memory location ==, which is exactl what is needed in this situation
                if (gui.guiCloseAction == recolorClose)
                {
                    open = false;
                }
                //kill existing GUI before opening new one
                gui.guiCloseAction();
                GameObject.Destroy(guiObject);
                guiObject = null;
            }
            if (open)
            {
                guiObject = new GameObject("SSTURecolorGUI");
                gui       = guiObject.AddComponent <CraftRecolorGUI>();
                gui.openGUIPart(part);
                gui.guiCloseAction = recolorClose;
            }
        }