Пример #1
0
 public void AnimalDetails(AnimalView model)
 {
     using (var animal = new AnimalRepository())
     {
         Animal ani = animal.GetById(model.AnimalId);
     }
 }
Пример #2
0
        public ActionResult Tag(int id)
        {
            AnimalView ins = animalRep.GetAnimalView(id);

            ViewData["InseminationTubes"] = commonRep.GetInseminationTubesDropDown();
            return(View(ins));
        }
Пример #3
0
        public List <AnimalView> Consultar(string nome, string nomeDono)
        {
            string script = @"SELECT * FROM vw_animal_nmcliente WHERE nm_animal LIKE @nm_animal AND nm_nome LIKE @nm_nome";

            List <MySqlParameter> parms = new List <MySqlParameter>();

            parms.Add(new MySqlParameter("nm_animal", nome + "%"));
            parms.Add(new MySqlParameter("nm_nome", nomeDono + "%"));


            Database        db     = new Database();
            MySqlDataReader reader = db.ExecuteSelectScript(script, parms);

            List <AnimalView> lista = new List <AnimalView>();

            while (reader.Read())
            {
                AnimalView animal = new AnimalView();
                animal.Id           = reader.GetInt32("id_animal");
                animal.Nome         = reader.GetString("nm_animal");
                animal.dsPelagem    = reader.GetString("ds_pelagem");
                animal.dsCorPelagem = reader.GetString("ds_corPelagem");
                animal.DtDataNasc   = reader.GetString("dt_dataNasc");
                animal.dsRaca       = reader.GetString("ds_raca");
                animal.dsSexo       = reader.GetString("ds_sexo");
                animal.IdCliente    = reader.GetString("nm_nome");
                animal.dsObs        = reader.GetString("ds_obs");

                lista.Add(animal);
            }

            reader.Close();
            return(lista);
        }
Пример #4
0
        public ActionResult Insert(AnimalView model)
        {
            var m = batch.GetAllBatches().Find(x => x.BatchTypeid == model.BatchTypeid);

            int count = ani.GetAllAnimals().FindAll(x => x.BatchTypeDesc.Contains(model.AniCode.Substring(0, 2))).Count;

            ViewBag.Batchtypeid = new SelectList(_db2.GetAllBatchTypes(), "BatchTypeid", "BatchTypeDesc");
            if (ani.tot(model) == 0)
            {
                if (count < m.NumOfAnimals)
                {
                    ani.InsertAnimals(model);

                    count = count = ani.GetAllAnimals().FindAll(x => x.BatchTypeDesc.Contains(model.AniCode.Substring(0, 2))).Count;
                    if (count < m.NumOfAnimals)
                    {
                        return(RedirectToAction("InsertAnimals"));
                    }
                }
            }
            else
            {
                ViewBag.Exist = "The current cost you have entered must be less than total cost";
                return(View(model));
            }

            return(RedirectToAction("GetAllAnimals"));
        }
Пример #5
0
        public List <AnimalView> Listar()
        {
            string script = @"SELECT * FROM vw_animal_nmcliente";

            Database        db     = new Database();
            MySqlDataReader reader = db.ExecuteSelectScript(script, null);

            List <AnimalView> animalL = new List <AnimalView>();

            while (reader.Read())
            {
                AnimalView animal = new AnimalView();
                animal.Id           = reader.GetInt32("id_animal");
                animal.Nome         = reader.GetString("nm_animal");
                animal.dsPelagem    = reader.GetString("ds_pelagem");
                animal.dsCorPelagem = reader.GetString("ds_corPelagem");
                animal.DtDataNasc   = reader.GetString("dt_dataNasc");
                animal.dsRaca       = reader.GetString("ds_raca");
                animal.dsSexo       = reader.GetString("ds_sexo");
                animal.IdCliente    = reader.GetString("nm_nome");
                animal.dsObs        = reader.GetString("ds_obs");

                animalL.Add(animal);
            }
            reader.Close();
            return(animalL);
        }
