Ejemplo n.º 1
0
        // 手指滑动;
        void EasyTouch_On_Swipe(Gesture gesture)
        {
            List <FruitItemOne> mFruitsList = MainModel.Instance.mFruitsOneList;

            for (int i = 0; i < mFruitsList.Count; ++i)
            {
                if (gesture.IsInRect(NGUIObjectToRect(mFruitsList[i].gameObject)))
                {
                    // 用于水果的切;
                    mFruitsList[i].onClick(null);
                }
            }

            // 检测道场;
            if (gesture.IsInRect(NGUIObjectToRect(mGo_DC)))
            {
                OnDC(null);
            }

            // 检测游戏;
            if (gesture.IsInRect(NGUIObjectToRect(mGo_Game)))
            {
                OnGame(null);
            }

            // 检测退出;
            if (gesture.IsInRect(NGUIObjectToRect(mGo_Quit)))
            {
                FruitItem fuit = mGo_Quit.GetComponentInParent <FruitItem>();
                fuit.doAction(false);
                OnQuit(null);
            }
        }
Ejemplo n.º 2
0
        public void onClick(object obj)
        {
            gameObject.SetActive(false);
            // 像父节点发送被按下的消息;
            FruitItem item = gameObject.GetComponentInParent <FruitItem>();

            item.doAction(true);
        }
Ejemplo n.º 3
0
        // 创建UI界面的水果;
        public static GameObject CreateUIFruit(GameObject parent, fruitType type, Vector3 vec)
        {
            GameObject obj = Instantiate(Resources.Load(UIPrafabs.oneFruit)) as GameObject;

            obj.transform.parent        = parent.transform;
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = vec;
            FruitItem fruit = AddOneComponent <FruitItem>(obj);

            fruit.init(type);
            return(fruit.getOne());
        }
Ejemplo n.º 4
0
        public static GameObject loadFruit(GameObject parent, fruitType type, Vector3 vec)
        {
            GameObject go = Instantiate(Resources.Load(UIPrafabs.oneFruit)) as GameObject;

            go.transform.parent        = parent.transform;
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = Vector3.zero;
            FruitItem fruit = AddOneComponent <FruitItem>(go);

            fruit.init(type);
            fruit.setPos(vec);
            return(fruit.getOne());
        }
Ejemplo n.º 5
0
        public void Restart()
        {
            List <FruitItemOne> mFruitsList = MainModel.Instance.mFruitsOneList;

            for (int i = 0; i < mFruitsList.Count; ++i)
            {
                FruitItem item = mFruitsList[i].GetComponentInParent <FruitItem>();
                item.gameObject.SetActive(false);
            }
            mGo_Rings.Clear();
            MainModel.Instance.Clear();
            onEnterUI();
        }
Ejemplo n.º 6
0
        void OnGame(object obj)
        {
            FruitItem fuit = mGo_Game.GetComponentInParent <FruitItem>();

            fuit.doAction(false);

            // 设置退出向下移动;
            Framework.SetUpDown2(mGo_Quit_parent, 800f, false, Vector3.zero);
            // 设置DC向下移动;
            Framework.SetUpDown2(mGo_DC_parent, 800f, false, Vector3.zero);

            // 点击game的回调;
            setLeaveUIMove();

            enterGame();
        }
Ejemplo n.º 7
0
        void reset()
        {
            // 去除动力学;

            leftBody.isKinematic  = true;
            rightBody.isKinematic = true;

            // 位置置为0;
            leftBody.transform.localPosition  = Vector3.zero;
            rightBody.transform.localPosition = Vector3.zero;
            // 划过水果之后,要将水果重新向上抛;
            FruitItem item = gameObject.GetComponentInParent <FruitItem>();

            item.reSet(isNeedUp);
            gameObject.SetActive(false);
        }
