Esempio n. 1
0
 public Category CheckMarkItemRemove(ulong markUid, ulong itemUid)
 {
     if (markUid == 0)
     {
         return(0);
     }
     if (m_Items.TryGetValue(markUid, out ItemContainer item))
     {
         switch (item)
         {
         case ItemWarShipVO val:
             if (m_ShipProxy.RemoveItemToShip(val.UID, itemUid, m_Items[itemUid].ParentUID))
             {
                 MsgShipDataChanged info = MessageSingleton.Get <MsgShipDataChanged>();
                 info.ShipUid      = markUid;
                 info.ChangeType   = MsgShipDataChanged.Type.Remove;
                 info.ItemType     = m_Items[itemUid].MainType;
                 info.ContainerUid = m_Items[itemUid].ParentUID;
                 info.ItemUid      = itemUid;
                 Facade.SendNotification(NotificationName.MSG_SHIP_DATA_CHANGED, info);
                 return(info.ItemType);
             }
             break;
         }
     }
     return(0);
 }
Esempio n. 2
0
    /// <summary>
    /// 某个装备入口被点击
    /// </summary>
    /// <param name="sender">触发对象</param>
    /// <param name="args">装备入口索引</param>
    private void OnEquipmentClick(GameObject sender, params object[] args)
    {
        m_BeforeToggle = sender.GetComponent <Toggle>();
        //sender.GetComponent<Animator>().SetBool("IsOn", true);
        m_CanvasGroup.interactable = false;

        MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>();

        msg.State       = WarshipPanelState.ListEquip;
        msg.CurrentShip = m_CurrentShip;

        msg.CurrentWeaponData   = null;
        msg.CurrentModData      = null;
        msg.CurrentReformerData = null;

        int pos = (int)args[0];

        msg.CurrentEquipmentData = new MsgWarshipPanelState.DataBase <IEquipment>(
            m_Equipment[pos],
            m_CurrentShip.GetEquipmentContainer().GetUID(),
            pos);
        // GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE);
        GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg);

        UIManager.Instance.ClosePanel(OwnerView);
    }
Esempio n. 3
0
    /// <summary>
    /// 刷新数据
    /// </summary>
    /// <param name="msg"></param>
    public void OnRefresh()
    {
        m_CanvasGroup.interactable = true;
        if (m_CurrentShip == null)
        {
            return;
        }
        SendViewerChange();
        SetData();
        RefreshHotKey();
        if (m_BeforeToggle && m_BeforeToggle.gameObject)
        {
            OnToggleValueChange(m_BeforeToggle.gameObject);
            EventSystemUtils.SetFocus(m_BeforeToggle);
        }
        else
        {
            OnToggleValueChange(m_WeaponCellList[0].gameObject);
            EventSystemUtils.SetFocus(m_WeaponCellList[0].GetComponent <Toggle>());
        }
        MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>();

        msg.State = WarshipPanelState.Main;
        GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg);
    }
