// Update is called once per frame
    void Update()
    {
        Point2D          gazeCoords = GazeDataValidator.Instance.GetLastValidSmoothedGazeCoordinates();
        GraphicRaycaster gr         = this.GetComponent <GraphicRaycaster>();
        //Current pointer position
        PointerEventData point = new PointerEventData(null);

        if (!Global.useMouse)
        {
            Point2D gp = UnityGazeUtils.GetGazeCoordsToUnityWindowCoords(gazeCoords);
            point.position = new Vector3((float)gp.X, (float)gp.Y, CamaraPosition.nearClipPlane + 1f);
        }

        else
        {
            point.position = Input.mousePosition;
        }
        //result will contain all of the hit canvas
        List <RaycastResult> results = new List <RaycastResult> ();

        gr.Raycast(point, results);


        if (results.Count > 0)
        {
            for (int i = 0; i < results.Count; i++)
            {
                if (results [i].gameObject.name == "menu")
                {
                    text.color = Color.blue;
                    if (delay > waitTime)
                    {
                        try{
                            if (KeyboardManager.keyboardManager.getText() != "")
                            {
                                SavePoints.pointsInstance.Save(new PlayerPoints(KeyboardManager.keyboardManager.getText(), Global.points));
                                KeyboardManager.keyboardManager.setText("");
                                SceneManager.LoadScene("MainMenu");
                            }
                        } catch (System.Exception e) {
                            SceneManager.LoadScene("MainMenu");
                        }
                    }
                    else
                    {
                        delay += Time.deltaTime;
                    }
                }
                else
                {
                    text.color = Color.white;
                }
                if (results [i].gameObject.name == "keyboard")
                {
                    if (delay > waitTime)
                    {
                        SceneManager.LoadScene("Keyboard");
                    }
                    else
                    {
                        delay += Time.deltaTime;
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     _throwAlcohol     = FindObjectOfType <ThrowAlcohol>();
     _canvas           = GetComponentInParent <Canvas>();
     _graphicRaycaster = GetComponentInParent <GraphicRaycaster>();
 }
Exemplo n.º 3
0
    int mouseTimeGradeCount = 10; // mouseTimeGrade가 GradeCount를 넘어서면 이동이 빨라짐.

    IEnumerator ButtonTouched()
    {
        bool touched = false; // Touch 시작 여부 체크.

        gr  = mycanvas.GetComponent <GraphicRaycaster>();
        ped = new PointerEventData(null);
        while (true)
        {
            if (Input.touchCount > 0)
            {
                touched = true;
                //Debug.Log(Input.touchCount);
                for (int i = 0; i < Input.touchCount; i++)
                {
                    List <RaycastResult> results = TouchedObjs(i);
                    if (results != null && results.Count > 0)
                    {
                        switch (System.Convert.ToInt32(tempTouch.phase))
                        {
                        case 0:
                            MoveButtonCheck(results);
                            if (PuzzleManager.instance.cursor.GetComponent <CursorController>().ready == true)
                            {
                                MarkButtonCheck(results);
                            }
                            break;

                        case 1:
                        case 2:
                            if (mouseTime > mouseFirstTime)
                            {
                                MoveButtonCheck(results);
                            }
                            else
                            {
                                mouseTime += 0.01f;
                            }
                            if (PuzzleManager.instance.cursor.GetComponent <CursorController>().ready == true)
                            {
                                MarkButtonCheck(results);
                            }
                            break;

                        case 3:    //TouchPhase.End
                                   //Debug.Log(results[0].gameObject.name);
                            if (results[0].gameObject.tag == "MoveBtn")
                            {
                                mouseTimeGrade = 0; mouseTime += 0.01f;
                            }
                            else if (results[0].gameObject.name == "Btn_Hint")
                            {
                                HintButtonClicked();
                            }
                            else
                            {
                                MarkButtonOutCheck(results);
                            }
                            break;
                        }
                    }
                }
                if (Input.touchCount == 1)
                {
                    List <RaycastResult> results = TouchedObjs(0);
                    if (results.Count > 0)
                    {
                        if (results[0].gameObject.tag == "CheckBtn")
                        {
                            mouseTimeGrade = 0; mouseTime = 0;
                        }
                        else
                        {
                            MarkButtonOutCheck(results);
                        }
                    }
                }
            }
            else
            {
                mouseTimeGrade = 0;
                mouseTime      = 0;
                checkTime      = 0;
                PuzzleManager.instance.cursor.GetComponent <CursorController>().CheckOut();
                if (touched == true)
                {
                    touched = false;
                }
            }
            yield return(null);
        }
    }
Exemplo n.º 4
0
    private void Start()
    {
        gr = GetComponentInParent <GraphicRaycaster>();

        SmashCSS.instance.ShowCharacterInSlot(0, null);
    }
 private void Start()
 {
     m_Raycaster = canvas.GetComponent <GraphicRaycaster>();
 }
Exemplo n.º 6
0
 // Use this for initialization
 private void Start()
 {
     DontDestroyOnLoad(gameObject);
     graphicRaycaster = gameObject.AddComponent <GraphicRaycaster>();
 }
Exemplo n.º 7
0
    public Sprite[] characterBackgrounds;   //Array with the character backgrounds

    // Start is called before the first frame update
    void Start()
    {
        //Obtain the Canvas' Raycaster and EventSystem Components
        rc          = GetComponent <GraphicRaycaster>();
        eventSystem = GetComponent <EventSystem>();
    }
Exemplo n.º 8
0
        void InitializeCanvas()
        {
            if (VERBOSE)
            {
                Debug.Log("Started canvas initialization in " + id);
            }

            GameObject canvasGameObject = new GameObject("UIScreenSpace");

            canvasGameObject.layer = LayerMask.NameToLayer("UI");
            canvasGameObject.transform.SetParent(scene.GetSceneTransform());
            canvasGameObject.transform.ResetLocalTRS();

            // Canvas
            canvas            = canvasGameObject.AddComponent <Canvas>();
            canvas.renderMode = RenderMode.ScreenSpaceOverlay;

            // Canvas Scaler (for maintaining ui aspect ratio)
            CanvasScaler canvasScaler = canvasGameObject.AddComponent <CanvasScaler>();

            canvasScaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            canvasScaler.referenceResolution = new Vector2(1280f, 720f);
            canvasScaler.matchWidthOrHeight  = 1f; // Match height, recommended for landscape projects

            // Graphics Raycaster (for allowing touch/click input on the ui components)
            graphicRaycaster = canvasGameObject.AddComponent <GraphicRaycaster>();

            canvas.sortingOrder = -1;

            // We create a middleman-gameobject to change the size of the parcel-devs accessible canvas, to have its bottom limit at the taskbar height, etc.
            GameObject resizedPanel = new GameObject("ResizeUIArea");

            resizedPanel.AddComponent <CanvasRenderer>();
            childHookRectTransform = resizedPanel.AddComponent <RectTransform>();
            childHookRectTransform.SetParent(canvas.transform);
            childHookRectTransform.ResetLocalTRS();

            childHookRectTransform.anchorMin = Vector2.zero;
            childHookRectTransform.anchorMax = new Vector2(1, 0);

            // We scale the panel downwards to subtract the viewport's top 10%
            float canvasHeight = canvasScaler.referenceResolution.y;

            childHookRectTransform.pivot = new Vector2(0.5f, 0f);
            float canvasSubtraction = canvasHeight * UISettings.RESERVED_CANVAS_TOP_PERCENTAGE / 100;

            childHookRectTransform.sizeDelta = new Vector2(0, canvasHeight - canvasSubtraction);

            // We scale the panel upwards to subtract the viewport's bottom 5% for Decentraland's taskbar
            canvasHeight = childHookRectTransform.sizeDelta.y;
            childHookRectTransform.pivot            = new Vector2(0.5f, 1f);
            childHookRectTransform.anchoredPosition = new Vector3(0, canvasHeight, 0f);
            childHookRectTransform.sizeDelta        = new Vector2(0, canvasHeight - canvasSubtraction / 2);

            // Canvas group
            canvasGroup                = canvas.gameObject.AddComponent <CanvasGroup>();
            canvasGroup.alpha          = 0f; // Alpha will be updated later when the player enters this scene
            canvasGroup.blocksRaycasts = false;

            if (VERBOSE)
            {
                Debug.Log("canvas initialized, width: " + childHookRectTransform.rect.width);
                Debug.Log("canvas initialized, height: " + childHookRectTransform.rect.height);
            }

            if (DCLCharacterController.i != null)
            {
                OnCharacterMoved(DCLCharacterController.i.characterPosition);
            }

            if (VERBOSE)
            {
                Debug.Log("Finished canvas initialization in " + id);
            }

            if (!scene.isPersistent)
            {
                UpdateCanvasVisibility();
            }
        }
Exemplo n.º 9
0
 void Awake()
 {
     mGray = GameObject.Find("Canvas").GetComponent <GraphicRaycaster>();
 }
Exemplo n.º 10
0
    void FixedUpdate()
    {
        HPText.text    = "HP  " + Mathf.Ceil(ba.Ability.HP) + "/" + ba.Ability.MaxHP;
        rect.sizeDelta = new Vector2(ba.Ability.HP / ba.Ability.MaxHP * MaxW, rect.sizeDelta.y);

        //角色死亡处理
        DieScreen.SetActive(ba.Recovery);
        if (ba.Recovery)
        {
            return;
        }

        bool ExV = (GameConfig.ExS != "");

        ExBar.SetActive(ExV); ExSkill.SetActive(ExV);
        if (GameConfig.ExS != lSkill && ExV)
        {
            lSkill = GameConfig.ExS;
            SkillManager.Skill s = SkillManager.S.Find(m => m.Name == GameConfig.ExS);
            s.CD /= 5;
            ExSkill.GetComponent <MSBC>().s = s;
            ExSkill.GetComponent <MSBC>().ReLoad();
        }

        //Role Switcher
        if (Input.GetKeyUp(KeyCode.Q) || GameConfig.IsTouched(Switcher))
        {
            ControlRole = (ControlRole == 0) ? 1 : 0;
            RPGEvent rpg = GameConfig.Controller.GetComponent <RPGEvent>();
            GameConfig.Followers[0].character = rpg.character;
            GameConfig.Followers[0].Confirm();
            rpg.character = TeamController.Team.Mem[ControlRole].Name;
            rpg.Reload();
            if (ControlRole == 0)
            {
                Ability2 = ba.Ability;
            }
            if (ControlRole == 1)
            {
                Ability1 = ba.Ability;
            }
            Reset();
            SkillManager.PlaySkillAni(GameConfig.Controller.transform.localPosition,
                                      "Interactive\\Stars\\StarExplosion");
        }

        //Touch Hander
        foreach (Touch t in Input.touches)
        {
            if (t.phase == TouchPhase.Ended)
            {
                GraphicRaycaster gr   = this.GetComponent <GraphicRaycaster>();
                PointerEventData data = new PointerEventData(EventSystem.current);
                data.pressPosition = t.position;
                data.position      = t.position;
                List <RaycastResult> results = new List <RaycastResult>();
                gr.Raycast(data, results);

                GameConfig.TouchAt.Clear();
                foreach (RaycastResult rr in results)
                {
                    GameConfig.TouchAt.Add(rr.gameObject);
                }
            }
        }
    }
 void Start()
 {
     // Cache our GraphicRaycaster and EventSystem components. We're going to need them.
     m_Raycaster   = GetComponent <GraphicRaycaster>();
     m_EventSystem = GetComponent <EventSystem>();
 }
Exemplo n.º 12
0
        void Init(CountersData data)
        {
            _audioTimeSync = data.AudioTimeSyncController;
            length         = _audioTimeSync.songLength;
            if (settings.Mode == ICounterMode.Original)
            {
                Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
                TextHelper.CreateText(out _timeMesh, position + new Vector3(-0.25f, 0.25f, 0));
                _timeMesh.text     = settings.ProgressTimeLeft ? $"{Math.Floor(length / 60):N0}:{Math.Floor(length % 60):00}" : "0:00";
                _timeMesh.fontSize = 4;
                _timeMesh.color    = Color.white;
                _timeMesh.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
                _timeMesh.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);

                var image = ReflectionUtil.GetPrivateField <Image>(
                    Resources.FindObjectsOfTypeAll <ScoreMultiplierUIController>().First(), "_multiplierProgressImage");

                GameObject g      = new GameObject();
                Canvas     canvas = g.AddComponent <Canvas>();
                canvas.renderMode = RenderMode.WorldSpace;
                CanvasScaler cs = g.AddComponent <CanvasScaler>();
                cs.scaleFactor          = 10.0f;
                cs.dynamicPixelsPerUnit = 10f;
                GraphicRaycaster gr = g.AddComponent <GraphicRaycaster>();
                g.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1f);
                g.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 1f);

                GameObject g2 = new GameObject();
                _image = g2.AddComponent <Image>();
                g2.transform.parent = g.transform;
                g2.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0.5f);
                g2.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0.5f);
                g2.transform.localScale = new Vector3(2.3f, 2.3f, 2.3f);

                _image.sprite        = image.sprite;
                _image.type          = Image.Type.Filled;
                _image.fillMethod    = Image.FillMethod.Radial360;
                _image.fillOrigin    = (int)Image.Origin360.Top;
                _image.fillClockwise = true;


                GameObject g3 = new GameObject();
                var        bg = g3.AddComponent <Image>();
                g3.transform.parent = g.transform;
                g3.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0.5f);
                g3.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0.5f);
                g3.transform.localScale = new Vector3(2.3f, 2.3f, 2.3f);

                bg.sprite = image.sprite;
                bg.CrossFadeAlpha(0.05f, 1f, false);

                g.GetComponent <RectTransform>().SetParent(this.transform, false);
                g.transform.localPosition = new Vector3(-0.25f, .25f, 0f);
                transform.position       += new Vector3(0.5f, 0, 0);
                _image.fillAmount         = (settings.ProgressTimeLeft && settings.IncludeRing) ? 1 : 0;
            }
            else if (settings.Mode == ICounterMode.Percent)
            {
                Vector3 position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
                TextHelper.CreateText(out _timeMesh, position);
                _timeMesh.text      = settings.ProgressTimeLeft ? "100%" : "0.00%";
                _timeMesh.fontSize  = 4;
                _timeMesh.color     = Color.white;
                _timeMesh.alignment = TextAlignmentOptions.Center;
            }
            transform.position = CountersController.DeterminePosition(gameObject, settings.Position, settings.Distance);
            if (GameObject.Find("SongProgressPanel") != null && settings.Mode != ICounterMode.BaseGame)
            {
                Destroy(GameObject.Find("SongProgressPanel"));
            }
            StartCoroutine(SecondTick());
        }
