// 스킬 생성 void InstantiateSkills(SkillSetInfo _CurrentSkillSet) { List <DataSkillInfo> SkillDataList = _CurrentSkillSet.CurrentSkillList; Sprite[] ActiveSkills = _CurrentSkillSet.ActiveSkills; Sprite[] PassiveSkills = _CurrentSkillSet.PassiveSkills; int j = 0; int pIndex = 0; float yPos = prototypePos.y; // 복제할 오브젝트 끄기 SkillPrototype.gameObject.SetActive(false); _CurrentSkillSet.Skills = null; _CurrentSkillSet.Skills = new RectTransform[SkillDataList.Count]; // 스킬 생성 for (int i = 0; i < SkillDataList.Count; i++) { var skill = GameObject.Instantiate(SkillPrototype) as RectTransform; skill.SetParent(_CurrentSkillSet.rectTransform, false); skill.name = i.ToString(); skill.GetComponent <SkillInfo>().ConvertData(SkillDataList[i]); skill.anchoredPosition = new Vector2(prototypePos.x + (j++ *110), yPos); _CurrentSkillSet.Skills[i] = skill; // 색 지정 Color _color = skill.GetComponent <Image>().color; _color.a = 0.5f; skill.GetComponent <Image>().color = _color; // 이미지 넣어주기 if (!skill.GetComponent <SkillInfo>().m_isPassive) { skill.GetComponent <Image>().sprite = ActiveSkills[i]; } else { skill.GetComponent <Image>().sprite = PassiveSkills[pIndex++]; } skill.gameObject.SetActive(true); if (i == 3 || i == 7 || i == 15) { j = 0; yPos -= 110; } else if (i == 11) { j = 0; yPos = -100; } } // 스킬셋 켜주기 _CurrentSkillSet.rectTransform.gameObject.SetActive(true); }
// 리셋 버튼 작동 public void ClickReset(RectTransform _rectTransform) { SkillSetInfo _CurrentSkillSet = _rectTransform.GetComponentInParent <SkillSetInfo>(); List <DataSkillInfo> SkillDataList = _CurrentSkillSet.CurrentSkillList; // 자식 오브젝트 SkillInfo 초기화하기 for (int i = 0; i < SkillDataList.Count; i++) { // 색 다시 반투명으로 Color _color = _CurrentSkillSet.rectTransform.Find(i.ToString()).GetComponent <Image>().color; _color.a = 0.5f; _CurrentSkillSet.rectTransform.Find(i.ToString()).GetComponent <Image>().color = _color; // 정보 초기화 _CurrentSkillSet.rectTransform.Find(i.ToString()).GetComponent <SkillInfo>().ConvertData(SkillDataList[i]); } }
// 스킬셋변경 버튼 작동 public void ClickChangeSkillSet(RectTransform _rectTransform) { SkillSetInfo _CurrentSkillSet = _rectTransform.GetComponentInParent <SkillSetInfo>(); for (int i = 0; i < _selectType.Length; i++) { if (_CurrentSkillSet.rectTransform.GetComponentInChildren <SkillInfo>().m_type == _selectType[i].type) { _selectType[i].isSelected = false; } } // 인스턴스한 스킬들 삭제 for (int i = 0; i < _CurrentSkillSet.Skills.Length; i++) { Destroy(_CurrentSkillSet.Skills[i].gameObject); } _CurrentSkillSet.Skills = null; _CurrentSkillSet.CurrentSkillList = null; _CurrentSkillSet.rectTransform.gameObject.SetActive(false); }
public void LoadLowData() { { TextAsset data = Resources.Load("TestJson/Skill_Ability", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject Ability = new JSONObject(strSrc); for (int i = 0; i < Ability.list.Count; i++) { AbilityInfo tmpInfo = new AbilityInfo(); tmpInfo.Idx = (uint)Ability[i]["Idx_ui"].n; tmpInfo.notiIdx = (ushort)Ability[i]["notiIdx_us"].n; tmpInfo.targetEffect = Ability[i]["targetEffect_c"].str; tmpInfo.skillType = (byte)Ability[i]["skillType_b"].n; tmpInfo.applyTarget = (byte)Ability[i]["applyTarget_b"].n; tmpInfo.eCount = (byte)Ability[i]["eCount_b"].n; tmpInfo.targetCount = (byte)Ability[i]["targetCount_b"].n; tmpInfo.rangeType = (byte)Ability[i]["rangeType_b"].n; tmpInfo.radius = (ushort)Ability[i]["radius_us"].n; tmpInfo.angle = (ushort)Ability[i]["angle_us"].n; tmpInfo.rangeCenter = (float)Ability[i]["rangeCenter_f"].n; tmpInfo.rangeRotation = (float)Ability[i]["rangeRotation_f"].n; tmpInfo.baseFactor = (byte)Ability[i]["baseFactor_b"].n; tmpInfo.eventValue = (float)Ability[i]["eventValue_f"].n; tmpInfo.availableCnt = (ushort)Ability[i]["availableCnt_us"].n; tmpInfo.targetSound = (uint)Ability[i]["targetSound_ui"].n; tmpInfo.cameraShake = (byte)Ability[i]["cameraShake_b"].n; tmpInfo.pushTime = (float)Ability[i]["pushTime_f"].n; tmpInfo.pushpower = (float)Ability[i]["pushpower_f"].n; tmpInfo.diePower = (float)Ability[i]["diePower_f"].n; tmpInfo.stiffenTime = (float)Ability[i]["stiffenTime_f"].n; tmpInfo.dieMinDistance = (float)Ability[i]["dieMinDistance_f"].n; tmpInfo.dieMaxDistance = (float)Ability[i]["dieMaxDistance_f"].n; AbilityInfoList.Add(tmpInfo); } } { TextAsset data = Resources.Load("TestJson/Skill_Action", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject Action = new JSONObject(strSrc); for (int i = 0; i < Action.list.Count; i++) { ActionInfo tmpInfo = new ActionInfo(); tmpInfo.idx = (uint)Action[i]["idx_ui"].n; tmpInfo.name = (uint)Action[i]["name_ui"].n; tmpInfo.descrpition = (uint)Action[i]["descrpition_ui"].n; tmpInfo.Icon = (uint)Action[i]["Icon_ui"].n; tmpInfo.GlobalCooltime = (float)Action[i]["GlobalCooltime_f"].n; tmpInfo.range = (ushort)Action[i]["range_us"].n; tmpInfo.effectCallNotiIdx = (ushort)Action[i]["effectCallNotiIdx_us"].n; tmpInfo.needtarget = (byte)Action[i]["needtarget_b"].n; tmpInfo.camera = (byte)Action[i]["camera_b"].n; tmpInfo.skillpass = (byte)Action[i]["skillpass_b"].n; tmpInfo.casttime = (float)Action[i]["casttime_f"].n; tmpInfo.hittime = (float)Action[i]["hittime_f"].n; tmpInfo.mergetime = (float)Action[i]["mergetime_f"].n; tmpInfo.watingtime = (float)Action[i]["watingtime_f"].n; tmpInfo.pabody = (byte)Action[i]["pabody_b"].n; tmpInfo.emit = (byte)Action[i]["emit_b"].n; ActionInfoDic.Add(tmpInfo.idx, tmpInfo); } } { TextAsset data = Resources.Load("TestJson/Skill_Buff", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject Buff = new JSONObject(strSrc); for (int i = 0; i < Buff.list.Count; i++) { BuffInfo tmpInfo = new BuffInfo(); tmpInfo.Indx = (uint)Buff[i]["Indx_ui"].n; tmpInfo.name = (uint)Buff[i]["name_ui"].n; tmpInfo.descrpition = (uint)Buff[i]["descrpition_ui"].n; tmpInfo.icon = Buff[i]["icon_c"].str; tmpInfo.effect = Buff[i]["effect_c"].str; tmpInfo.effectBreak = Buff[i]["effectBreak_c"].str; tmpInfo.buffcategory = (byte)Buff[i]["buffcategory_b"].n; tmpInfo.buffAbility = (byte)Buff[i]["buffAbility_b"].n; tmpInfo.buffType = (byte)Buff[i]["buffType_b"].n; tmpInfo.buffGrade = (byte)Buff[i]["buffGrade_b"].n; tmpInfo.startType = (byte)Buff[i]["startType_b"].n; tmpInfo.CastingEffect = Buff[i]["CastingEffect_c"].str; tmpInfo.baseFactor = (byte)Buff[i]["baseFactor_b"].n; tmpInfo.valueType = (byte)Buff[i]["valueType_b"].n; tmpInfo.factorRate = (uint)Buff[i]["factorRate_ui"].n; tmpInfo.bufflink = (uint)Buff[i]["bufflink_ui"].n; tmpInfo.overLapCount = (byte)Buff[i]["overLapCount_b"].n; tmpInfo.tic = (float)Buff[i]["tic_f"].n; tmpInfo.buffDisplay = (uint)Buff[i]["buffDisplay_ui"].n; tmpInfo.addBuffType = (byte)Buff[i]["addBuffType_b"].n; BuffInfoDic.Add(tmpInfo.Indx, tmpInfo); } } { TextAsset data = Resources.Load("TestJson/Skill_BuffGroup", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject BuffGroup = new JSONObject(strSrc); for (int i = 0; i < BuffGroup.list.Count; i++) { BuffGroupInfo tmpInfo = new BuffGroupInfo(); tmpInfo.LogIdx = (uint)BuffGroup[i]["LogIdx_ui"].n; tmpInfo.partnerType = (byte)BuffGroup[i]["partnerType_b"].n; tmpInfo.Indx = (uint)BuffGroup[i]["Indx_ui"].n; tmpInfo.buffRate = (float)BuffGroup[i]["buffRate_f"].n; tmpInfo.payType = (byte)BuffGroup[i]["payType_b"].n; tmpInfo.cost = (uint)BuffGroup[i]["cost_ui"].n; tmpInfo.resetBuff = (byte)BuffGroup[i]["resetBuff_b"].n; BuffGroupInfoList.Add(tmpInfo); } } { TextAsset data = Resources.Load("TestJson/Skill_ProjectTile", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject ProjectTile = new JSONObject(strSrc); for (int i = 0; i < ProjectTile.list.Count; i++) { ProjectTileInfo tmpInfo = new ProjectTileInfo(); tmpInfo.idx = (uint)ProjectTile[i]["idx_ui"].n; tmpInfo.prefab = ProjectTile[i]["prefab_c"].str; tmpInfo.colideSound = (uint)ProjectTile[i]["colideSound_ui"].n; tmpInfo.colideEffect = ProjectTile[i]["colideEffect_c"].str; tmpInfo.Type = (byte)ProjectTile[i]["Type_b"].n; tmpInfo.moveSpeed = (float)ProjectTile[i]["moveSpeed_f"].n; tmpInfo.maxDistance = (float)ProjectTile[i]["maxDistance_f"].n; tmpInfo.durationTime = (float)ProjectTile[i]["durationTime_f"].n; tmpInfo.radius = (ushort)ProjectTile[i]["radius_us"].n; tmpInfo.penetrate = (byte)ProjectTile[i]["penetrate_b"].n; tmpInfo.penetrateCount = (byte)ProjectTile[i]["penetrateCount_b"].n; tmpInfo.availableCnt = (ushort)ProjectTile[i]["availableCnt_us"].n; tmpInfo.damageinterval = (float)ProjectTile[i]["dmginterval_f"].n; tmpInfo.startType = (byte)ProjectTile[i]["startType_b"].n; tmpInfo.startLocation = (float)ProjectTile[i]["startLocation_f"].n; tmpInfo.yLocation = (byte)ProjectTile[i]["yLocation_b"].n; tmpInfo.castDummy = ProjectTile[i]["castDummy_c"].str; tmpInfo.callBuffIdx = (uint)ProjectTile[i]["callBuffIdx_ui"].n; tmpInfo.ProjectSound = (uint)ProjectTile[i]["ProjectSound_ui"].n; ProjectTileInfoDic.Add(tmpInfo.idx, tmpInfo); } } { TextAsset data = Resources.Load("TestJson/Skill_SkillLevel", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject SkillLevel = new JSONObject(strSrc); for (int i = 0; i < SkillLevel.list.Count; i++) { SkillLevelInfo tmpInfo = new SkillLevelInfo(); tmpInfo.Idx = (uint)SkillLevel[i]["Idx_ui"].n; tmpInfo.unitIdx = (uint)SkillLevel[i]["unitIdx_ui"].n; tmpInfo.skillIdx = (uint)SkillLevel[i]["skillIdx_ui"].n; tmpInfo.name = (uint)SkillLevel[i]["name_ui"].n; tmpInfo.skilldesc = (uint)SkillLevel[i]["skilldesc_ui"].n; tmpInfo.icon = (uint)SkillLevel[i]["icon_ui"].n; tmpInfo.skillLevel = (uint)SkillLevel[i]["skillLevel_ui"].n; tmpInfo.LimitLv = (byte)SkillLevel[i]["LimitLv_b"].n; tmpInfo.SkillLevelUpStatusId = (uint)SkillLevel[i]["SkillLevelUpStatusId_ui"].n; tmpInfo.SkillLevelUpItem1 = (uint)SkillLevel[i]["SkillLevelUpItem1_ui"].n; tmpInfo.SkillLevelUpItem1Count = (uint)SkillLevel[i]["SkillLevelUpItem1Count_ui"].n; tmpInfo.SkillLevelUpItem2 = (uint)SkillLevel[i]["SkillLevelUpItem2_ui"].n; tmpInfo.SkillLevelUpItem2Count = (uint)SkillLevel[i]["SkillLevelUpItem2Count_ui"].n; tmpInfo.CostGold = (uint)SkillLevel[i]["CostGold_ui"].n; tmpInfo.rate = (uint)SkillLevel[i]["rate_ui"].n; tmpInfo.durationTime = (float)SkillLevel[i]["durationTime_f"].n; tmpInfo.factorRate = new JsonCustomData(SkillLevel[i]["factorRate_j"].ToString()); tmpInfo.factor = (uint)SkillLevel[i]["factor_ui"].n; tmpInfo.SuperArmorDamage = new JsonCustomData(SkillLevel[i]["SuperArmorDamage_j"].ToString()); tmpInfo.SuperArmorRecovery = new JsonCustomData(SkillLevel[i]["SuperArmorRecovery_j"].ToString()); tmpInfo.cooltime = (float)SkillLevel[i]["cooltime_f"].n; tmpInfo.callCastingBuffIdx = (uint)SkillLevel[i]["callCastingBuffIdx_ui"].n; tmpInfo.CastingBuffDurationTime = (float)SkillLevel[i]["CastingBuffDurationTime_f"].n; tmpInfo.callBuffIdx = new JsonCustomData(SkillLevel[i]["callBuffIdx_j"].ToString()); tmpInfo.callAbilityIdx = (uint)SkillLevel[i]["callAbilityIdx_ui"].n; tmpInfo.callChainIdx = (uint)SkillLevel[i]["callChainIdx_ui"].n; tmpInfo.callChainTime = (float)SkillLevel[i]["callChainTime_f"].n; tmpInfo.ignoreDef = new JsonCustomData(SkillLevel[i]["ignoreDef_j"].ToString()); SkillLevelInfoList.Add(tmpInfo); } } { TextAsset data = Resources.Load("TestJson/Skill_SkillSet", typeof(TextAsset)) as TextAsset; StringReader sr = new StringReader(data.text); string strSrc = sr.ReadToEnd(); JSONObject SkillSet = new JSONObject(strSrc); for (int i = 0; i < SkillSet.list.Count; i++) { SkillSetInfo tmpInfo = new SkillSetInfo(); tmpInfo.Id = (uint)SkillSet[i]["Id_ui"].n; tmpInfo.Class = (byte)SkillSet[i]["Class_b"].n; tmpInfo.Default = (byte)SkillSet[i]["Default_b"].n; tmpInfo.SetName = (uint)SkillSet[i]["SetName_ui"].n; tmpInfo.SetDescriptionId = (uint)SkillSet[i]["SetDescriptionId_ui"].n; tmpInfo.Icon = (uint)SkillSet[i]["Icon_ui"].n; tmpInfo.AniPath = SkillSet[i]["AniPath_c"].str; tmpInfo.AniId = (uint)SkillSet[i]["AniId_ui"].n; tmpInfo.skill0 = new JsonCustomData(SkillSet[i]["skill0_j"].ToString()); tmpInfo.skill1 = (uint)SkillSet[i]["skill1_ui"].n; tmpInfo.skill2 = (uint)SkillSet[i]["skill2_ui"].n; tmpInfo.skill3 = (uint)SkillSet[i]["skill3_ui"].n; tmpInfo.skill4 = (uint)SkillSet[i]["skill4_ui"].n; tmpInfo.Chain = new JsonCustomData(SkillSet[i]["Chain_j"].ToString()); SkillSetInfoDic.Add(tmpInfo.Id, tmpInfo); } } }
// 어떤 스킬셋 버튼 눌렀는지 public void ClickSelectSkillSetButton(RectTransform _rectTransform, SkillType type) { // 이미 열린 스킬셋은 열지 않기 for (int i = 0; i < _selectType.Length; i++) { if (_selectType[i].type == type) { if (_selectType[i].isSelected == true) { return; } else { _selectType[i].isSelected = true; } } } List <DataSkillInfo> SkillDataList = new List <DataSkillInfo>(); Sprite[] ActiveSkills = null; Sprite[] PassiveSkills = null; // 스킬셋 가져오기 SkillTabInfo _SkillTabInfo = _rectTransform.GetComponentInParent <SkillTabInfo>(); SkillSetInfo _CurrentSkillSet = _SkillTabInfo.SkillSet; switch (type) { case SkillType.Battlerage: SkillDataList = Battlerage; ActiveSkills = Resources.LoadAll <Sprite>("격투액티브"); PassiveSkills = Resources.LoadAll <Sprite>("격투패시브"); break; case SkillType.Sorcery: SkillDataList = Sorcery; ActiveSkills = Resources.LoadAll <Sprite>("마법액티브"); PassiveSkills = Resources.LoadAll <Sprite>("마법패시브"); break; case SkillType.Archery: SkillDataList = Archery; ActiveSkills = Resources.LoadAll <Sprite>("야성액티브"); PassiveSkills = Resources.LoadAll <Sprite>("야성패시브"); break; case SkillType.Shadowplay: SkillDataList = Shadowplay; ActiveSkills = Resources.LoadAll <Sprite>("사명액티브"); PassiveSkills = Resources.LoadAll <Sprite>("사명패시브"); break; case SkillType.Witchcraft: SkillDataList = Witchcraft; ActiveSkills = Resources.LoadAll <Sprite>("환술액티브"); PassiveSkills = Resources.LoadAll <Sprite>("환술패시브"); break; } // 해당 스킬셋에 리스트 할당 _CurrentSkillSet.CurrentSkillList = SkillDataList; _CurrentSkillSet.ActiveSkills = ActiveSkills; _CurrentSkillSet.PassiveSkills = PassiveSkills; // 스킬셋 넘기기 InstantiateSkills(_CurrentSkillSet); }