Esempio n. 4
0
    /// <summary>
    /// 设置模型图
    /// </summary>
    /// <param name="itemTid">itemTid</param>
    /// <param name="isShip">是否是船</param>
    private void SendViewerChange(uint itemTid, bool isShip)
    {
        if (itemTid != 0)
        {
            Msg3DViewerInfo viewerInfo = MessageSingleton.Get <Msg3DViewerInfo>();
            Model           model      = CfgEternityProxy.GetItemModelByKey(itemTid);
            viewerInfo.Model  = model;
            viewerInfo.IsShip = isShip;
            if (isShip)
            {
                viewerInfo.position = new Vector3(-271.7f, -53.3f, 0);
                viewerInfo.size     = new Vector2(1775, 1209);
            }
            else
            {
                viewerInfo.position = new Vector3(-332, -220, 0);
                viewerInfo.size     = new Vector2(724, 693);
            }

            Parent.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE, viewerInfo);
        }
        else
        {
            Parent.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE);
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 筛选目标列表
    /// </summary>
    protected override void FiltrateTheTargets(float delta)
    {
        m_LockedTargetList.Clear();
        if (m_State == GunState.Fire)
        {
            BaseEntity fentiy = GetForwardEntity();//屏幕中心单位
            if (IsThereSurplusMissile() && fentiy != null)
            {
                TryToLockThisTarget(fentiy.EntityId());
            }
            //清除不在虚拟相机内的单位
            ClearAlreadyNoInVirtualCameraTargets();

            //更新锁定中的单位状态
            UpdateTheLocking(delta);

            //设置技能需要的目标列表结构数据
            SetSkillTargets();
        }
        // 通知UI当前锁定的所有目标
        PlayerMissileWeaponTargetSelectionInfo targetInfoNotify = MessageSingleton.Get <PlayerMissileWeaponTargetSelectionInfo>();

        targetInfoNotify.TargeList = m_LockTargeMap;
        GameFacade.Instance.SendNotification(NotificationName.PlayerMissileWeaponTargetSelection, targetInfoNotify);
    }
    /// <summary>
    /// 打开mod List
    /// </summary>
    private void OpenModList()
    {
        if (m_CurrentSelectedCell == null)
        {
            return;
        }

        MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>();

        msg.BeforeState = m_CurrentState;
        msg.State       = WarshipPanelState.ListMod;

        msg.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>(
            m_CurrentWeapon,
            m_WeaponContainerUID,
            m_WeaponContainerPOS);

        msg.CurrentModData = new MsgWarshipPanelState.ModData(
            m_CurrentSelectedCell.GetData(),
            m_CurrentSelectedCell.GetContainerUID(),
            m_CurrentSelectedCell.GetContainerPOS());
        msg.CurrentModData.ModType1 = m_CurrentSelectedCell.GetEquipmentModL1();
        msg.CurrentModData.ModType2 = m_CurrentSelectedCell.GetEquipmentModL2();

        UIManager.Instance.ClosePanel(OwnerView);
        // GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE);
        GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg);
        UIManager.Instance.OpenPanel(UIPanel.WarshipChipPanel, msg);
    }
Esempio n. 7
0
    public void SetFocus(bool focus)
    {
        if (focus)
        {
            MsgInteractiveInfo msg = MessageSingleton.Get <MsgInteractiveInfo>();
            msg.Describe = null;

            MissionProxy missionProxy = GameFacade.Instance.RetrieveProxy(ProxyName.MissionProxy) as MissionProxy;
            if (missionProxy.GetCanSubmitMissionBy(GetTemplateID()) == null)
            {
                string fKeyText = missionProxy.GetTalkMissionFKeyText(GetTemplateID());
                if (!string.IsNullOrEmpty(fKeyText))
                {
                    msg.Describe = fKeyText;
                }
            }

            msg.Tid = GetTemplateID();
            msg.MustUseHumanFBox = false;
            GameFacade.Instance.SendNotification(NotificationName.MSG_INTERACTIVE_SHOWFLAG, msg);
        }
        else
        {
            GameFacade.Instance.SendNotification(NotificationName.MSG_INTERACTIVE_HIDEFLAG);
            if (m_NpcTmpVO.DialogueTurn == 1)
            {
                GetSkinTransform().DORotateQuaternion(m_BornServerRotation, 0.5f);
            }
        }
    }
Esempio n. 8
0
    /// <summary>
    /// 设置tips
    /// </summary>
    private void SetTips()
    {
        MsgChildShowTipsInfo msg = MessageSingleton.Get <MsgChildShowTipsInfo>();

        msg.TipData = m_CurrentShip;
        State.SetTipData(msg.TipData);
        GameFacade.Instance.SendNotification(NotificationName.MSG_CHILD_TIPS_CHANGE, msg);
    }
Esempio n. 9
0
    /// <summary>
    /// 设置当前创角选角状态
    /// </summary>
    /// <param name="state"></param>
    public void SetCurrentState(CharacterPanelState state)
    {
        m_state = state;
        MsgCharacterPanelState stateMsg = MessageSingleton.Get <MsgCharacterPanelState>();

        stateMsg.State = m_state;
        SendNotification(NotificationName.MSG_CHARACTER_CREATE_STATE_CHANGE, stateMsg);
    }
Esempio n. 10
0
    public virtual void NotifyHUDTargetSelected(SpacecraftEntity targetSelected)
    {
        WeaponSelectedTargetInfo targetInfoNotify = MessageSingleton.Get <WeaponSelectedTargetInfo>();

        // FIXME. 动态内存分配
        targetInfoNotify.selectedTarget = targetSelected;
        GameFacade.Instance.SendNotification(NotificationName.PlayerWeaponSelectedTarget, targetInfoNotify);
    }
