Exemplo n.º 1
0
    /// ボタンをクリックした時の処理
    public void OnClick()
    {
        //Debug.Log("Button click!");

        //c = 1;

        // 非表示にする
        //gameObject.SetActive(false);

        // 自分自身を無効化する
        MyCanvas.SetInteractive("Button", false);

        //Cubeを非表示
        MyCanvas.SetActive("unitychan", false);
        MyCanvas.SetActive("robo", false);

        //taichiの表示
        MyCanvas.SetActive("taichi", true);



        // Button2を表示する
        //MyCanvas.SetActive("Button2", true);

        //Button2の有効化
        MyCanvas.SetInteractive("Button2", true);
        MyCanvas.SetInteractive("Button3", true);
    }
Exemplo n.º 2
0
    void OnTouchDown()
    {
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject())
        {
            Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);
            if (hit)
            {
                GameObject obj = hit.collider.gameObject;
                if (hit.collider.gameObject.tag == "Unit")
                {
                    obj.GetComponent <Unit>().OnTouchDown();
                }
                else if (hit.collider.tag == "Untagged")
                {
                    //Debug.Log("よくわからないもの");
                    MyCanvas.SetInteractive("Button", false);
                }
                else if (hit.collider.tag == "Goal")
                {
                    ReturnCanvas.setenableReturnUI(true);
                }
                if (hit.collider.gameObject.tag != "Unit")
                {
                }
            }
            else
            {
                EnemyDataCanvas.Instance.CancelPlate();

                Debug.Log("はずれ");
                MyCanvas.SetInteractive("Button", false);
            }
        }
    }
    void Update()
    {
        Ray ray = Camera.main.ViewportPointToRay(Camera.main.WorldToViewportPoint(myRight2.transform.position));//ScreenPointToRay//WorldToScreenPoint
        //Debug.Log(myRight.transform.position.z);
        //Debug.Log(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100.0f))
        {
            //if (mycolor2 == Color.black)
            //{
            //    Pen2.transform.position = hit.point;// -(ray.direction)*5f; // +hit.nhormal;
            //MyEraser2.transform.position = space2;
            //}


            if (mycolor2 == Color.white)
            {
                MyEraser2.transform.position = hit.point;
                Pen2.transform.position      = space2;
            }
            else
            {
                Pen2.transform.position      = hit.point;// -(ray.direction)*5f; // +hit.nhormal;
                MyEraser2.transform.position = space2;
            }

            //Debug.Log(hit.textureCoord * 256);

            if (myExt2)
            {
                Draw(hit.textureCoord * 256);


                MyCanvas.SetInteractive("Button2", true);
                //Indexpos2.saveflag2 = true;//save可能
                drawflag2 = true;//何か書いた
            }
            else
            {
                beforep2 = Vector2.zero;
            }
            drawTexture.SetPixels(buffer);
            drawTexture.Apply();
            saveTexture2 = drawTexture;
            GetComponent <Renderer>().material.mainTexture = drawTexture;
        }
    }
Exemplo n.º 4
0
    public void OnClick()
    {
        // 自分自身を無効化する
        MyCanvas.SetInteractive("ButtonCharacter", false);

        MyCanvas.SetActive("Panel", true);



        // Buttonを表示する
        //MyCanvas.SetActive("Button", true);

        //Buttonを有効化
        MyCanvas.SetInteractive("Button", true);
        MyCanvas.SetInteractive("Button3", true);
    }
Exemplo n.º 5
0
    public void MyClick()
    {
        //Debug.Log("Button click!");
        // 非表示にする
        //gameObject.SetActive(false);
        MyCanvas.SetInteractive("Buttonyellow", false);

        PaintController.mycolor   = Color.yellow;
        PaintController2.mycolor2 = Color.yellow;

        MyCanvas.SetInteractive("Buttoneraser", true);
        MyCanvas.SetInteractive("Buttonblack", true);
        MyCanvas.SetInteractive("Buttonblue", true);
        MyCanvas.SetInteractive("Buttonred", true);
        MyCanvas.SetInteractive("Buttonsave", true);
        MyCanvas.SetInteractive("Buttonquit", true);
    }