Exemplo n.º 13
0
 public TowerSelector(Camera camera, GraphicRaycaster graphicRaycaster)
 {
     _camera           = camera;
     _graphicRaycaster = graphicRaycaster;
 }
Exemplo n.º 14
0
 private void Start()
 {
     gr = GetComponent <GraphicRaycaster>();
 }
Exemplo n.º 15
0
        /// <summary>
        /// Returns if objects at the given RectTransform are interactable.
        /// This will check both for Raycasts and for Interactable on CanvasGroups.
        /// </summary>
        static public bool IsPointerInteractable(this RectTransform inRectTransform)
        {
            if (!inRectTransform.gameObject.activeInHierarchy)
            {
                return(false);
            }

            Graphic graphic = inRectTransform.GetComponent <Graphic>();

            if (!ReferenceEquals(graphic, null) && !graphic.raycastTarget)
            {
                return(false);
            }

            List <Component> components = s_CachedComponentList ?? (s_CachedComponentList = new List <Component>(8));
            Component        c;

            Transform t = inRectTransform;
            bool      bIgnoreParentGroups = false;
            bool      bRaycastValid       = true;
            bool      bContinueTraversal  = true;

            while (t != null)
            {
                t.GetComponents(components);
                for (int i = 0, len = components.Count; i < len; ++i)
                {
                    c = components[i];

                    Canvas canvas = c as Canvas;
                    if (!ReferenceEquals(canvas, null) && canvas.overrideSorting)
                    {
                        bRaycastValid      = canvas.enabled;
                        bContinueTraversal = false;
                        continue;
                    }

                    GraphicRaycaster raycaster = c as GraphicRaycaster;
                    if (!ReferenceEquals(raycaster, null) && !raycaster.enabled)
                    {
                        bContinueTraversal = false;
                        bRaycastValid      = false;
                        break;
                    }

                    CanvasGroup group = c as CanvasGroup;
                    if (!ReferenceEquals(group, null) && !bIgnoreParentGroups)
                    {
                        bIgnoreParentGroups = group.ignoreParentGroups;
                        bRaycastValid       = group.interactable && group.blocksRaycasts;
                        if (!bRaycastValid)
                        {
                            bContinueTraversal = false;
                            break;
                        }
                    }

                    Selectable selectable = c as Selectable;
                    if (!ReferenceEquals(selectable, null) && !selectable.interactable)
                    {
                        bRaycastValid      = false;
                        bContinueTraversal = false;
                        break;
                    }
                }

                t = bContinueTraversal ? t.parent : null;
            }

            components.Clear();
            return(bRaycastValid);
        }