Esempio n. 11
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Esempio n. 12
0
    /// <summary>
    /// server 生产加速返回
    /// </summary>
    /// <param name="buf"></param>
    private void OnFoundrySpeed(KProtoBuf buf)
    {
        S2C_FOUNDRY_SPEED_BACK msg = buf as S2C_FOUNDRY_SPEED_BACK;

        m_FoundryProxy.SetFoundryItemFinish(msg.itemTid);
        MsgProduct msgProduct = MessageSingleton.Get <MsgProduct>();

        msgProduct.itemTID = msg.itemTid;
        msgProduct.msg     = NotificationName.MSG_FOUNDRY_SPEED;
        GameFacade.Instance.SendNotification(NotificationName.MSG_FOUNDRY_UPDATE, msgProduct);
    }
Esempio n. 13
0
    /// <summary>
    /// 武器技能释放结束
    /// </summary>
    public override void WeaponSkillFinish()
    {
        base.WeaponSkillFinish();
        m_LockTargeMap.Clear();

        // 通知UI当前锁定的所有目标
        PlayerMissileWeaponTargetSelectionInfo targetInfoNotify = MessageSingleton.Get <PlayerMissileWeaponTargetSelectionInfo>();

        targetInfoNotify.TargeList = m_LockTargeMap;
        GameFacade.Instance.SendNotification(NotificationName.PlayerMissileWeaponTargetSelection, targetInfoNotify);
    }
Esempio n. 14
0
    /// <summary>
    /// server 生产取消返回
    /// </summary>
    /// <param name="buf"></param>
    private void OnFoundryCancel(KProtoBuf buf)
    {
        S2C_FOUNDRY_CANCEL_BACK msg = buf as S2C_FOUNDRY_CANCEL_BACK;

        m_FoundryProxy.RemoveMember(msg.itemTid);
        MsgProduct msgProduct = MessageSingleton.Get <MsgProduct>();

        msgProduct.itemTID = msg.itemTid;
        msgProduct.msg     = NotificationName.MSG_FOUNDRY_CANCEL;
        GameFacade.Instance.SendNotification(NotificationName.MSG_FOUNDRY_UPDATE, msgProduct);
    }
Esempio n. 15
0
 /// <summary>
 /// 设置模型图
 /// </summary>
 private void SendViewerChange()
 {
     if (m_CurrentShip != null)
     {
         Msg3DViewerInfo viewerInfo = MessageSingleton.Get <Msg3DViewerInfo>();
         Model           model      = m_CfgEternityProxy.GetModel(m_CurrentShip.GetBaseConfig().Model);
         viewerInfo.Model    = model;
         viewerInfo.IsShip   = true;
         viewerInfo.position = new Vector3(-271.7f, -53.3f, 0);
         viewerInfo.size     = new Vector2(1775, 1209);
         GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE, viewerInfo);
     }
 }
    /// <summary>
    /// 设置tips
    /// </summary>
    private void SetTips()
    {
        MsgChildShowTipsInfo msg = MessageSingleton.Get <MsgChildShowTipsInfo>();

        if (m_CurrentState == WarshipPanelState.ModMainShip)
        {
            msg.TipData = m_CurrentShip;
        }
        else
        {
            msg.TipData = m_CurrentWeapon;
        }
        State.SetTipData(msg.TipData);
        GameFacade.Instance.SendNotification(NotificationName.MSG_CHILD_TIPS_CHANGE, msg);
    }
Esempio n. 17
0
    /// <summary>
    /// server 生产建造返回
    /// </summary>
    /// <param name="buf"></param>
    private void OnFoundryBuild(KProtoBuf buf)
    {
        S2C_FOUNDRY_BUILD_BACK msg = buf as S2C_FOUNDRY_BUILD_BACK;

        m_FoundryProxy.AddMember(
            msg.member.itemTid,
            (ulong)msg.member.startTime,
            (ulong)msg.member.endTime,
            0,
            msg.member.is_finish > 0);
        MsgProduct msgProduct = MessageSingleton.Get <MsgProduct>();

        msgProduct.itemTID = msg.member.itemTid;
        msgProduct.msg     = NotificationName.MSG_FOUNDRY_BUILD;
        GameFacade.Instance.SendNotification(NotificationName.MSG_FOUNDRY_UPDATE, msgProduct);
    }
