Ejemplo n.º 1
0
    public void addTile(Vector2Int gridPos, TileLayout layout)
    {
        GameTile tile = spawnTile(gridPos, layout);

        grid.Add(gridPos, tile);
        tile.invalid = !isTileValid(tile);
    }
Ejemplo n.º 2
0
        public TileLayout GetTileLayout(Int32 count, TileLayout tLayout, Boolean autoUpdateLayout)
        {
            if (autoUpdateLayout && count < (12 / (int)tLayout))
            {
                switch (count)
                {
                case 0:
                    return(TileLayout.grid_6);

                case 1:
                case 2:
                    return(TileLayout.grid_6);

                case 3:
                    return(TileLayout.grid_4);

                case 4:
                    return(TileLayout.grid_3);

                case 5:
                    return(TileLayout.grid_2);

                default:
                    return(TileLayout.grid_1);
                }
            }
            else
            {
                return(tLayout);
            }
        }
Ejemplo n.º 3
0
 public void ShowEditTilePanel(GameObject ghostTile, TileLayout layout)
 {
     if (myTurn)
     {
         tileEditPanel.SetActive(true);
     }
 }
Ejemplo n.º 4
0
 public void tilePlaced(GameObject ghostTile, TileLayout layout)
 {
     if (myTurn)
     {
         CmdTilePlaced(ghostTile, layout);
     }
 }
Ejemplo n.º 5
0
 private void Awake()
 {
     layout     = FindObjectOfType <TileLayout>();
     place      = FindObjectOfType <PlaceObjects>();
     tileCountX = layout.getTileCountX();
     tileCountY = layout.getTileCountY();
 }
Ejemplo n.º 6
0
 public void CmdTilePlaced(GameObject ghostTile, TileLayout layout)
 {
     if (myTurn)
     {
         board.placeTileOnGhost(ghostTile, layout);
         TargetSelectObject(board.unconfirmedTile.gameObject);
     }
 }
Ejemplo n.º 7
0
    private void Awake()
    {
        place      = FindObjectOfType <PlaceObjects>();
        tool       = FindObjectOfType <MultiTool>();
        tileLayout = FindObjectOfType <TileLayout>();
        player     = GameObject.FindGameObjectWithTag("Player");

        indicatorRenderer = indicator.GetComponent <SpriteRenderer>();
    }
Ejemplo n.º 8
0
        private TileLayout GimmeTileLayout()
        {
            var testAdd = new TileLayout();

            testAdd.Name  = "Default";
            testAdd.Tiles = new List <Tile>();
            testAdd.Tiles.Add(GimmeTile());
            return(testAdd);
        }
Ejemplo n.º 9
0
 public static void WriteLayout(this NetworkWriter writer, TileLayout tile)
 {
     if (tile != null)
     {
         writer.WriteString(tile.name);
     }
     else
     {
         writer.WriteString("null");
     }
 }