Exemplo n.º 6
0
    void OnTouchDown()
    {
        if (TabManager.Instance.Getisblood())
        {
            return;
        }
        if (InputManager.Instance.IsTouchBegan() && !EventSystem.current.IsPointerOverGameObject())
        {
            Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);
            if (hit)
            {
                GameObject obj = hit.collider.gameObject;
                if (hit.collider.gameObject.tag == "Unit")
                {
                    obj.GetComponent <Unit>().OnTouchDown();
                    //Debug.Log("タッチ");
                    NewCamera.Instance.SetUnitT(0);
                    unitPos = obj.GetComponent <Unit>().getPos();
                    AudioManager.Instance.PlaySe("hitotap.wav");
                    NewCamera.Instance.SetUnitStartPos(NewCamera.Instance.cameraposx);
                    isUnitTouch = true;
                }
                else if (hit.collider.tag == "Untagged")
                {
                    //Debug.Log("よくわからないもの");
                    MyCanvas.SetInteractive("Start", false);
                }
                else if (hit.collider.tag == "Goal")
                {
                    Debug.Log("あたり");
                    EnableReturnUI();
                }
                if (hit.collider.gameObject.tag != "Unit")
                {
                }
            }
            else
            {
                EnemyDataCanvas.Instance.CancelPlate();

                Debug.Log("はずれ");
                MyCanvas.SetInteractive("Start", false);
            }
        }
    }
Exemplo n.º 7
0
    public void OnTouchDown()
    {
        if (TabManager.Instance.Getisblood())
        {
            return;
        }
        Debug.Log("こうんと" + enemyDatas.Count);
        List <EnemyData.EnemyInternalDatas> buf = new List <EnemyData.EnemyInternalDatas>();

        buf = SearchManager.Instance.getSendEnemyDatas();
        if (buf.Count > 1)//初期状態でなければ
        {
            SearchManager.Instance.setEnemyDatas(enemyDatas);
            if (number == SearchManager.Instance.GetEnemyNum())//前と同じものを選択していれば
            {
                //何もしない
            }
            else
            {
                EnemyDataCanvas.Instance.ResetPlate();
                SearchManager.Instance.setEnemyDatas(enemyDatas);
                SearchManager.Instance.setEnemyNUm(number);

                EnemyDataCanvas.Instance.CreatePlate();
            }
        }
        else
        {
            SearchManager.Instance.setEnemyNUm(number);
            SearchManager.Instance.setEnemyDatas(enemyDatas);
            EnemyDataCanvas.Instance.CreatePlate();
        }


        for (int i = 0; i < enemyDatas.Count; i++)
        {
            if (enemyDatas[i].isbattle)
            {
                MyCanvas.SetInteractive("Start", true);
                return;
            }
        }
        MyCanvas.SetInteractive("Start", false);
    }
Exemplo n.º 8
0
    public void OnClick()
    {
        // 自分自身を無効化する
        MyCanvas.SetInteractive("WordButton", false);

        MyCanvas.SetActive("InputField", true);
        MyCanvas.SetActive("send", true);
        MyCanvas.SetActive("Image", true);
        //MyCanvas.SetActive("ButtonCharactor", true);


        MyCanvas.SetActive("Panel", false);



        //Buttonを有効化
        MyCanvas.SetActive("ButtonCharacter", true);



        // Buttonを表示する
        //MyCanvas.SetActive("Button", true);
    }
