private void OnDisable() { _backBtn.onClick.RemoveListener(CloseThisDialog); _basicBtn.onClick.RemoveListener(ShowBasicSkillTab); _advanceBtn.onClick.RemoveListener(ShowAdvanceSkillTab); _learnSkill.onClick.RemoveListener(LearnNewSkill); _closeInfo.onClick.RemoveListener(() => { _skillDataInfo = null; _skillInfoObj.SetActive(false); }); }
public async Task <ActionResult> Post([FromBody] NewSkill skill) { var createdSkill = await _codingSkillService.Add(_mapper.Map <CodingSkillEntity>(skill), User.GetId()); await _dbTransaction.CompleteAsync(); return(StatusCode(StatusCodes.Status201Created, createdSkill.Id)); }
private void OnEnable() { _backBtn.onClick.AddListener(CloseThisDialog); _basicBtn.onClick.AddListener(ShowBasicSkillTab); _advanceBtn.onClick.AddListener(ShowAdvanceSkillTab); _learnSkill.onClick.AddListener(LearnNewSkill); _closeInfo.onClick.AddListener(() => { _skillDataInfo = null; _skillInfoObj.SetActive(false); }); _skillPoint.text = CharacterInfo._instance._baseProperties.SkillPoint.ToString(); LoadSkillEquipInCharacter(); ShowBasicSkillTab(); ListSkillEachClass(ConverClassCharacterEnumToId(CharacterInfo._instance._baseProperties._classCharacter)); }
bool checkHeroWearedSkill(NewSkill tempSkill) { bool check = false; foreach (NewSkill _skill in SplitDataFromServe._heroSkill) { if (_skill.data["idk"].AsInt == tempSkill.data["idInit"].AsInt && _skill.data["typewear"] == 1) { check = true; break; } } return(check); }
int getSPRequiredToLearn(NewSkill _tempSkill) { int levelSkill = 0; int levelRequiredNextLevel = 0; if (levelSkill < 10) { levelRequiredNextLevel = int.Parse(_tempSkill.data["levelrequired"].Value.Split('/')[levelSkill].ToString()); } else if (levelSkill == 10) { levelRequiredNextLevel = int.Parse(_tempSkill.data["levelrequired"].Value.Split('/')[levelSkill - 1].ToString()); } return(Constant.UPGRADE_SKILLPOINT_REQUIRE[levelRequiredNextLevel]); }
public IActionResult AddSkill([FromBody] NewSkill newSkill) { if (newSkill.text != null) { UserProfile userProfile = _context.UserProfiles.FirstOrDefault(x => x.Id == newSkill.id); Skill skill = new Skill() { Title = newSkill.text, UserProfile = userProfile }; _context.Skills.Add(skill); _context.SaveChanges(); } return(PartialView("~/Views/Shared/AdminUsersPartialViews/SkillsList.cshtml", _context.Skills.Where(x => x.Id == newSkill.id).ToList())); }
int getLevelRequiredToLearnNextLevel(NewSkill _tempSkill) { int requireLevel = 0; int levelSkill = _tempSkill.data["level"].AsInt; if (levelSkill < 10) { requireLevel = int.Parse(_tempSkill.data["levelrequired"].Value.Split('/')[levelSkill].ToString()); } else { requireLevel = int.Parse(_tempSkill.data["levelrequired"].Value.Split('/')[9].ToString()); } return(requireLevel); }
public async Task <IActionResult> AddVacancySkill([FromBody] NewSkill newSkill) { Vacancy vacancy = _context.Vacancies.FirstOrDefault(x => x.Id == newSkill.id); if (vacancy == null) { return(NotFound()); } Skill skill = new Skill() { Title = newSkill.text, Vacancy = vacancy }; _context.Skills.Add(skill); await _context.SaveChangesAsync(); return(PartialView("~/Views/Shared/ProjectManagerPartialViews/EditPartialViews/EditSkillView.cshtml", skill)); }
public void LoadSkillToDictionary() { if (CharacterItemInGame.Instance._listTextAssetSkill.Count > 0) { int totalTextAssetSkill = CharacterItemInGame.Instance._listTextAssetSkill.Count; for (int i = 0; i < totalTextAssetSkill; i++) { string text = CharacterItemInGame.Instance._listTextAssetSkill[i].ToString(); text = text.Replace("\r\n", ""); int idSkill = CoreLib.JSONNode.Parse(text)["idInit"]; NewSkill skill = new NewSkill(CoreLib.JSONNode.Parse(text)); skill.addField("nick", "Skill" + idSkill); SplitDataFromServe.skillInit.Add("Skill" + idSkill, skill); } } //LoginUI.Instance._numerSkillDic.text = "Number assets " + CharacterItemInGame.Instance._listTextAssetSkill.Count; Adapter.skills = SplitDataFromServe.skillInit; StartCoroutine(CharacterItemInGame.Instance.GetTextAssetsAbsFiles()); }
public void RangeAttack(CharacterPlayer atk, CharacterPlayer def, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill) { Transform hostPos = this.transform; Transform newPosX; newPosX = def.transform; StartCoroutine(ExecuteRangeAttack(atk, def, hostPos, newPosX, playerId, indexState, health, isnormalAtk, useSkill)); }
public IEnumerator ExecuteRangeAttack(CharacterPlayer _atk, CharacterPlayer _target, Transform hostPos, Transform newPos, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill) { skeAnimator.SetBool("attack", true); yield return(new WaitForSeconds(0.01f)); yield return(new WaitForSeconds(skeAnimator.GetCurrentAnimatorStateInfo(0).length / 2f - 0.01f)); if (isnormalAtk) { GameObject bullet = EffectManager.Instance.CreateEffect("Prefabs/RangeAttack", hostPos); bullet.transform.position = new Vector3(hostPos.position.x + hostPos.GetComponent <BoxCollider2D>().bounds.size.x / 2, hostPos.position.y + hostPos.GetComponent <BoxCollider2D>().bounds.size.y / 2, hostPos.position.z); EffectManager.Instance.EffectMoving(bullet, newPos.position.x, 0.5f); } else { if (useSkill != null) { if (useSkill.data["type"].Value.ToString() == "passive") { } else if (useSkill.data["type"].Value.ToString() != "passive") { GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform); effSkill.transform.position = new Vector3(_target.transform.position.x, _target.transform.position.y + _target.GetComponent <BoxCollider2D>().bounds.size.y / 2, _target.transform.position.z); } } } SendDamage(playerId.ToString() + "," + indexState.ToString() + "," + health.ToString() + "," + "senddamge"); yield return(new WaitForSeconds(skeAnimator.GetCurrentAnimatorStateInfo(0).length / 2f)); skeAnimator.SetBool("attack", false); }
public void ShowInfoSkill(NewSkill skillData) { bool skillLeard = false; foreach (NewSkill _tempSkill in SplitDataFromServe._heroSkill) { if (_tempSkill.data["idk"].AsInt == skillData.data["idInit"].AsInt) { skillLeard = true; break; } } _skillPoint.text = CharacterInfo._instance._baseProperties.SkillPoint.ToString(); int levelRequiredToLearn = getLevelRequiredToLearnNextLevel(skillData); int spRequiredToLearn = getSPRequiredToUpgrade(skillData); if (skillData.data["level"].AsInt < 10) { int levelRequiredToLearnTemp = getLevelRequiredToLearnNextLevel(skillData); int spRequiredToLearnTemp = getSPRequiredToUpgrade(skillData); if (skillLeard) { _desSkillCurrent.text = skillData.data["description"].Value + "\n" + "Level require to learn next level :" + levelRequiredToLearnTemp + "\n" + "Skillpoint require to learn next level :" + spRequiredToLearnTemp; } else { _desSkillCurrent.text = skillData.data["description"].Value + "\n" + "Level require to learn :" + int.Parse(skillData.data["levelrequired"].Value.Split('/')[0].ToString()) + "\n" + "Skillpoint require to learn :" + Constant.UPGRADE_SKILLPOINT_REQUIRE[int.Parse(skillData.data["levelrequired"].Value.Split('/')[0].ToString())]; } } else if (skillData.data["level"].AsInt == 10) { _desSkillCurrent.text = skillData.data["description"].Value; } if (skillData.data["level"].AsInt < 10) { if (WaitingRoomUI.Instance != null) { WaitingRoomUI.Instance.SetLog("skill class" + skillData.data["class"].Value); WaitingRoomUI.Instance.SetLog("character class " + CharacterInfo._instance._baseProperties._classCharacter.ToString()); WaitingRoomUI.Instance.SetLog("level character " + CharacterInfo._instance._baseProperties.Level); WaitingRoomUI.Instance.SetLog("level require to learn " + levelRequiredToLearn); } if ((skillData.data["class"].Value == CharacterInfo._instance._baseProperties._classCharacter.ToString()) && CharacterInfo._instance._baseProperties.Level >= levelRequiredToLearn) { _learnSkill.gameObject.SetActive(true); } else { _learnSkill.gameObject.SetActive(false); } } else if (skillData.data["level"].AsInt == 10) { _learnSkill.gameObject.SetActive(false); } _skillDataInfo = skillData; _skillInfoObj.SetActive(true); _nameSkillInfo.text = skillData.data["name"].Value; if (skillLeard) { _levelSkillInfo.gameObject.SetActive(true); _levelSkillInfo.text = "Level " + skillData.data["level"].Value; } else { _levelSkillInfo.gameObject.SetActive(false); } _typeSkillInfo.text = skillData.data["type"].Value; _skillInfoImg.sprite = Resources.Load <Sprite>("Textures/skillAss/" + skillData.data["sprite"].Value); ShowValueSkill(skillData.data["value"].Value, skillData.data["level"].AsInt); }
public void SetDataSkill(NewSkill tempSkill) { this.dataSkill = tempSkill; }
public void Donothing(CharacterPlayer meCharacter, CharacterPlayer enemyCharacter, int playerId, int indexState, int health, NewSkill useSkill) { StartCoroutine(ExecuteDonothing(meCharacter, enemyCharacter, playerId, indexState, health, useSkill)); }
public void OnDrop(PointerEventData eventData) { if (GetDropObject(eventData) != null && GetDropObject(eventData).tag == "Skill") { Debug.Log("switch skill slot"); Sprite dropSprite = gameObject.GetComponent <Image>().sprite; Sprite dragSprite = GetDropObject(eventData).GetComponent <Image>().sprite; NewSkill dropSkill = gameObject.GetComponent <DropHandle>().dataSkill; NewSkill dragSkill = GetDropObject(eventData).GetComponent <DragHandeler>().dataSkill; int indexDropSkill = PlayerPrefs.GetInt(gameObject.GetComponent <DropHandle>().dataSkill.data["idhk"].Value); int indexDragSkill = PlayerPrefs.GetInt(GetDropObject(eventData).GetComponent <DragHandeler>().dataSkill.data["idhk"].Value); PlayerPrefs.SetInt(GetDropObject(eventData).GetComponent <DropHandle>().dataSkill.data["idhk"].Value, indexDropSkill); PlayerPrefs.SetInt(gameObject.GetComponent <DropHandle>().dataSkill.data["idhk"].Value, indexDragSkill); this.gameObject.GetComponent <Image>().sprite = dragSprite; GetDropObject(eventData).GetComponent <Image>().sprite = dropSprite; this.gameObject.GetComponent <DragHandeler>().SetDataSkill(dragSkill); this.gameObject.GetComponent <DropHandle>().SetDataSkill(dragSkill); GetDropObject(eventData).GetComponent <DragHandeler>().SetDataSkill(dropSkill); GetDropObject(eventData).GetComponent <DropHandle>().SetDataSkill(dropSkill); } else if (GetDropObject(eventData) != null && GetDropObject(eventData).tag == "SkillInList") { Sprite dragSprite = GetDropObject(eventData).GetComponent <Image>().sprite; NewSkill dragSkill = GetDropObject(eventData).GetComponent <DragHandeler>().dataSkill; NewSkill dropSkill = gameObject.GetComponent <DropHandle>().dataSkill; int indexDropSkill = PlayerPrefs.GetInt(gameObject.GetComponent <DropHandle>().dataSkill.data["idhk"].Value); if (dragSkill.data["idInit"].AsInt != dropSkill.data["idInit"].AsInt && !checkHeroWearedSkill(dragSkill)) { StartCoroutine(ServerAdapter.UnEquipSkill(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, dropSkill.data["idhk"].AsInt, result => { Debug.Log(result.ToString()); if (result.StartsWith("Error")) { Debug.Log("Do nothing"); } else { Debug.Log("remove old skill ok"); foreach (NewSkill _tempSkill in SplitDataFromServe._heroSkill) { if (dropSkill.data["idhk"].AsInt == _tempSkill.data["idhk"].AsInt) { _tempSkill.addField("typewear", 0); break; } } StartCoroutine(ServerAdapter.EquipSkill(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, dragSkill.data["idhk"].AsInt, result1 => { Debug.Log(result1.ToString()); if (result1.StartsWith("Error")) { Debug.Log("Do nothing"); } else { Debug.Log("change skill ok"); foreach (NewSkill _tempSkill in SplitDataFromServe._heroSkill) { if (dragSkill.data["idhk"].AsInt == _tempSkill.data["idhk"].AsInt) { _tempSkill.addField("typewear", 1); break; } } PlayerPrefs.DeleteKey(dropSkill.data["idhk"].Value); PlayerPrefs.SetInt(dragSkill.data["idhk"].Value, indexDropSkill); this.gameObject.GetComponent <Image>().sprite = dragSprite; this.gameObject.GetComponent <DragHandeler>().SetDataSkill(dragSkill); this.gameObject.GetComponent <DropHandle>().SetDataSkill(dragSkill); } })); } })); } else { Debug.Log("Do nothing"); } } }
public IEnumerator ExecuteAttackandBack(CharacterPlayer atk, CharacterPlayer def, Vector3 oldPos, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill) { skeAnimator.SetBool("attack", true); yield return(new WaitForSeconds(0.01f)); yield return(new WaitForSeconds(skeAnimator.GetCurrentAnimatorStateInfo(0).length / 2f - 0.01f)); if (isnormalAtk) { if (CharacterManager.Instance._meCharacter.playerId == playerId) { GameObject slash = EffectManager.Instance.CreateEffect("Effect/Slash", this.transform); slash.transform.position = new Vector3(atk.transform.position.x + atk.transform.GetComponent <BoxCollider2D>().bounds.size.x / 2, atk.transform.position.y + atk.transform.GetComponent <BoxCollider2D>().bounds.size.y / 2, atk.transform.position.z); } else if (CharacterManager.Instance._meCharacter.playerId != playerId) { GameObject slash = EffectManager.Instance.CreateEffect("Effect/Slash", this.transform); slash.transform.localScale = new Vector3(-1, 1, 1); slash.transform.position = new Vector3(atk.transform.position.x - atk.transform.GetComponent <BoxCollider2D>().bounds.size.x / 2, atk.transform.position.y + atk.transform.GetComponent <BoxCollider2D>().bounds.size.y / 2, atk.transform.position.z); } } else { if (useSkill != null) { if (useSkill.data["type"].Value.ToString() == "passive") { GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform); effSkill.transform.position = new Vector3(this.transform.position.x, this.transform.position.y + this.transform.GetComponent <BoxCollider2D>().bounds.size.y / 2, this.transform.position.z); } else if (useSkill.data["type"].Value.ToString() != "passive") { GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform); effSkill.transform.position = new Vector3(def.transform.position.x, def.transform.position.y + def.transform.GetComponent <BoxCollider2D>().bounds.size.y / 2, def.transform.position.z); } } } SendDamage(playerId.ToString() + "," + indexState.ToString() + "," + health.ToString() + "," + "senddamge"); yield return(new WaitForSeconds(skeAnimator.GetCurrentAnimatorStateInfo(0).length / 2f)); skeAnimator.SetBool("attack", false); transform.DOMoveX(oldPos.x, 0.25f); if (CharacterManager.Instance._meCharacter == atk) { BattleSceneUI.Instance._effectParentMe.transform.DOMoveX(oldPos.x, 0.1f); } if (CharacterManager.Instance._enemyCharacter == atk) { BattleSceneUI.Instance._effectParentEnemy.transform.DOMoveX(oldPos.x, 0.1f); } }
public void AttackandBack(CharacterPlayer atk, CharacterPlayer deff, Vector3 oldPos, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill) { StartCoroutine(ExecuteAttackandBack(atk, deff, oldPos, playerId, indexState, health, isnormalAtk, useSkill)); }
public void MeeleAttack(CharacterPlayer atk, CharacterPlayer def, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill) { Debug.Log("melee atack"); //skeletonAnimation.AnimationName = moveAnimation; skeletonAnimator.Skeleton.FlipX = false; Vector3 oldPos = this.transform.position; float newPosX; if (transform.position.x < def.transform.position.x) { newPosX = def.transform.position.x - def.GetComponent <BoxCollider2D>().bounds.size.x; } else { newPosX = def.transform.position.x + def.GetComponent <BoxCollider2D>().bounds.size.x; } if (CharacterManager.Instance._meCharacter == atk) { BattleSceneUI.Instance._effectParentMe.transform.DOMoveX(newPosX, 0.1f); } if (CharacterManager.Instance._enemyCharacter == atk) { BattleSceneUI.Instance._effectParentEnemy.transform.DOMoveX(newPosX, 0.1f); } transform.DOMoveX(newPosX, 0.1f).OnComplete(() => AttackandBack(atk, def, oldPos, playerId, indexState, health, isnormalAtk, useSkill)); }
public IEnumerator ExecuteDonothing(CharacterPlayer meCharacter, CharacterPlayer enemyCharacter, int playerId, int indexState, int health, NewSkill useSkill) { yield return(new WaitForSeconds(0.5f)); if (meCharacter != enemyCharacter) { if (meCharacter.playerId == playerId) { if (useSkill != null) { GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform); if (useSkill.data["typeDisplayEffect"].Value == "me") { effSkill.transform.position = new Vector3(meCharacter.transform.position.x, meCharacter.transform.position.y + effSkill.GetComponent <BoxCollider2D>().size.y / 2, meCharacter.transform.position.z); } else if (useSkill.data["typeDisplayEffect"].Value == "enemy") { effSkill.transform.position = new Vector3(enemyCharacter.transform.position.x, enemyCharacter.transform.position.y + effSkill.GetComponent <BoxCollider2D>().size.y / 2, enemyCharacter.transform.position.z); effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); } else if (useSkill.data["typeDisplayEffect"].Value == "move") { effSkill.transform.position = new Vector3(meCharacter.transform.position.x, meCharacter.transform.position.y + meCharacter.GetComponent <BoxCollider2D>().size.y / 2, meCharacter.transform.position.z); EffectManager.Instance.EffectMoving(effSkill, enemyCharacter.transform.position.x, 0.5f); } else if (useSkill.data["typeDisplayEffect"].Value == "center") { effSkill.transform.position = Vector3.zero; } else { effSkill.transform.position = new Vector3(enemyCharacter.transform.position.x, enemyCharacter.transform.position.y + enemyCharacter.GetComponent <BoxCollider2D>().size.y / 2, enemyCharacter.transform.position.z); effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); } } } else if (enemyCharacter.playerId == playerId) { Debug.Log("name skill " + useSkill.data["name"].Value.ToString()); Debug.Log("name eff " + useSkill.data["prefEffect"].Value.ToString()); GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform); if (useSkill.data["typeDisplayEffect"].Value == "me") { effSkill.transform.position = new Vector3(enemyCharacter.transform.position.x, enemyCharacter.transform.position.y + effSkill.GetComponent <BoxCollider2D>().size.y / 2, enemyCharacter.transform.position.z); effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); } else if (useSkill.data["typeDisplayEffect"].Value == "enemy") { effSkill.transform.position = new Vector3(meCharacter.transform.position.x, meCharacter.transform.position.y + effSkill.GetComponent <BoxCollider2D>().size.y / 2, meCharacter.transform.position.z); } else if (useSkill.data["typeDisplayEffect"].Value == "move") { effSkill.transform.position = new Vector3(enemyCharacter.transform.position.x, enemyCharacter.transform.position.y + enemyCharacter.GetComponent <BoxCollider2D>().size.y / 2, enemyCharacter.transform.position.z); effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); EffectManager.Instance.EffectMoving(effSkill, meCharacter.transform.position.x, 0.5f); } else if (useSkill.data["typeDisplayEffect"].Value == "center") { effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); effSkill.transform.position = Vector3.zero; } else { effSkill.transform.position = new Vector3(meCharacter.transform.position.x, meCharacter.transform.position.y + meCharacter.GetComponent <BoxCollider2D>().size.y / 2, meCharacter.transform.position.z); } } SendDamage(playerId.ToString() + "," + indexState.ToString() + "," + health.ToString() + "," + "senddamge"); } else { if (useSkill != null) { GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform); if (useSkill.data["typeDisplayEffect"].Value == "me") { effSkill.transform.position = new Vector3(meCharacter.transform.position.x, meCharacter.transform.position.y + effSkill.GetComponent <BoxCollider2D>().size.y / 2, meCharacter.transform.position.z); } else if (useSkill.data["typeDisplayEffect"].Value == "enemy") { effSkill.transform.position = new Vector3(enemyCharacter.transform.position.x, enemyCharacter.transform.position.y + effSkill.GetComponent <BoxCollider2D>().size.y / 2, enemyCharacter.transform.position.z); effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); } else if (useSkill.data["typeDisplayEffect"].Value == "move") { effSkill.transform.position = new Vector3(meCharacter.transform.position.x, meCharacter.transform.position.y + meCharacter.GetComponent <BoxCollider2D>().size.y / 2, meCharacter.transform.position.z); EffectManager.Instance.EffectMoving(effSkill, enemyCharacter.transform.position.x, 0.5f); } else if (useSkill.data["typeDisplayEffect"].Value == "center") { effSkill.transform.position = Vector3.zero; } else { effSkill.transform.position = new Vector3(enemyCharacter.transform.position.x, enemyCharacter.transform.position.y + enemyCharacter.GetComponent <BoxCollider2D>().size.y / 2, enemyCharacter.transform.position.z); effSkill.transform.localScale = new Vector3(effSkill.transform.localScale.x * -1, effSkill.transform.localScale.y, effSkill.transform.localScale.z); } } SendDamage(playerId.ToString() + "," + indexState.ToString() + "," + health.ToString() + "," + "dontsend"); } }