Exemplo n.º 16
0
 void Awake()
 {
     paneTransform = GetComponent <RectTransform>();
     raycaster     = GetComponentInParent <GraphicRaycaster>();
     system        = GetComponentInParent <EventSystem>();
 }
Exemplo n.º 17
0
    private void Start()
    {
        // 컴포넌트 불러오기
        m_Net = GameObject.Find("NetManager").GetComponent <InitNetManager>();
        m_gr  = GameObject.Find("UI_canvas").GetComponent <GraphicRaycaster>();
        ped   = new PointerEventData(null);

        // 숨기기 및 잠금
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
        mouseOut         = false;

        // 방 날씨 설정

        // - 낮
        if (m_Net.m_weather == "Morning")
        {
            // 텍스쳐 변경
            GameObject.Find("SkyDome").GetComponent <MeshRenderer>().material.mainTexture = m_Morning;
            m_light.color     = new Color32(248, 198, 158, 255);
            m_weather_passive = -1;
        }

        // - 저녁
        if (m_Net.m_weather == "Evening")
        {
            // 텍스쳐 변경
            GameObject.Find("SkyDome").GetComponent <MeshRenderer>().material.mainTexture = m_Evening;
            m_light.color     = new Color32(255, 28, 0, 255);
            m_weather_passive = 0;
        }

        // - 밤/새벽
        if (m_Net.m_weather == "Dawn")
        {
            // 텍스쳐 변경
            GameObject.Find("SkyDome").GetComponent <MeshRenderer>().material.mainTexture = m_Dawn;
            m_light.color     = new Color32(82, 2, 142, 255);
            m_weather_passive = 1;
        }

        // 아이템 생성
        for (int i = 0; i < 5; ++i)
        {
            var new_Item = (GameObject)Instantiate(m_Item_Prefabs, new Vector3(m_Net.m_items_x[i], m_Net.m_items_y[i], m_Net.m_items_z[i]), Quaternion.identity);
            new_Item.name = "Item_num/" + (i + 1); // 오브젝트 이름 설정
        }

        // 플레이어 UI 설정
        if (m_Net.m_team_num % 2 == 0)                                                                                                             // 루비
        {
            GameObject.Find("character_img").transform.GetComponent <Image>().sprite = m_R_UI_chr_imgs[m_Net.r_chr_num[m_Net.m_team_num - 1] - 1]; // 오브젝트 캐릭터 이미지 설정
        }
        if (m_Net.m_team_num % 2 == 1)                                                                                                             // 사파이어
        {
            GameObject.Find("character_img").transform.GetComponent <Image>().sprite = m_S_UI_chr_imgs[m_Net.r_chr_num[m_Net.m_team_num - 1] - 1]; // 오브젝트 캐릭터 이미지 설정
        }
        // 플레이어 생성
        for (int i = 0; i < 4; ++i)
        {
            // 본인 플레이어 생성
            if (m_Net.m_team_num == i + 1)
            {
                var new_Player = (GameObject)Instantiate(m_user_Character_Prefabs[m_Net.r_chr_num[i] - 1], UnityEngine.Vector3.zero, Quaternion.identity);
                new_Player.name = "Team_num/" + (i + 1);                                                                         // 오브젝트 이름 설정
                new_Player.transform.localPosition = new UnityEngine.Vector3(m_Net.r_posX[i], m_Net.r_posY[i], m_Net.r_posZ[i]); // 오브젝트 위치 설정
                new_Player.transform.eulerAngles   = new UnityEngine.Vector3(m_Net.r_rotX[i], m_Net.r_rotY[i], m_Net.r_rotZ[i]); // 오브젝트 방향 설정

                // 플레이어 팀 circle 설정
                if ((i + 1) % 2 == 0) // 루비
                {
                    new_Player.transform.GetChild(2).GetComponent <MeshRenderer>().material = m_R_Circle;
                    m_Net.max_hp = 120; // 루비팀 특성상 최대 체력 상승
                }

                if ((i + 1) % 2 == 1) // 사파이어
                {
                    new_Player.transform.GetChild(2).GetComponent <MeshRenderer>().material = m_S_Circle;
                    m_Net.max_hp = 100; // 사파이어 체력
                }
            }
            // 그 외 플레이어 생성
            else
            {
                var new_Player = (GameObject)Instantiate(m_other_Character_Prefabs[m_Net.r_chr_num[i] - 1], UnityEngine.Vector3.zero, Quaternion.identity);
                new_Player.name = "Team_num/" + (i + 1);                                                                         // 오브젝트 이름 설정
                new_Player.transform.localPosition = new UnityEngine.Vector3(m_Net.r_posX[i], m_Net.r_posY[i], m_Net.r_posZ[i]); // 오브젝트 위치 설정
                new_Player.transform.eulerAngles   = new UnityEngine.Vector3(m_Net.r_rotX[i], m_Net.r_rotY[i], m_Net.r_rotZ[i]); // 오브젝트 방향 설정

                // 플레이어 팀 circle 설정
                if ((i + 1) % 2 == 0) // 루비
                {
                    new_Player.transform.GetChild(2).GetComponent <MeshRenderer>().material = m_R_Circle;
                }

                if ((i + 1) % 2 == 1) // 사파이어
                {
                    new_Player.transform.GetChild(2).GetComponent <MeshRenderer>().material = m_S_Circle;
                }
            }
        }

        // 플레이어 입력 컴포넌트 연결
        m_Net.playerInput = GameObject.Find("Team_num/" + m_Net.m_team_num).GetComponent <PlayerInput>();

        // 날씨 영향 시작
        StartCoroutine(Weather_Passive());

        if (m_Net.new_player) // 도중 입장 플레이어의 경우
        {
            // 임시 플레이어 컨트롤 잠금
            GameObject.Find("Team_num/" + m_Net.m_team_num).GetComponent <PlayerController>().Dead = true;

            // 본인의 색깔 변경
            GameObject.Find("Team_num/" + m_Net.m_team_num).GetComponent <PlayerController>().transform.GetChild(0).GetComponent <SkinnedMeshRenderer>().material.SetColor("_Color", new Color32(255, 215, 100, 255));

            // 무적 5초 후 해제
            GameObject.Find("Team_num/" + m_Net.m_team_num).GetComponent <ResponsePlayer>().FirstResponse();

            // 타이머 시작 및 업데이트
            if (m_Net.new_Sec < 10)
            {
                GameObject.Find("Time_text").GetComponent <Text>().text = m_Net.new_Min + " : 0" + ((int)m_Net.new_Sec - 4); // 카운터 만큼 제거
            }
            else
            {
                GameObject.Find("Time_text").GetComponent <Text>().text = m_Net.new_Min + " : " + ((int)m_Net.new_Sec - 4); // 카운터 만큼 제거
            }

            GameObject.Find("Time_text").GetComponent <timer>().GetTimerStart(m_Net.new_Min, m_Net.new_Sec);

            // 팀 점수 업데이트
            if (m_Net.new_S_score < 10)
            {
                GameObject.Find("Sapphire_Score_text").GetComponent <Text>().text = "0" + m_Net.new_S_score.ToString();
            }
            else
            {
                GameObject.Find("Sapphire_Score_text").GetComponent <Text>().text = m_Net.new_S_score.ToString();
            }

            if (m_Net.new_R_score < 10)
            {
                GameObject.Find("Ruby_Score_text").GetComponent <Text>().text = "0" + m_Net.new_R_score.ToString();
            }
            else
            {
                GameObject.Find("Ruby_Score_text").GetComponent <Text>().text = m_Net.new_R_score.ToString();
            }
        }
        else // 그 외 일반 플레이어
        {
            // 게임 시작 호출
            m_Net.GameStart();
        }
    }
