Пример #1
0
        public EditRowDialog(Activity context, RowController controller)
        {
            this.context    = context;
            this.controller = controller;

            mainView = new ScrollView(context);

            layout = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical
            };
            mainView.AddView(layout);

            deleteButton = new Button(context);
            deleteButton.SetText(Resource.String.delete_button_txt);
            deleteButton.SetBackgroundColor(Android.Graphics.Color.Red);
            deleteButton.SetOnClickListener(this);
            layout.AddView(deleteButton);

            cells   = new List <CellView>();
            columns = new List <ColumnView>();

            this.controller = controller;
            controller.HookView(this);
        }
Пример #2
0
 private void RecomputeCells(RowController <T> row, float heightSoFar)
 {
     #region Make Cells
     List <CellController <T> > cells = new List <CellController <T> >();
     float widthSoFar = 0;
     for (int j = 0; j < controller.Columns.Count; j++)
     {
         cells.Add(new CellController <T>
         {
             View = new CellView <T>
             {
                 TextFont    = this.Font,
                 Column      = controller.ColumnDefs[j],
                 BoundingBox = new RectangleF
                 {
                     X      = widthSoFar,
                     Y      = heightSoFar,
                     Width  = controller.Columns[j].View.BoundingBox.Width,
                     Height = rowHeight
                 }
             }
         });
         widthSoFar += controller.Columns[j].View.BoundingBox.Width;
     }
     row.Cells = cells.ToArray();
     #endregion
 }
    void SpawnRow()
    {
        int numArrows = Random.Range(1, 3);

        if (numArrows == 0)
        {
            return;
        }

        RowController newRow = (GameObject.Instantiate(rowPrefab, top.position, Quaternion.identity, rowParent)
                                as GameObject).GetComponent <RowController> ();

        rows.Enqueue(newRow);

        if (numArrows == 1)
        {
            int   arrowInd = Random.Range(0, 4);
            Arrow newArrow = SpawnArrow(arrowInd, newRow.transform);
            newRow.AddArrow(newArrow);
        }
        else
        {
            List <int> inds = new List <int> (arrowInds);
            for (int i = 0; i < numArrows; i++)
            {
                int   ind      = Random.Range(0, inds.Count);
                Arrow newArrow = SpawnArrow(inds[ind], newRow.transform);
                newRow.AddArrow(newArrow);
                inds.RemoveAt(ind);
            }
        }
    }
Пример #4
0
 public RowModel()
 {
     controller    = new RowController(this);
     cells         = new List <CellModel>();
     childListener = new RowChildChangeListener(this);
     isChecked     = false;
 }
Пример #5
0
        public void InitializeTests()
        {
            this.Board         = new Game.Data.Contract.Board();
            this.RowController = new RowController();
            this.Recognizer    = new PatternRecognizer(this.Board, this.RowController);
            this.Analyzer      = new BoardAnalyzer(this.Board);
            this.Controller    = new BoardController(this.Board, this.Analyzer, this.Recognizer);
            this.Controller.Initialize();
            this.Player = new Player("Nerzal")
            {
                Color = Colors.White
            };
            this.Player2 = new Player("Wr4thon")
            {
                Color = Colors.Black
            };

            IMovementRules movementRules = new MovementRules(this.Analyzer, this.Board);
            IGameOverRules gameOverRules = new GameOverRules(this.Analyzer);
            IRuleSet       ruleSet       = new RuleSet(movementRules, gameOverRules);
            IHistory       history       = new History();

            this.MillRuleEvaluator = new Evaluator(ruleSet, this.Analyzer);
            IRowController     rowController     = new RowController();
            IPatternRecognizer patternRecognizer = new PatternRecognizer(this.Board, rowController);

            this.GameController = new GameController(this.MillRuleEvaluator, this.Board, history, this.Controller, patternRecognizer, rowController);
        }
Пример #6
0
        private void RecomputeRows()
        {
            #region Compute Row Width
            controller.Rows.Clear();
            float heightSoFar = rowHeight;
            for (int i = 0; i < controller.PageSize; i++)
            {
                RowController <T> row = new RowController <T>
                {
                    View = new RowView <T>
                    {
                        BoundingBox = new RectangleF
                        {
                            X      = 0,
                            Y      = heightSoFar,
                            Width  = view.BoundingBox.Width - scrollWidth,
                            Height = rowHeight
                        }
                    }
                };

                RecomputeCells(row, heightSoFar);

                controller.Rows.Add(row);

                heightSoFar += rowHeight;
            }
            #endregion
        }