Esempio n. 18
0
    /// <summary>
    /// 技能治疗效果
    /// </summary>
    /// <param name="buf"></param>
    private void OnSkillHealEffect_ServerMessage(IComponentEvent componentEvent)
    {
        S2C_HEAL_EFFECT_Event respond = componentEvent as S2C_HEAL_EFFECT_Event;

        SpacecraftEntity caster = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wCasterID) as SpacecraftEntity;
        SpacecraftEntity target = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wTargetHeroID) as SpacecraftEntity;

        if ((caster != null && caster.IsMain()) || (target != null && target.IsMain()))
        {
            BuffHurtInfo hurtInfo = MessageSingleton.Get <BuffHurtInfo>();
            hurtInfo.targetID = respond.msg.wTargetHeroID;
            hurtInfo.type     = (EffectType)respond.msg.Healtype;
            hurtInfo.value    = (int)respond.msg.wHealValue;
            GameFacade.Instance.SendNotification(NotificationName.BuffHurt, hurtInfo);
        }
    }
Esempio n. 19
0
    /// <summary>
    /// 添加消息
    /// </summary>
    /// <param name="channel"></param>
    /// <param name="text"></param>
    /// <param name="fromID"></param>
    /// <param name="fromName"></param>
    public void AddMessage(ChatChannel channel, string text, ulong fromID = 0, string fromName = null)
    {
        ChatMessageInfoVO channelMessage = new ChatMessageInfoVO();

        channelMessage.Time     = System.DateTime.Now;
        channelMessage.Channel  = channel;
        channelMessage.Message  = text;
        channelMessage.FromID   = fromID;
        channelMessage.FromName = fromName;

        List <ChatMessageInfoVO> messages = GetMessages(channel);

        messages.Add(channelMessage);

        while (messages.Count > CHANNEL_MESSAGE_MAX_COUNT)
        {
            messages.RemoveAt(0);
        }

        MsgChatChannelMessageChanged message = MessageSingleton.Get <MsgChatChannelMessageChanged>();

        message.m_channel = channel;
        SendNotification(NotificationName.ChatMessageChanged, message);

        if (fromID == 0 && fromName == null)
        {
            return;
        }

        if (channel != ChatChannel.All && channel != ChatChannel.CombatLog)
        {
            channel = ChatChannel.All;

            messages = GetMessages(channel);
            messages.Add(channelMessage);

            while (messages.Count > CHANNEL_MESSAGE_MAX_COUNT)
            {
                messages.RemoveAt(0);
            }

            message           = MessageSingleton.Get <MsgChatChannelMessageChanged>();
            message.m_channel = channel;
            SendNotification(NotificationName.ChatMessageChanged, message);
        }
    }
Esempio n. 20
0
    /// <summary>
    /// server 生产消息返回
    /// </summary>
    /// <param name="buf"></param>
    private void OnFoundryInfo(KProtoBuf buf)
    {
        S2C_FOUNDRY_GETINFO_BACK msg = buf as S2C_FOUNDRY_GETINFO_BACK;

        for (int i = 0; i < msg.member.Count; i++)
        {
            m_FoundryProxy.AddMember(
                msg.member[i].itemTid,
                (ulong)msg.member[i].startTime,
                (ulong)msg.member[i].endTime,
                ServerTimeUtil.Instance.GetNowTime() - (ulong)msg.member[i].startTime,
                msg.member[i].is_finish > 0);
        }
        MsgProduct msgProduct = MessageSingleton.Get <MsgProduct>();

        msgProduct.msg = NotificationName.MSG_FOUNDRY_GET_INFO;
        GameFacade.Instance.SendNotification(NotificationName.MSG_FOUNDRY_UPDATE, msgProduct);
    }
Esempio n. 21
0
 private void OnModClick(HotkeyCallback callback)
 {
     if (callback.performed)
     {
         UIManager.Instance.ClosePanel(Parent);
         MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>();
         msg.BeforeState       = Parent.Data.State;
         msg.State             = WarshipPanelState.ModMainWeapon;
         msg.CurrentShip       = Parent.Data.CurrentShip;
         msg.CurrentModData    = null;
         msg.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>(
             m_CurrentItemData as IWeapon,
             m_ContainerUID,
             m_ContainerPOS);
         Parent.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg);
         UIManager.Instance.OpenPanel(UIPanel.WarshipModPanel, msg);
     }
 }
