/// <summary> /// 设置当前玩家所在地图的标记 /// </summary> public void UpdatePlayerPos() { int cur_scene_id = (int)SceneHelp.Instance.CurSceneID; uint transferLv = (uint)xc.TransferHelper.GetTransferLevel(); if (m_MapId != cur_scene_id || m_playerTransferLv != transferLv) { m_MapId = cur_scene_id; m_playerTransferLv = transferLv; GameObject map_point; if (mMapGoDic.TryGetValue(cur_scene_id, out map_point)) { var refObjPos = GetMapPointRefObjPos(map_point); mLocalPlayerPoint.gameObject.SetActive(true); mLocalPlayerPoint.transform.localPosition = new Vector3(refObjPos.x + 60, refObjPos.y - 45, 0); var head_icon = RoleHelp.GetPlayerIconName(Game.Instance.LocalPlayerVocation, transferLv, false); mLocalPlayerPoint.Find("HeadIcon").GetComponent <Image>().sprite = Window.LoadSprite(head_icon); float y = mMapScroll.viewport.rect.height / 2 - map_point.transform.localPosition.y; float x = mMapScroll.viewport.rect.width / 2 - map_point.transform.localPosition.x; MapTexture.rectTransform.anchoredPosition = new Vector2(x, y); } else { mLocalPlayerPoint.gameObject.SetActive(false); } } }
public void InsertOneServerRoleHead(GameObject roleHead, ServerRoleInfo serverRoleInfo) { GameObject item = GameObject.Instantiate(roleHead); item.SetActive(true); item.name = "ServerRole_" + serverRoleInfo.RoleId; Transform itemTrans = item.transform; itemTrans.SetParent(roleHead.transform.parent); itemTrans.localScale = Vector3.one; itemTrans.localPosition = Vector3.zero; // 等级,新角色控制服会发0过来,强制显示成1 Text levelText = itemTrans.Find("Text").GetComponent <Text>(); if (serverRoleInfo.Level <= 0) { levelText.text = "1"; } else { // 巅峰等级 Image lvBGImage = itemTrans.Find("LvBG").GetComponent <Image>(); Image peakLvBGImage = itemTrans.Find("PeakLvBG").GetComponent <Image>(); uint peakLevel = 0; bool isPeak = TransferHelper.IsPeak((uint)serverRoleInfo.Level, out peakLevel, serverRoleInfo.TransferLv); if (isPeak == true) { lvBGImage.gameObject.SetActive(false); peakLvBGImage.gameObject.SetActive(true); } else { lvBGImage.gameObject.SetActive(true); peakLvBGImage.gameObject.SetActive(false); } levelText.text = peakLevel.ToString(); } // 头像 Image headImage = itemTrans.Find("HeadImage").GetComponent <Image>(); headImage.sprite = mRoleHeadSpriteList.LoadSprite(RoleHelp.GetPlayerIconName((uint)serverRoleInfo.IconId, serverRoleInfo.TransferLv, false)); }
public void SetInfoPanel() { if (mTargetMono == null) { SetHpBarPanelVisible(false); return; } var actor = mTargetMono.BindActor; if (actor == null) { SetHpBarPanelVisible(false); return; } uint vocation_id = ActorHelper.TypeIdToRoleId(actor.ActorId); string iconName = RoleHelp.GetPlayerIconName(vocation_id, actor.TransferLv, false); uint peakLevel = 0; bool isPeak = TransferHelper.IsPeak((uint)actor.Level, out peakLevel, actor.TransferLv); if (isPeak == true) { mLvBgImage.gameObject.SetActive(false); mPeakLvBgImage.gameObject.SetActive(true); } else { mLvBgImage.gameObject.SetActive(true); mPeakLvBgImage.gameObject.SetActive(false); } mLvText.text = string.Format("{0}", peakLevel.ToString()); string replaceName = DBInstanceTypeControl.Instance.GetReplaceOtherPlayerName(InstanceManager.Instance.InstanceType, InstanceManager.Instance.InstanceSubType); if (replaceName == null || replaceName == "") { mNameText.text = actor.UserName; } else { mNameText.text = replaceName; } var icon = xc.DBManager.Instance.GetDB <xc.DBHonor>().GetHonorIcon(actor.Honor); if (icon == null || icon == "") { mHonorIcon.gameObject.SetActive(false); } else { mHonorIcon.sprite = Window.LoadSprite(icon); mHonorIcon.gameObject.SetActive(true); } mPlayerIconImage.sprite = Window.LoadSprite(iconName); SetHpBarPanel(); AvatarProperty ap = actor.mAvatarCtrl.GetLatestAvatartProperty(); if (ap == null) { mPlayerPhotoFrame.Clean(); } else { mPlayerPhotoFrame.SetModelId(ap.FashionPhotoFrameId); } }