public Dictionary <string, string> GetSkillData(string skillId) { if (!(skillSheet != null && boxesSheet != null && skillId != null && skillId != "")) { return(null); } string trimmedSid = skillId.Trim(); IRow skillRow = XlsUtil.findRow(skillSheet, trimmedSid); if (skillRow == null) { return(null); } IRow skillRefRow = skillSheet.GetRow(2); IRow boxesRefRow = boxesSheet.GetRow(2); Dictionary <string, string> skillData = XlsUtil.getValueDict(skillRow, skillRefRow); return(skillData); }
public void TryShowSkill(string skillId) { //var rigidBody = gameObject.GetComponent<Rigidbody> (); //rigidBody.velocity = testVelocity; if (!(skillSheet != null && boxesSheet != null && skillId != null && skillId != "")) { return; } string trimmedSid = skillId.Trim(); IRow skillRow = XlsUtil.findRow(skillSheet, trimmedSid); if (skillRow == null) { return; } IRow skillRefRow = skillSheet.GetRow(2); IRow boxesRefRow = boxesSheet.GetRow(2); Dictionary <string, string> skillData = XlsUtil.getValueDict(skillRow, skillRefRow); List <string> boxIdList = new List <string> (); for (int i = 1; i <= 10; ++i) { string key = "box" + i.ToString(); if (skillData.ContainsKey(key)) { boxIdList.Add(skillData [key]); } } List <Dictionary <string, string> > boxDataDict = new List <Dictionary <string, string> >(); foreach (string boxId in boxIdList) { IRow boxRow = XlsUtil.findRow(boxesSheet, boxId); if (boxRow != null) { Dictionary <string, string> boxData = XlsUtil.getValueDict(boxRow, boxesRefRow); boxDataDict.Add(boxData); } } // clear colliders for simulate hit pause clearColliders(); foreach (var boxData in boxDataDict) { if (boxData.ContainsKey("shake_tm")) { delayList.Add(Single.Parse(boxData["shake_tm"]) / 24); } else { delayList.Add(0.0f); } } // play sounds List <KeyValuePair <string, int> > sounds = new List <KeyValuePair <string, int> >(); if (skillData.ContainsKey("sound1")) { string sounds_str = skillData ["sound1"]; string frames_str = ""; if (skillData.ContainsKey("sound_frame1")) { frames_str = skillData ["sound_frame1"]; } string[] all_sounds = sounds_str.Split(','); string[] all_frames = frames_str.Split(','); for (int i = 0; i < all_sounds.Length; ++i) { string sound = all_sounds[i].Trim(); int frame = 0; if (all_frames.Length > i) { frame = Convert.ToInt32(all_frames [i]); } sounds.Add(new KeyValuePair <string, int>(sound, frame)); } } if (gtc != null) { gtc.destroy(); gtc = null; } if (audioGtc != null) { audioGtc.destroy(); audioGtc = null; } _sounds = sounds; _skillData = skillData; _boxDataDict = boxDataDict; var config = LBootEditor.GameConfig.Get(); animLen = config.getClipLength(this.animator.runtimeAnimatorController.name, skillData["anim_type"]); // StartCoroutine ("loadSounds"); loadSounds(); }
public void TryShowSkill() { //var rigidBody = gameObject.GetComponent<Rigidbody> (); //rigidBody.velocity = testVelocity; if (!(skillWorkBook != null && boxesWorkBook != null && skillId != null && skillId != "")) { return; } ISheet skillSheet = skillWorkBook.GetSheetAt(1); ISheet boxesSheet = boxesWorkBook.GetSheetAt(1); string trimmedSid = skillId.Trim(); IRow skillRow = XlsUtil.findRow(skillSheet, trimmedSid); if (skillRow == null) { return; } IRow skillRefRow = skillSheet.GetRow(2); IRow boxesRefRow = boxesSheet.GetRow(2); Dictionary <string, string> skillData = XlsUtil.getValueDict(skillRow, skillRefRow); List <string> boxIdList = new List <string> (); for (int i = 1; i <= 10; ++i) { string key = "box" + i.ToString(); if (skillData.ContainsKey(key)) { boxIdList.Add(skillData [key]); } } List <Dictionary <string, string> > boxDataDict = new List <Dictionary <string, string> >(); foreach (string boxId in boxIdList) { IRow boxRow = XlsUtil.findRow(boxesSheet, boxId); if (boxRow != null) { Dictionary <string, string> boxData = XlsUtil.getValueDict(boxRow, boxesRefRow); boxDataDict.Add(boxData); } } // clear colliders for simulate hit pause clearColliders(); foreach (var boxData in boxDataDict) { if (boxData.ContainsKey("shake_tm")) { delayList.Add(Single.Parse(boxData["shake_tm"]) / 24); } else { delayList.Add(0.0f); } } if (gtc != null) { gtc.destroy(); gtc = null; } this.time = 0; animTimeVal = 0; preATV = 0; preState = skillData["anim_type"]; gameObject.transform.position = Vector3.zero; this.animator.Play(preState, 0, 0); this.animator.enabled = true; this.animator.speed = 1.0f; DestroyEfx(); if (skillData.ContainsKey("self_eff")) { effect_nf = MakeEfx(skillData["self_eff"]); } if (skillData.ContainsKey("self_eff_follow")) { effect_f = MakeEfx(skillData["self_eff_follow"]); } if (effect_f != null) { effect_f.transform.SetParent(gameObject.transform, true); effect_f.name = skillData["self_eff_follow"] + "efx"; } if (effect_nf != null) { effect_nf.transform.position = gameObject.transform.position; effect_nf.name = skillData["self_eff"] + "efx"; } if (skillData["is_jump_skill"] == "是") { applyJumpSkillMove(boxDataDict); } else { applyNonJumpSkillMove(boxDataDict); } }