Exemplo n.º 9
0
    void Update()
    {
        Frame frame = m_Provider.CurrentFrame;

        //keysave
        //if (Input.GetKey(KeyCode.S)&&saveflag==true)
        //{
        //    if (!PaintController.drawflag)
        //    {
        //        Debug.Log("draw");

        //    }
        //    else
        //    {
        //        Debug.Log("Save");

        //        //ScreenCapture.CaptureScreenshot(Application.dataPath + "/savedata.PNG");


        //        //start
        //        Texture2D tex = PaintController.saveTexture;

        //        byte[] pngData = tex.EncodeToPNG();   // pngのバイト情報を取得.

        //        MyCanvas.SetInteractive("Button2", false);

        //        //string now = DateTime.Now.ToString("HHmmss");
        //        //File.WriteAllBytes("C:/Users/sens/Desktop/leapmotion_2017_3 _2/Assets/output_image/" + now + ".png", pngData);

        //        string savename = savenum.ToString();
        //        File.WriteAllBytes("C:/Users/sens/Desktop/leapmotion_2017_3 _2/Assets/output_image/" + savename + ".png", pngData);

        //        saveflag =false;

        //        savenum++;
        //        if (savenum > 20) {
        //            savenum = 1;
        //        }

        //        SceneManager.LoadScene("opening");

        //    }
        //}



        //framecount++;
        //if (framecount <= 5)
        //{
        //    return;
        //}
        //else {
        //    framecount = 0;
        //}

        //// 右手を取得する
        //Hand rightHand = null;
        //foreach (Hand hand in frame.Hands)
        //{
        //    if (hand.IsRight)
        //    {
        //        Debug.Log("find right hand");
        //        rightHand = hand;
        //        break;
        //    }
        //}
        ////左手取得
        //Hand leftHand = null;
        //foreach (Hand hand in frame.Hands)
        //{
        //    if (hand.IsLeft)
        //    {
        //        Debug.Log("find l hand");
        //        leftHand = hand;
        //        break;
        //    }
        //}
        //if (rightHand == null && leftHand == null)
        //{
        //    return;
        //}

        // 右手を取得する
        Hand rightHand = null;
        //左手取得
        Hand leftHand = null;

        foreach (Hand hand in frame.Hands)
        {
            if (hand.IsRight)
            {
                Debug.Log("find right hand");
                rightHand = hand;
                break;
            }

            if (hand.IsLeft)
            {
                Debug.Log("find l hand");
                leftHand = hand;
                break;
            }
        }

        if (rightHand == null && leftHand == null)
        {
            return;
        }
        if (rightHand == null)
        {
            rightHand = leftHand;
        }

        if (rightHand != null)
        {
            if (rightHand.Fingers[0].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR1", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR1", true);
            }
            if (rightHand.Fingers[1].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR2", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR2", true);
            }
            if (rightHand.Fingers[2].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR3", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR3", true);
            }
            if (rightHand.Fingers[3].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR4", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR4", true);
            }
            if (rightHand.Fingers[4].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR5", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR5", true);
            }


            Vector3 touchScreenPosition = rightHand.StabilizedPalmPosition.ToVector3();//rightHand.PalmPosition.ToVector3(); //rightHand.Fingers[1].bones[3].NextJoint.ToVector3();



            //Debug.Log("x"+touchScreenPosition.x+"z"+ touchScreenPosition.z);

            //touchScreenPosition.x = (touchScreenPosition.x+0.1f)/0.2f * Screen.width;
            //touchScreenPosition.z = (touchScreenPosition.z-0.2f)/0.2f * Screen.height;


            //touchScreenPosition.x = Mathf.Clamp(touchScreenPosition.x, 0f, Screen.width);
            //touchScreenPosition.y = Mathf.Clamp(touchScreenPosition.z, 0f, Screen.height);
            ////touchScreenPosition.y = Screen.height - touchScreenPosition.y;

            //touchScreenPosition.z = 1.0f;

            //Camera gameCamera = Camera.main;
            //Vector3 touchWorldPosition = gameCamera.ScreenToWorldPoint(touchScreenPosition);


            //PaintController.myExt = rightHand.Fingers[0].IsExtended & rightHand.Fingers[1].IsExtended & rightHand.Fingers[2].IsExtended & rightHand.Fingers[3].IsExtended & rightHand.Fingers[4].IsExtended;
            if (Convert.ToInt32(rightHand.Fingers[0].IsExtended) + Convert.ToInt32(rightHand.Fingers[1].IsExtended) + Convert.ToInt32(rightHand.Fingers[2].IsExtended) + Convert.ToInt32(rightHand.Fingers[3].IsExtended) + Convert.ToInt32(rightHand.Fingers[4].IsExtended) <= 2)
            {
                PaintController.myExt = true;
            }
            else
            {
                PaintController.myExt = false;
            }

            //右手どれか開き
            //Debug.Log(touchScreenPosition);
            m_object.transform.position = touchScreenPosition;//touchWorldPosition;
        }


        //if (leftHand != null && !(leftHand.Fingers[0].IsExtended || leftHand.Fingers[1].IsExtended || leftHand.Fingers[2].IsExtended || leftHand.Fingers[3].IsExtended || leftHand.Fingers[4].IsExtended))
        //{//左手全部閉じ
        //    PaintController.mycolor = Color.white;
        //    PaintController.paintsize = 8;
        //    MyCanvas.SetInteractive("Button", false);

        //}
        //else
        //{
        //    PaintController.mycolor = Color.black;
        //    PaintController.paintsize = 5;
        //    MyCanvas.SetInteractive("Button", true);
        //}

        //save
        //if (/*PaintController.drawflag &&*/ saveflag && leftHand!=null && (!(leftHand.Fingers[0].IsExtended) & leftHand.Fingers[1].IsExtended & leftHand.Fingers[2].IsExtended & !(leftHand.Fingers[3].IsExtended) & !(leftHand.Fingers[4].IsExtended))) {

        //    if (!PaintController.drawflag)
        //    {
        //        Debug.Log("draw");

        //    }
        //    else
        //    {
        //        Debug.Log("Save");

        //        //ScreenCapture.CaptureScreenshot(Application.dataPath + "/savedata.PNG");


        //        //start
        //        Texture2D tex = PaintController.saveTexture;

        //        byte[] pngData = tex.EncodeToPNG();   // pngのバイト情報を取得.

        //        MyCanvas.SetInteractive("Button2", false);

        //        string now = DateTime.Now.ToString("HHmmss");
        //        File.WriteAllBytes("C:/Users/sens/Desktop/leapmotion_2017_3 _2/Assets/output_image/" + now + ".png", pngData);
        //        saveflag = false;
        //    }
        //}
    }
