private void CreateLobbyItems()
    {
        PositionGrid grid      = new PositionGrid(ItemDistance, RowDistance, transform.position);
        var          tmpLobbys = lobbyLoader.OpenLobbies;

        for (int x = 0; x < NumRowItems; x++)
        {
            for (int y = 0; y < NumRows; y++)
            {
                if (tmpLobbys.Count > (currentStartId + x + y))
                {
                    CreateLobbyCard(grid.GetAtXY(x, y), transform.localScale, transform.localRotation * Quaternion.Euler(90, 180, 0), tmpLobbys[currentStartId + x + y]);
                }
            }
        }
    }
        private void InitializePositionGrid()
        {
            PositionGrid.InitializeGrid();

            var grid = PositionGrid.PrimaryGrid;

            grid.EnableClipboardPasteNumbers();
            grid.GroupByRow.Visible   = false;
            grid.SelectionGranularity = SelectionGranularity.Cell;
            grid.UseAlternateRowStyle = true;
            grid.AllowEdit            = true;
            grid.MultiSelect          = true;
            grid.InitialActiveRow     = RelativeRow.FirstRow;
            grid.InitialSelection     = RelativeSelection.LastCell;


            grid.SuperGrid.CellValidating += (s, e) =>
            {
                if (e.GridCell.ColumnIndex != 1)
                {
                    return;
                }

                var itemValue = int.Parse(e.Value.ToString());

                if (!(itemValue >= 1 && itemValue <= 50))
                {
                    MessageDialog.ShowValidationError(this, "Number must be 1 - 50 only", focusControl: false);
                    e.Cancel = true;
                }
            };

            var col = grid.CreateColumn("Code", "Code", 80);

            col.AllowEdit = false;

            col           = grid.CreateColumn("Position", "Position", 200);
            col.AllowEdit = false;

            col          = grid.CreateColumn("SalaryGrade", "Salary Grade", 80, Alignment.MiddleCenter);
            col.DataType = typeof(int);


            col.EditorType = typeof(GridDoubleIntInputEditControl);
        }
Exemple #3
0
 void AddChild()
 {
     ComputeHeight();
     for (int i = 0; i < gridHeight; i++)
     {
         for (int j = 0; j < gridWidth; j++)
         {
             GameObject g = Instantiate <GameObject>(prefab);
             g.layer    = 0;
             g.isStatic = true;
             g.name     = i + "," + j;
             g.transform.SetParent(transform);
             g.transform.localPosition = new Vector3(i * cellSize, yOffset, j * cellSize);
             PositionGrid pg = g.GetComponent <PositionGrid>();
             pg.Init(cellSize, i, j);
             DestroyImmediate(pg);
         }
     }
 }
Exemple #4
0
 void AddChild()
 {
     while (transform.childCount != 0)
     {
         DestroyImmediate(transform.GetChild(0).gameObject);
     }
     ComputeHeight();
     for (int y = 0; y < TileHeight; y++)
     {
         for (int x = 0; x < TileWidth; x++)
         {
             GameObject g = Instantiate <GameObject>(TilePrefab.gameObject);
             g.layer    = 0;
             g.isStatic = true;
             g.name     = x + "," + y;
             g.transform.SetParent(transform);
             g.transform.localPosition = new Vector3(x * CELLSIZE, HEIGHTOFFSET, y * CELLSIZE);
             PositionGrid pg = g.GetComponent <PositionGrid>();
             pg.Init(CELLSIZE, x, y);
             DestroyImmediate(pg);
         }
     }
 }
Exemple #5
0
        public void Update()
        {
            CalcGyroForce();

            PositionGrid centre = ((PositionWorld)myGrid.Physics.CenterOfMassWorld).ToGrid(myGrid);

            if (Vector3.DistanceSquared(centre, m_centreOfMass) > 1f || Math.Abs(myGrid.Physics.Mass - m_mass) > 1000f)
            {
                using (m_lock.AcquireExclusiveUsing())
                {
                    if (m_updating)
                    {
                        Log.DebugLog("already updating", Logger.severity.DEBUG);
                        return;
                    }
                    m_updating = true;
                }

                m_centreOfMass = centre;
                m_mass         = myGrid.Physics.Mass;

                Thread.EnqueueAction(CalculateInertiaMoment);
            }
        }
Exemple #6
0
 void Start()
 {
     CreatedItems = new List <SelectorActor>();
     grid         = new PositionGrid(ItemDistance, ItemDistance * 1.5f, transform.position);
 }
    /*
     * private List<Vector2> posTrail = new List<Vector2>();
     * private List<Vector2> posGrass = new List<Vector2>();
     *
     * private List<Transform> pos = new List<Transform>();
     */

    // Use this for initialization
    void Start()
    {
        Grass = new PositionGrid();
        Trail = new PositionGrid();
    }