//注册
 public void RegisterModel(VisualModel model)
 {
     Models[model.Name] = model;
     if (!this.models.Contains(model.Name))
     {
         this.models.Add(model.Name);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// If the cell is not linked to a grid the result is not accurate (Font can be null)
        /// </summary>
        /// <param name="position">Position of the current cell</param>
        /// <param name="g">The graphics.</param>
        /// <param name="p_RowSpan">The row span.</param>
        /// <param name="p_ColSpan">The column span.</param>
        /// <returns></returns>
        protected virtual Size InternalCalculateRequiredSize(Position position, Graphics g, int p_RowSpan, int p_ColSpan)
        {
            SizeF l_ReqSize = VisualModel.GetRequiredSize(g, this, position);

            // Approximate the width and Height value if ColSpan or RowSpan are grater than 1
            l_ReqSize.Width  = l_ReqSize.Width / (float)p_ColSpan;
            l_ReqSize.Height = l_ReqSize.Height / (float)p_RowSpan;

            return(l_ReqSize.ToSize());
        }
        public ActionResult Edit(VisualModel model)
        {
            var visual = _visualRepository.GetById(model.Id);

            if (ModelState.IsValid)
            {
                visual = model.ToEntity(visual);
                //always set IsNew to false when saving
                visual.IsNew = false;
                _visualRepository.Update(visual);

                //commit all changes
                this._dbContext.SaveChanges();

                //notification
                SuccessNotification(_localizationService.GetResource("Record.Saved"));
                return(new NullJsonResult());
            }
            else
            {
                return(Json(new { Errors = ModelState.SerializeErrors() }));
            }
        }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (_abilityIsActive)
        {
            if (SCR_ButtonMaster.Player1 == "Police")
            {
                if (Input.GetAxisRaw(SCR_ButtonMaster.Master.AcitvateAbility1(_abilityOne)) > 0)
                {
                    if (MineObject != null)
                    {
                        _mineObjectArr[_nextToSpawnIndex].SetActive(true);
                        _mineObjectArr[_nextToSpawnIndex].transform.position      = SpawnLocation.transform.position;
                        _mineObjectArr[_nextToSpawnIndex].transform.localRotation = Quaternion.Euler(0, 0, 0);
                        Quaternion rot = SpawnLocation.parent.transform.rotation;

                        _mineObjectArr[_nextToSpawnIndex].transform.rotation = rot;
                        _mineObjectArr[_nextToSpawnIndex].transform.Rotate(new Vector3(0, 90, 0));

                        _nextToSpawnIndex++;
                        if (_nextToSpawnIndex == _maxMines)
                        {
                            _nextToSpawnIndex = 0;
                        }
                        _mineObjectArr[_nextToSpawnIndex].SetActive(true);
                        _mineObjectArr[_nextToSpawnIndex].transform.position      = SpawnLocation2.transform.position;
                        _mineObjectArr[_nextToSpawnIndex].transform.localRotation = Quaternion.Euler(0, 0, 0);
                        rot = SpawnLocation.parent.transform.rotation;

                        _mineObjectArr[_nextToSpawnIndex].transform.rotation = rot;
                        _mineObjectArr[_nextToSpawnIndex].transform.Rotate(new Vector3(0, 90, 0));
                        _nextToSpawnIndex++;
                        if (_nextToSpawnIndex == _maxMines)
                        {
                            _nextToSpawnIndex = 0;
                        }
                        _mineObjectArr[_nextToSpawnIndex].SetActive(true);
                        _mineObjectArr[_nextToSpawnIndex].transform.position      = SpawnLocation3.transform.position;
                        _mineObjectArr[_nextToSpawnIndex].transform.localRotation = Quaternion.Euler(0, 0, 0);
                        rot = SpawnLocation.parent.transform.rotation;

                        _mineObjectArr[_nextToSpawnIndex].transform.rotation = rot;
                        _mineObjectArr[_nextToSpawnIndex].transform.Rotate(new Vector3(0, 90, 0));
                        _nextToSpawnIndex++;
                        if (_nextToSpawnIndex == _maxMines)
                        {
                            _nextToSpawnIndex = 0;
                        }
                        _SoundHolder.GetComponent <SCR_AudioManager>().PlaySound(_SoundHolder.GetComponent <SCR_AudioManager>().GetSoundEffects()[2], GameObject.FindWithTag("DonutTruck"));
                    }
                    _abilityIsActive = false;


                    if (_abilityOne)
                    {
                        SCR_AbilityManager.PoliceAbilityActive = false;
                    }
                    else
                    {
                        SCR_AbilityManager.PoliceAbilityActive2 = false;
                    }

                    if (VisualModel != null)
                    {
                        VisualModel.SetActive(false);
                    }
                }
            }
            else if (SCR_ButtonMaster.Player2 == "Police")
            {
                if (Input.GetAxisRaw(SCR_ButtonMaster.Master.AcitvateAbility2(_abilityOne)) > 0)
                {
                    if (MineObject != null)
                    {
                        _mineObjectArr[_nextToSpawnIndex].SetActive(true);
                        _mineObjectArr[_nextToSpawnIndex].transform.position      = SpawnLocation.transform.position;
                        _mineObjectArr[_nextToSpawnIndex].transform.localRotation = Quaternion.Euler(0, 0, 0);
                        Quaternion rot = SpawnLocation.parent.transform.rotation;

                        _mineObjectArr[_nextToSpawnIndex].transform.rotation = rot;
                        _mineObjectArr[_nextToSpawnIndex].transform.Rotate(new Vector3(0, 90, 0));

                        _nextToSpawnIndex++;
                        if (_nextToSpawnIndex == _maxMines)
                        {
                            _nextToSpawnIndex = 0;
                        }
                        _mineObjectArr[_nextToSpawnIndex].SetActive(true);
                        _mineObjectArr[_nextToSpawnIndex].transform.position      = SpawnLocation2.transform.position;
                        _mineObjectArr[_nextToSpawnIndex].transform.localRotation = Quaternion.Euler(0, 0, 0);
                        rot = SpawnLocation.parent.transform.rotation;

                        _mineObjectArr[_nextToSpawnIndex].transform.rotation = rot;
                        _mineObjectArr[_nextToSpawnIndex].transform.Rotate(new Vector3(0, 90, 0));
                        _nextToSpawnIndex++;
                        if (_nextToSpawnIndex == _maxMines)
                        {
                            _nextToSpawnIndex = 0;
                        }
                        _mineObjectArr[_nextToSpawnIndex].SetActive(true);
                        _mineObjectArr[_nextToSpawnIndex].transform.position      = SpawnLocation3.transform.position;
                        _mineObjectArr[_nextToSpawnIndex].transform.localRotation = Quaternion.Euler(0, 0, 0);
                        rot = SpawnLocation.parent.transform.rotation;

                        _mineObjectArr[_nextToSpawnIndex].transform.rotation = rot;
                        _mineObjectArr[_nextToSpawnIndex].transform.Rotate(new Vector3(0, 90, 0));
                        _nextToSpawnIndex++;
                        if (_nextToSpawnIndex == _maxMines)
                        {
                            _nextToSpawnIndex = 0;
                        }

                        _SoundHolder.GetComponent <SCR_AudioManager>().PlaySound(_SoundHolder.GetComponent <SCR_AudioManager>().GetSoundEffects()[2], GameObject.FindWithTag("DonutTruck"));
                    }
                    DisableAbilityPolice();
                }
            }
        }
    }
Exemplo n.º 5
0
 //注册模型
 protected void RegisterModel(VisualModel model)
 {
     VisualMVC.Instance.RegisterModel(model);
 }
 //删除注册
 public void RemoveModel(VisualModel model)
 {
     Models.Remove(model.Name);
 }