Пример #6
0
        public AnimalView GetAnimalById2(AnimalView anView)
        {
            decimal sum   = 0;
            int     count = 0;

            count++;
            sum = anima.GetAll().Sum(x => x.AniCurrentCost);
            using (var animal = new AnimalRepository())
            {
                foreach (var c in bat.GetAll())
                {
                    Batch ani = batches.GetAll().FindLast(x => x.BatchTypeid == c.BatchTypeid);
                    if (ani != null)
                    {
                        anView.AnimalId = count;
                        anView.AniCode  = ani.BatchCode + "-" + "SU" + "-" +
                                          anView.AnimalId + "-" + Guid.NewGuid().ToString().Substring(0, 5);
                        anView.BatchTypeid      = anView.BatchTypeid;
                        anView.AniColor         = "";
                        anView.AniFeedingStatus = "Feeding Lot";
                        anView.AniAge           = 0;
                        anView.AniGender        = "";
                        anView.AniHealthStatus  = "Healthy";
                        anView.AniCurrentCost   = ani.Totalcost / ani.NumOfAnimals;
                        anView.AniSaleStatus    = "Not Ready";
                        anView.AniTotCost       = 0;
                        anView.AnimalValue      = Convert.ToDouble(anView.AniCurrentCost + anView.AniTotCost);
                    }
                }

                return(anView);
            }
        }
Пример #7
0
    private void Start()
    {
        m_animalView            = transform.parent.GetComponent <AnimalView>();
        m_playerCameraTransform = PlayerInteraction.PlayerCamera.transform;

        GetComponentInChildren <UIAnimalAwareness>().SetupUIElement(m_animalView);

        LookAtCamera();
    }
Пример #8
0
    public void Initialize(int size, Color color)
    {
        this._size = size;

        for (int i = 0; i < this._size; i++)
        {
            Agent = Instantiate(Agent);
            Agent.Initialize(color);
            Animals.Add(Agent);
        }
    }
Пример #9
0
    public void Del(GameObject obj)
    {
        AnimalView aniView = obj.GetComponent <AnimalView>();

        if (flyUseList.Contains(aniView))
        {
            aniView.gameObject.SetActive(false);
            flyUseList.Remove(aniView);
            flyPoollist.Add(aniView);
        }
    }
Пример #10
0
    public void Reset()
    {
        int size = Animals.Count;

        for (int i = size - 1; i >= 0; i--)
        {
            AnimalView a = this.Animals.ElementAt(i);
            this.Animals.RemoveAt(i);
            Destroy(a.gameObject);
        }
        Destroy(this.gameObject);
    }
Пример #11
0
    public AnimalView Add()
    {
        GameObject aniObj = flymovePrefab.Spawn(flymoveRoot, Vector3.zero);

        aniObj.SetActive(false);

        AnimalView aniView = aniObj.GetComponent <AnimalView>();

        flyPoollist.Add(aniView);

        return(aniView);
    }
Пример #12
0
        public decimal current(AnimalView view)
        {
            decimal current = 0;
            var     animal  = new AnimalRepository();

            foreach (var model in batches.GetAll())
            {
                if (view.BatchTypeid == model.BatchTypeid)
                {
                    current = (model.Totalcost / model.NumOfAnimals);
                }
            }
            return(current);
        }
Пример #13
0
        public string GenerateAnimalId(AnimalView model)
        {
            string id = "";

            foreach (var b in bat.GetAll())
            {
                if (b.BatchTypeid == model.BatchTypeid)
                {
                    id = (b.BatchTypeDesc.Substring(0, 2) + "-" + "SU" + "-" + 0 + "-" + "-" +
                          Guid.NewGuid().ToString().Substring(0, 5)).ToUpper();
                }
            }

            return(id);
        }