Exemplo n.º 18
0
        public void CreateButtons()
        {
            float scale = 0.001f;

            Cleanup();

            GameObject canvasObject = new GameObject();

            canvas              = canvasObject.AddComponent <Canvas>();
            canvas.renderMode   = RenderMode.WorldSpace;
            canvas.pixelPerfect = false;
            SuperController.singleton.AddCanvas(canvas);

            canvas.transform.SetParent(SuperController.singleton.mainHUD, false);

            CanvasScaler cs = canvasObject.AddComponent <CanvasScaler>();

            cs.scaleFactor          = 80.0f;
            cs.dynamicPixelsPerUnit = 1f;

            GraphicRaycaster gr = canvasObject.AddComponent <GraphicRaycaster>();

            canvas.transform.localScale = new Vector3(scale, scale, scale);
            //canvas.transform.localPosition = new Vector3(-0.7f, 0, 0);

            canvas.transform.localPosition = new Vector3(-.45f, -0.72f, 0.35f);

            LookAtCamera();

            int startingColumn = 0;

            if (IS_AUTOMATE_VERSION.IS_AUTOMATE)
            {
                startingColumn = 2;
            }

            hipCycleForceButton = AddButton("Thrust When Aroused", () =>
            {
                if (!hasCycleForce)
                {
                    wantToCreateHipCycleForce = true;
                }
                else
                {
                    wantToRemoveHipCycleForce = true;
                }
            }, startingColumn, 1);

            penisButton = AddButton("Create Penis", () =>
            {
                if (hasPenis)
                {
                    if (animatingPenis)
                    {
                        wantToRemovePenis = true;
                        animatingPenis    = false;
                    }
                    else
                    {
                        wantToAnimatePenis = true;
                    }
                }
                else
                {
                    wantToCreatePenis = true;
                }
            }, startingColumn, 0);


            rotatePenisButton = AddButton("Rotate Penis", () =>
            {
                wantToRotatePenis = true;
            }, startingColumn + 1, 0);
            rotatePenisButton.gameObject.SetActive(false);

            CheckButtonNames();

            canvas.transform.Translate(0, 0.2f, 0);
        }
