示例#1
0
    public override void SelectAction(GMenuItem item)
    {
        string filename = "Level.txt";

        #if UNITY_EDITOR
        var curLock = Screen.lockCursor;
        var curShow = Screen.showCursor;
        Screen.lockCursor = false;
        Screen.showCursor = true;
        filename = UnityEditor.EditorUtility.OpenFilePanel("Level to load", Application.dataPath, "txt");
        Screen.lockCursor = curLock;
        Screen.showCursor = curShow;
        GenerateWorld.LevelToLoad = filename;
        #endif

        #if UNITY_WEBPLAYER
        if ( PlayerPrefs.HasKey("LevelData") == false )
        {
            PlayerPrefs.SetString("LevelData", defaultLevel.text);
        }
        #else
        if ( System.IO.File.Exists("Level.txt") == false )
        {
            File.WriteAllText(defaultLevel.text);
        }
        #endif

        Application.LoadLevel(Level);
        item.enabled = false;
    }
示例#2
0
        private MenuItem CreateMenuItem(int index, string text, EventHandler handler)
        {
            GMenuItem mex = new GMenuItem();

            mex.Text   = text;
            mex.Index  = index;
            mex.Click += handler;
            return(mex);
        }
示例#3
0
 public override void SelectAction(GMenuItem item)
 {
     #if UNITY_EDITOR
     UnityEditor.EditorApplication.isPlaying = false;
     #elif UNITY_WEBPLAYER
     Application.OpenURL(webplayerQuitURL);
     #else
     Application.Quit();
     #endif
 }
示例#4
0
    public override void SelectAction(GMenuItem item)
    {
        #if UNITY_WEBPLAYER
        PlayerPrefs.SetString("LevelData", defaultLevel.text);
        #else
        File.WriteAllText(defaultLevel.text);
        #endif

        Application.LoadLevel(Level);
    }
示例#5
0
 public void SelectGui(GMenuItem item)
 {
     for ( int i = 0; i < this.MenuItems.Length; i++ )
     {
         if ( MenuItems[i] == item ) {
             selection = i;
             break;
         }
     }
 }
示例#6
0
    public override void SelectAction(GMenuItem item)
    {
        InvContainer.visible = !InvContainer.visible;

        if ( InvContainer.visible ) {
            Screen.showCursor = true;
            Screen.lockCursor = false;
        } else {
            Screen.showCursor = false;
            Screen.lockCursor = true;
        }
    }
示例#7
0
 public void Add(GMenuItem child)
 {
     this.m_Children.Remove((Gump)child);
     if (this.m_LeftToRight)
     {
         child.X = this.m_Children.Count * 119;
         child.Y = 0;
     }
     else
     {
         child.X = 0;
         child.Y = this.m_Children.Count * 23;
     }
     this.m_Children.Add((Gump)child);
 }
示例#8
0
    public override void SelectAction(GMenuItem item)
    {
        #if UNITY_WEBPLAYER
        if ( PlayerPrefs.HasKey("LevelData") == false )
        {
            PlayerPrefs.SetString("LevelData", defaultLevel.text);
        }
        #else
        if ( System.IO.File.Exists("Level.txt") == false )
        {
            File.WriteAllText(defaultLevel.text);
        }
        #endif

        Application.LoadLevel(Level);
    }
示例#9
0
        public void Layout()
        {
            int num = 0;

            foreach (Gump gump in this.m_Children.ToArray())
            {
                GMenuItem gmenuItem = gump as GMenuItem;
                if (gmenuItem != null)
                {
                    if (this.m_LeftToRight)
                    {
                        gmenuItem.X = num++ *119;
                        gmenuItem.Y = 0;
                    }
                    else
                    {
                        gmenuItem.X = 0;
                        gmenuItem.Y = num++ *23;
                    }
                }
            }
        }
示例#10
0
        public override void OnClick()
        {
            string str = this.m_Param.Param;

            if (str == null)
            {
                return;
            }
            Action action = this.m_Action;

            if (action == null)
            {
                Gump gump = this.m_Parent;
                while (gump != null && !(gump is GMacroEditorPanel))
                {
                    gump = gump.Parent;
                }
                if (!(gump is GMacroEditorPanel))
                {
                    return;
                }
                Macro macro = ((GMacroEditorPanel)gump).Macro;
                macro.AddAction(new Action(this.m_Handler.Action, str));
                ((GMacroEditorForm)gump.Parent.Parent).Current = macro;
            }
            else
            {
                action.Param = str;
                GMenuItem gmenuItem = (GMenuItem)this;
                while (gmenuItem.Parent is GMenuItem)
                {
                    gmenuItem = (GMenuItem)gmenuItem.Parent;
                }
                gmenuItem.Text = this.m_Param.Name;
            }
        }
示例#11
0
 public virtual void SelectAction( GMenuItem item )
 {
 }
示例#12
0
 public bool Contains(GMenuItem child)
 {
     return(this.m_Children.IndexOf((Gump)child) >= 0);
 }
示例#13
0
 public void Remove(GMenuItem child)
 {
     this.m_Children.Remove((Gump)child);
     this.Layout();
 }