Beispiel #1
0
    public void PointerEnter()
    {
        if (titleText == "레벨 업" && skill.getSkillPoint() == 0)
        {
            Tooltip.SetActive(false);
            return;
        }

        DescriptionUpdate();
        if (Tooltip != null)
        {
            Tooltip.SetActive(true);

            float tooltip_height = 30;
            Tooltip.transform.Find("TitleText").GetComponent <Text>().text         = titleText;
            Tooltip.transform.Find("HotKey").GetComponent <Text>().text            = "";
            Tooltip.transform.Find("Title_Description").GetComponent <Text>().text = titleDescription.Replace("\\n", "\n");
            Tooltip.transform.Find("Cooldown").GetComponent <Text>().text          = "";
            tooltip_height += 5.0f;
            Canvas.ForceUpdateCanvases();

            int description_lineCount = Tooltip.transform.Find("Title_Description").GetComponent <Text>().cachedTextGenerator.lineCount;
            tooltip_height += 15.0f * description_lineCount;

            if (addtionalDescription != string.Empty)
            {
                // Line1 표시
                tooltip_height += 5.0f;
                Tooltip.transform.Find("Line1").gameObject.SetActive(true);
                Tooltip.transform.Find("Line1").GetComponent <RectTransform>().anchoredPosition =
                    new Vector3(Tooltip.transform.Find("Line1").GetComponent <RectTransform>().anchoredPosition.x, -tooltip_height);
                tooltip_height += 10.0f;

                // 추가설명 갱신
                Tooltip.transform.Find("Additional_Description").GetComponent <RectTransform>().anchoredPosition =
                    new Vector3(Tooltip.transform.Find("Additional_Description").GetComponent <RectTransform>().anchoredPosition.x, -tooltip_height);
                Tooltip.transform.Find("Additional_Description").GetComponent <Text>().text = addtionalDescription.Replace("\\n", "\n");
                Canvas.ForceUpdateCanvases();

                int a_description_lineCount = Tooltip.transform.Find("Additional_Description").GetComponent <Text>().cachedTextGenerator.lineCount;
                tooltip_height += 19.0f * a_description_lineCount;
            }
            else
            {
                Tooltip.transform.Find("Line1").gameObject.SetActive(false);
                Tooltip.transform.Find("Line2").gameObject.SetActive(false);
                Tooltip.transform.Find("Additional_Description").GetComponent <Text>().text  = "";
                Tooltip.transform.Find("Additional_Description2").GetComponent <Text>().text = "";
            }

            tooltip_height += 5.0f;
            Tooltip.GetComponent <RectTransform>().sizeDelta = new Vector2(Tooltip.GetComponent <RectTransform>().sizeDelta.x, tooltip_height);
        }
    }
