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

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

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

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

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

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

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

            tooltip_height += 5.0f;
            midToolTip.GetComponent <RectTransform>().sizeDelta = new Vector2(midToolTip.GetComponent <RectTransform>().sizeDelta.x, tooltip_height);
        }
    }
Example #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");
                }
            }
        }
    }