void AddSelfIcon() { if (mainPlayer == null) { return; } Transform iconTrans = m__wordBg.transform.Find("SelfIcon"); uint job = (uint)mainPlayer.GetProp((int)PlayerProp.Job); string textureName = ""; table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex) 1); if (sdb != null) { textureName = sdb.strprofessionIcon; } UITeammateMapInfoGrid teaminfo = null; if (iconTrans == null) { iconTrans = GameObject.Instantiate <Transform>(m_trans_UITeammateMapInfoGrid); } teaminfo = iconTrans.GetComponent <UITeammateMapInfoGrid>(); if (teaminfo == null) { teaminfo = iconTrans.gameObject.AddComponent <UITeammateMapInfoGrid>(); } teaminfo.SetItemInfo(textureName, mainPlayer.GetName()); if (iconTrans != null) { iconTrans.name = "SelfIcon"; iconTrans.parent = m__wordBg.transform; if (m_dicWorldMapTrans.ContainsKey((int)m_mapid)) { Transform temp = m_dicWorldMapTrans[(int)m_mapid]; iconTrans.localPosition = temp.localPosition; iconTrans.gameObject.SetActive(true); } else { iconTrans.gameObject.SetActive(false); } iconTrans.localScale = Vector3.one; iconTrans.localRotation = Quaternion.identity; } }
void SyncTeammatePos(GameCmd.TeamPosData teamData) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es != null) { m_iconName.Remove(0, m_iconName.Length); m_iconName.Append(IconType.duiyouicon.ToString()); m_iconName.Append("_"); m_iconName.Append(teamData.uid); TeamMemberInfo info = DataManager.Manager <TeamDataManager>().GetTeamMember(teamData.uid); string iconName = m_iconName.ToString(); Transform iconTrans = mapTex.transform.Find(iconName); uint job = info.job; string textureName = ""; table.SelectRoleDataBase sdb = table.SelectRoleDataBase.Where((GameCmd.enumProfession)job, (GameCmd.enmCharSex) 1); if (sdb != null) { textureName = sdb.strprofessionIcon; } UITeammateMapInfoGrid teaminfo = null; if (iconTrans == null) { iconTrans = GameObject.Instantiate <Transform>(m_trans_UITeammateMapInfoGrid); m_duiyouList.Add(iconTrans.gameObject); iconTrans.name = iconName; } teaminfo = iconTrans.GetComponent <UITeammateMapInfoGrid>(); if (teaminfo == null) { teaminfo = iconTrans.gameObject.AddComponent <UITeammateMapInfoGrid>(); } if (teaminfo != null) { teaminfo.SetItemInfo(textureName, info.name); } Vector3 iconPos = GetIconPosByMapPos(new Vector3(teamData.x, 0, -teamData.y)); AddIconToMap(iconTrans.gameObject, iconPos); } }