Ejemplo n.º 8
0
        public void setUp(FruitItemOne fruit)
        {
            fruit.transform.localPosition = new Vector3(0f, GameData.mMaxBottomY);
            Rigidbody body = fruit.GetComponent <Rigidbody>();

            body.velocity = Vector3.zero;
            int randForceX = Random.Range(GameData.mMinUpForceX, GameData.mMaxUpForceX);
            int randForceY = Random.Range(GameData.mMinUpForceY, GameData.mMaxUpForceY);

            body.AddForce(new Vector3(randForceX, randForceY, 0f));
            int       rand = Random.Range((int)fruitType.apple, (int)fruitType.sandia);
            fruitType type = Framework.getTypeByID(rand);
            FruitItem item = fruit.GetComponentInParent <FruitItem>();

            item.init(type);
            body.isKinematic = false;
        }
Ejemplo n.º 9
0
        void setQuit()
        {
            // 游戏的外环顺时针旋转;
            mGo_Quit_parent.transform.localPosition = Vector3.zero;
            GameObject go = mGo_Quit_parent.transform.FindChild("fruitparent/ring").gameObject;

            Framework.SetRotate(go, 10f, true);
            Framework.SetScale(go);
            AddRing(go);
            // 游戏的水果逆时针旋转;
            Vector3 vec = mGo_Quit_parent.transform.FindChild("fruitparent").localPosition;

            if (mGo_Quit == null)
            {
                mGo_Quit = Framework.CreateUIFruit(mGo_Quit_parent, fruitType.boom, vec);
                FruitItem fuit = mGo_Quit.GetComponentInParent <FruitItem>();
                Framework.AddOnClick(mGo_Quit, "", OnQuit);
            }
        }
Ejemplo n.º 10
0
        void OnDC(object obj)
        {
            // 点击道场的回调;

            // 划水果;

            FruitItem fuit = mGo_DC.GetComponentInParent <FruitItem>();

            fuit.doAction(false);

            // 设置退出向下移动;
            Framework.SetUpDown2(mGo_Quit_parent, 800f, false, Vector3.zero);
            // 设置Game向下移动;
            Framework.SetUpDown2(mGo_Game_parent, 800f, false, GameData.Vecs_mGo_GameParent);

            // 离开当前页面;
            setLeaveUIMove();

            // 进入UI界面;
            StartCoroutine(StartInterUI());
        }
Ejemplo n.º 11
0
        void setNewGame()
        {
            // 游戏的外环顺时针旋转;
            mGo_Game_parent.transform.localPosition = GameData.Vecs_mGo_GameParent;
            GameObject mGo_Game_ring = mGo_Game_parent.transform.FindChild("ring").gameObject;

            Framework.SetRotate(mGo_Game_ring, 10f, false);
            Framework.SetScale(mGo_Game_ring);
            AddRing(mGo_Game_ring);
            // 游戏的水果逆时针旋转;
            Vector3 vec = mGo_Game_parent.transform.FindChild("fruitparent").localPosition;

            if (mGo_Game == null)
            {
                mGo_Game = Framework.CreateUIFruit(mGo_Game_parent, fruitType.sandia, vec);
                Framework.AddOnClick(mGo_Game, "", OnGame);
            }
            FruitItem fuit = mGo_Game.GetComponentInParent <FruitItem>();

            fuit.getOne().SetActive(true);
            Framework.SetRotate(mGo_Game.transform.parent.gameObject, 5f, true);
            Framework.SetScale(mGo_Game.transform.parent.gameObject);
        }
Ejemplo n.º 12
0
        void setDC()
        {
            // 道场的外环旋转(顺时针,right);
            mGo_DC_parent.transform.localPosition = Vector3.zero;
            GameObject mGo_DC_ring = mGo_DC_parent.transform.FindChild("ring").gameObject;

            Framework.SetRotate(mGo_DC_ring, 10f, false);
            Framework.SetScale(mGo_DC_ring);
            mGo_Rings.Add(mGo_DC_ring);

            // 道场的水果旋转(顺时针,right);
            Vector3 vec = mGo_DC_parent.transform.FindChild("fruitparent").localPosition;

            if (mGo_DC == null)
            {
                mGo_DC = Framework.CreateUIFruit(mGo_DC_parent, fruitType.peach, vec);
                Framework.AddOnClick(mGo_DC, "", OnDC);
            }
            FruitItem fuit = mGo_DC.GetComponentInParent <FruitItem>();

            Framework.SetRotate(mGo_DC.transform.parent.gameObject, 5f, false);
            Framework.SetScale(mGo_DC.transform.parent.gameObject);
        }