//召唤兽普通攻击特效 void selfFx(int id) { MS0000_Default_Event mde = m_curModel.gameObject.GetComponent <MS0000_Default_Event>(); SXML sxml = XMLMgr.instance.GetSXML("monsters.monsters", "id==" + summonid); if (sxml != null && sxml.getString("skillid_1") != "") { // mde.onSFX_EFF(sxml.getString("skillid_"+id)); mde.effect = sxml.getString("skillid_" + id); } }
private void selfFx(int id) { MS0000_Default_Event component = this.m_curModel.gameObject.GetComponent <MS0000_Default_Event>(); SXML sXML = XMLMgr.instance.GetSXML("monsters.monsters", "id==" + this.summonid); bool flag = sXML != null && sXML.getString("skillid_1") != ""; if (flag) { component.effect = sXML.getString("skillid_" + id); } }
public Material set_strength_shader(Material ml, Texture2D tex1, int id, int fxlevel) { //Material cur_mat = ml; Texture tex = ml.GetTexture(EnumShader.SPI_MAINTEX); ////例如 mage_skin0_diff_h 到 mage_skin0_q //string tex1_name = tex.name.Substring(0, tex.name.Length - 6) + "q"; ////debug.Log("材质是"+ tex1_name); ////Texture tex1 = GAMEAPI.ABFight_LoadTexture2D("mtl_" + tex1_name); //Texture tex1 = null; Material mtl_inst = GameObject.Instantiate(m_fxLvMtl) as Material; mtl_inst.SetTexture(EnumShader.SPI_MAINTEX, tex); if (tex1 != null) { mtl_inst.SetTexture(EnumShader.SPI_SUBTEX, tex1); } SXML xml = XMLMgr.instance.GetSXML("item.stage", "stage_level==" + fxlevel); if (xml == null) { return(mtl_inst); } xml = xml.GetNode("stage_info", "itemid==" + id); if (xml == null) { return(mtl_inst); } xml = xml.GetNode("intensify_light", null); if (xml == null) { return(mtl_inst); } string[] high_light = xml.getString("high_light").Split(','); string[] strength_light = xml.getString("strength_light").Split(','); string[] color = xml.getString("color").Split(','); Vector4 splRim = new Vector4(float.Parse(high_light[0]), float.Parse(high_light[1]), float.Parse(high_light[2]), float.Parse(high_light[3])); Vector4 strAnim = new Vector4(float.Parse(strength_light[0]), float.Parse(strength_light[1]), float.Parse(strength_light[2]), float.Parse(strength_light[3])); Color strColor = new Color(float.Parse(color[0]) / 255, float.Parse(color[1]) / 255, float.Parse(color[2]) / 255); mtl_inst.SetVector(EnumShader.SPI_SPLRIM, splRim); mtl_inst.SetVector(EnumShader.SPI_STRANIM, strAnim); mtl_inst.SetColor(EnumShader.SPI_STRCOLOR, strColor); return(mtl_inst); }
private void OnPetStageChange() { Transform transform = SelfRole._inst.m_curModel.FindChild("birdstop"); for (int i = 0; i < transform.childCount; i++) { UnityEngine.Object.Destroy(transform.GetChild(i)); } A3_PetModel instance = ModelBase <A3_PetModel> .getInstance(); SXML node = instance.PetXML.GetNode("pet.stage", "stage==" + instance.Stage.ToString()); string @string = node.getString("avatar"); GameObject gameObject = Resources.Load <GameObject>("profession/" + @string); GameObject x = Resources.Load <GameObject>("profession/birdpath"); bool flag = this._birdPrefab == null || x == null; if (!flag) { GameObject gameObject2 = UnityEngine.Object.Instantiate(this._birdPrefab, transform.position, Quaternion.identity) as GameObject; GameObject gameObject3 = UnityEngine.Object.Instantiate(this._pathPrefab, transform.position, Quaternion.identity) as GameObject; bool flag2 = gameObject2 == null || gameObject3 == null; if (!flag2) { gameObject3.transform.parent = transform; PetBird petBird = gameObject2.AddComponent <PetBird>(); petBird.Path = gameObject3; } } }
public override void PlaySkill(int id) { debug.Log("PlaySkill: " + id); //flytxt.instance.fly(id.ToString ()); MS0000_Default_Event mde = m_curModel.gameObject.GetComponent <MS0000_Default_Event>(); mde.effect = null; if (id != 1) { if (ismapEffect) { mde.vec = effectVec; ismapEffect = false; } // mde.onSFX_EFF(id.ToString()); mde.effect = id.ToString(); } else { selfFx(id); } int play_skill; if (id == 1) { play_skill = 1; } else { SXML sxml = XMLMgr.instance.GetSXML("skill.skill", "id==" + id); if (sxml != null) { play_skill = sxml.getInt("action_tp"); flyskill(sxml.getString("name")); } else { play_skill = 1; } } m_fAttackCount = 0.5f; if (play_skill == 1) { OtherSkillShow(); EnterAttackState(); } else { m_fSkillShowTime = 5.0f; m_curAni.SetInteger(EnumAni.ANI_I_SKILL, play_skill); m_curAni.SetBool(EnumAni.ANI_ATTACK, false); } //selfFx(play_skill); }
private void OnPetStageChange() { Transform stop = SelfRole._inst.m_curModel.FindChild("birdstop"); for (int i = 0; i < stop.childCount; i++) { GameObject.Destroy(stop.GetChild(i)); } A3_PetModel petModel = A3_PetModel.getInstance(); SXML stageXML = petModel.PetXML.GetNode("pet.stage", "stage==" + petModel.Stage.ToString()); string avatar = stageXML.getString("avatar"); GameObject birdPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_" + avatar); GameObject pathPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_birdpath"); if (_birdPrefab == null || pathPrefab == null) { return; } GameObject bird = GameObject.Instantiate(_birdPrefab, stop.position, Quaternion.identity) as GameObject; GameObject path = GameObject.Instantiate(_pathPrefab, stop.position, Quaternion.identity) as GameObject; if (bird == null || path == null) { return; } path.transform.parent = stop; PetBird bd = null; bd = bird.AddComponent <PetBird>(); bd.Path = path; }
public Material set_strength_shader(Material ml, int id, int fxlevel) { Material material = UnityEngine.Object.Instantiate <Material>(this.m_fxLvMtl); Texture texture = ml.GetTexture(EnumShader.SPI_MAINTEX); material.SetTexture(EnumShader.SPI_MAINTEX, texture); string str = texture.name.Substring(0, texture.name.Length - 6) + "q"; debug.Log("材质是" + str); Texture texture2 = Resources.Load("mtl/" + str) as Texture2D; bool flag = texture2 != null; if (flag) { material.SetTexture(EnumShader.SPI_SUBTEX, texture2); } SXML sXML = XMLMgr.instance.GetSXML("item.stage", "stage_level==" + fxlevel); bool flag2 = sXML == null; Material result; if (flag2) { result = material; } else { sXML = sXML.GetNode("stage_info", "itemid==" + id); bool flag3 = sXML == null; if (flag3) { result = material; } else { sXML = sXML.GetNode("intensify_light", null); bool flag4 = sXML == null; if (flag4) { result = material; } else { string[] array = sXML.getString("high_light").Split(new char[] { ',' }); string[] array2 = sXML.getString("strength_light").Split(new char[] { ',' }); string[] array3 = sXML.getString("color").Split(new char[] { ',' }); Vector4 vector = new Vector4(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3])); Vector4 vector2 = new Vector4(float.Parse(array2[0]), float.Parse(array2[1]), float.Parse(array2[2]), float.Parse(array2[3])); Color color = new Color(float.Parse(array3[0]) / 255f, float.Parse(array3[1]) / 255f, float.Parse(array3[2]) / 255f); material.SetVector(EnumShader.SPI_SPLRIM, vector); material.SetVector(EnumShader.SPI_STRANIM, vector2); material.SetColor(EnumShader.SPI_STRCOLOR, color); result = material; } } } return(result); }
public MonsterRole AddMonster(int id, Vector3 pos, uint serverid = 0u, float roatate = 0f, int boset_num = 0, int carr = 0, string name = null) { this.init(); bool flag = this.m_mapMonster.ContainsKey(serverid); MonsterRole result; if (flag) { result = null; } else { SXML sXML = this.dMon[id]; int num = sXML.getInt("obj"); float @float = sXML.getFloat("scale"); bool flag2 = serverid <= 0u; if (flag2) { bool flag3 = Globle.m_nTestMonsterID > 0; if (flag3) { num = Globle.m_nTestMonsterID; } } bool flag4 = sXML.getInt("collect_tar") > 0; bool isHardDemo = Globle.isHardDemo; Type type; if (isHardDemo) { type = MonsterMgr.getTypeHandle("Md" + num); } else { bool flag5 = flag4; if (flag5) { bool flag6 = num == 122; if (flag6) { type = Type.GetType("CollectBox"); } else { type = Type.GetType("CollectRole"); } } else { type = Type.GetType("M" + num); } } bool flag7 = id == 4002 || carr == 2; if (flag7) { type = Type.GetType("M000P2"); } else { bool flag8 = id == 4003 || carr == 3; if (flag8) { type = Type.GetType("M000P3"); } else { bool flag9 = id == 4005 || carr == 5; if (flag9) { type = Type.GetType("M000P5"); } } } bool flag10 = type == null; if (flag10) { type = Type.GetType("M00000"); } MonsterRole monsterRole = (MonsterRole)Activator.CreateInstance(type); bool flag11 = name != null; if (flag11) { monsterRole.ownerName = name; } bool flag12 = carr == 0; if (flag12) { monsterRole.roleName = sXML.getString("name"); } monsterRole.tempXMl = sXML; monsterRole.m_circle_type = sXML.getInt("boss_circle"); bool flag13 = sXML.getFloat("boss_circle_scale") == -1f; if (flag13) { monsterRole.m_circle_scale = 1f; } else { monsterRole.m_circle_scale = sXML.getFloat("boss_circle_scale"); } monsterRole.isBoos = (sXML.getInt("boss") == 1); bool flag14 = @float > 0f; if (flag14) { monsterRole.scale = @float; } bool flag15 = monsterRole != null; if (flag15) { bool flag16 = id == 4002 || carr == 2; if (flag16) { monsterRole.Init("profession/warrior_inst", EnumLayer.LM_MONSTER, pos, roatate); } else { bool flag17 = id == 4003 || carr == 3; if (flag17) { monsterRole.Init("profession/mage_inst", EnumLayer.LM_MONSTER, pos, roatate); } else { bool flag18 = id == 4005 || carr == 5; if (flag18) { monsterRole.Init("profession/assa_inst", EnumLayer.LM_MONSTER, pos, roatate); } else { bool flag19 = flag4; if (flag19) { monsterRole.Init("npc/" + num, EnumLayer.LM_MONSTER, pos, roatate); } else { monsterRole.Init("monster/" + num, EnumLayer.LM_MONSTER, pos, roatate); } } } } monsterRole.monsterid = id; bool flag20 = boset_num > 0; if (flag20) { PlayerNameUIMgr.getInstance().show(monsterRole); PlayerNameUIMgr.getInstance().seticon_forDaobao(monsterRole, boset_num); } bool flag21 = ModelBase <A3_ActiveModel> .getInstance().mwlr_map_info.Count > 0; if (flag21) { PlayerNameUIMgr.getInstance().seticon_forMonsterHunter(monsterRole, ModelBase <A3_ActiveModel> .getInstance().mwlr_map_info[0]["target_mid"] != id); } bool flag22 = serverid > 0u; if (flag22) { monsterRole.m_unIID = serverid; this.m_mapMonster.Add(serverid, monsterRole); } else { monsterRole.isfake = true; monsterRole.m_unIID = this.idIdx; this.m_mapFakeMonster.Add(this.idIdx, monsterRole); this.idIdx += 1u; } bool flag23 = !GRMap.loading; if (flag23) { monsterRole.refreshViewType(2); } } this.m_listMonster.Add(monsterRole); bool flag24 = monsterRole != null; if (flag24) { base.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, monsterRole, false)); } result = monsterRole; } return(result); }
public MonsterRole AddSummon(Variant m) { this.init(); bool loading = GRMap.loading; MonsterRole result; if (loading) { this.cacheProxy.Add(m); result = null; } else { Vector3 pos = new Vector3(m["x"] / 53.333f, 0f, m["y"] / 53.333f); int num = m["mid"]; uint num2 = m["iid"]; bool flag = this.m_mapMonster.ContainsKey(num2); if (flag) { this.RemoveMonster(num2); } SXML sXML = this.dMon[num]; int num3 = sXML.getInt("obj"); float @float = sXML.getFloat("scale"); string @string = sXML.getString("name"); bool flag2 = num2 <= 0u; if (flag2) { bool flag3 = Globle.m_nTestMonsterID > 0; if (flag3) { num3 = Globle.m_nTestMonsterID; } } MS0000 mS = new MS0000(); mS.tempXMl = sXML; mS.isBoos = (sXML.getInt("boss") == 1); bool flag4 = @float > 0f; if (flag4) { mS.scale = @float; } bool flag5 = mS != null; if (flag5) { mS.Init("monster/" + num3, EnumLayer.LM_MONSTER, pos, 0f); PlayerNameUIMgr.getInstance().show(mS); PlayerNameUIMgr.getInstance().setName(mS, @string, m["owner_name"] + "的小伙伴"); mS.roleName = @string; mS.monsterid = num; bool flag6 = num2 > 0u; if (flag6) { mS.m_unIID = num2; this.m_mapMonster.Add(num2, mS); } else { mS.isfake = true; mS.m_unIID = this.idIdx; this.m_mapFakeMonster.Add(this.idIdx, mS); this.idIdx += 1u; } bool flag7 = !GRMap.loading; if (flag7) { mS.refreshViewType(2); } mS.issummon = true; mS.summonid = num; mS.masterid = m["owner_cid"]; bool flag8 = mS.masterid == ModelBase <PlayerModel> .getInstance().cid; if (flag8) { bool flag9 = a3_herohead.instance; if (flag9) { ModelBase <A3_SummonModel> .getInstance().lastatkID = 0u; a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]); a3_herohead.instance.refresh_sumbar(); a3_herohead.instance.do_sum_CD = false; } } } this.m_listMonster.Add(mS); bool flag10 = mS != null; if (flag10) { base.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mS, false)); } bool flag11 = mS != null; if (flag11) { mS.curhp = m["hp"]; mS.maxHp = m["battleAttrs"]["max_hp"]; mS.owner_cid = m["owner_cid"]; } result = mS; } return(result); }
public MonsterRole AddMonster(int id, Vector3 pos, uint serverid = 0, float roatate = 0, int boset_num = 0, int carr = 0, string name = null) { init(); if (m_mapMonster.ContainsKey(serverid)) { return(m_mapMonster[serverid]); } MonsterRole mon = null; //if (monID == 1) //{ SXML xml = dMon[id]; int tempid = xml.getInt("obj"); float scale = xml.getFloat("scale"); //用来给美术测试新加的怪物用的 if (serverid <= 0) { if (Globle.m_nTestMonsterID > 0) { tempid = Globle.m_nTestMonsterID; } } bool isCollect = xml.getInt("collect_tar") > 0; bool isboxCollect = xml.getInt("collect_box") > 0; // 判断这个宝箱是不是采集用的 > 0 则是采集的用宝箱 //Type TCls; //if (Globle.isHardDemo) // TCls = getTypeHandle("Md" + tempid); //else //{ // if (isCollect) // { // if (tempid == 122 && !isboxCollect) // { // TCls = System.Type.GetType("CollectBox"); // } // else TCls = System.Type.GetType("CollectRole"); // } // else // { // TCls = System.Type.GetType("M" + tempid); // } //} //if (id == 4002 || carr == 2) TCls = System.Type.GetType("M000P2"); //else if (id == 4003 || carr == 3) TCls = System.Type.GetType("M000P3"); //else if (id == 4005 || carr == 5) TCls = System.Type.GetType("M000P5"); //if (TCls == null) //{ // TCls = System.Type.GetType("M00000"); //} //mon = (MonsterRole)Activator.CreateInstance(TCls); if (isCollect) { if (tempid == 122) { mon = new CollectBox(); } else { mon = new CollectRole(); } } if (id == 4002 || carr == 2) { mon = new M000P2(); } else if (id == 4003 || carr == 3) { mon = new M000P3(); } else if (id == 4005 || carr == 5) { mon = new M000P5(); } if (mon == null) { mon = new M00000(); } if (name != null) { mon.ownerName = name; } if (carr == 0) { mon.roleName = xml.getString("name"); } mon.tempXMl = xml; mon.m_circle_type = xml.getInt("boss_circle"); if (xml.getFloat("boss_circle_scale") == -1) { mon.m_circle_scale = 1; } else { mon.m_circle_scale = xml.getFloat("boss_circle_scale"); } mon.isBoos = xml.getInt("boss") == 1; mon.isBoss_c = xml.getInt("boss_c") == 1; if (scale > 0f) { mon.scale = scale; } if (serverid > 0) { mon.m_unIID = serverid; m_mapMonster.Add(serverid, mon); } else { mon.isfake = true; mon.m_unIID = idIdx; m_mapFakeMonster.Add(idIdx, mon); idIdx++; } if (mon != null) { if (id == 4002 || carr == 2) { mon.Init("profession_warrior_inst", EnumLayer.LM_MONSTER, pos, roatate); } else if (id == 4003 || carr == 3) { mon.Init("profession_mage_inst", EnumLayer.LM_MONSTER, pos, roatate); } else if (id == 4005 || carr == 5) { mon.Init("profession_assa_inst", EnumLayer.LM_MONSTER, pos, roatate); } else if (isCollect) { mon.Init("npc_" + tempid, EnumLayer.LM_MONSTER, pos, roatate); } else { mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, pos, roatate); } mon.monsterid = id; if (boset_num > 0) { PlayerNameUIMgr.getInstance().show(mon); PlayerNameUIMgr.getInstance().seticon_forDaobao(mon, boset_num); } if (A3_ActiveModel.getInstance().mwlr_map_info.Count > 0) { PlayerNameUIMgr.getInstance().seticon_forMonsterHunter(mon, A3_ActiveModel.getInstance().mwlr_map_info[0]["target_mid"] != id); } //if (GRMap.grmap_loading == false) // mon.refreshViewType(2); } m_listMonster.Add(mon); //} //else if (monID == 2) //{ // mon = new M10002Srg(); // mon.Init("monster/10002", EnumLayer.LM_MONSTER, bornpt); // m_mapMonster.Add(idIdx, mon); //} //else if (monID == 3) //{ // mon = new M10003Stl(); // mon.Init("monster/10003", EnumLayer.LM_MONSTER, bornpt); // m_mapMonster.Add(idIdx, mon); //} //if (mon != null) //{ // MonsterData dta = new MonsterData(); // dta.roleId = idIdx; // dta.monid = monID; // mon.monsterDta = dta; //} //idIdx++; if (mon != null) { dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon)); } return(mon); }
public MonsterRole AddSummon(Variant m) { init(); if (GRMap.grmap_loading) { cacheProxy.Add(m); return(null); } Vector3 born_pt = new Vector3(m["x"] / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, m["y"] / GameConstant.PIXEL_TRANS_UNITYPOS); int id = m["mid"]; uint serverid = m["iid"]; if (m_mapMonster.ContainsKey(serverid)) { if (m["owner_cid"] == PlayerModel.getInstance().cid) { if (a3_herohead.instance) { A3_SummonModel.getInstance().lastatkID = 0; a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]); a3_herohead.instance.refresh_sumbar(); a3_herohead.instance.do_sum_CD = false; } } return(m_mapMonster[serverid]); } //return null; SXML xml = dMon[id]; int tempid = xml.getInt("obj"); float scale = xml.getFloat("scale"); string name = xml.getString("name"); if (serverid <= 0) { if (Globle.m_nTestMonsterID > 0) { tempid = Globle.m_nTestMonsterID; } } MS0000 mon = new MS0000(); mon.tempXMl = xml; mon.isBoos = xml.getInt("boss") == 1; mon.isBoss_c = xml.getInt("boss_c") == 1; if (scale > 0f) { mon.scale = scale; } if (mon != null) { if (serverid > 0) { mon.m_unIID = serverid; m_mapMonster.Add(serverid, mon); roleSummonMapping[m["owner_cid"]] = serverid; // 人物对应的召唤兽 id } else { mon.isfake = true; mon.m_unIID = idIdx; m_mapFakeMonster.Add(idIdx, mon); idIdx++; } mon.masterid = m["owner_cid"]; mon.issummon = true; mon.summonid = id; if (SceneCamera.m_nModelDetail_Level != 1 && mon.masterid != PlayerModel.getInstance().cid) {//设置隐藏召唤兽 mon.Init("monster_" + tempid, EnumLayer.LM_DEFAULT, born_pt, 0); } else { mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, born_pt, 0); } mon.m_layer = EnumLayer.LM_MONSTER; PlayerNameUIMgr.getInstance().show(mon); PlayerNameUIMgr.getInstance().setName(mon, name, m["owner_name"] + ContMgr.getCont("MonsterMgr")); mon.roleName = name; mon.monsterid = id; //if (GRMap.grmap_loading == false) // mon.refreshViewType(2); //mon.master = RoleMgr._instance.getRole(m["owner_cid"]); if (mon.masterid == PlayerModel.getInstance().cid) { if (a3_herohead.instance) { A3_SummonModel.getInstance().lastatkID = 0; a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]); a3_herohead.instance.refresh_sumbar(); a3_herohead.instance.do_sum_CD = false; } } } m_listMonster.Add(mon); if (mon != null) { dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon)); } if (mon != null) { mon.curhp = m["hp"]; mon.maxHp = m["battleAttrs"]["max_hp"]; mon.owner_cid = m["owner_cid"]; } return(mon); }