Пример #7
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        //int matNum = UnityEngine.Random.Range(0, 2);
        meshRenderer = GetComponent <MeshRenderer>();
        //meshRenderer.material = matList[matNum];
        mat = meshRenderer.material;

        rc = transform.parent.GetComponent <RowController>();

        //Debug.Log(column + ", " + row);
        myPos = transform.position;
    }
        public TableRowEditView(Activity context, RowController controller)
        {
            this.context    = context;
            this.controller = controller;

            mainView   = context.LayoutInflater.Inflate(Resource.Layout.ItemsEditlinearlayout, null, false);
            mainLayout = mainView.FindViewById <LinearLayout>(Resource.Id.editCellItemsLayout);

            cells = new List <CellView>();

            controller.HookView(this);
        }
Пример #10
0
    private void LoadHeader()
    {
        RowController header = GetRow();

        header.SetAsHeader(true);
        if (tableData.HasKey(COLUMNS))
        {
            if (tableData[COLUMNS].Count > 0)
            {
                for (int i = 0; i < tableData[COLUMNS].Count; i++)
                {
                    header.AddCell(tableData[COLUMNS][i]);
                }
            }
        }
    }
    void TakeSingleInput(int ind)
    {
        InputAnim(ind);

        if (rows.Count != 0)
        {
            RowController rc = rows.Peek();
            if (rc.IsInRange() && rc.TryHit(ind))
            {
                Hit();
            }
            else
            {
                Miss();
            }
        }
    }
Пример #12
0
        public ItemView(Activity context, RowController controller)
        {
            this.context    = context;
            this.controller = controller;
            imagesAmount    = 0;

            cells = new List <ItemCellView>();

            mainView = context.LayoutInflater.Inflate(Resource.Layout.TableItem, null);
            mainView.SetOnClickListener(this);

            contentlayout        = mainView.FindViewById <LinearLayout>(Resource.Id.linearLayoutItemContent);
            mainIdentifierLayout = mainView.FindViewById <RelativeLayout>(Resource.Id.relativeLayoutFirstCell);
            imageView            = mainView.FindViewById <FrameLayout>(Resource.Id.imageViewItemImage);

            controller.HookView(this);
        }
Пример #13
0
        public TableRowView(Activity context, RowController controller)
        {
            this.context = context;
            row_view     = new TableRow(context);

            checkBox = new CheckBox(context);
            row_view.AddView(checkBox);
            checkBox.SetOnCheckedChangeListener(this);

            expand_view_button = new ImageButton(context);
            expand_view_button.SetImageResource(Android.Resource.Drawable.IcInputGet);
            expand_view_button.SetBackgroundColor(Android.Graphics.Color.Transparent);
            expand_view_button.SetScaleType(ImageView.ScaleType.FitCenter);

            expand_view_button.SetOnClickListener(this);
            row_view.AddView(expand_view_button);

            cells = new List <CellView>();

            this.controller = controller;
            controller.HookView(this);
        }
Пример #14
0
    void Start()
    {
        // Store current window size for restoration after fullscreen
        // will remain at default (640x480) if already fullscreen
        if (!Screen.fullScreen)
        {
            width  = Screen.width;
            height = Screen.height;
        }

        // Set static prefab array references
        hexprefabs    = hexprefabcontainer;
        hexelprefabs  = hexelprefabcontainer;
        sounds        = soundcontainer;
        numbers       = numbercontainer;
        hexelpreviews = hexelpreviewcontainer;

        // Create controllers
        gamecontroller  = (GameController)gameObject.AddComponent <GameController>();
        boardcontroller = (BoardController)gameObject.AddComponent <BoardController>();
        rowcontroller   = (RowController)gameObject.AddComponent <RowController>();
        savecontroller  = (SaveController)gameObject.AddComponent <SaveController>();
        soundcontroller = (SoundController)gameObject.AddComponent <SoundController>();
    }
Пример #15
0
 private void Awake()
 {
     singleton = this;
 }
 public void PopRow()
 {
     RowController rc = rows.Dequeue();
 }
Пример #17
0
        public static void Main(string[] args)
        {
            RowController rowController = new RowController();

            rowController.rowProcessor();
        }