Beispiel #2
0
    public void SkillCheck()
    {
        if (ctrlcheck && Input.GetKeyDown(KeyCode.Q))
        {
            if (UISkill.getSkillPoint() >= 1 && UISkill.SkillUpButton[0].activeSelf)
            {
                UISkill.skillUp("Q");
            }
        }
        if (ctrlcheck && Input.GetKeyDown(KeyCode.W))
        {
            if (UISkill.getSkillPoint() >= 1 && UISkill.SkillUpButton[1].activeSelf)
            {
                UISkill.skillUp("W");
            }
        }
        if (ctrlcheck && Input.GetKeyDown(KeyCode.E))
        {
            if (UISkill.getSkillPoint() >= 1 && UISkill.SkillUpButton[2].activeSelf)
            {
                UISkill.skillUp("E");
            }
        }
        if (ctrlcheck && Input.GetKeyDown(KeyCode.R))
        {
            if (UISkill.getSkillPoint() >= 1 && UISkill.SkillUpButton[3].activeSelf)
            {
                UISkill.skillUp("R");
            }
        }

        if (!playerSkill || !chatfunction)
        {
            return;
        }

        // 현재쿨타임이 0일때만(쿨타임이 안돌아갈때만) 스킬 써짐
        if (canSkill && !playerData.isDead)
        {
            if (!playerSkill.isSkillIng && !chatfunction.chatInput.IsActive())
            {
                if (Input.GetKeyDown(KeyCode.Q) && !ctrlcheck)
                {
                    if (current_Cooldown_Q == 0 && skill_Q >= 1)
                    {
                        if (isNoMP)
                        {
                            if (totalstat.Hp - 2 > mana_Q)
                            {
                                playerSkill.QCasting();
                            }
                        }
                        else if (totalstat.Mp >= mana_Q)
                        {
                            playerSkill.QCasting();
                        }
                    }
                }
                if (Input.GetKeyDown(KeyCode.W) && !ctrlcheck)
                {
                    if (current_Cooldown_W == 0 && skill_W >= 1)
                    {
                        if (isNoMP)
                        {
                            if (totalstat.Hp - 2 > mana_W)
                            {
                                playerSkill.WCasting();
                            }
                        }
                        else if (totalstat.Mp >= mana_W)
                        {
                            playerSkill.WCasting();
                        }
                    }
                }
                if (Input.GetKeyDown(KeyCode.E) && !ctrlcheck)
                {
                    if (current_Cooldown_E == 0 && skill_E >= 1)
                    {
                        if (isNoMP)
                        {
                            if (totalstat.Hp - 2 > mana_E)
                            {
                                playerSkill.ECasting();
                            }
                        }
                        else if (totalstat.Mp >= mana_E)
                        {
                            playerSkill.ECasting();
                        }
                    }
                }
                if (Input.GetKeyDown(KeyCode.R) && !ctrlcheck)
                {
                    if (current_Cooldown_R == 0 && skill_R >= 1)
                    {
                        if (isNoMP)
                        {
                            if (totalstat.Hp - 2 > mana_R)
                            {
                                playerSkill.RCasting();
                            }
                        }
                        else if (totalstat.Mp >= mana_R)
                        {
                            playerSkill.RCasting();
                        }
                    }
                }
            }
        }
        // 스킬쿨이 돌고있으면 시간마다 점점 쿨감소
        if (current_Cooldown_Q != 0)
        {
            current_Cooldown_Q -= Time.deltaTime;
            if (current_Cooldown_Q < 0)
            {
                current_Cooldown_Q = 0;
                UISkill.SkillDisabledImage[1].SetActive(false);
                UISkill.SkillCooldownImage[1].fillAmount = 0;
                UISkill.SkillCooldownText[1].text        = "";
            }
            else
            {
                // 이미지와 텍스트 갱신
                UISkill.SkillCooldownImage[1].fillAmount = current_Cooldown_Q / temp_Cooldown_Q;
                if (current_Cooldown_Q > 1.0f)
                {
                    UISkill.SkillCooldownText[1].text = Mathf.FloorToInt(current_Cooldown_Q).ToString();
                }
                else
                {
                    UISkill.SkillCooldownText[1].text = current_Cooldown_Q.ToString("N1");
                }
            }
        }
        if (current_Cooldown_W != 0)
        {
            current_Cooldown_W -= Time.deltaTime;
            if (current_Cooldown_W < 0)
            {
                current_Cooldown_W = 0;
                UISkill.SkillDisabledImage[2].SetActive(false);
                UISkill.SkillCooldownImage[2].fillAmount = 0;
                UISkill.SkillCooldownText[2].text        = "";
            }
            else
            {
                // 이미지와 텍스트 갱신
                UISkill.SkillCooldownImage[2].fillAmount = current_Cooldown_W / temp_Cooldown_W;
                if (current_Cooldown_W > 1.0f)
                {
                    UISkill.SkillCooldownText[2].text = Mathf.FloorToInt(current_Cooldown_W).ToString();
                }
                else
                {
                    UISkill.SkillCooldownText[2].text = current_Cooldown_W.ToString("N1");
                }
            }
        }
        if (current_Cooldown_E != 0)
        {
            current_Cooldown_E -= Time.deltaTime;
            if (current_Cooldown_E < 0)
            {
                current_Cooldown_E = 0;
                UISkill.SkillDisabledImage[3].SetActive(false);
                UISkill.SkillCooldownImage[3].fillAmount = 0;
                UISkill.SkillCooldownText[3].text        = "";
            }
            else
            {
                // 이미지와 텍스트 갱신
                UISkill.SkillCooldownImage[3].fillAmount = current_Cooldown_E / temp_Cooldown_E;
                if (current_Cooldown_E > 1.0f)
                {
                    UISkill.SkillCooldownText[3].text = Mathf.FloorToInt(current_Cooldown_E).ToString();
                }
                else
                {
                    UISkill.SkillCooldownText[3].text = current_Cooldown_E.ToString("N1");
                }
            }
        }
        if (current_Cooldown_R != 0)
        {
            current_Cooldown_R -= Time.deltaTime;
            if (current_Cooldown_R < 0)
            {
                current_Cooldown_R = 0;
                UISkill.SkillDisabledImage[4].SetActive(false);
                UISkill.SkillCooldownImage[4].fillAmount = 0;
                UISkill.SkillCooldownText[4].text        = "";
            }
            else
            {
                // 이미지와 텍스트 갱신
                UISkill.SkillCooldownImage[4].fillAmount = current_Cooldown_R / temp_Cooldown_R;
                if (current_Cooldown_R > 1.0f)
                {
                    UISkill.SkillCooldownText[4].text = Mathf.FloorToInt(current_Cooldown_R).ToString();
                }
                else
                {
                    UISkill.SkillCooldownText[4].text = current_Cooldown_R.ToString("N1");
                }
            }
        }
    }