Пример #14
0
    void Start()
    {
        animal           = InitAnimal();
        animalView       = new AnimalView();
        animalController = new AnimalController(animal, animalView);
        animalController.PrintInfo();
        //更新名字
        animalController.Setname("鸡");
        animalController.PrintInfo();


        //更新名字和种类
        animalController.Settype("海洋生物");
        animalController.Setname("鲨鱼");
        animalController.PrintInfo();
    }
Пример #15
0
        public int TotalCost(AnimalView model)
        {
            decimal sum = 0;

            sum = GetAllAnimals().FindAll(x => x.AniCode.Substring(0, 2) == model.AniCode.Substring(0, 2)).Sum(x => x.AniCurrentCost) + model.AniCurrentCost;
            var m = batches.GetAll().Find(x => x.BatchTypeid == model.BatchTypeid);

            if (sum > m.Totalcost || sum < m.Totalcost)
            {
                num = 1;
            }
            else
            {
                num = 0;
            }
            return(num);
        }
Пример #16
0
    public void AddViewsForAnimal(Animal animal)
    {
        int        animalPrefabIndex = (int)animal.animalType;
        AnimalView animalView        = AnimalPrefabs[animalPrefabIndex].Spawn(animalsTransform, PointForCell(animal.column, animal.row)).GetComponent <AnimalView>();

        animalView.transform.localScale = new Vector2(0.5f, 0.5f);
        animal.view = animalView;

        SpriteRenderer animalViewRenderer = animalView.GetComponent <SpriteRenderer>();
        Color          color = animalViewRenderer.color;

        color.a = 0f;
        animalViewRenderer.color = color;

        Sequence sequence = DOTween.Sequence();

        sequence.Append(animalViewRenderer.DOFade(1f, 0.25f))
        .Join(animalView.transform.DOScale(1f, 0.25f))
        .PrependInterval(Random.Range(0f, 0.5f));
    }
Пример #17
0
    public void AnimateMatchedAnimals(HashSet <Chain> chains, Action completion)
    {
        foreach (Chain chain in chains)
        {
            AnimateScoreForChain(chain);

            foreach (Animal animal in chain.Animals())
            {
                if (animal.view)
                {
                    AnimalView animalView = animal.view;
                    animalView.transform.DOScale(0.1f, 0.3f).SetEase(Ease.OutExpo).OnComplete(() => { animalView.Recycle(); animal.view = null; });
                }
            }
        }

        audioSource.PlayOneShot(matchSound);

        // TODO: try to call completion in better way!
        transform.DOScale(Vector3.one, 0.3f).OnComplete(() => completion());
    }
Пример #18
0
        public void LoadScreen(AnimalView view)
        {
            this.animal          = view;
            txtNomeAnimal.Text   = view.Nome;
            txtCorPelo.Text      = view.dsCorPelagem;
            txtObs.Text          = view.dsObs;
            txtRaca.Text         = view.dsRaca;
            txtTipoPelo.Text     = view.dsPelagem;
            mkbDataNasc.Text     = view.DtDataNasc;
            cboDono.SelectedItem = view.Cliente;
            cboSexo.SelectedItem = view.dsSexo;

            if (view.Imagem == string.Empty)
            {
                pbxImagem.Image = null;
            }
            else
            {
                pbxImagem.Image = PlugIn.ImagemPlugIn.ConverterParaImagem(view.Imagem);
            }
        }