Esempio n. 22
0
    /// <summary>
    /// 进入舰船mod页面
    /// </summary>
    /// <param name="callback"></param>
    private void OnModClick(HotkeyCallback callback)
    {
        if (callback.performed)
        {
            m_CanvasGroup.interactable = false;

            MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>();
            msg.State                = WarshipPanelState.ModMainShip;
            msg.CurrentShip          = m_CurrentShip;
            msg.CurrentEquipmentData = null;
            msg.CurrentModData       = null;
            msg.CurrentReformerData  = null;
            msg.CurrentWeaponData    = null;
            // GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE);
            GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg);

            UIManager.Instance.ClosePanel(OwnerView);
        }
    }
Esempio n. 23
0
    private void AddEntity <EntityType, RespondType>(ulong entityId, EntityType entity)
        where EntityType : GameEntity <RespondType>
        where RespondType : KProtoBuf
    {
        m_EntityTable.Add(entityId, entity);

        Dictionary <ulong, BaseEntity> keyValuePairs;

        if (!m_EntityTypeTable.TryGetValue(typeof(EntityType), out keyValuePairs))
        {
            keyValuePairs = new Dictionary <ulong, BaseEntity>();
            m_EntityTypeTable.Add(typeof(EntityType), keyValuePairs);
        }
        keyValuePairs.Add(entityId, entity);

        switch (entity)
        {
        case HumanEntity val:
        {
            MsgEntityInfo msg = MessageSingleton.Get <MsgEntityInfo>();
            msg.Uid    = val.UId();
            msg.Tid    = val.GetTemplateID();
            msg.IsMain = val.IsMain();
            GameFacade.Instance.SendNotification(NotificationName.MSG_HUMAN_ENTITY_ON_ADDED, msg);
        }
        break;

        case SpacecraftEntity val:
        {
            MsgEntityInfo msg = MessageSingleton.Get <MsgEntityInfo>();
            msg.Uid    = val.UId();
            msg.Tid    = val.GetTemplateID();
            msg.IsMain = val.IsMain();
            GameFacade.Instance.SendNotification(NotificationName.MSG_HUMAN_ENTITY_ON_ADDED, msg);
        }
        break;
        }
    }
Esempio n. 24
0
    /// <summary>
    /// server 生产接收返回
    /// </summary>
    /// <param name="buf"></param>
    private void OnFoundryReceive(KProtoBuf buf)
    {
        S2C_FOUNDRY_RECEIVE_BACK msg = buf as S2C_FOUNDRY_RECEIVE_BACK;
        //奖励面板
        ProduceInfoVO foundryMember = m_FoundryProxy.GetFoundryById(msg.itemTid);

        if (foundryMember == null)
        {
            return;
        }
        //var drawVO = (GameFacade.Instance.RetrieveProxy(ProxyName.CfgItemListProxy) as CfgItemListProxy).GetDrawingVOByKey((int)foundryMember.TID);
        //if (drawVO.ByteBuffer == null)
        //{
        //	return;
        //}
        //to do 奖励面板确定是否要
        m_FoundryProxy.RemoveMember(msg.itemTid);
        MsgProduct msgProduct = MessageSingleton.Get <MsgProduct>();

        msgProduct.itemTID = msg.itemTid;
        msgProduct.msg     = NotificationName.MSG_FOUNDRY_RECEIVE;
        GameFacade.Instance.SendNotification(NotificationName.MSG_FOUNDRY_UPDATE, msgProduct);
    }
 /// <summary>
 /// esc操作
 /// </summary>
 /// <param name="callback"></param>
 private void OnEscClick(HotkeyCallback callback)
 {
     if (callback.performed)
     {
         GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE);
         UIManager.Instance.ClosePanel(OwnerView);
         MsgWarshipPanelState msg = MessageSingleton.Get <MsgWarshipPanelState>();
         msg.CurrentWeaponData = null;
         if (m_CurrentState == WarshipPanelState.ModMainShip)
         {
             msg.State = WarshipPanelState.Main;
         }
         else
         {
             msg.State             = WarshipPanelState.ListWeapon;
             msg.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>(
                 m_CurrentWeapon,
                 m_WeaponContainerUID,
                 m_WeaponContainerPOS);
         }
         UIManager.Instance.OpenPanel(UIPanel.WarshipDialogPanel, m_CurrentShip);
         GameFacade.Instance.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, msg);
     }
 }