Exemplo n.º 19
0
    public GameObject currentObjectHit; // The current object we are hitting.

    // Start is called before the first frame update
    void Start()
    {
        m_Raycaster = GetComponent <GraphicRaycaster>();
    }
Exemplo n.º 20
0
        protected virtual void BuildUp(GameObject editor)
        {
            editor.AddComponent <GLRenderer>();

            GameObject ui = new GameObject("UI");

            ui.transform.SetParent(editor.transform);

            Canvas canvas = ui.AddComponent <Canvas>();

            if (IsVR)
            {
                canvas.renderMode  = RenderMode.WorldSpace;
                canvas.worldCamera = Camera.main;
            }
            else
            {
                canvas.renderMode    = RenderMode.ScreenSpaceCamera;
                canvas.worldCamera   = Camera.main;
                canvas.planeDistance = Camera.main.nearClipPlane + 0.01f;
            }

            canvas.sortingOrder = short.MinValue;

            GameObject scene = new GameObject("SceneWindow");

            scene.transform.SetParent(ui.transform, false);

            RuntimeWindow sceneView = scene.AddComponent <RuntimeWindow>();

            sceneView.IsPointerOver = true;
            sceneView.WindowType    = RuntimeWindowType.Scene;
            if (Camera.main == null)
            {
                GameObject camera = new GameObject();
                camera.name      = "RTE SceneView Camera";
                sceneView.Camera = camera.AddComponent <Camera>();
            }
            else
            {
                sceneView.Camera = Camera.main;
            }

            EventSystem eventSystem = FindObjectOfType <EventSystem>();

            if (eventSystem == null)
            {
                eventSystem = editor.AddComponent <EventSystem>();
                if (IsVR)
                {
                    //
                }
                else
                {
                    editor.AddComponent <StandaloneInputModule>();
                }
            }

            RectTransform rectTransform = sceneView.GetComponent <RectTransform>();

            if (rectTransform != null)
            {
                RectTransform parentTransform = rectTransform.parent as RectTransform;
                if (parentTransform != null)
                {
                    rectTransform.anchorMin = new Vector2(0, 0);
                    rectTransform.anchorMax = new Vector2(1, 1);
                    rectTransform.pivot     = new Vector2(0.5f, 0.5f);
                    rectTransform.offsetMax = new Vector2(0, 0);
                    rectTransform.offsetMin = new Vector2(0, 0);
                }
            }

            if (IsVR)
            {
                gameObject.AddComponent <VRTracker>();
            }
            else
            {
                m_raycaster = ui.AddComponent <GraphicRaycaster>();
            }
            m_eventSystem = eventSystem;
        }
