// 选定种族aa public void SelectRace(int iRace) { mSelectedRace = iRace; // if (iRace == 0) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior; mGender = 0; } else if (iRace == 1) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Magic; mGender = 1; } else if (iRace == 2) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue; mGender = 0; } else if (iRace == 3) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Minister; mGender = 1; } else { return; } // 更新右侧种族属性介绍aa if (mCreateRoleRace) { mCreateRoleRace.SelectRace(mSelectedRace); } // 删除之前角色aa if (mLoginCharObject != null) { if (mSpinObject) { mSpinObject.m_Target = null; } GameObject.Destroy(mLoginCharObject); mLoginChar = null; mLoginCharObject = null; } // 创建角色aa GameObject obj = GameObject.Find("city_construct_halidom02"); mLoginCharObject = new GameObject(); mLoginCharObject.name = "@CreateChar1"; mLoginCharObject.transform.parent = GameObject.Find("SelectSceneWnd").transform; mLoginCharObject.transform.localPosition = new Vector3(obj.transform.localPosition.x, -0.76f, obj.transform.localPosition.z); mLoginCharObject.transform.localRotation = Quaternion.Euler(0.0f, 158.1343f, 0.0f); mLoginCharObject.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f); mLoginCharObject.AddComponent <AudioSource>(); // sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo(); kInfo.mGender = (byte)mGender; kInfo.mHairStyle = (byte)mHairStyle; kInfo.mSkinColor = (byte)mHairColor; kInfo.mBaseJob = (byte)mJob; kInfo.mJob = (byte)mJob; mLoginChar = mLoginCharObject.AddComponent <sdLoginChar>(); mLoginChar.SetVisiable_WhenLoading(false); mLoginChar.init(kInfo); // 高级套装. uint [] uiEquipment = null; uint uiEquipmentCount = 0; if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior) { uiEquipment = new uint[7] { 1100, 1101, 1102, 1103, 1104, 1105, 1106 }; uiEquipmentCount = 7; } else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Magic) { uiEquipment = new uint[6] { 4100, 4102, 4103, 4104, 4105, 4106 }; uiEquipmentCount = 6; } else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue) { uiEquipment = new uint[6] { 8100, 8102, 8103, 8104, 8105, 8106 }; uiEquipmentCount = 6; } else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Minister) { uiEquipment = new uint[7] { 6100, 6101, 6102, 6103, 6104, 6105, 6106 }; uiEquipmentCount = 7; } mLoginChar.updateAvatar(uiEquipment, uiEquipmentCount); if (m_ReturnModel) { m_ReturnModel = false; } // 设置给旋转脚本aa if (mSpinObject) { mSpinObject.m_Target = mLoginChar; } mLoginChar.RequestEnd(); }
// 创建种族,展示裸装aa protected void CreateRace(int iRace) { mSelectedRace = iRace; // if (iRace == 0) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior; mGender = 0; } else if (iRace == 1) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Magic; mGender = 1; } else if (iRace == 2) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue; mGender = 0; } else if (iRace == 3) { mJob = (int)HeaderProto.ERoleJob.ROLE_JOB_Minister; mGender = 1; } else { return; } // 设置头发样式图标aa foreach (GameObject kGameObject in m_HairStyleObjectArray) { DragPanelHairIcon kIcon = kGameObject.GetComponent <DragPanelHairIcon>(); if (kIcon) { int iIndex = kIcon.m_IconId; //< 1,2,3,4,5,6,7,8 int iHairStyle = iIndex - 1; //< 0,1,2,3,4,5,6,7 kIcon.Gender = mGender; kIcon.HairStyle = iHairStyle; kIcon.HairColor = 0; } } // 更新头发颜色图标aa foreach (GameObject kGameObject in m_HairColorObjectArray) { DragPanelHairIcon kIcon = kGameObject.GetComponent <DragPanelHairIcon>(); if (kIcon) { int iIndex = kIcon.m_IconId; //< 1,2,3,4,5,6,7,8 int iHairColor = iIndex - 1; //< 0,1,2,3,4,5,6,7 kIcon.Gender = mGender; kIcon.HairColor = iHairColor; } } // 重置头发样式UIaa if (m_HairStyleObject) { mHairStyle = (int)(Random.value * 100.0f) % 8; //< 随机头发样式aa DragPanelIcon kSelIcon = null; foreach (GameObject kGameObject in m_HairStyleObjectArray) { if (kGameObject == null) { continue; } DragPanelIcon kIcon = kGameObject.GetComponent <DragPanelIcon>(); if (kIcon != null && (kIcon.m_IconId == mHairStyle + 1)) { kSelIcon = kIcon; break; } } if (kSelIcon != null) { kSelIcon.Select(); } } // 重置头发颜色UIaa if (m_HairColorObject) { mHairColor = (int)(Random.value * 100.0f) % 8; //< 随机头发颜色aa DragPanelIcon kSelIcon = null; foreach (GameObject kGameObject in m_HairColorObjectArray) { if (kGameObject == null) { continue; } DragPanelIcon kIcon = kGameObject.GetComponent <DragPanelIcon>(); if (kIcon != null && (kIcon.m_IconId == mHairColor + 1)) { kSelIcon = kIcon; break; } } if (kSelIcon != null) { kSelIcon.Select(); } } // 删除之前角色aa if (mLoginCharObject != null) { if (mSpinObject) { mSpinObject.m_Target = null; } GameObject.Destroy(mLoginCharObject); mLoginChar = null; mLoginCharObject = null; } // 创建角色aa GameObject obj = GameObject.Find("city_construct_halidom02"); mLoginCharObject = new GameObject(); mLoginCharObject.name = "@CreateChar2"; mLoginCharObject.transform.parent = GameObject.Find("SelectSceneWnd").transform; mLoginCharObject.transform.localPosition = new Vector3(obj.transform.localPosition.x, -0.76f, obj.transform.localPosition.z); mLoginCharObject.transform.localRotation = Quaternion.Euler(0.0f, 158.1343f, 0.0f); mLoginCharObject.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f); mLoginCharObject.AddComponent <AudioSource>(); // sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo(); kInfo.mGender = (byte)mGender; kInfo.mHairStyle = (byte)mHairStyle; kInfo.mSkinColor = (byte)mHairColor; kInfo.mBaseJob = (byte)mJob; kInfo.mJob = (byte)mJob; mLoginChar = mLoginCharObject.AddComponent <sdLoginChar>(); mLoginChar.SetVisiable_WhenLoading(false); mLoginChar.init(kInfo); // 新手套装,不显示头盔. uint [] uiEquipment = null; uint uiEquipmentCount = 0; if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior) { uiEquipment = new uint[6] { 1000, 1001, 1003, 1004, 1005, 1006 }; uiEquipmentCount = 6; } else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Magic) { uiEquipment = new uint[5] { 4000, 4003, 4004, 4005, 4006 }; uiEquipmentCount = 5; } else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue) { uiEquipment = new uint[5] { 8000, 8003, 8004, 8005, 8006 }; uiEquipmentCount = 5; } else if (mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Minister) { uiEquipment = new uint[6] { 6000, 6001, 6003, 6004, 6005, 6006 }; uiEquipmentCount = 6; } mLoginChar.updateAvatar(uiEquipment, uiEquipmentCount); mLoginChar.RequestEnd(); // 设置给旋转脚本aa if (mSpinObject) { mSpinObject.m_Target = mLoginChar; } }
// 指定角色被选中aa public void DoSelect(int iRoleID) { if (iRoleID < 0 || iRoleID > 4) { if (mLoginCharObject != null) { mLoginCharObject.SetActive(false); } return; } sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[iRoleID]; if (kPlayerInfo == null) { if (mLoginCharObject != null) { mLoginCharObject.SetActive(false); } return; } if (mLoginChar != null) { if (kPlayerInfo.mDBID == mLoginChar.DBID) { mLoginCharObject.SetActive(true); mLoginChar.PlayShow(); return; } } // 销毁先前预览角色aa if (mLoginCharObject != null) { if (mSpinObject) { mSpinObject.m_Target = null; } GameObject.Destroy(mLoginCharObject); mLoginChar = null; mLoginCharObject = null; } // 创建预览角色aa GameObject obj = GameObject.Find("city_construct_halidom02"); mLoginCharObject = new GameObject(); mLoginCharObject.name = "@LoginChar"; mLoginCharObject.transform.parent = GameObject.Find("SelectSceneWnd").transform; mLoginCharObject.transform.localPosition = new Vector3(obj.transform.localPosition.x, -0.76f, obj.transform.localPosition.z); mLoginCharObject.transform.localRotation = Quaternion.Euler(0.0f, 158.1343f, 0.0f); mLoginCharObject.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f); mLoginCharObject.AddComponent <AudioSource>(); // sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo(); kInfo.mDBID = kPlayerInfo.mDBID; kInfo.mGender = kPlayerInfo.mGender; kInfo.mHairStyle = kPlayerInfo.mHairStyle; kInfo.mSkinColor = kPlayerInfo.mSkinColor; kInfo.mBaseJob = kPlayerInfo.mBaseJob; kInfo.mJob = kPlayerInfo.mJob; kInfo.mLevel = kPlayerInfo.mLevel; mLoginChar = mLoginCharObject.AddComponent <sdLoginChar>(); mLoginChar.SetVisiable_WhenLoading(false); mLoginChar.init(kInfo); mLoginChar.updateAvatar(kPlayerInfo.mEquipID, kPlayerInfo.mEquipCount); mLoginChar.RequestEnd(); // 设置给旋转脚本aa if (mSpinObject) { mSpinObject.m_Target = mLoginChar; } }