Ejemplo n.º 10
0
        private void InitializeTagView(long idDashboard, Int32 miniTileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, OrderItemsBy orderBy, ref long preloadIdTag)
        {
            List <dtoLiteTile> tiles = Service.TilesGetForUser(UserContext.CurrentUserID, idDashboard, TileType.CommunityTag);

            if (tiles == null || !tiles.Any())
            {
                View.DisplayUnableToLoadTile(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight));
            }
            View.CurrentTileLayout = Service.GetTileLayout(tiles.Count, tLayout, autoUpdateLayout);
            LoadMiniTags(tiles, miniTileDisplayItems, GroupItemsBy.Tag, orderBy, ref preloadIdTag);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Overriding the MAIN AddEventListener method!
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="handler"></param>
 /// <param name="phases"></param>
 /// <param name="priority"></param>
 public override void AddEventListener(string eventType, EventHandler handler, EventPhase phases, int priority)
 {
     if (eventType == "propertyChange")
     {
         if (!HasEventListener(eventType))
         {
             TileLayout.AddEventListener(eventType, RedispatchHandler, phases, priority);
         }
     }
     base.AddEventListener(eventType, handler);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Overriding the MAIN RemoveEventListener method!
 /// </summary>
 /// <param name="eventType"></param>
 /// <param name="handler"></param>
 /// <param name="phases"></param>
 public override void RemoveEventListener(string eventType, EventHandler handler, EventPhase phases)
 {
     if (eventType == "propertyChange")
     {
         if (!HasEventListener(eventType))
         {
             TileLayout.RemoveEventListener(eventType, RedispatchHandler);
         }
     }
     base.RemoveEventListener(eventType, handler, phases);
 }
Ejemplo n.º 13
0
 public TileLayout GetTileLayout(DisplayNoticeboard noticeboard, Int32 count, TileLayout tLayout, Boolean autoUpdateLayout)
 {
     switch (noticeboard)
     {
     case DisplayNoticeboard.OnLeft:
     case DisplayNoticeboard.OnRight:
         count++;
         break;
     }
     return(GetTileLayout(count, tLayout, autoUpdateLayout));
 }
Ejemplo n.º 14
0
    private GameTile spawnTile(Vector2Int gridPos, TileLayout layout)
    {
        Vector3    pos    = new Vector3(gridPos.x * tileSize, 0, gridPos.y * tileSize);
        GameObject tileGO = Instantiate(tilePrefab, pos, Quaternion.identity, transform);
        GameTile   tile   = tileGO.GetComponent <GameTile>();

        tile.layout  = layout;
        tile.gridPos = gridPos;
        setUnconfirmedTile(tile);
        NetworkServer.Spawn(tileGO);
        return(tile);
    }
Ejemplo n.º 15
0
        public override void Load()
        {
            var buttons = new List <Widget>();

            for (int i = 0; i < 8; i++)
            {
                buttons.Add(new Button($"Button{i}"));
            }

            Container = new TileLayout()
            {
                Flow = FlowDirection.TopToBottom
            }.AddChilds(buttons.ToArray());
        }
Ejemplo n.º 16
0
 public void onClickTileCard(TileLayout layout, GameObject cardGO)
 {
     if (board.editingTile)
     {
         return;
     }
     if (selectedCardGO != null)
     {
         selectedCardGO.GetComponent <TileCard>().DeselectCard();
     }
     selectedLayout = layout;
     selectedCardGO = cardGO;
     selectedCardGO.GetComponent <TileCard>().SelectCard();
 }
Ejemplo n.º 17
0
        void OnTileLayoutChanged(TileLayout value)
        {
            rootGroup.Clear();
            int rowCount    = TileLayoutExtension.GetRowCount(value);
            int columnCount = TileLayoutExtension.GetColumnsCount(value);

            BaseLayoutItem[] rows = new BaseLayoutItem[rowCount];
            panelContentList.Clear();
            for (int i = 0; i < rowCount; i++)
            {
                rows[i] = CreateRow(i, columnCount);
            }
            rootGroup.AddRange(rows);
            dockManager.Update();
        }
Ejemplo n.º 18
0
    public void placeTileOnGhost(GameObject ghostTile, TileLayout newLayout)
    {
        if (unconfirmedTile != null)
        {
            Vector2Int oldpos = unconfirmedTile.gridPos;
            removeTile(unconfirmedTile.gridPos);
            createGhostTile(oldpos);
        }
        Vector2Int pos = removeGhostTile(ghostTile);

        if (pos != null)
        {
            addTile(pos, newLayout);
        }
    }
Ejemplo n.º 19
0
 public void updateLayout(TileLayout oldLayout, TileLayout newLayout)
 {
     foreach (Vector2Int dir in new Vector2Int[] { Vector2Int.left, Vector2Int.up, Vector2Int.right, Vector2Int.down })
     {
         if (newLayout.doorDirections.Contains(dir))
         {
             setDoor(dir);
         }
         else
         {
             setWall(dir);
         }
     }
     if (newLayout.name.Equals("Security Station Tile"))
     {
         jailObject.SetActive(true);
     }
 }
Ejemplo n.º 20
0
 public void deselectLayout(bool force)
 {
     if (!_preventDeselect || force)
     {
         if (selectedCardGO != null)
         {
             selectedCardGO.GetComponent <TileCard>().DeselectCard();
         }
         selectedLayout = null;
         selectedCardGO = null;
         if (force)
         {
             _preventDeselect = false;
         }
     }
     if (selectedCardGO == null)
     {
         triggerNoCardSelected();
     }
 }
Ejemplo n.º 21
0
    /// <summary>
    /// Constructs a new SequentialArranger
    /// </summary>
    /// <param name="arrangerWidth">Width of arranger in elements</param>
    /// <param name="arrangerHeight">Height of arranger in elements</param>
    /// <param name="dataSource"><see cref="DataSource"/> assigned to each <see cref="ArrangerElement"/></param>
    /// <param name="palette"><see cref="Palette"/> assigned to each <see cref="ArrangerElement"/></param>
    /// <param name="codecFactory">Factory responsible for creating new codecs</param>
    /// <param name="codecName">Name of codec each Element will be initialized to</param>
    public SequentialArranger(int arrangerWidth, int arrangerHeight, DataSource dataSource, Palette palette, ICodecFactory codecFactory, string codecName)
    {
        Mode             = ArrangerMode.Sequential;
        FileSize         = dataSource.Length;
        Name             = dataSource.Name;
        ActiveDataSource = dataSource;
        ActivePalette    = palette;
        _codecs          = codecFactory;

        ActiveCodec = _codecs.GetCodec(codecName, default);
        ColorType   = ActiveCodec.ColorType;

        Layout = ActiveCodec.Layout switch
        {
            ImageLayout.Tiled => ElementLayout.Tiled,
            ImageLayout.Single => ElementLayout.Single,
            _ => throw new InvalidOperationException($"{nameof(SequentialArranger)}.ctor was called with an invalid {nameof(ImageLayout)}")
        };

        ElementPixelSize = new Size(ActiveCodec.Width, ActiveCodec.Height);
        TileLayout       = TileLayout.Default;

        Resize(arrangerWidth, arrangerHeight);
    }
Ejemplo n.º 22
0
 public static int GetRowCount(TileLayout layout)
 {
     return((layout == TileLayout.Layout3x3) ? 3 : 2);
 }
Ejemplo n.º 23
0
 public static int GetColumnsCount(TileLayout layout)
 {
     return((layout == TileLayout.Layout4x2) ? 4 : 3);
 }
Ejemplo n.º 24
0
        public void ShowMoreTiles(DisplayNoticeboard noticeboard, long idDashboard, Int32 tileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, GroupItemsBy groupBy, Boolean value)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.Tile, groupBy, View.CurrentOrderItemsBy, noticeboard, -1, -1, true, value, false));
            }
            else
            {
                View.DisplayLessCommand = value;
                View.DisplayMoreCommand = !value;
                if (value)
                {
                    View.SendUserAction(0, CurrentIdModule, idDashboard, ModuleDashboard.ActionType.TileDashboardMoreTiles);
                }
                else
                {
                    View.SendUserAction(0, CurrentIdModule, idDashboard, ModuleDashboard.ActionType.TileDashboardLessTiles);
                }
                switch (groupBy)
                {
                case GroupItemsBy.CommunityType:
                    InitializeTileView(View.TileRedirectOn, noticeboard, idDashboard, tileDisplayItems, tLayout, autoUpdateLayout, groupBy, TileType.CommunityType);
                    break;

                case GroupItemsBy.Tile:
                    InitializeTileView(View.TileRedirectOn, noticeboard, idDashboard, tileDisplayItems, tLayout, autoUpdateLayout, groupBy, TileType.CombinedTags);
                    break;

                case GroupItemsBy.Tag:
                    InitializeTileView(View.TileRedirectOn, noticeboard, idDashboard, tileDisplayItems, tLayout, autoUpdateLayout, groupBy, TileType.CommunityTag);
                    break;

                case GroupItemsBy.None:
                    if (!View.IsPreview)
                    {
                        View.LoadDashboard(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight));
                    }
                    break;
                }
            }
        }
