Exemplo n.º 1
0
        public IActionResult GeneralSkills(GeneralSkillsModel model)
        {
            var skills = new GeneralSkills();

            if (model.GeneralSkillsPercentage < 0 || model.GeneralSkillsPercentage > 100)
            {
                ModelState.AddModelError(nameof(model.GeneralSkillsPercentage), " Percentage Must Be  0 With 100 ");
                return(View(model));
            }
            if (ModelState.IsValid)
            {
                skills.GeneralSkillsName       = model.GeneralSkillsName;
                skills.GeneralSkillsPercentage = model.GeneralSkillsPercentage;
                repository.generalSkills.Add(skills);
                repository.SaveChanges();
                TempData["message"] = $"{model.GeneralSkillsName} Kayıt Edildi";
                return(RedirectToAction("Index", "Admin"));
            }
            else
            {
                return(View(model));
            }
        }
Exemplo n.º 2
0
    void showInfo()
    {
        bool isDisplay = false;

        for (int i = 0; i < 技能.Count; i++)
        {
            Vector2 thePos = Camera.main.ScreenToWorldPoint(技能[i].transform.position);
            if (技能[i].GetComponent <Text>().enabled&& Mathf.Abs(mouse.x - thePos.x) < 0.38 && Mathf.Abs(mouse.y - thePos.y) < 0.08)
            {
                GeneralSkills theSkill = chosen[0].GetComponent <skilledUnits>().skill[i];
                //string theTest = theSkill.name + "(等级" + theSkill.level + ")" + "\n" + theSkill.description;
                string theTest = theSkill.name + "(Level" + theSkill.level + ")" + "\n" + theSkill.description;
                if (i == 0)
                {
                    //theTest += "\n" + "按[Q]使用技能";
                    theTest += "\n" + "Press [Q] to use the skill";
                }
                else if (i == 1)
                {
                    //theTest += "\n" + "按[W]使用技能";
                    theTest += "\n" + "Press [W] to use the skill";
                }
                else if (i == 2)
                {
                    //theTest += "\n" + "按[E]使用技能";
                    theTest += "\n" + "Press [E] to use the skill";
                }
                else
                {
                    //theTest += "\n" + "按[R]使用技能";
                    theTest += "\n" + "Press [R] to use the skill";
                }
                wordHolder.GetComponent <InputField>().placeholder.GetComponent <Text>().text = theTest;
                isDisplay = true;
                wordHolder.GetComponent <Image>().enabled = true;
                wordHolder.GetComponent <InputField>().placeholder.GetComponent <Text>().enabled = true;
            }
        }
        for (int i = 0; i < 物品.Count; i++)
        {
            Vector2 thePos = Camera.main.ScreenToWorldPoint(物品[i].transform.position);
            if (物品[i].GetComponent <Text>().enabled&& Mathf.Abs(mouse.x - thePos.x) < 0.38 && Mathf.Abs(mouse.y - thePos.y) < 0.08)
            {
                GeneralItem theItem = chosen[0].GetComponent <Hero>().Item[i];
                string      theTest = theItem.name + "\n" + theItem.description;
                if (i == 0)
                {
                    //theTest += "\n" + "按[z + 1]丢弃物品 ";
                    theTest += "\n" + "Press [z + 1] to discard the item";
                }
                else if (i == 1)
                {
                    //theTest += "\n" + "按[z + 2]丢弃物品 ";
                    theTest += "\n" + "Press [z + 2] to discard the item";
                }
                else if (i == 2)
                {
                    //theTest += "\n" + "按[z + 3]丢弃物品 ";
                    theTest += "\n" + "Press [z + 3] to discard the item";
                }
                else
                {
                    //theTest += "\n" + "按[z + 4]丢弃物品 ";
                    theTest += "\n" + "Press [z + 4] to discard the item";
                }
                if (theItem.canUse)
                {
                    //theTest += "按[Alt + " + (i + 1).ToString() + "]使用物品";
                    theTest += "Press [Alt + " + (i + 1).ToString() + "] to use the item";
                }
                wordHolder.GetComponent <InputField>().placeholder.GetComponent <Text>().text = theTest;
                isDisplay = true;
            }
        }
        if (isDisplay)
        {
            if (!wordHolder.GetComponent <Image>().enabled)
            {
                wordHolder.GetComponent <Image>().enabled = true;
                wordHolder.GetComponent <InputField>().placeholder.GetComponent <Text>().enabled = true;
            }
            wordHolder.transform.position = Camera.main.WorldToScreenPoint(mouse);
        }
        else
        {
            wordHolder.GetComponent <Image>().enabled = false;
            wordHolder.GetComponent <InputField>().placeholder.GetComponent <Text>().enabled = false;
        }
    }