Exemplo n.º 10
0
    void Update()
    {
        Frame frame = m_Provider.CurrentFrame;


        // 右手を取得する
        Hand rightHand = null;
        //左手取得
        Hand leftHand = null;

        foreach (Hand hand in frame.Hands)
        {
            if (hand.IsRight)
            {
                Debug.Log("find right hand");
                rightHand = hand;
                break;
            }

            if (hand.IsLeft)
            {
                Debug.Log("find l hand");
                leftHand = hand;
                break;
            }
        }

        if (rightHand == null && leftHand == null)
        {
            return;
        }
        if (rightHand == null)
        {
            rightHand = leftHand;
        }

        if (rightHand != null)
        {
            if (rightHand.Fingers[0].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR1", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR1", true);
            }
            if (rightHand.Fingers[1].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR2", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR2", true);
            }
            if (rightHand.Fingers[2].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR3", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR3", true);
            }
            if (rightHand.Fingers[3].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR4", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR4", true);
            }
            if (rightHand.Fingers[4].IsExtended)
            {
                MyCanvas.SetInteractive("ButtonR5", false);
            }
            else
            {
                MyCanvas.SetInteractive("ButtonR5", true);
            }


            Vector3 touchScreenPosition = rightHand.StabilizedPalmPosition.ToVector3();//rightHand.PalmPosition.ToVector3(); //rightHand.Fingers[1].bones[3].NextJoint.ToVector3();



            //PaintController2.myExt2 = rightHand.Fingers[0].IsExtended & rightHand.Fingers[1].IsExtended & rightHand.Fingers[2].IsExtended & rightHand.Fingers[3].IsExtended & rightHand.Fingers[4].IsExtended;
            if (Convert.ToInt32(rightHand.Fingers[0].IsExtended) + Convert.ToInt32(rightHand.Fingers[1].IsExtended) + Convert.ToInt32(rightHand.Fingers[2].IsExtended) + Convert.ToInt32(rightHand.Fingers[3].IsExtended) + Convert.ToInt32(rightHand.Fingers[4].IsExtended) <= 2)
            {
                PaintController2.myExt2 = true;
            }
            else
            {
                PaintController2.myExt2 = false;
            }

            //右手どれか開き
            //Debug.Log(touchScreenPosition);
            m_object.transform.position = touchScreenPosition;//touchWorldPosition;
        }
    }