private GameObject createMagaAvatar(ChaOutInfo info) { GameObject original = Resources.Load <GameObject>("profession/avatar_ui/mage_avatar"); GameObject gameObject = UnityEngine.Object.Instantiate(original, this.standPoint.transform.position, Quaternion.identity) as GameObject; Transform transform = gameObject.transform.FindChild("model"); ProfessionAvatar professionAvatar = new ProfessionAvatar(); professionAvatar.Init("profession/mage/", "h_", EnumLayer.LM_FX, EnumMaterial.EMT_EQUIP_H, transform.transform, "Fx/armourFX/mage/"); professionAvatar.set_body(info.bodyID, info.bodyInte); professionAvatar.set_weaponl(info.weaponLID, info.weaponLInte); professionAvatar.set_weaponr(info.weaponRID, info.weaponRInte); professionAvatar.set_wing(info.wingID, info.wingInte); professionAvatar.set_equip_color((uint)info.colorID); bool addeff = info.addeff; if (addeff) { professionAvatar.set_equip_eff(info.bodyID, true); } this.m_curProAvatar = professionAvatar; Transform parent = gameObject.transform.FindChild("model/R_Finger1"); original = Resources.Load <GameObject>("profession/avatar_ui/mage_r_finger_fire"); GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(original); gameObject2.transform.SetParent(parent, false); return(gameObject); }
public void SetSkin() { SXML sXML = XMLMgr.instance.GetSXML("mlzd", ""); int num = SelfRole._inst.zhuan * 10 + SelfRole._inst.lvl; int num2 = 2; int num3 = 3; List <SXML> nodeList = sXML.GetNodeList("stage", ""); foreach (SXML current in nodeList) { string @string = current.getString("lvl"); int num4 = int.Parse(@string.Split(new char[] { ',' })[0]); int num5 = int.Parse(@string.Split(new char[] { ',' })[1]); bool flag = num <= num4 * 10 + num5; if (flag) { num2 = current.getInt("waiguan"); break; } } GameObject gameObject = this.m_curModel.parent.gameObject; string avatar_path = "profession/assa/"; Transform[] componentsInChildren = gameObject.GetComponentsInChildren <Transform>(); for (int i = 0; i < componentsInChildren.Length; i++) { Transform transform = componentsInChildren[i]; transform.gameObject.layer = EnumLayer.LM_SELFROLE; } Transform transform2 = gameObject.transform.FindChild("model"); ProfessionAvatar professionAvatar = new ProfessionAvatar(); professionAvatar.Init(avatar_path, "l_", this.m_curGameObj.layer, EnumMaterial.EMT_EQUIP_L, this.m_curModel, ""); professionAvatar.set_body(num3 * 100 + num2 * 10 + 3, 0); professionAvatar.set_weaponl(num3 * 100 + num2 * 10 + 6, 0); professionAvatar.set_weaponr(num3 * 100 + num2 * 10 + 6, 0); professionAvatar.set_wing(0, 0); this.m_curPhy = this.m_curModel.transform.FindChild("physics"); try { this.m_curPhy.gameObject.layer = EnumLayer.LM_BT_FIGHT; } catch (Exception var_18_1F5) { } }
private GameObject createAssassinAvatar(ChaOutInfo info) { GameObject original = Resources.Load <GameObject>("profession/avatar_ui/assa_avatar"); GameObject gameObject = UnityEngine.Object.Instantiate(original, this.standPoint.transform.position, Quaternion.identity) as GameObject; Transform cur_model = gameObject.transform.FindChild("model"); ProfessionAvatar professionAvatar = new ProfessionAvatar(); professionAvatar.Init("profession/assa/", "h_", EnumLayer.LM_FX, EnumMaterial.EMT_EQUIP_H, cur_model, "Fx/armourFX/assa/"); professionAvatar.set_body(info.bodyID, info.bodyInte); professionAvatar.set_weaponl(info.weaponLID, info.weaponLInte); professionAvatar.set_weaponr(info.weaponRID, info.weaponRInte); professionAvatar.set_wing(info.wingID, info.wingInte); professionAvatar.set_equip_color((uint)info.colorID); bool addeff = info.addeff; if (addeff) { professionAvatar.set_equip_eff(info.bodyID, true); } this.m_curProAvatar = professionAvatar; return(gameObject); }
public void SetSkin() { SXML itemsXMl = XMLMgr.instance.GetSXML("mlzd"); int lvln = SelfRole._inst.zhuan * SelfRole._inst.lvl; int waiguan = 2; int a_w_b_c = 1; var vv = itemsXMl.GetNodeList("stage"); foreach (var v in vv) { string ss = v.getString("lvl"); int a = int.Parse(ss.Split(',')[0]); int b = int.Parse(ss.Split(',')[1]); if (lvln <= a * b) { waiguan = v.getInt("waiguan"); break; } } GameObject m_Obj = this.m_curModel.parent.gameObject; ProfessionAvatar m_proAvatar; string m_strAvatarPath = ""; if (SelfRole._inst is P2Warrior) { m_strAvatarPath = "profession/warrior/"; a_w_b_c = 1; } else if (SelfRole._inst is P3Mage) { m_strAvatarPath = "profession/mage/"; a_w_b_c = 2; } else if (SelfRole._inst is P5Assassin) { m_strAvatarPath = "profession/assa/"; a_w_b_c = 3; } foreach (Transform tran in m_Obj.GetComponentsInChildren <Transform>()) { tran.gameObject.layer = EnumLayer.LM_FX; // 更改物体的Layer层 } Transform cur_model = m_Obj.transform.FindChild("model"); //手上的小火球 if (SelfRole._inst.m_LockRole is P3Mage) { Transform cur_r_finger1 = cur_model.FindChild("R_Finger1"); var obj_prefab = Resources.Load <GameObject>("profession/avatar_ui/mage_r_finger_fire"); GameObject light_fire = GameObject.Instantiate(obj_prefab) as GameObject; light_fire.transform.SetParent(cur_r_finger1, false); } m_proAvatar = new ProfessionAvatar(); m_proAvatar.Init(m_strAvatarPath, "h_", EnumLayer.LM_FX, EnumMaterial.EMT_EQUIP_H, cur_model); m_proAvatar.set_body(a_w_b_c * 100 + waiguan * 10 + 3, 0); m_proAvatar.set_weaponl(a_w_b_c * 100 + waiguan * 10 + 6, 0); m_proAvatar.set_weaponr(a_w_b_c * 100 + waiguan * 10 + 6, 0); m_proAvatar.set_wing(SelfRole._inst.get_wingid(), SelfRole._inst.get_windfxid()); m_proAvatar.set_equip_color(SelfRole._inst.get_equip_colorid()); m_curPhy = m_curModel.transform.FindChild("physics"); try { m_curPhy.gameObject.layer = EnumLayer.LM_BT_FIGHT; } catch (System.Exception ex) { } }
public void initAvatar() { bool flag = this.m_anim_usr == null; if (flag) { this.m_selfObj = null; bool flag2 = SelfRole._inst is P2Warrior; if (flag2) { GameObject original = Resources.Load <GameObject>("profession/avatar_ui/warrior_avatar"); this.m_selfObj = (UnityEngine.Object.Instantiate(original, new Vector3(500f, 0f, 1f), new Quaternion(0f, 0f, 0f, 0f)) as GameObject); this.m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0f, -20f, 0f)); } else { bool flag3 = SelfRole._inst is P3Mage; if (flag3) { GameObject original = Resources.Load <GameObject>("profession/avatar_ui/mage_avatar"); this.m_selfObj = (UnityEngine.Object.Instantiate(original, new Vector3(500f, 0f, 1f), new Quaternion(0f, 0f, 0f, 0f)) as GameObject); this.m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0f, -20f, 0f)); } else { bool flag4 = SelfRole._inst is P5Assassin; if (flag4) { GameObject original = Resources.Load <GameObject>("profession/avatar_ui/assa_avatar"); this.m_selfObj = (UnityEngine.Object.Instantiate(original, new Vector3(500f, 0f, 1f), new Quaternion(0f, 0f, 0f, 0f)) as GameObject); this.m_selfObj.transform.FindChild("model").localRotation = Quaternion.Euler(new Vector3(0f, -20f, 0f)); } } } Transform transform = this.m_selfObj.transform.FindChild("model"); transform.localScale = new Vector3(1.3f, 1.3f, 1.3f); ProfessionAvatar professionAvatar = new ProfessionAvatar(); professionAvatar.Init(SelfRole._inst.m_strAvatarPath, "h_", EnumLayer.LM_FX, EnumMaterial.EMT_EQUIP_H, transform, ""); this.m_proAvatar = professionAvatar; bool flag5 = ModelBase <a3_EquipModel> .getInstance().active_eqp.Count >= 10; if (flag5) { this.m_proAvatar.set_equip_eff(ModelBase <a3_EquipModel> .getInstance().GetEqpIdbyType(3), true); } professionAvatar.set_body(SelfRole._inst.get_bodyid(), SelfRole._inst.get_bodyfxid()); professionAvatar.set_weaponl(SelfRole._inst.get_weaponl_id(), SelfRole._inst.get_weaponl_fxid()); professionAvatar.set_weaponr(SelfRole._inst.get_weaponr_id(), SelfRole._inst.get_weaponr_fxid()); professionAvatar.set_wing(SelfRole._inst.get_wingid(), SelfRole._inst.get_windfxid()); professionAvatar.set_equip_color(SelfRole._inst.get_equip_colorid()); this.m_anim_usr = transform.GetComponent <Animator>(); Transform[] componentsInChildren = this.m_selfObj.GetComponentsInChildren <Transform>(); Transform[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Transform transform2 = array[i]; transform2.gameObject.layer = EnumLayer.LM_DEFAULT; } bool flag6 = SelfRole._inst is P3Mage; if (flag6) { Vector3 center = professionAvatar.m_BodySkin.localBounds.center; center.y = 1.3f; Bounds localBounds = professionAvatar.m_BodySkin.localBounds; Vector3 size = localBounds.size; SkinnedMeshRenderer arg_3BE_0 = professionAvatar.m_ShoulderSkin; SkinnedMeshRenderer arg_3B6_0 = professionAvatar.m_BodySkin; localBounds = new Bounds(center, size); arg_3B6_0.localBounds = localBounds; arg_3BE_0.localBounds = localBounds; } } NpcRole npc = dialog.m_npc; bool flag7 = dialog.fake_npc != null; if (flag7) { npc = dialog.fake_npc; } bool flag8 = this.m_anim_npc == null && npc != null; if (flag8) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(npc.gameObject); this.m_anim_npc = gameObject.GetComponent <Animator>(); UnityEngine.Object.Destroy(gameObject.GetComponent <NavMeshAgent>()); gameObject.transform.localPosition = npc.talkOffset; gameObject.transform.localScale = npc.talkScale; gameObject.transform.eulerAngles = Vector3.zero; debug.Log(string.Concat(new object[] { ":::::::::::::::::::::::::::::::::::::::::::::", gameObject.transform.position, " ", gameObject.gameObject.name })); Transform[] componentsInChildren2 = gameObject.GetComponentsInChildren <Transform>(); Transform[] array2 = componentsInChildren2; for (int j = 0; j < array2.Length; j++) { Transform transform3 = array2[j]; transform3.gameObject.layer = EnumLayer.LM_DEFAULT; } NpcRole component = gameObject.GetComponent <NpcRole>(); bool flag9 = component != null; if (flag9) { UnityEngine.Object.Destroy(component); } } }