protected void RemoveMenu() { TileMenu menu = GameData.LevelObjects.Find("menu") as TileMenu; if (menu != null) { GameData.LevelObjects.Remove(menu); } }
static void Init() { TileMenu window = (TileMenu)EditorWindow.GetWindow(typeof(TileMenu)); window.tileObject = ScriptableObject.CreateInstance <TileInfo>(); window.tile = new SerializedObject(window.tileObject); window.editor = (TileEditor)Editor.CreateEditor(window.tileObject); window.Show(); }
private void Awake() { if (instance == null) { instance = this; //DontDestroyOnLoad(this); } else { Destroy(gameObject); } }
public void BeforeAnimationBasic(ref BookData Data, int iCurrenPage, ref TileMenu CurrentMenuItem) { //Data.TurnTypeManager = TurnType.TurnFromRight; if (iCurrenPage - 2 >= 0) { Data._previousPageLeftPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage - 2]).generatePage(); Data._previousPageRightPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage - 1]).generatePage(); } else { Data._previousPageLeftPart = null; Data._previousPageRightPart = null; } if (iCurrenPage + 1 < CurrentMenuItem.ListSubMenu.Count) {//have 2 left, right pages Data._nextPageLeftPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage]).generatePage(); Data._nextPageRightPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage + 1]).generatePage(); } else { if (CurrentMenuItem.ListSubMenu.Count == 1) { Data._nextPageLeftPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage]).generatePage(); Data._nextPageRightPart = null; } else { Data._currentPageLeftPage = null; Data._currentPageRightPage = null; Data._nextPageLeftPart = null; Data._nextPageRightPart = null; } } if (iCurrenPage + 3 < CurrentMenuItem.ListSubMenu.Count) { Data.PreNextPageLeftPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage + 2]).generatePage(); Data.PreNextPageRightPart = ((TilePage)CurrentMenuItem.ListSubMenu[iCurrenPage + 3]).generatePage(); } else { Data.PreNextPageLeftPart = null; Data.PreNextPageRightPart = null; } }
public override void OnEnter(GameState previousState) { // Generate all font sizes for zooming //for(double i = 1; i <= 4; i += 0.01) //Game.DefaultFonts.MonoBold.Measure((uint)(8 * i), ""); Menu = new TileMenu(BaseState.Map.Info.Environment, Game); Menu.SelectionChanged = (t, s) => { Layer = s.Layer; }; Menu.Rectangle.TweenTo(new Rectangle(-250, 114, Menu.Rectangle.TargetValue.Width, Menu.Rectangle.TargetValue.Height), TweenEaseType.Linear, 0); Menu.Rectangle.TweenTo(new Rectangle(48, 114, Menu.Rectangle.TargetValue.Width, Menu.Rectangle.TargetValue.Height), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("tool-paintone", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/paintone.png"), Position = new TweenedVector2(Game, new Vector2(-250, 114 + 31)), Active = true, Clicked = (btn) => { _tool = EditTool.PaintOne; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["tool-paintone"].Position.TweenTo(new Vector2(48, 114 + 31), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("tool-rectangle", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/rectangle.png"), Position = new TweenedVector2(Game, new Vector2(-250, 114 + 31 + 32)), Active = false, Clicked = (btn) => { _tool = EditTool.PaintRectangle; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["tool-rectangle"].Position.TweenTo(new Vector2(48, 114 + 31 + 32), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("eraser", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/eraser.png"), Position = new TweenedVector2(Game, new Vector2(-250, 114 + 31 + 32 * 2)), Active = false, CanClickActive = true, Clicked = (btn) => { _eraseMode = !_eraseMode; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["eraser"].Position.TweenTo(new Vector2(48, 114 + 31 + 32 * 2), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("layer-terrain", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/terrain.png"), Position = new TweenedVector2(Game, new Vector2(-250, 119 + 31 + 32 * 3)), Active = true, Clicked = (btn) => { Layer = Tile.MapLayer.Terrain; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["layer-terrain"].Position.TweenTo(new Vector2(48, 119 + 31 + 32 * 3), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("layer-decoration", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/decoration.png"), Position = new TweenedVector2(Game, new Vector2(-250, 119 + 31 + 32 * 4)), Active = false, Disabled = false, Clicked = (btn) => { Layer = Tile.MapLayer.Decoration; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["layer-decoration"].Position.TweenTo(new Vector2(48, 119 + 31 + 32 * 4), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("layer-npc", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/npc.png"), Position = new TweenedVector2(Game, new Vector2(-250, 119 + 31 + 32 * 5)), Active = false, Disabled = false, Clicked = (btn) => { Layer = Tile.MapLayer.NPC; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["layer-npc"].Position.TweenTo(new Vector2(48, 119 + 31 + 32 * 5), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); BaseState.Buttons.Add("layer-control", new Button { Text = "", Icon = Assets.Get <Texture2D>("editor/tile/control.png"), Position = new TweenedVector2(Game, new Vector2(-250, 119 + 31 + 32 * 6)), Active = false, Clicked = (btn) => { Layer = Tile.MapLayer.Control; }, Font = Game.DefaultFonts.Normal }); BaseState.Buttons["layer-control"].Position.TweenTo(new Vector2(48, 119 + 31 + 32 * 6), TweenEaseType.EaseOutQuad, previousState == null ? 0.65f : 0f); }
public SelectionManager(TileMap tileMap, FogOfWar fog) { mTileMenu = new TileMenu(tileMap, fog); mObjectMenu = new ObjectMenu(tileMap, fog); }