Exemplo n.º 1
0
    void _SaveSectors_inEditor()
    {
        _parSecArray = new ParallaxSector[0];
        _parSecArray = new ParallaxSector[transform.childCount];
        for (int __sectorId = 0; __sectorId < transform.childCount; __sectorId++)
        {
            BoxCollider2D __secBox2D = transform.GetChild(__sectorId).GetComponent <BoxCollider2D>();
            float         __x        = __secBox2D.size.x / 2;
            float         __y        = __secBox2D.size.y / 2;
            Vector2       __secPos   = __secBox2D.transform.position;
            _parSecArray[__sectorId].area     = new AreaV2(__secPos.x - __x, __secPos.y + __y, __secPos.x + __x, __secPos.y - __y);
            _parSecArray[__sectorId].myLayers = new List <MyLayer>();
            for (int __layerId = 0; __layerId < transform.GetChild(__sectorId).childCount; __layerId++)
            {
                _parSecArray[__sectorId].myLayers.Add(new MyLayer(transform.GetChild(__sectorId).GetChild(__layerId).transform.position.z, Methods._GiveFilledListOfVector2Wrappers(DeadPoolHandler._DP_Handler._bgObjPrefabs.GetLength(0))));

                for (int __objectId = 0; __objectId < transform.GetChild(__sectorId).GetChild(__layerId).childCount; __objectId++)
                {
                    BgObject __bgObject = transform.GetChild(__sectorId).GetChild(__layerId).GetChild(__objectId).GetComponent <BgObject>();

                    _parSecArray[__sectorId].myLayers[__layerId].positions[__bgObject._id].list.Add(__bgObject.transform.localPosition);
                }
            }
        }
        UnityEditor.EditorUtility.SetDirty(this);

        Methods._KillAllChildren(transform);
    }
Exemplo n.º 2
0
        public async Task <IActionResult> Create(BgObject bgObject)
        {
            var game = await this.bggService.Get(bgObject.ObjectId);

            var categories = this.db.Categories.ToDictionary(c => c.ObjectId, c => c);

            var boardGame = new BoardGameEntry(game);

            foreach (var importCategory in game.Boardgamecategory)
            {
                //If the category doesn't exist create it
                if (!categories.ContainsKey(importCategory.Objectid))
                {
                    boardGame.Categories.Add(
                        new GameCategoryGameEntry()
                    {
                        BoardGameCategory = new BoardGameCategory
                        {
                            Name     = importCategory.Text,
                            ObjectId = importCategory.Objectid,
                        }
                    }
                        );
                }
                else
                {
                    boardGame.Categories.Add(new GameCategoryGameEntry
                    {
                        BoardGameCategory = categories[importCategory.Objectid]
                    }
                                             );
                }
            }

            this.db.Games.Add(boardGame);

            this.db.SaveChanges();

            return(this.Ok(bgObject.ObjectId));
        }