Пример #19
0
    public void AnimateNewAnimals(List <List <Animal> > columns, Action completion)
    {
        float longestDuration = 0f;

        foreach (List <Animal> animals in columns)
        {
            int startRow = animals[0].row + 1;

            int animalIndex = 0;
            foreach (Animal animal in animals)
            {
                int        animalPrefabIndex = (int)animal.animalType;
                AnimalView animalView        = AnimalPrefabs[animalPrefabIndex].Spawn(animalsTransform, PointForCell(animal.column, startRow)).GetComponent <AnimalView>();
                animalView.transform.localScale = Vector3.one;
                animal.view = animalView;

                float delay    = 0.1f + 0.2f * (animals.Count - animalIndex - 1);
                float duration = (startRow - animal.row) * 0.1f;
                longestDuration = Mathf.Max(longestDuration, duration + delay);

                Vector2 newPosition = PointForCell(animal.column, animal.row);

                SpriteRenderer animalViewRenderer = animalView.GetComponent <SpriteRenderer>();
                Color          color = animalViewRenderer.color;
                color.a = 0f;
                animalViewRenderer.color = color;

                Sequence sequence = DOTween.Sequence();
                sequence.Append(animalViewRenderer.DOFade(1f, 0.05f))
                .Join(animalView.transform.DOLocalMove(newPosition, duration).SetEase(Ease.OutExpo).OnStart(() => audioSource.PlayOneShot(addAnimalSound)))
                .PrependInterval(delay);

                animalIndex++;
            }
            ;
        }

        // TODO: try to call completion in better way!
        transform.DOScale(Vector3.one, longestDuration).OnComplete(() => completion());
    }
Пример #20
0
 public void InsertAnimals(AnimalView model)
 {
     using (var x = new AnimalRepository())
     {
         var animals = new Animal
         {
             AnimalId         = model.AnimalId,
             AniCode          = model.AniCode,
             BatchTypeid      = model.BatchTypeid,
             AniColor         = model.AniColor,
             AniFeedingStatus = "FeedLot",
             AniAge           = model.AniAge,
             AniGender        = model.AniGender,
             AniHealthStatus  = "Healthy",
             AniCurrentCost   = model.AniCurrentCost,
             AniSaleStatus    = "Not Ready",
             AniTotCost       = 0,
             AnimalValue      = model.AnimalValue,
         };
         x.Insert(animals);
     }
 }
Пример #21
0
    public void FlyMoveToTarget(Vector3 worldposition, AnimalType type)
    {
        AnimalView anView = null;

        if (flyPoollist.Count != 0)
        {
            anView = flyPoollist[0];
        }
        else
        {
            anView = Add();
        }

        //change view
        anView.ChangeSpriteByType(type);

        if (anView != null)
        {
            anView.gameObject.transform.position = worldposition;
            anView.gameObject.SetActive(true);
            flyPoollist.Remove(anView);
            flyUseList.Add(anView);

            CustomFly flycom = anView.gameObject.GetComponent <CustomFly>();
            flycom.EndMove    = this.EndMove;
            flycom.SourecePos = worldposition;

            //只能在最上层移动
            Vector3 targetPos = new Vector3(targetTrans.position.x, targetTrans.position.y, -2);
            flycom.Fly(targetPos);
        }
        else
        {
            Debug.LogError("anView is null!");
        }

        //Debug.Log("--world position--x:" + worldposition.x + "--y:" + worldposition.y + "--z:" + worldposition.z);
    }
Пример #22
0
        public List <Animalpar> GetAllAnimals()
        {
            decimal    sum   = 0;
            AnimalView model = new AnimalView();

            using (var b = new AnimalRepository())
            {
                return(b.GetAll().Select(x => new Animalpar
                {
                    AnimalId = x.AnimalId,
                    AniCode = x.AniCode,
                    BatchTypeDesc = bat.GetAll().Find(y => y.BatchTypeid == x.BatchTypeid).BatchTypeDesc,
                    AniColor = x.AniColor,
                    AniFeedingStatus = "FeedLot",
                    AniAge = x.AniAge,
                    AniGender = x.AniGender,
                    AniHealthStatus = "Healthy",
                    AniCurrentCost = x.AniCurrentCost,
                    AniSaleStatus = "Not Ready",
                    AniTotCost = 0,
                    AnimalValue = Convert.ToDouble(x.AniCurrentCost + x.AniTotCost),
                }).ToList());
            }
        }