Ejemplo n.º 25
0
        private void InitializeTagView(DashboardViewType tileRedirectOn, DisplayNoticeboard noticeboard, long idDashboard, Int32 tileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout)
        {
            List <dtoLiteTile> tiles = (View.IsPreview) ? Service.TilesGetForDashboard(idDashboard, TileType.CommunityTag, false) : Service.TilesGetForUser(UserContext.CurrentUserID, idDashboard, TileType.CommunityTag);

            if (tiles == null || !tiles.Any())
            {
                View.DisplayUnableToLoadTile(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, noticeboard));
            }
            View.CurrentTileLayout = Service.GetTileLayout(noticeboard, tiles.Count, tLayout, autoUpdateLayout);
            LoadTags(tileRedirectOn, noticeboard, idDashboard, tiles, tileDisplayItems, GroupItemsBy.Tag);
        }
Ejemplo n.º 26
0
 public placement(TileLayout l, int r = 0)
 {
     layout    = l;
     rotations = r;
 }
Ejemplo n.º 27
0
        private void InitializeTileView(long idDashboard, Int32 miniTileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, GroupItemsBy groupBy, OrderItemsBy orderBy, long preloadIdTile, TileType type, out dtoTileDisplay selectedTile)
        {
            List <dtoLiteTile> tiles = (View.IsPreview) ? Service.TilesGetForDashboard(idDashboard, type, false) : Service.TilesGetForUser(UserContext.CurrentUserID, idDashboard, type);

            if (tiles != null)
            {
                tiles = tiles.Where(t => t.Tile.Type != TileType.DashboardUserDefined && t.Tile.Type != TileType.UserDefined).ToList();
            }
            if (tiles == null || !tiles.Any())
            {
                View.DisplayUnableToLoadTile(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight));
                View.CurrentTileLayout = tLayout;
                selectedTile           = null;
            }
            else
            {
                View.CurrentTileLayout = Service.GetTileLayout(tiles.Count, tLayout, autoUpdateLayout);
                LoadMiniTiles(idDashboard, tiles, miniTileDisplayItems, groupBy, orderBy, preloadIdTile, out selectedTile);
            }
        }