Esempio n. 26
0
    public void SwtichMap(ulong areaId, Vector3 worldPos)
    {
        StateChangeHandler.HandleChangeState();
        DropHandler.HandleSyncDrop();
        SkillBroadCastRPCNet.Handle();

        LoadingPanelParamere loadingPanelParamere = MessageSingleton.Get <LoadingPanelParamere>();

        loadingPanelParamere.OnShown = () =>
        {
            GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
            if (gameplayProxy != null)
            {
                GameplayManager.Instance.Clear();
                gameplayProxy.SetCurrentAreaUid(areaId);
                Vector3 gameWorldPos = gameplayProxy.WorldPositionToServerAreaOffsetPosition(worldPos);
                Map.MapManager.GetInstance().SetPlayerPosition(worldPos, gameWorldPos);
            }
            OnSwitchMapLoadingPanelShown();
        };
        UIManager.Instance.OpenPanel(UIPanel.LoadingSecondPanel, loadingPanelParamere);

        CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        uint             lastGamingMapId  = cfgEternityProxy.GetLastGamingMapId();
        uint             gamingMapId      = cfgEternityProxy.GetCurrentGamingMapId();

        if (lastGamingMapId != Map.Constants.NOTSET_MAP_UID)
        {
            int lastMapType = cfgEternityProxy.GetMapByKey(lastGamingMapId).Value.GamingType;
            int mapType     = cfgEternityProxy.GetMapByKey(gamingMapId).Value.GamingType;
            if (lastMapType == 4 && mapType == 4)
            {
                WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_StartCrossingTheGate, WwiseMusicPalce.Palce_1st, false, null);
            }
        }
    }
    /// <summary>
    /// 设置模型图
    /// </summary>
    private void SendViewerChange()
    {
        Msg3DViewerInfo viewerInfo = MessageSingleton.Get <Msg3DViewerInfo>();
        Model           model;

        if (m_CurrentState == WarshipPanelState.ModMainShip)
        {
            model               = m_CfgEternityProxy.GetModel(m_CurrentShip.GetBaseConfig().Model);
            viewerInfo.IsShip   = true;
            viewerInfo.position = new Vector3(-49.8f, -89.7f, 0);
            viewerInfo.size     = new Vector2(1987, 1416);
        }
        else
        {
            //暂时没有武器
            model               = m_CfgEternityProxy.GetModel(m_CurrentWeapon.GetBaseConfig().Model);
            viewerInfo.IsShip   = false;
            viewerInfo.position = new Vector3(-49.8f, -89.7f, 0);
            viewerInfo.size     = new Vector2(1987, 1416);
        }
        viewerInfo.Model = model;

        GameFacade.Instance.SendNotification(NotificationName.MSG_3DVIEWER_CHANGE, viewerInfo);
    }