Пример #23
0
 private void OnAnimalExit(AnimalView obj)
 {
     // TODO: MS: Handle the case of Scatering when there is hurdle in the path.
 }
Пример #24
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     animal = dgvAnimal.Rows[e.RowIndex].DataBoundItem as AnimalView;
 }
Пример #25
0
 public AnimalController(Animal animal, AnimalView animalView)
 {
     this.animal     = animal;
     this.animalView = animalView;
 }
Пример #26
0
 private void OnAnimalEnter(AnimalView obj)
 {
     Mediator.AddAnimalToGroup(obj);
 }
Пример #27
0
 // Start is called before the first frame update
 protected virtual void Start()
 {
     m_animalView = this.GetComponent <AnimalView>();
 }
Пример #28
0
 public void SetupUIElement(AnimalView animalView)
 {
     m_animalView = animalView;
     m_animalView.AnimalAwareness.AnimalAwarenessChanged += AwarenessMeterChanged;
 }
Пример #29
0
    //食物被放下时响应,判断食物是否会被动物吃掉
    public void foodEaten(int foodIndex)
    {
        GameObject        currentPointedFood = gameView.foods[foodIndex];
        Vector3           foodPosition       = currentPointedFood.transform.position;
        List <GameObject> animals            = null;
        PlayerController  currentPlayer      = null;

        foreach (PlayerController playerController in MatchController.Instance.players)
        {
            if (gameMod.control == playerController.playerMod.playerId)
            {
                animals       = playerController.playerView.animals;
                currentPlayer = playerController;
                break;
            }
        }
        if (animals != null && currentPlayer != null)
        {
            bool isFoodEat = false;
            foreach (GameObject animal in animals)
            {
                if (!isFoodEat)
                {
                    float x = animal.GetComponent <SphereCollider>().bounds.size.x / 2;
                    float y = animal.GetComponent <SphereCollider> ().bounds.size.y;
                    float z = animal.GetComponent <SphereCollider> ().bounds.size.z / 2;

                    //Debug.LogWarning ("x:" + x + " y:" + y + " z:" + z);
                    AnimalView animalView     = animal.GetComponent <AnimalView>();
                    Vector3    animalPosition = animal.transform.position;
                    float      left           = animalPosition.x - x;
                    float      right          = animalPosition.x + x;
                    float      top            = animalPosition.z + z;
                    float      bottom         = animalPosition.z - z;
                    //				if ((foodPosition.z >= animalPosition.z - z && foodPosition.x <= animalPosition.z + z) &&
                    //					(foodPosition.x >= animalPosition.x - x && foodPosition.x <= animalPosition.x + x)) {
                    if ((foodPosition.x < right && foodPosition.x > left) &&
                        (foodPosition.z < top && foodPosition.z > bottom) && animalView.isMouseEnter)
                    {
                        int animalIndex = animal.GetComponent <AnimalView> ().mod.index;
                        if (currentPlayer.checkAnimalCanEat(animalIndex) == true)
                        {
                            currentPlayer.CmdEatFood(animalIndex, foodIndex);
                            isFoodEat = true;
                            Debug.Log("animal " + animalIndex + "eat food " + foodIndex);
                        }
                        else
                        {
                            currentPlayer.CmdRefreshFoodPosition(foodIndex, latestChoosenFoodPosition);
                            //Debug.Log("refresh to "+latestChoosenFoodPosition);
                        }
                    }
                    else
                    {
                        currentPlayer.CmdRefreshFoodPosition(foodIndex, latestChoosenFoodPosition);
                        //Debug.Log("refresh to "+latestChoosenFoodPosition);
                    }
                }
            }
        }
    }
Пример #30
0
        private void AddAnimalToGroup(AnimalView animalView)
        {
            AnimalRemoteDataModel model = (AnimalRemoteDataModel)animalView.Model;

            AddAnimalToGroupSignal.AddAnimal(SignalBus, model);
        }