Exemplo n.º 21
0
 void Awake()
 {
     _raycaster = GetComponent <GraphicRaycaster>();
     // _eventSystem = GetComponent<EventSystem>();
 }
Exemplo n.º 22
0
 public virtual void Awake()
 {
     graphicRaycaster = GetComponent <GraphicRaycaster>();
 }
Exemplo n.º 23
0
        protected override void InitManager(Canvas canvas, CanvasScaler canvasScaler, GraphicRaycaster graphicRaycaster)
        {
            canvas.renderMode   = RenderMode.ScreenSpaceOverlay;
            canvas.sortingOrder = 10000;

            canvasScaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            canvasScaler.referenceResolution = new Vector2(2048, 1536);
            canvasScaler.screenMatchMode     = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
            canvasScaler.matchWidthOrHeight  = 1;

            graphicRaycaster.blockingObjects = GraphicRaycaster.BlockingObjects.All;
        }
Exemplo n.º 24
0
    public HashSet <Selectable> GetUITargets(GraphicRaycaster gRay, PointerEventData pD)
    {
        if (cam != gRay.eventCamera)
        {
            cam = gRay.eventCamera;
        }

        aD.Reset();
        aD.moveVector = (this.pD.position - pD.position);

        float x1 = this.pD.position.x,
              x2 = pD.position.x,
              y1 = this.pD.position.y,
              y2 = pD.position.y;

        float xDiff = x1 - x2;
        float yDiff = y1 - y2;

        MoveDirection dir = MoveDirection.None;

        if (xDiff > yDiff)
        {
            if (xDiff > 0f)
            {
                dir = MoveDirection.Right;
            }
            else if (xDiff < 0f)
            {
                dir = MoveDirection.Left;
            }
            else if (yDiff > xDiff)
            {
                if (yDiff > 0f)
                {
                    dir = MoveDirection.Up;
                }
                else if (yDiff < 0f)
                {
                    dir = MoveDirection.Down;
                }
            }
        }

        aD.moveDir = dir;

        var ray = cam.ScreenPointToRay(pD.position);

        Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow);

        List <RaycastResult> hits = new List <RaycastResult>();
        HashSet <Selectable> uibT = new HashSet <Selectable>();

        gRay.Raycast(pD, hits);

        if (hits.Count > 0)
        {
            pD.pointerCurrentRaycast = pD.pointerPressRaycast = hits[0];
        }

        for (int i = 0; i < hits.Count; i++)
        {
            var        go = hits[i].gameObject;
            Selectable u  = GOGetter(go);

            if (u)
            {
                uibT.Add(u);
            }
        }

        this.pD = pD;

        return(uibT);
    }