Esempio n. 28
0
    /// <summary>
    /// 检测是否已经选中了新的目标
    /// 更新已经锁定了的目标的锁定状态
    /// </summary>
    /// <param name="deltaTime"></param>
    public override void OnUpdate(float deltaTime)
    {
        base.OnUpdate(deltaTime);

        //  调试代码
        if (Input.GetKeyDown(KeyCode.Keypad0))
        {
            ResetWeaponRuntimeData();
            Debug.LogError("清理武器导弹状态");
        }

        TranslateUniformParamToWeaponParam();
        // 调试代码

        List <SpacecraftEntity> targetList = new List <SpacecraftEntity>();

        // 锁定多目标, 同时让他们描红的逻辑, 还需要仔细考虑. 这里暂时先注释. 选择目标把它描红的逻辑让HUD执行
        //bool targetSelected = GetAllEntitySelectedByVirtualCamera(ref targetList);
        //NotifyHUDTargetSelected(targetSelected ? targetList[0] : null);

        // 尝试锁定新的目标
        if (m_State == State.Lock && IsThereSurplusMissile())
        {
            for (int iTarget = 0; iTarget < targetList.Count; iTarget++)
            {
                TryToLockThisTarget(targetList[iTarget]);
            }
        }

        PlayerMissileWeaponTargetSelectionInfo targetInfoNotify = MessageSingleton.Get <PlayerMissileWeaponTargetSelectionInfo>();

        // FIXME. 动态内存分配
        //targetInfoNotify.TargeList = m_LockTargeMap;
        GameFacade.Instance.SendNotification(NotificationName.PlayerMissileWeaponTargetSelection, targetInfoNotify);

        // 更新已有的目标
        // iterate all locking and locked target
        // locking:
        //		once countdown finished, set target state to Locked
        // locking and locked:
        //		if target is out of range / dead, unlock target
        List <SpacecraftEntity> cancelLockList = new List <SpacecraftEntity>();

        foreach (var pair in m_LockTargeMap)
        {
            SpacecraftEntity targetEntity   = pair.Key;
            TargetLockInfo   targetLockInfo = pair.Value;
            if (targetLockInfo.LockState == TargetLockState.Locking)
            {
                if (targetLockInfo.LockTimeRemaining <= 0f)
                {
                    targetLockInfo.LockState         = TargetLockState.Locked;
                    targetLockInfo.LockTimeRemaining = 0f;
                    targetLockInfo.LockTimes++;

                    SLog("目标锁定完成. {0}", targetEntity.name);
                }
                else
                {
                    targetLockInfo.LockTimeRemaining -= deltaTime;
                }
            }

            // UNDONE, 检查所有目标是不是已经超出了射程或者已经死了. 如果是的话, 就接触锁定
            if (targetEntity == null || targetEntity.IsDead())
            {
                cancelLockList.Add(targetEntity);
            }
        }

        // 接触已经不可用的目标的锁定
        for (int iEntity = 0; iEntity < cancelLockList.Count; iEntity++)
        {
            m_LockTargeMap.Remove(cancelLockList[iEntity]);
            SLog("目标因为死亡或者超出视野而失去锁定. {0}", iEntity);
        }
    }
Esempio n. 29
0
    /// <summary>
    /// esc
    /// </summary>
    /// <param name="callback"></param>
    private void OnEscClick(HotkeyCallback callback)
    {
        if (callback.performed)
        {
            MsgWarshipPanelState data = MessageSingleton.Get <MsgWarshipPanelState>();

            data.CurrentShip = Parent.Data.CurrentShip;
            if (Parent.Data.State == WarshipPanelState.ListMod)
            {
                data.State             = Parent.Data.BeforeState;
                data.CurrentWeaponData = new MsgWarshipPanelState.DataBase <IWeapon>(
                    m_CurrentWeapon,
                    m_CurrentWeaponContainerUID,
                    m_CurrentWeaponContainerPOS);
                data.CurrentModData = new MsgWarshipPanelState.ModData(
                    m_CurrentItemData as IMod,
                    m_ContainerUID,
                    m_ContainerPOS);


                switch (data.State)
                {
                case WarshipPanelState.Main:
                    break;

                case WarshipPanelState.ModMainShip:
                case WarshipPanelState.ModMainWeapon:
                    UIManager.Instance.OpenPanel(UIPanel.WarshipModPanel, data);
                    break;

                case WarshipPanelState.ListWeapon:
                    UIManager.Instance.OpenPanel(UIPanel.WarshipListPanel, data);
                    break;

                case WarshipPanelState.ListMod:
                    UIManager.Instance.OpenPanel(UIPanel.WarshipChipPanel, data);
                    break;

                case WarshipPanelState.ListReformer:
                    UIManager.Instance.OpenPanel(UIPanel.WarshipReformerPanel, data);
                    break;

                case WarshipPanelState.ListEquip:
                    switch ((EquipmentL1)data.CurrentEquipmentData.ContainerPOS + 1)
                    {
                    case EquipmentL1.Processor:
                        UIManager.Instance.OpenPanel(UIPanel.WarshipProcessorPanel, data);
                        break;

                    case EquipmentL1.Armor:
                        UIManager.Instance.OpenPanel(UIPanel.WarshipArmorPanel, data);
                        break;

                    case EquipmentL1.Reactor:
                        UIManager.Instance.OpenPanel(UIPanel.WarshipReactorPanel, data);
                        break;

                    case EquipmentL1.AuxiliaryUnit:
                        UIManager.Instance.OpenPanel(UIPanel.WarshipAuxiliaryUnitPanel, data);
                        break;

                    case EquipmentL1.Nanobot:
                        UIManager.Instance.OpenPanel(UIPanel.WarshipNanobotPanel, data);
                        break;

                    case EquipmentL1.SignalGenerator:
                        UIManager.Instance.OpenPanel(UIPanel.WarshipSignalGeneratorPanel, data);
                        break;

                    default:
                        break;
                    }
                    break;
                }
                Parent.SendNotification(NotificationName.MSG_WARSHIP_PANEL_CHANGE, data);
            }
            else
            {
                data.State = WarshipPanelState.Main;
                data.CurrentEquipmentData = null;
                data.CurrentModData       = null;
                data.CurrentReformerData  = null;
                data.CurrentWeaponData    = null;
                data.CurrentShip          = Parent.Data.CurrentShip;

                UIManager.Instance.OpenPanel(UIPanel.WarshipDialogPanel, Parent.Data.CurrentShip);
            }

            UIManager.Instance.ClosePanel(Parent);
        }
    }
