Esempio n. 1
0
        public void OnTouchFarmLand(PlowLandFrame land)
        {
            if (DragState == LandDragState.Invalid)
            {
                DragState = LandDragState.Operate;
                TouchFarmLands.Clear();
                TouchFarmLands.Add(land);
            }
            else if (DragState == LandDragState.Draging)
            {
                if (mTouchingFarmLand != null && mTouchingFarmLand != land)
                {
                    //第一个必须是选中的那个土地
                    if (!TouchFarmLands.Contains(mTouchingFarmLand))
                    {
                        return;
                    }
                }

                if (!TouchFarmLands.Contains(land))
                {
                    TouchFarmLands.Add(land);
                    EventDispatcher.Instance.DispatchEvent(new FarmLandCellClick(land.DataModel.Index, true));
                }
            }

            Logger.Info("TouchFarmLand......{0}", land.name);
        }
Esempio n. 2
0
        public void OnClickCloseLandMenu()
        {
            var e = new FarmOperateEvent(15);

            EventDispatcher.Instance.DispatchEvent(e);
            mTouchingFarmLand = null;
        }
Esempio n. 3
0
        private void OnFarmMenuDrag(IEvent ievent)
        {
            var e = ievent as FarmMenuDragEvent;

            if (e.Index == -1)
            {
                DragState = LandDragState.Invalid;
                TouchFarmLands.Clear();
                mTouchingFarmLand = null;
            }
            else
            {
                DragState = LandDragState.Draging;
                TouchFarmLands.Clear();
            }
        }
Esempio n. 4
0
        public void OnClickLand(PlowLandFrame land)
        {
            if (land == null)
            {
                return;
            }
            land.OnClickLand();
            if (mTouchingFarmLand != null)
            {
                //mTouchingFarmLand = null;
                return;
            }
            MatureTimeBg.gameObject.SetActive(false);
            if (mMatureTimer != null)
            {
                StopCoroutine(mMatureTimer);
                mMatureTimer = null;
            }
            mMatureScend = 0;
            if (land.DataModel.State == (int)LandState.Lock)
            {
                //这块土地还未开垦,请提升农场等级!
                var e1 = new ShowUIHintBoard(300302);
                EventDispatcher.Instance.DispatchEvent(e1);
                return;
            }
            var parent = UIManager.GetInstance().GetUIRoot(UIType.TYPE_TIP);
            var loc    = parent.transform.worldToLocalMatrix * land.LockSprite.worldCenter;

            loc.x -= 100;
            loc.y += 70;
            loc.z  = -300;
            LandMenu.transform.localPosition  = loc;
            LandMenu.transform.localPosition += new Vector3(-80, 0, 0);
            SpringPanel.Stop(MenuObject.gameObject);
            ResetScrollViewPostion();
            EventDispatcher.Instance.DispatchEvent(new FarmLandCellClick(land.DataModel.Index, false));
            mTouchingFarmLand = land;
            DragState         = LandDragState.Invalid;
        }