void Awake() { stDialogueCharacter character = new stDialogueCharacter(); character.pos = gameObject.transform.position; character.rotate = gameObject.transform.rotation; character.character = gameObject; character.name = gameObject.name; character.cameraDis = cameraDis; sdUICharacter.Instance.DialogueCharacterList.Add(character); Hashtable movietable = sdConfDataMgr.Instance().m_Movie; if (movietable.ContainsKey(sdUICharacter.Instance.iCurrentLevelID)) { sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[SDNetGlobal.lastSelectRole]; string strLevel = sdConfDataMgr.Instance().GetRoleSetting("MovieDialogue_" + kPlayerInfo.mRoleName); if (strLevel.Length != 0 && int.Parse(strLevel) >= sdUICharacter.Instance.iCurrentLevelID) { gameObject.SetActive(false); } stStageMovie stagemovie = (stStageMovie)movietable[sdUICharacter.Instance.iCurrentLevelID]; for (int index = 0; index < stagemovie.movieList.Count; ++index) { stMovie movieData = stagemovie.movieList[index]; if (movieData.npcModel == gameObject.name) { if (movieData.npcShow == 1) { gameObject.SetActive(false); break; } } } } }
public static void OnMessage_GCID_ROLELIST(int iMsgID, ref CMessage msg) { SDGlobal.Log("rolelist received"); CliProto.GC_ROLELIST refMSG = (CliProto.GC_ROLELIST)msg; SDNetGlobal.roleCount = refMSG.m_Count; if (!SDNetGlobal.bReConnectGate) { SDNetGlobal.lastSelectRole = SelectRole.SortRoleList(refMSG); } for (int i = 0; i < SDNetGlobal.roleCount; i++) { if (SDNetGlobal.playerList[i] == null) { SDNetGlobal.playerList[i] = new sdPlayerInfo(); } sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[i]; kPlayerInfo.mRoleName = System.Text.Encoding.UTF8.GetString(refMSG.m_RoleInfoList[i].m_RoleInfo.m_RoleName); kPlayerInfo.mDBID = refMSG.m_RoleInfoList[i].m_RoleInfo.m_DBRoleId; kPlayerInfo.mGender = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Gender; kPlayerInfo.mSkinColor = refMSG.m_RoleInfoList[i].m_RoleInfo.m_SkinColor; kPlayerInfo.mHairStyle = refMSG.m_RoleInfoList[i].m_RoleInfo.m_HairStyle; kPlayerInfo.mBaseJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_BaseJob; kPlayerInfo.mJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Job; kPlayerInfo.mLevel = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Level; kPlayerInfo.mEquipCount = refMSG.m_RoleInfoList[i].m_Equip.m_ItemCount; if (kPlayerInfo.mEquipCount > 0) { kPlayerInfo.mEquipID = new uint[kPlayerInfo.mEquipCount]; for (int j = 0; j < kPlayerInfo.mEquipCount; ++j) { kPlayerInfo.mEquipID[j] = (uint)refMSG.m_RoleInfoList[i].m_Equip.m_Items[j].m_TID; } } } for (int i = SDNetGlobal.roleCount; i < 4; i++) { SDNetGlobal.playerList[i] = null; } SelectRole sr = sdGameLevel.instance.NGUIRoot.GetComponentInChildren <SelectRole>(); if (sr != null) { sr.OnRoleList(); } if (SDNetGlobal.bReConnectGate) { SDNetGlobal.OnMessage_GCID_ROLELIST(iMsgID, ref msg); } }
// protected void OnMessage_GCID_ROLELIST(int iMsgID, ref CMessage msg) { SDGlobal.Log("rolelist received"); CliProto.GC_ROLELIST refMSG = (CliProto.GC_ROLELIST)msg; SDNetGlobal.roleCount = refMSG.m_Count; SDNetGlobal.lastSelectRole = SelectRole.SortRoleList(refMSG); for (int i = 0; i < SDNetGlobal.roleCount; i++) { if (SDNetGlobal.playerList[i] == null) { SDNetGlobal.playerList[i] = new sdPlayerInfo(); } sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[i]; kPlayerInfo.mRoleName = System.Text.Encoding.UTF8.GetString(refMSG.m_RoleInfoList[i].m_RoleInfo.m_RoleName).Trim('\0'); kPlayerInfo.mDBID = refMSG.m_RoleInfoList[i].m_RoleInfo.m_DBRoleId; kPlayerInfo.mGender = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Gender; kPlayerInfo.mSkinColor = refMSG.m_RoleInfoList[i].m_RoleInfo.m_SkinColor; kPlayerInfo.mHairStyle = refMSG.m_RoleInfoList[i].m_RoleInfo.m_HairStyle; kPlayerInfo.mBaseJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_BaseJob; kPlayerInfo.mJob = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Job; kPlayerInfo.mLevel = refMSG.m_RoleInfoList[i].m_RoleInfo.m_Level; kPlayerInfo.mEquipCount = refMSG.m_RoleInfoList[i].m_Equip.m_ItemCount; if (kPlayerInfo.mEquipCount > 0) { kPlayerInfo.mEquipID = new uint[kPlayerInfo.mEquipCount]; for (int j = 0; j < kPlayerInfo.mEquipCount; ++j) { kPlayerInfo.mEquipID[j] = (uint)refMSG.m_RoleInfoList[i].m_Equip.m_Items[j].m_TID; } } } for (int i = SDNetGlobal.roleCount; i < 4; i++) { SDNetGlobal.playerList[i] = null; } m_bRoleListRec = true; }
// 初始化按钮信息aa public void InitRole() { if (m_RoleSelect && m_bSelected == false) { m_RoleSelect.gameObject.SetActive(false); } if (m_RoleID < 0 || m_RoleID > 3 || SDNetGlobal.playerList[m_RoleID] == null) { m_isEmpty = true; if (m_RoleName) { m_RoleName.gameObject.SetActive(false); } if (m_RoleLevel) { m_RoleLevel.gameObject.SetActive(false); } if (m_RoleRace) { m_RoleRace.gameObject.SetActive(false); } if (m_RolePic) { m_RolePic.gameObject.SetActive(false); } if (m_RoleCreate) { m_RoleCreate.gameObject.SetActive(true); } return; } m_isEmpty = false; if (m_RoleCreate) { m_RoleCreate.gameObject.SetActive(false); } if (m_RoleName) { m_RoleName.gameObject.SetActive(true); m_RoleName.text = SDNetGlobal.playerList[m_RoleID].mRoleName; } if (m_RoleLevel) { m_RoleLevel.gameObject.SetActive(true); m_RoleLevel.text = "Lv. " + SDNetGlobal.playerList[m_RoleID].mLevel; } // 职业aa if (m_RoleRace) { m_RoleRace.gameObject.SetActive(true); if (SDNetGlobal.playerList[m_RoleID].mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Warrior) { m_RoleRace.text = "战士"; } else if (SDNetGlobal.playerList[m_RoleID].mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Rogue) { m_RoleRace.text = "游侠"; } else if (SDNetGlobal.playerList[m_RoleID].mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Minister) { m_RoleRace.text = "牧师"; } else if (SDNetGlobal.playerList[m_RoleID].mJob == (int)HeaderProto.ERoleJob.ROLE_JOB_Magic) { m_RoleRace.text = "法师"; } } // 头像aa if (m_RolePic) { m_RolePic.gameObject.SetActive(true); m_RolePic.spriteName = ""; sdPlayerInfo kPlayInfo = SDNetGlobal.playerList[m_RoleID]; if (kPlayInfo != null) { mGender = kPlayInfo.mGender; mHairStyle = kPlayInfo.mHairStyle; mHairColor = kPlayInfo.mSkinColor; LoadAvatarHeadAtlas(kPlayInfo.mGender, kPlayInfo.mHairStyle, kPlayInfo.mSkinColor); } } }
void RefreshPK() { sdPlayerInfo kPlayerInfo = SDNetGlobal.playerList[SDNetGlobal.lastSelectRole]; if (pk_selfname == null) { Debug.Log("pkself name == null"); return; } lstjobAtlas.Clear(); // military level Hashtable militarylevelTable = sdConfDataMgr.Instance().GetTable("militarylevel"); int totalReputation = 0; int index = 1; if (sdPVPManager.Instance.nMilitaryLevel > 1) { for (; index < sdPVPManager.Instance.nMilitaryLevel; index++) { Hashtable militaryTable = militarylevelTable[index.ToString()] as Hashtable; totalReputation += int.Parse((string)militaryTable["reputation"]); } } Hashtable mymilitary = militarylevelTable[(sdPVPManager.Instance.nMilitaryLevel).ToString()] as Hashtable; if (mymilitary == null) { return; } string NameColor = mymilitary["namecolor"].ToString(); NameColor = NameColor.Substring(1); pk_selfname.text = "[" + NameColor + "]" + kPlayerInfo.mRoleName; pk_selflevel.text = "Lv." + sdGameLevel.instance.mainChar.Level.ToString(); pk_titleimage.spriteName = mymilitary["icon"] as string; Hashtable mynextmilitary = militarylevelTable[(sdPVPManager.Instance.nMilitaryLevel + 1).ToString()] as Hashtable; if (mynextmilitary == null) { pk_reputation.text = "满级"; pk_sprite_reputation.width = ms_Hplength; } else { int value = (int)sdPVPManager.Instance.nReputation + totalReputation; int needvalue = int.Parse((string)mymilitary["reputation"]) + totalReputation; pk_reputation.text = value.ToString() + "/" + needvalue.ToString(); float fpercent = value / (float)needvalue; fpercent = fpercent > 1.0f ? 1.0f : fpercent; pk_sprite_reputation.width = (int)(ms_Hplength * fpercent); } pk_selftitle.text = (string)mymilitary["name"]; pk_win.text = "胜" + sdPVPManager.Instance.nWin.ToString(); pk_lose.text = "负" + sdPVPManager.Instance.nLose.ToString(); pk_ranklist.text = sdPVPManager.Instance.nRank.ToString(); pk_score.text = sdPVPManager.Instance.nScore.ToString(); pk_challenge.text = sdPVPManager.Instance.nChallenge.ToString() + "次"; if (sdPVPManager.Instance.m_ChallengeBuyLeft <= 0) { pkLeft.transform.FindChild("Button_addchallenge").gameObject.SetActive(false); } else { pkLeft.transform.FindChild("Button_addchallenge").gameObject.SetActive(true); } if (sdPVPManager.Instance.mMilitaryRewards) { pkLeft.transform.FindChild("Button_getrewards").FindChild("Background").GetComponent <UISprite>().spriteName = "btn_2dis"; } if (sdPVPManager.Instance.m_bPVPSuspend) { pkRight.SetActive(false); pkRightSuspend.SetActive(true); } else { pkRight.SetActive(true); pkRightSuspend.SetActive(false); Hashtable mainProp = (Hashtable)sdGlobalDatabase.Instance.globalData["MainCharBaseProp"]; List <stPVPRival> rivalList = sdPVPManager.Instance.GetRivallist(); index = 0; for (; index < ms_TotalRival && index < rivalList.Count; ++index) { stPVPRival rival = rivalList[index]; Transform character = pkRight.transform.FindChild("Sprite_character" + index); character.gameObject.SetActive(true); UISprite headicon = character.FindChild("Sprite_headicon1").GetComponent <UISprite>(); UILabel level = character.FindChild("Label_level1").GetComponent <UILabel>(); level.text = "Lv." + rival.nLevel.ToString(); UILabel name = character.FindChild("Label_name1").GetComponent <UILabel>(); name.text = rival.strName; //职业aaa UISprite title = character.FindChild("Sprite_title1").GetComponent <UISprite>(); UIAtlas jobAtlas = sdConfDataMgr.Instance().GetAtlas(rival.nProfession.ToString()); if (jobAtlas != null) { title.atlas = jobAtlas; } else { sdConfDataMgr.Instance().LoadJobAtlas(rival.nProfession); JobAtlasInfo item = new JobAtlasInfo(); item.jobname = rival.nProfession.ToString(); item.sprite = title; lstjobAtlas.Add(item); } title.spriteName = sdConfDataMgr.Instance().GetJobIcon(rival.nProfession.ToString()); UILabel titlename = character.FindChild("Label_title1").GetComponent <UILabel>(); if (militarylevelTable.ContainsKey((rival.nMilitaryLevel).ToString())) { Hashtable table2 = militarylevelTable[(rival.nMilitaryLevel).ToString()] as Hashtable; if (table2 == null) { titlename.text = "满级"; } else { titlename.text = (string)table2["name"]; } //title.spriteName = table2["icon"].ToString(); } UILabel score = character.FindChild("Label_score1").GetComponent <UILabel>(); score.text = rival.nScore.ToString(); int nwin = CalcWinPoints((int)sdPVPManager.Instance.nScore, (int)rival.nScore); int nlose = CalcLosePoints((int)sdPVPManager.Instance.nScore, (int)rival.nScore); UILabel winreputation = character.FindChild("Label_winreputation1").GetComponent <UILabel>(); winreputation.text = "+5 声望"; UILabel winscore = character.FindChild("Label_winscore1").GetComponent <UILabel>(); winscore.text = "+" + nwin.ToString() + " 积分"; UILabel losereputation = character.FindChild("Label_losereputation1").GetComponent <UILabel>(); losereputation.text = "+2 声望"; UILabel losescore = character.FindChild("Label_losescore1").GetComponent <UILabel>(); losescore.text = "-" + nlose.ToString() + " 积分"; sdConfDataMgr.Instance().SetHeadPic(rival.nSex, rival.hairstyle, rival.haircolor, character.FindChild("Sprite_headicon1").GetComponent <UISprite>()); } for (; index < ms_TotalRival; index++) { Transform character = pkRight.transform.FindChild("Sprite_character" + index); character.gameObject.SetActive(false); } if (sdPVPManager.Instance.m_bMilitaryLevelUp) { sdUICharacter.Instance.ShowPVPTitleUpWnd(true); sdPVPManager.Instance.m_bMilitaryLevelUp = false; } Hashtable configTable = sdConfDataMgr.Instance().GetTable("config"); if (configTable.ContainsKey("refreshpvp")) { Hashtable table = configTable["refreshpvp"] as Hashtable; pk_refreshpvpmoney.text = table["value"] as string; } } }
// 指定角色被选中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; } }