private static void msg_SCID_OTHER_APPEAR(int iMsgID, ref CMessage msg) { CliProto.SC_OTHER_APPEAR refMSG = (CliProto.SC_OTHER_APPEAR)msg; if (refMSG == null) { return; } sdGameLevel gameLevel = sdGameLevel.instance; if (gameLevel == null) { Debug.Log("No gamelevel"); return; } //如果不是主城 暂时不允许创建玩家..等服务器调整好之后再做处理.. if (gameLevel.levelType != sdGameLevel.LevelType.MainCity) { Debug.Log(gameLevel.levelType.ToString() + " don't allow create sdOtherChar."); return; } for (int i = 0; i < refMSG.m_Count; ++i) { CliProto.SOtherInfoWithPos kOtherRoleInfo = refMSG.m_RoleInfo[i]; float fX = ServerPos2Client(kOtherRoleInfo.m_Pos.m_X); float fY = ServerPos2Client(kOtherRoleInfo.m_Pos.m_Y); float fZ = ServerPos2Client(kOtherRoleInfo.m_Pos.m_Z); float fDirection = ServerOri2Client(kOtherRoleInfo.m_Pos.m_Orientation); sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo(); kInfo.mDBID = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_DBRoleId; kInfo.mObjID = kOtherRoleInfo.m_RoleInfo.m_ObjID; kInfo.mGender = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_Gender; kInfo.mHairStyle = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_HairStyle; kInfo.mSkinColor = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_SkinColor; kInfo.mBaseJob = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_BaseJob; kInfo.mJob = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_Job; kInfo.mLevel = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_Level; kInfo.mRoleName = System.Text.Encoding.UTF8.GetString(kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_RoleInfo.m_RoleName); sdOtherChar otherChar = sdGameLevel.instance.createOtherChar( kInfo, //new Vector3(0.0f, -1.4f, 35.5f), new Vector3(fX, fY, fZ), Quaternion.Euler(0, fDirection, 0)); uint uiEquipCount = kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_Equip.m_ItemCount; if (otherChar != null && uiEquipCount > 0) { uint[] auiEquipArray = new uint[uiEquipCount]; for (int j = 0; j < uiEquipCount; ++j) { auiEquipArray[j] = (uint)kOtherRoleInfo.m_RoleInfo.m_RoleInfo.m_Equip.m_Items[j].m_TID; } otherChar.updateAvatar(auiEquipArray, uiEquipCount); } } }
// 初始化aa public new bool init(sdGameActorCreateInfo kInfo) { base.init(kInfo); // 设置角色初始朝向aa mFaceDirection = transform.rotation * Vector3.forward; // 加载角色动画aa LoadSimpleAnimationFile(kInfo.mJob); return(true); }
// 鍒濆?鍖朼a public new bool init(sdGameActorCreateInfo kInfo) { //AvatarCount = 1; base.init(kInfo); switch (kInfo.mJob) { case 1: case 2: case 3: { LoadWarriorData(); break; } case 4: case 5: case 6: { LoadMageData(); break; } case 7: case 8: case 9: { LoadRougeData(); break; } case 10: case 11: case 12: { LoadClericData(); break; } default: { LoadWarriorData(); break; } } return(true); }
public void Refresh(sdFriend roleInfo, int nType) { for (int i = 0; i < btnPanel.Length; ++i) { btnPanel[i].SetActive(i == nType); } lb_name.text = roleInfo.name; //euqip if (UI_avatar != null) { UI_avatar.transform.localRotation = Quaternion.Euler(0.0f, 180.0f, 0.0f); for (int i = 0; i < UI_avatar.transform.childCount; ++i) { if (UI_avatar.transform.GetChild(i).gameObject != null) { GameObject.Destroy(UI_avatar.transform.GetChild(i).gameObject); } } m_kInfo = new sdGameActorCreateInfo(); m_kInfo.mDBID = ulong.Parse(roleInfo.id); m_kInfo.mGender = roleInfo.gender; m_kInfo.mHairStyle = roleInfo.hairStyle; m_kInfo.mSkinColor = roleInfo.color; m_kInfo.mBaseJob = byte.Parse(roleInfo.job); m_kInfo.mJob = byte.Parse(roleInfo.job); m_kInfo.mLevel = int.Parse(roleInfo.level); m_equiplist = roleInfo.equipList.ToArray(); m_strName = roleInfo.name; //lb_power.gameObject.SetActive(int.Parse(roleInfo.power) != 0); lb_power.text = "战斗力 " + roleInfo.power; string name = ""; int job = int.Parse(roleInfo.job); switch (job) { case (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior: { name = "warrior"; break; } case (int)HeaderProto.ERoleJob.ROLE_JOB_Magic: { name = "magic"; break; } case (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue: { name = "rogue"; break; } case (int)HeaderProto.ERoleJob.ROLE_JOB_Minister: { name = "minister"; break; } } ResLoadParams para = new ResLoadParams(); para.info = "back"; para.userdata0 = job; para.userdata1 = false; string namePreb = string.Format("UI/Icon/$icon_{0}_back/icon_{0}_back.prefab", name); sdUICharacter.Instance.LoadAtlas(namePreb, sprite_profession, sdConfDataMgr.Instance().GetJobBack(roleInfo.job)); UpdateEquip(roleInfo); } //fashion //pet int nChildCount = petPanel.transform.childCount; for (int index = 0; index < nChildCount; ++index) { GameObject uiItem = null; Transform trans = petPanel.transform.FindChild("item" + index.ToString()); if (trans != null) { uiItem = trans.gameObject; } else { uiItem = GameObject.Instantiate(petTemplate) as GameObject; uiItem.name = "item" + index.ToString(); uiItem.transform.parent = petPanel.transform; uiItem.transform.localScale = Vector3.one; uiItem.transform.localPosition = new Vector3(petTemplate.transform.localPosition.x, petTemplate.transform.localPosition.y - index * 120, petTemplate.transform.localPosition.z); uiItem.transform.localRotation = Quaternion.identity; } uiItem.SetActive(true); Transform tran_head = uiItem.transform.FindChild("border").FindChild("head"); GameObject obj_petName = uiItem.transform.FindChild("name").gameObject; UISprite sprite_level = uiItem.transform.FindChild("border").GetComponent <UISprite>(); UILabel lb_power = uiItem.transform.FindChild("pow").GetComponent <UILabel>(); UILabel lb_level = uiItem.transform.FindChild("level").GetComponent <UILabel>(); UILabel lb_intensify = uiItem.transform.FindChild("intensify").GetComponent <UILabel>(); if (index < roleInfo.petList.Count) { SClientPetInfo petInfo = roleInfo.petList[index]; Hashtable Info = sdConfDataMgr.Instance().GetPetTemplate(petInfo.m_uiTemplateID.ToString()); if (Info == null) { continue; } tran_head.gameObject.SetActive(true); sprite_level.gameObject.SetActive(true); obj_petName.SetActive(true); lb_power.gameObject.SetActive(true); lb_level.gameObject.SetActive(true); lb_intensify.gameObject.SetActive(true); UISprite sprite_head = tran_head.GetComponent <UISprite>(); sprite_head.spriteName = Info["Icon"].ToString(); int iAbility = int.Parse(Info["Ability"].ToString()); sprite_level.spriteName = spritename_level[iAbility - 1]; sdNewPetMgr.SetLabelColorByAbility(iAbility, obj_petName); obj_petName.GetComponent <UILabel>().text = Info["Name"].ToString(); //星级aaa //int parentWidth = sprite_head.width; for (int i = 1; i <= 5; ++i) { GameObject obj_start = tran_head.FindChild("start" + i.ToString()).gameObject; obj_start.SetActive(true); int nWidth = obj_start.GetComponent <UISprite>().width *iAbility; obj_start.SetActive(i <= iAbility); Vector3 pos = obj_start.transform.localPosition; obj_start.transform.localPosition = new Vector3(-nWidth / 2 + i * 15, pos.y, pos.z); } lb_power.text = "战斗力 " + sdConfDataMgr.Instance().GetPetScoreByTemplateID((int)petInfo.m_uiTemplateID, petInfo.m_iUp, petInfo.m_iLevel).ToString(); lb_level.text = "等级:" + petInfo.m_iLevel.ToString(); lb_intensify.text = "强化:+" + petInfo.m_iUp.ToString(); } else { tran_head.gameObject.SetActive(false); sprite_level.gameObject.SetActive(false); obj_petName.SetActive(false); lb_power.gameObject.SetActive(false); lb_level.gameObject.SetActive(false); lb_intensify.gameObject.SetActive(false); for (int i = 1; i <= 5; ++i) { GameObject obj_start = tran_head.FindChild("start" + i.ToString()).gameObject; obj_start.SetActive(false); } } } ShowEquip(); tab_equip.GetComponent <sdRadioButton>().Active(true); tab_fashion.GetComponent <sdRadioButton>().Active(false); tab_pet.GetComponent <sdRadioButton>().Active(false); }
// 初始化角色aa protected bool init(sdGameActorCreateInfo kInfo) { mDBID = kInfo.mDBID; mObjID = kInfo.mObjID; mGender = kInfo.mGender; mSkinColor = kInfo.mSkinColor; mHairStyle = kInfo.mHairStyle; mBaseJob = kInfo.mBaseJob; mJob = kInfo.mJob; mLevel = kInfo.mLevel; mName = kInfo.mRoleName; // name = kInfo.mRoleName; itemInfo = new Hashtable(); strikedInfo = new ArrayList(); //< for test //skillTree = sdSkillTree.createWarriorSkillTree(this); // 根据角色信息构建裸模装备表aa mNakeItemTable = new Hashtable(); Hashtable kEquipTable = (Hashtable)sdConfDataMgr.Instance().GetStartEquipTable(); if (kEquipTable != null) { foreach (DictionaryEntry kEquipItem in kEquipTable) { Hashtable kEquipItemInfo = (Hashtable)kEquipItem.Value; sdGameItem kItem = new sdGameItem(); int iNeedGender = int.Parse(kEquipItemInfo["NeedSex"].ToString()); if (iNeedGender != mGender) { continue; } // int iNeedJob = int.Parse(kEquipItemInfo["NeedJob"].ToString()); // if (iNeedJob != mJob) // continue; kItem.templateID = int.Parse(kEquipItemInfo["Id"].ToString()); kItem.mdlPath = kEquipItemInfo["Filename"].ToString(); kItem.mdlPartName = kEquipItemInfo["FilePart"].ToString(); kItem.anchorNodeName = kEquipItemInfo["Dummy"].ToString(); kItem.equipPos = int.Parse(kEquipItemInfo["Character"].ToString()); mNakeItemTable[kItem.templateID] = kItem; } } int iHairTemplateID = mHairStyle + 100 + 10 * mGender + 1; Hashtable kHairTable = (Hashtable)sdConfDataMgr.Instance().GetHairTable(); if (kHairTable != null) { foreach (DictionaryEntry kHairItem in kHairTable) { Hashtable kHairItemInfo = (Hashtable)kHairItem.Value; int iTemplateID = int.Parse(kHairItemInfo["Id"].ToString()); if (iHairTemplateID == iTemplateID) { // 从初始装备表移除旧的发型aa int equipPos = int.Parse(kHairItemInfo["Character"].ToString()); sdGameItem kOldHairItem = getStartItem(equipPos); if (kOldHairItem != null) { mNakeItemTable.Remove(kOldHairItem.templateID); } // 从初始装备表添加新的发型aa sdGameItem kNewHairItem = new sdGameItem(); kNewHairItem.templateID = int.Parse(kHairItemInfo["Id"].ToString()); kNewHairItem.mdlPath = kHairItemInfo["Filename"].ToString(); kNewHairItem.mdlPartName = kHairItemInfo["FilePart"].ToString(); kNewHairItem.anchorNodeName = kHairItemInfo["Dummy"].ToString(); kNewHairItem.equipPos = equipPos; mNakeItemTable[kNewHairItem.templateID] = kNewHairItem; break; } } } LoadNake(); m_summonInfo = sdConfDataMgr.CloneHashTable(sdConfDataMgr.Instance().m_BaseSummon); m_SkillEffect = sdConfDataMgr.CloneHashTable(sdConfDataMgr.Instance().m_BaseSkillEffect); return(true); }
// 初始化aa public new bool init(sdGameActorCreateInfo kInfo) { base.init(kInfo); // 设置角色初始朝向aa mFaceDirection = transform.rotation * Vector3.forward; // 初始化技能树aa CreateSkill_Action(kInfo.mJob); // 初始化角色属性aa if (sdGlobalDatabase.Instance.globalData != null) { // 属性表 if (Property == null) { Property = sdConfDataMgr.CloneHashTable(sdGlobalDatabase.Instance.globalData["MainCharBaseProp"] as Hashtable); } // 每次进图就满血满蓝aa if (Property.ContainsKey("HP") && Property.ContainsKey("MaxHP")) { Property["HP"] = Property["MaxHP"]; } if (Property.ContainsKey("SP") && Property.ContainsKey("MaxSP")) { Property["SP"] = Property["MaxSP"]; } // AddSuitBuff(); // 设置到UIaa RefreshProp(); // if (sdConfDataMgr.Instance().skilliconAtlas == null) { int job = int.Parse(Property["BaseJob"].ToString()); sdConfDataMgr.Instance().LoadSkillIcon(job); } // 换装aa if (sdGlobalDatabase.Instance.globalData.Contains("MainCharItemInfo")) { SetItemInfo(sdGlobalDatabase.Instance.globalData["MainCharItemInfo"] as Hashtable); } // 技能aa if (sdGlobalDatabase.Instance.globalData.Contains("MainCharSkillInfo")) { SetSkillInfo(sdGlobalDatabase.Instance.globalData["MainCharSkillInfo"] as Hashtable); } // 初始Buffaa if (sdGlobalDatabase.Instance.globalData.Contains("InitBuff")) { int[] buffArray = (int[])sdGlobalDatabase.Instance.globalData["InitBuff"]; if (buffArray != null) { foreach (int id in buffArray) { AddBuff(id, 0, this); } } sdGlobalDatabase.Instance.globalData["InitBuff"] = null; } // 宠物战队Buffaa List <int> kBuffList = sdNewPetMgr.Instance.GetPetGroupBuff(this); if (kBuffList != null) { foreach (int iBuffId in kBuffList) { AddBuff(iBuffId, 0, this); } } } // 加载角色动画aa LoadAnimationFile(kInfo.mJob); // 初始化个体AI参数(自动战斗系统)aa FingerControl kFingerControl = sdGameLevel.instance.GetFingerControl(); if (kFingerControl != null) { mAutoFight = kFingerControl; mAutoFight.NotifyChangeTarget += NotifyBattleSystemChangeTarget; sdSkill kSkill = skillTree.getSkill(1001); if (kSkill != null) { sdBaseState kState = kSkill.actionStateList[0]; int iCastDistance = (int)kState.stateData["CastDistance"]; mAutoFight.BattleDistance = (iCastDistance) * 0.001f; } } sdGuideMgr.Instance.Init(Property["Name"].ToString().Trim('\0')); // 初始化群体AI参数aa sdBehaviourNode kBehaviourNode = sdBehaviourManager.GetSingleton().GetBehaviourNode(1); if (kBehaviourNode != null) { kBehaviourNode.AddActor(this); } return(true); }
// 初始化aa public new bool init(sdGameActorCreateInfo kInfo) { base.init(kInfo); // 设置角色初始朝向aa mFaceDirection = transform.rotation * Vector3.forward; // 初始化技能树aas CreateSkill_Action(kInfo.mJob); // 初始化基本属性表aa mBaseProperty = sdConfDataMgr.CloneHashTable(sdPVPManager.Instance.PVPBaseProperty); Property = sdConfDataMgr.CloneHashTable(sdPVPManager.Instance.PVPBaseProperty); // 每次进图满血满蓝aa if (Property.ContainsKey("HP") && Property.ContainsKey("MaxHP")) { Property["HP"] = Property["MaxHP"]; } if (Property.ContainsKey("SP") && Property.ContainsKey("MaxSP")) { Property["SP"] = Property["MaxSP"]; } // 初始化角色装备表aa SetItemInfo(sdPVPManager.Instance.PVPItemProperty); // 初始化角色技能表aa SetSkillInfo(sdPVPManager.Instance.PVPSkillProperty); // 宠物战队Buffaa List <int> kBuffList = sdPVPManager.Instance.GetPetGroupBuff(this); if (kBuffList != null) { foreach (int iBuffId in kBuffList) { AddBuff(iBuffId, 0, this); } } // 加载角色动画aa LoadAnimationFile(kInfo.mJob); // 自动战斗系统aa { PVPAutoFight kPVPAutoFight = new PVPAutoFight(); sdSkill kSkill = skillTree.getSkill(1001); if (kSkill != null) { sdBaseState kState = kSkill.actionStateList[0]; int iCastDistance = (int)kState.stateData["CastDistance"]; kPVPAutoFight.BattleDistance = (iCastDistance) * 0.001f; } mAutoFight = kPVPAutoFight; mAutoFight.SetActor(this); } return(true); }
public void ShowFriInfo() { if (friinfo != null) { sdFriend fri = sdFriendMgr.Instance.GetFriend(sdUICharacter.Instance.GetCurFriId()); if (fri == null) { fri = sdFriendMgr.Instance.GetTempFriend(sdUICharacter.Instance.GetCurFriId()); } if (fri == null) { return; } friinfo.SetActive(true); petAvatar.SetActive(false); if (avatar != null) { sdGameActorCreateInfo kInfo = new sdGameActorCreateInfo(); kInfo.mDBID = 1; kInfo.mGender = fri.gender; kInfo.mHairStyle = fri.hairStyle; kInfo.mSkinColor = fri.color; kInfo.mBaseJob = byte.Parse(fri.job); kInfo.mJob = byte.Parse(fri.job); kInfo.mLevel = int.Parse(fri.level); avatar.AddComponent <sdFriAvatar>(); avatar.GetComponent <sdFriAvatar>().init(kInfo); uint[] equiplist = fri.equipList.ToArray(); avatar.GetComponent <sdFriAvatar>().updateAvatar(equiplist, (uint)fri.equipList.Count); avatar.GetComponent <sdFriAvatar>().PlayIdle(); avatar.GetComponent <SpinObject>().m_Target = avatar.GetComponent <sdFriAvatar>(); avatar.GetComponent <SpinObject>().m_Speed = 0.5f; int maxNum = fri.petList.Count; int i = 0; for (; i < maxNum; ++i) { petList[i].SetInfo(fri.petList[i].m_uiTemplateID.ToString()); } maxNum = sdNewPetMgr.Instance.BattlePetNum; for (; i < maxNum; ++i) { petList[i].SetInfo(""); } needJobBack = true; baseJob = int.Parse(fri.job); sdConfDataMgr.Instance().LoadJobAtlas(baseJob); } if (friendName != null) { friendName.GetComponent <UILabel>().text = fri.name; } if (power != null) { power.GetComponent <UILabel>().text = sdConfDataMgr.Instance().GetShowStr("Score") + fri.power; } } }
// 创建种族,展示裸装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 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 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; } }