Esempio n. 30
0
    /// <summary>
    /// 技能命中效果
    /// </summary>
    /// <param name="buf"></param>
    private void OnSkillEffect_ServerMessage(IComponentEvent componentEvent)
    {
        S2C_SKILL_EFFECT_Event respond = componentEvent as S2C_SKILL_EFFECT_Event;

        uint MainID = m_GameplayProxy.GetMainPlayerUID();

        SpacecraftEntity caster = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wCasterID) as SpacecraftEntity;
        SpacecraftEntity target = m_GameplayProxy.GetEntityById <SpacecraftEntity>(respond.msg.wTargetHeroID) as SpacecraftEntity;

        if ((caster != null && caster.IsMain()) ||
            (target != null && target.IsMain()) ||
            (caster != null && caster.GetEntityFatherOwnerID() == MainID) ||
            (target != null && target.GetEntityFatherOwnerID() == MainID)
            )
        {
            SkillHurtInfo hurtInfo = MessageSingleton.Get <SkillHurtInfo>();
            hurtInfo.TargetID          = respond.msg.wTargetHeroID;
            hurtInfo.IsCrit            = respond.msg.crit_type != 0;
            hurtInfo.PenetrationDamage = (int)respond.msg.PenetrationDamage;
            hurtInfo.IsDodge           = respond.msg.isdoge != 0;
            hurtInfo.EffectID          = (int)(respond.msg.byAttackEvent == (byte)EffectType.TriggerAnomaly ? respond.msg.wTriggerID : 0);
            hurtInfo.IsWeak            = respond.msg.crit_type == 3;

            for (int iDamage = 0; iDamage < respond.msg.count; iDamage++)
            {
                hurtInfo.Damage = (int)(respond.msg.wDamage / respond.msg.count);
                GameFacade.Instance.SendNotification(NotificationName.SkillHurt, hurtInfo);
            }

            // 采矿的表现 (矿物碎裂)
            SpacecraftEntity currentTargetEntity = m_Property.GetTarget();
            if (currentTargetEntity != null && currentTargetEntity.GetHeroType() == KHeroType.htMine && caster.GetTargetCollider() != null)
            {
                MineDamage mineEvent = new MineDamage();
                mineEvent.HitCollider = caster.GetTargetCollider();
                mineEvent.Damage      = respond.msg.wDamage;
                currentTargetEntity.SendEvent(ComponentEventName.MineDamage, mineEvent);
            }
        }

        if (target && target.IsMain())
        {
            if (m_Property.GetUnderAttackWarningToneCountdown() == 0)
            {
                WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_Be_Attacked, WwiseMusicPalce.Palce_1st, false, null);
            }

            float countDown = m_CfgEternityProxy.GetGamingConfig(1).Value.Sound.Value.CountDown.Value.UnderAttackWarningTone;
            m_Property.SetUnderAttackWarningToneCountdown(countDown);
        }

        /// 播放弱点攻击声音提示
        /// TODO.crit_type暂时没有枚举
        if (caster && caster.IsMain())
        {
            if (m_WeakSoundTmpCD >= m_WeakSoundCD && respond.msg.crit_type == 3)
            {
                float val = Random.value;
                if (val <= m_WeakSoundProbability)
                {
                    SendEvent(ComponentEventName.PlayVideoSound, new PlayVideoSound()
                    {
                        GroupID = (int)m_CfgEternityProxy.GetGamingConfig(1).Value.Mine.Value.Sound.Value.WeaknessSoundVideo
                    });
                    m_WeakSoundTmpCD = 0;
                }
            }
        }
    }