/// <summary> /// 显示角色模型 /// </summary> public void ShowCharacter() { int tid = m_ServerListProxy.GetCurrentCharacterVO().Tid; if (m_CfgEternityProxy.GetPlayerByItemTId(tid) != null) { Model m_Model = m_CfgEternityProxy.GetItemModelByKey((uint)tid); Effect3DViewer m_npc3DViewer = m_CharacterModel.GetOrAddComponent <Effect3DViewer>(); if (m_npc3DViewer != null) { m_npc3DViewer.ClearModel(); m_npc3DViewer.LoadModel (AssetAddressKey.PRELOADUI_UI3D_ESCCHARACTERPANEL, m_Model.AssetName, AssetAddressKey.FX_UI_CHARACTER_SCANNING, GetNpcPos(m_Model), GetNpcRotation(m_Model), GetNpcScale(m_Model)); } } else { Debug.Log("tid错误" + tid); } }
/// <summary> /// 保存掉落信息 /// </summary> /// <param name="hero_uid">怪物唯一id</param> /// <param name="drop_list">所有玩家的掉落list 注意是所有玩家的 --我觉得是隐患</param> internal void OnSaveDropItemInfo(uint hero_uid, List <DropInfo> drop_list, int type) { int length = drop_list.Count; if (length <= 0) { return; } ServerListProxy serverListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; ulong MainPlayerId = serverListProxy.GetCurrentCharacterVO().UId; for (int i = 0; i < length; ++i) { if (drop_list[i].PlayerUid == MainPlayerId) { DropItemInfo dropItemInfo = new DropItemInfo(); dropItemInfo.uid = hero_uid; dropItemInfo.tid = drop_list[i].ChestTid; dropItemInfo.qualityid = drop_list[i].Quality; dropItemInfo.shipgrade = drop_list[i].ShipTlv; m_ChestInfoDic.Add(hero_uid, dropItemInfo); break; } } }
private ulong GetRoleUid() { if (m_RoleUid == 0) { ServerListProxy proxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; m_RoleUid = proxy.GetCurrentCharacterVO().UId; } return(m_RoleUid); }
/// <summary> /// 设置当前角色模型 /// </summary> /// <param name="tid">模型ID</param> private void ShowCharacter() { Model model = m_CfgEternityProxy.GetItemModelByKey((uint)m_ServerListProxy.GetCurrentCharacterVO().Tid); State.Set3DModelInfo(AssetAddressKey.PRELOADUI_UI3D_CHARACTERPANEL, new Effect3DViewer.ModelInfo[] { new Effect3DViewer.ModelInfo() { perfab = model.AssetName, position = new Vector3(model.UiPosition(0), model.UiPosition(1), model.UiPosition(2)), rotation = new Vector3(model.UiRotation(0), model.UiRotation(1), model.UiRotation(2)), scale = model.UiScale * Vector3.one } }, null); }
/// <summary> /// 存储新船 /// </summary> public void SetNew(IShip ship) { if (!MarkNew(ship)) { ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; string key = m_ServerListProxy.GetCurrentCharacterVO().UId.ToString(); HistoryShip m_HistoryShip = new HistoryShip(); if (PlayerPrefs.HasKey(key)) { m_HistoryShip = JsonUtility.FromJson <HistoryShip>(PlayerPrefs.GetString(key)); m_HistoryShip.m_ShipList.Add(ship.GetUID()); PlayerPrefs.SetString(key, JsonUtility.ToJson(m_HistoryShip)); } else { m_HistoryShip.m_ShipList.Add(ship.GetUID()); PlayerPrefs.SetString(key, JsonUtility.ToJson(m_HistoryShip)); } } }
/// <summary> /// 当前船是否为新船 /// </summary> /// <returns></returns> public bool MarkNew(IShip ship) { ServerListProxy m_ServerListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; string key = m_ServerListProxy.GetCurrentCharacterVO().UId.ToString(); HistoryShip m_HistoryShip = new HistoryShip(); if (PlayerPrefs.HasKey(key)) { m_HistoryShip = JsonUtility.FromJson <HistoryShip>(PlayerPrefs.GetString(key)); if (m_HistoryShip.m_ShipList.Contains(ship.GetUID())) { return(true); } else { return(false); } } return(false); }
public override void InitializeByRespond(S2C_SYNC_NEW_HERO respond) { InitBaseProperty(respond); m_CfgEternityProxy = (CfgEternityProxy)GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy); ServerListProxy serverListProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy; m_IsMain = respond.ownerPlayerID == serverListProxy.GetCurrentCharacterVO().UId; if (m_IsMain) { GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; gameplayProxy.SetMainPlayerUID(respond.id); gameplayProxy.SetCurrentAreaUid(respond.area_id); } if (respond.item_tid != 0) { CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; m_AssetName = cfgEternityProxy.GetItemModelAssetNameByKey(respond.item_tid); } if (respond.ownerPlayerID != 0) { m_HeroType = KHeroType.htPlayer; if (m_IsMain) { Interaction.InteractionManager.GetInstance().RegisterOwnerPlayer(this); } m_Player = m_CfgEternityProxy.GetPlayerByItemTId((int)GetItemID()); } else { m_NpcTmpVO = (GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy).GetNpcByKey((uint)respond.templateID); m_HeroType = (KHeroType)m_NpcTmpVO.NpcType; m_TeleportId = respond.teleport_id_; if (m_NpcTmpVO.Function.HasValue || m_TeleportId > 0) { Interaction.InteractionManager.GetInstance().RegisterInteractable(this); //NetworkManager.Instance.GetTaskController().SendRequetNpcCanAcceptTaskInfo(respond.templateID); } if (m_NpcTmpVO.InteractionDelay > 0) { m_IsActive = false; UIManager.Instance.StartCoroutine(Excute(m_NpcTmpVO.InteractionDelay, () => { m_IsActive = true; })); } else { m_IsActive = true; } } transform.name += "_" + m_HeroType.ToString(); m_MovementRotationTransform = new GameObject("Rotation").transform; m_MovementRotationTransform.SetParent(transform); m_BornServerPosition = new Vector3(respond.posX, respond.posY, respond.posZ); SetLocalPosition(m_BornServerPosition); m_BornServerRotation = new Quaternion(respond.faceDirX, respond.faceDirY, respond.faceDirZ, respond.faceDirW); SetMovementLocalRotation(m_BornServerRotation); if (m_IsMain) { CameraManager.GetInstance().GetMainCamereComponent().SetFollowAndLookAtCMFreeLookAxisValue(MainCameraComponent.CMType.Character, transform, transform, m_BornServerRotation.eulerAngles.y, 0.5f); CameraManager.GetInstance().GetMainCamereComponent().RequestChangeCM(MainCameraComponent.CMType.Character); transform.name += "(Self)"; #if ENABLE_SYNCHRONOUS_HUMAN_SELF_LOG FightLogToFile.Instance.Write("===== InitializeByRespond =====\n"); FightLogToFile.Instance.Write("time " + Utils.Timer.ClockUtil.Instance().GetMillisecond() + "\n"); FightLogToFile.Instance.WriteToJson("S2C_SYNC_NEW_HERO", respond); FightLogToFile.Instance.Write("\n"); #endif } if (m_HeroType == KHeroType.htPlayer) { //音效组合,Listener 的目标 if (m_Player.HasValue) { WwiseUtil.LoadSoundCombo(m_Player.Value.MusicComboID); } } int humanLayer = m_HeroType == KHeroType.htPlayer ? IsMain() ? GameConstant.LayerTypeID.MainPlayer : GameConstant.LayerTypeID.HumanOtherPlayer : GameConstant.LayerTypeID.HumanNPC; LayerUtil.SetGameObjectToLayer(gameObject, humanLayer, true); m_AttManager = new AttributeManager(); InitAttManager(); }
/// <summary> /// 刷新热键 /// </summary> public void RefreshHotKey() { if (m_SelectVoUid > 0) { SetHotKeyEnabled(UIAction.Social_AddBlacklist, true, true); SetHotKeyEnabled(UIAction.Social_Delete_RemoveBlacklist, true, true); SetHotKeyEnabled(UIAction.Team_Kick_Leave, true, true); SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, true); SetHotKeyEnabled(UIAction.Social_PrivateChat, true); SetHotKeyEnabled(UIAction.Team_Promote, true); SetHotKeyEnabled(UIAction.Team_Invite, true); State.GetAction(UIAction.Social_Inspect_AddFriend).Visible = true; } SetHotKeyEnabled(UIAction.Team_Mute_Unmute_MicOn_MicOff, true); switch (m_SocialType) { case SocialType.Team: SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); SetHotKeyDescription(UIAction.Team_Promote, 0); SetHotKeyDescription(UIAction.Team_Invite, 0); if (m_TeamProxy.GetMember(m_SelectVoUid) != null) { if (!m_TeamProxy.GetMember(m_SelectVoUid).IsOnline) { SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); SetHotKeyEnabled(UIAction.Social_PrivateChat, false); SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); SetHotKeyEnabled(UIAction.Team_Mute_Unmute_MicOn_MicOff, false); } } if (IsCaptainBySelf()) //自己是队长 { if (m_SelectVoUid == m_ServerListProxy.GetCurrentCharacterVO().UId) //选自己 { SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 1, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 1, true); if (m_TeamProxy.GetMember(m_SelectVoUid) != null) { if (m_TeamProxy.GetMember(m_SelectVoUid).IsMute) { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 3); } else { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 2); } } SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); SetHotKeyEnabled(UIAction.Social_PrivateChat, false); SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 0); } else { SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 0, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 0, true); if (m_TeamProxy.GetMember(m_SelectVoUid) != null) { if (m_TeamProxy.GetMember(m_SelectVoUid).IsMute) { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 1); } } SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 0); if (m_FriendProxy.GetFriend(m_SelectVoUid) != null) //好友 { SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 0); } else { SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); } if (m_FriendProxy.GetBlack(m_SelectVoUid) != null) { SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); } } } else { SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); if (m_SelectVoUid == m_ServerListProxy.GetCurrentCharacterVO().UId) //选自己 { SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 1, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 1, true); SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); SetHotKeyEnabled(UIAction.Social_PrivateChat, false); SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 0); if (m_TeamProxy.GetMember(m_SelectVoUid) != null) { if (m_TeamProxy.GetMember(m_SelectVoUid).IsMute) { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 3); } else { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 2); } } } else { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 0); SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 0, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 0, true); SetHotKeyEnabled(UIAction.Social_Delete_RemoveBlacklist, false, true); SetHotKeyEnabled(UIAction.Team_Kick_Leave, false, true); if (m_FriendProxy.GetFriend(m_SelectVoUid) != null) //好友 { SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 0); SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); } else { SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); } if (m_FriendProxy.GetBlack(m_SelectVoUid) != null) { SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); } } } if (m_TeamProxy.GetMember(m_ServerListProxy.GetCurrentCharacterVO().UId) == null) { SetHotKeyEnabled(UIAction.Social_Delete_RemoveBlacklist, false, true); SetHotKeyEnabled(UIAction.Team_Kick_Leave, false, true); SetHotKeyEnabled(UIAction.Team_Mute_Unmute_MicOn_MicOff, false); SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); if (m_SelectVoUid == m_ServerListProxy.GetCurrentCharacterVO().UId) { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 2); } else { SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 0); } } if (m_SelectVoUid <= 0) { SetHotKeyEnabled(UIAction.Team_Mute_Unmute_MicOn_MicOff, false); } break; case SocialType.Friend: SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); State.GetAction(UIAction.Social_Inspect_AddFriend).Visible = false; SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 0); SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 0, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 0, true); SetHotKeyDescription(UIAction.Team_Promote, 0); SetHotKeyDescription(UIAction.Team_Invite, 0); if (m_FriendProxy.GetBlack(m_SelectVoUid) != null) { SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 1, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 1, true); SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); } else { SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 0, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 0, true); } if (m_FriendProxy.GetFriend(m_SelectVoUid) != null) { SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); if (m_FriendProxy.GetFriend(m_SelectVoUid).Status == FriendInfoVO.FriendState.LEAVE) { SetHotKeyEnabled(UIAction.Social_PrivateChat, false); SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); } } if (m_TeamProxy.GetMember(m_SelectVoUid) != null) { SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); } break; case SocialType.Ship: break; case SocialType.Other: SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); SetHotKeyDescription(UIAction.Team_Mute_Unmute_MicOn_MicOff, 0); SetHotKeyDescription(UIAction.Social_Delete_RemoveBlacklist, 0, true); SetHotKeyDescription(UIAction.Team_Kick_Leave, 0, true); SetHotKeyDescription(UIAction.Team_Promote, 0); SetHotKeyDescription(UIAction.Team_Invite, 0); SetHotKeyEnabled(UIAction.Social_Delete_RemoveBlacklist, false, true); SetHotKeyEnabled(UIAction.Team_Kick_Leave, false, true); if (m_FriendProxy.GetBlack(m_SelectVoUid) != null) { SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); if (m_FriendProxy.GetBlack(m_SelectVoUid).Status == FriendInfoVO.FriendState.LEAVE) { SetHotKeyEnabled(UIAction.Team_Invite, false); } } if (m_FriendProxy.GetFriend(m_SelectVoUid) != null) { SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 0); SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); State.GetAction(UIAction.Social_Inspect_AddFriend).Visible = false; if (m_FriendProxy.GetFriend(m_SelectVoUid).Status == FriendInfoVO.FriendState.LEAVE) { SetHotKeyEnabled(UIAction.Social_PrivateChat, false); SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); } } else { if (m_FriendProxy.GetRecent(m_SelectVoUid) != null) { if (m_FriendProxy.GetRecent(m_SelectVoUid).Status == FriendInfoVO.FriendState.LEAVE) { State.GetAction(UIAction.Social_Inspect_AddFriend).Visible = false; } } SetHotKeyDescription(UIAction.Social_Inspect_AddFriend, 1); } if (m_TeamProxy.GetMember(m_SelectVoUid) != null) { SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); } break; default: break; } if (m_SelectVoUid <= 0) { SetHotKeyEnabled(UIAction.Social_AddBlacklist, false, true); SetHotKeyEnabled(UIAction.Social_Delete_RemoveBlacklist, false, true); SetHotKeyEnabled(UIAction.Team_Kick_Leave, false, true); SetHotKeyEnabled(UIAction.Social_Inspect_AddFriend, false); State.GetAction(UIAction.Social_Inspect_AddFriend).Visible = false; SetHotKeyEnabled(UIAction.Social_PrivateChat, false); SetHotKeyEnabled(UIAction.Team_Promote, false); SetHotKeyEnabled(UIAction.Team_Invite, false); } }
/// <summary> /// 填充面板 /// </summary> private void FillPanel() { int count; //Debug.LogError("刷新hud "); if (m_TeamProxy.GetMembersList() != null) { List <TeamMemberVO> datas = m_TeamProxy.GetMembersList(); m_TeamProxy.SortMembers(); count = datas.Count; for (int i = 0; i < count; i++) { m_TeamContents[i].gameObject.SetActive(true); m_TypeIsAlive[i].SetActive(false); m_TypeOnLine[i].SetActive(false); m_TeamNameLabel[i].text = datas[i].Name; if (datas[i].MaxHP == 0) { datas[i].MaxHP = 1; } if (datas[i].MaxDefense == 0) { datas[i].MaxDefense = 1; } //if (datas[i].HP<=0) //{ // datas[i].IsDead = true; //} Debug.Log("HP------" + datas[i].HP + datas[i].Name); m_TeamHPSlider[i].value = datas[i].HP * 1.0f / datas[i].MaxHP; m_TeamDefenseSlider[i].value = datas[i].Defense * 1.0f / datas[i].MaxDefense; m_TeamCanvasGroup[i].alpha = 1f; if (datas[i].IsDead) { //Debug.Log("dead------" + datas[i].Name); m_TeamCanvasGroup[i].alpha = m_Alpha; m_TeamHPSlider[i].value = 1; m_TeamDefenseSlider[i].value = 1; m_TypeIsAlive[i].SetActive(true); m_TypeOnLine[i].SetActive(false); } else { //Debug.LogError(datas[i].HP+"huozhe------" + datas[i].Name); } if (!m_FriendProxy.NearbyList(datas[i].UID) && datas[i].UID != m_ServerListProxy.GetCurrentCharacterVO().UId) { //Debug.Log("yuanli------" + datas[i].Name); m_TeamCanvasGroup[i].alpha = m_Alpha; m_TeamHPSlider[i].value = 1; m_TeamDefenseSlider[i].value = 1; m_TypeIsAlive[i].SetActive(false); m_TypeOnLine[i].SetActive(false); } if (!datas[i].IsOnline) //todo 离线 { //Debug.Log("xiaxian------" + datas[i].Name); m_TeamCanvasGroup[i].alpha = m_Alpha; m_TypeIsAlive[i].SetActive(false); m_TypeOnLine[i].SetActive(true); } if (datas[i].UID == m_ServerListProxy.GetCurrentCharacterVO().UId) { CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; if (!cfgEternityProxy.IsSpace()) { datas[i].IsDead = false; m_TeamCanvasGroup[i].alpha = 1f; m_TeamHPSlider[i].value = 1; m_TeamDefenseSlider[i].value = 1; m_TypeIsAlive[i].SetActive(false); m_TypeOnLine[i].SetActive(false); } } else { CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy; if (!cfgEternityProxy.IsSpace()) { m_FriendProxy.GetNearbyList(); if (m_FriendProxy.GetNearby(datas[i].UID) != null) { datas[i].IsDead = false; m_TeamCanvasGroup[i].alpha = 1f; m_TeamHPSlider[i].value = 1; m_TeamDefenseSlider[i].value = 1; m_TypeIsAlive[i].SetActive(false); m_TypeOnLine[i].SetActive(false); } } } } for (int i = count; i < m_TeamProxy.MEMBERCOUNTLIMIT; i++) { m_TeamContents[i].gameObject.SetActive(false); } } else { for (int i = 0; i < m_TeamProxy.MEMBERCOUNTLIMIT; i++) { m_TeamContents[i].gameObject.SetActive(false); } } }