Exemplo n.º 25
0
    void Inventory()
    {
        if (GameObject.Find("Inven_Panel") != null)
        {
            Equip.GetComponent <Image>().sprite = Item_sprite[Equip_Item[0].shapeflag];
            if (Player_Item.Count > 0)
            {
                // Debug.Log(Player_Item[0].name);
                for (int i = 0; i < Player_Item.Count; i++)
                {
                    Inven[i].GetComponent <Image>().color  = new Color32(255, 255, 255, 255);
                    Inven[i].GetComponent <Image>().sprite = Item_sprite[Player_Item[i].shapeflag];
                }
            }

            raycaster    = canvas.GetComponent <GraphicRaycaster>();
            ped          = new PointerEventData(null);
            ped.position = Input.mousePosition;
            List <RaycastResult> results = new List <RaycastResult>();
            raycaster.Raycast(ped, results);

            if (results[0].gameObject.name == "Equip_Image")
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Equip_Item[0].name.ToString();
                Item_level.text  = Equip_Item[0].level.ToString();
                Item_damage.text = Equip_Item[0].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item1" && Player_Item[0] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[0].name.ToString();
                Item_level.text  = Player_Item[0].level.ToString();
                Item_damage.text = Player_Item[0].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item2" && Player_Item[1] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[1].name.ToString();
                Item_level.text  = Player_Item[1].level.ToString();
                Item_damage.text = Player_Item[1].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item3" && Player_Item[2] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[2].name.ToString();
                Item_level.text  = Player_Item[2].level.ToString();
                Item_damage.text = Player_Item[2].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item4" && Player_Item[3] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[3].name.ToString();
                Item_level.text  = Player_Item[3].level.ToString();
                Item_damage.text = Player_Item[3].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item5" && Player_Item[4] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[4].name.ToString();
                Item_level.text  = Player_Item[4].level.ToString();
                Item_damage.text = Player_Item[4].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item6" && Player_Item[5] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[5].name.ToString();
                Item_level.text  = Player_Item[5].level.ToString();
                Item_damage.text = Player_Item[5].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item7" && Player_Item[6] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[6].name.ToString();
                Item_level.text  = Player_Item[6].level.ToString();
                Item_damage.text = Player_Item[6].damage.ToString();
            }
            else if (results[0].gameObject.name == "Item8" && Player_Item[7] != null)
            {
                Item_Detail.transform.position = Input.mousePosition;
                Item_Detail.transform.gameObject.SetActive(true);
                Item_name.text   = Player_Item[7].name.ToString();
                Item_level.text  = Player_Item[7].level.ToString();
                Item_damage.text = Player_Item[7].damage.ToString();
            }
            else
            {
                Item_Detail.transform.gameObject.SetActive(false);
            }

            if (Input.GetMouseButtonDown(1))
            {
                item_name = results[0].gameObject.name;
                Debug.Log("아이템 이름 : " + item_name);
                Item_Detail.gameObject.SetActive(false);
                Item_Menu.gameObject.SetActive(true);
                mouse = Input.mousePosition;
                Item_Menu.gameObject.transform.position = mouse;
            }
        }
    }
 private void Start()
 {
     m_Raycaster   = GameObject.Find("Canvas").GetComponent <GraphicRaycaster>();
     m_EventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>();
 }
Exemplo n.º 27
0
 void Awake()
 {
     gr = UIInGame.instance.GetComponent <GraphicRaycaster>();
 }
Exemplo n.º 28
0
 void Start()
 {
     graphicRaycaster = GetComponent <GraphicRaycaster>();
     eventSystem      = GetComponent <EventSystem>();
 }
Exemplo n.º 29
0
 private void Awake()
 {
     this.raycaster = GetComponent <GraphicRaycaster>();
 }
Exemplo n.º 30
0
 private void Start()
 {
     myGraphicsRaycaster = FindObjectOfType <GraphicRaycaster>();
 }