Exemplo n.º 1
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 2
0
            private void AssignArray(SpoolSpace Memory)
            {
                if (this._Parameters.Count < 2)
                {
                    throw new Exception("Cannot assign an array without an index");
                }

                Cell x = Memory[this._LibName][this._VarName];

                if (!x.IsArray)
                {
                    throw new Exception("Requires an array");
                }

                // Find the array //
                CellArray  z       = x.valueARRAY;
                List <int> Indexes = new List <int>();

                for (int i = 0; i < this._Parameters.Count - 1; i++) // the last parameter is the value to assign
                {
                    Indexes.Add(this._Parameters[i].Evaluate(Memory).valueINT);
                }
                for (int i = 0; i < Indexes.Count - 1; i++) // the last parameter is the index we want to use to assign
                {
                    z = z[Indexes[i]].valueARRAY;
                }
                int idx = Indexes.Last();

                Cell q = this._Parameters.Last().Evaluate(Memory);

                switch (this._Affinity)
                {
                case AssignmentType.Equals:
                    z[idx] = q;
                    return;

                case AssignmentType.PlusEquals:
                    z[idx] += q;
                    return;

                case AssignmentType.MinusEquals:
                    z[idx] -= q;
                    return;

                case AssignmentType.MultEquals:
                    z[idx] *= q;
                    return;

                case AssignmentType.DivEquals:
                    z[idx] /= q;
                    return;

                case AssignmentType.Div2Equals:
                    z[idx] = CellOperations.CheckDivide(z[idx], q);
                    return;

                case AssignmentType.ModEquals:
                    z[idx] %= q;
                    return;

                case AssignmentType.Mod2Equals:
                    z[idx] = CellOperations.CheckMod(z[idx], q);
                    return;

                case AssignmentType.AndEquals:
                    z[idx] &= q;
                    return;

                case AssignmentType.OrEquals:
                    z[idx] |= q;
                    return;

                case AssignmentType.XorEquals:
                    z[idx] ^= q;
                    return;

                case AssignmentType.PlusPlus:
                    z[idx]++;
                    return;

                case AssignmentType.MinusMinus:
                    z[idx]--;
                    return;
                }

                throw new Exception("Operation is invalid");
            }
Exemplo n.º 3
0
 public void calc_cross_cells_static(ObjCell cell, CellArray cellArray)
 {
     cell.find_transit_cells(NumParts, Parts, cellArray);
 }
Exemplo n.º 4
0
        private void InitCellArray()
        {
            cellArray = new CellArray(rowSpanMgr, columns.Count);
            int colNum = 1;
            foreach (TableCell cell in children)
            {
                colNum = cellArray.GetNextFreeCell(colNum);
                int numCols = cell.GetNumColumnsSpanned();
                int numRows = cell.GetNumRowsSpanned();
                int cellColNum = cell.GetColumnNumber();

                if (cellColNum == 0)
                {
                    if (colNum < 1)
                    {
                        continue;
                    }
                    else
                    {
                        cellColNum = colNum;
                    }
                }
                else if (cellColNum > columns.Count)
                {
                    continue;
                }
                if (cellColNum + numCols - 1 > columns.Count)
                {
                    numCols = columns.Count - cellColNum + 1;
                }
                if (cellArray.StoreCell(cell, cellColNum, numCols) == false)
                {
                }
                if (cellColNum > colNum)
                {
                    colNum = cellColNum;
                }
                else if (cellColNum < colNum)
                {
                    colNum = cellColNum;
                }
                int cellWidth = GetCellWidth(cellColNum, numCols);
                cell.SetWidth(cellWidth);
                colNum += numCols;
            }
        }
Exemplo n.º 5
0
 public World(IWorldPrinter printer)
 {
     world = new CellArray(WorldWidth, WorldHeight);
     this.printer = printer;
 }