Ejemplo n.º 28
0
        public void ShowMoreCommunities(long idDashboard, Int32 miniTileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, GroupItemsBy groupBy, OrderItemsBy orderBy, long idCurrentTile, Boolean value, Boolean moreCommunities)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.Combined, groupBy, orderBy, View.CurrentDisplayNoticeboard, idCurrentTile, View.IdCurrentTag, true, value, moreCommunities));
            }
            else
            {
                View.DisplayLessCommand = value;
                View.DisplayMoreCommand = !value;
                if (value)
                {
                    View.SendUserAction(0, CurrentIdModule, idDashboard, ModuleDashboard.ActionType.CombinedDashboardMoreTiles);
                }
                else
                {
                    View.SendUserAction(0, CurrentIdModule, idDashboard, ModuleDashboard.ActionType.CombinedDashboardLessTiles);
                }
                dtoTileDisplay selectedTile = null;
                switch (groupBy)
                {
                case GroupItemsBy.CommunityType:
                    InitializeTileView(idDashboard, miniTileDisplayItems, tLayout, autoUpdateLayout, groupBy, orderBy, idCurrentTile, TileType.CommunityType, out selectedTile);
                    break;

                case GroupItemsBy.Tile:
                    InitializeTileView(idDashboard, miniTileDisplayItems, tLayout, autoUpdateLayout, groupBy, orderBy, idCurrentTile, TileType.CombinedTags, out selectedTile);
                    break;

                case GroupItemsBy.Tag:
                    InitializeTileView(idDashboard, miniTileDisplayItems, tLayout, autoUpdateLayout, groupBy, orderBy, idCurrentTile, TileType.CommunityTag, out selectedTile);
                    break;

                case GroupItemsBy.None:
                    View.LoadDashboard(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight));
                    break;
                }
            }
        }
Ejemplo n.º 29
0
 public bool matches(TileLayout other)
 {
     return(other.name.Equals(name) && other.prefab.Equals(other.prefab));
 }