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; }
private MenuItem CreateMenuItem(int index, string text, EventHandler handler) { GMenuItem mex = new GMenuItem(); mex.Text = text; mex.Index = index; mex.Click += handler; return(mex); }
public override void SelectAction(GMenuItem item) { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #elif UNITY_WEBPLAYER Application.OpenURL(webplayerQuitURL); #else Application.Quit(); #endif }
public override void SelectAction(GMenuItem item) { #if UNITY_WEBPLAYER PlayerPrefs.SetString("LevelData", defaultLevel.text); #else File.WriteAllText(defaultLevel.text); #endif Application.LoadLevel(Level); }
public void SelectGui(GMenuItem item) { for ( int i = 0; i < this.MenuItems.Length; i++ ) { if ( MenuItems[i] == item ) { selection = i; break; } } }
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; } }
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); }
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); }
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; } } } }
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; } }
public virtual void SelectAction( GMenuItem item ) { }
public bool Contains(GMenuItem child) { return(this.m_Children.IndexOf((Gump)child) >= 0); }
public void Remove(GMenuItem child) { this.m_Children.Remove((Gump)child); this.Layout(); }