Exemple #1
0
 public override void HandleNotification(INotification notification)
 {
     switch (notification.Name)
     {
         case NotificationName.MSG_CHANGE_BATTLE_STATE:
         case NotificationName.MainHeroRevive:
             RefreshAnimState();
             if (notification.Name == NotificationName.MainHeroRevive)
             {
                 UIManager.Instance.OpenPanel(UIPanel.HudSceneNamePanel);
                 UIManager.Instance.OpenPanel(UIPanel.HudAreaNamePanel);
             }
             break;
         case NotificationName.MainHeroDeath:
             RefreshAnimState();
             UIManager.Instance.CloseAllWindow();
             UIManager.Instance.OpenPanel(UIPanel.RevivePanel, notification.Body);
             break;
         case NotificationName.MSG_HUMAN_ENTITY_ON_ADDED:
             {
                 MsgEntityInfo entityInfo = (MsgEntityInfo)notification.Body;
                 if (entityInfo.IsMain)
                     RefreshAnimState();
             }
             break;
     }
 }
Exemple #2
0
    public override void HandleNotification(INotification notification)
    {
        switch (notification.Name)
        {
        case NotificationName.PlayerWeaponToggleEnd:
        case NotificationName.MSG_PACKAGE_ITEM_OPERATE:
            OnWeaponToggleEnd(false);
            break;

        case NotificationName.MSG_HUMAN_ENTITY_ON_ADDED:
        {
            MsgEntityInfo entityInfo = (MsgEntityInfo)notification.Body;
            if (entityInfo.IsMain)
            {
                OnWeaponToggleEnd(true);
            }
        }
        break;
        }
    }
 public override void HandleNotification(INotification notification)
 {
     switch (notification.Name)
     {
         case NotificationName.MSG_CHANGE_BATTLE_STATE:
         case NotificationName.PlayerWeaponToggleEnd:
             OnMainWeaponChanged();
             break;
         case NotificationName.PlayerWeaponShot:
             OnWeaponFire(notification.Body as MsgPlayerWeaponShot);
             break;
         case NotificationName.PlayerWeaponCrosshairScale:
             OnWeaponCrosshairOffset(notification.Body as MsgPlayerWeaponCrosshair);
             break;
         case NotificationName.PlayerMissileWeaponTargetSelection:
             OnTargetListChanged(notification.Body as PlayerMissileWeaponTargetSelectionInfo);
             break;
         case NotificationName.PlayerWeaponSelectedTarget:
             ChangeCrosshairColor((notification.Body as WeaponSelectedTargetInfo).selectedTarget);
             break;
         case NotificationName.PlayerWeaponCrosshairScale_ShotGun:
             OnWeaponCrosshairSonArea(notification.Body as MsgPlayerWeaponCrosshair_ShotGun);
             break;
         case NotificationName.MSG_HUMAN_ENTITY_ON_ADDED:
             {
                 MsgEntityInfo entityInfo = (MsgEntityInfo)notification.Body;
                 if (entityInfo.IsMain)
                     OnMainWeaponChanged();
             }
             break;
         case NotificationName.PlayerWeaponFireFail:
             OnWeaponFireFail();
             break;
         case NotificationName.Enter6DofMode:
             OnEnter6DofMode();
             break;
         case NotificationName.Exit6DofMode:
             OnExit6DofMode();
             break;
     }
 }
Exemple #4
0
    public override void HandleNotification(INotification notification)
    {
        switch (notification.Name)
        {
        case NotificationName.MSG_CHANGE_BATTLE_STATE:
        case NotificationName.MainHeroDeath:
        case NotificationName.MainHeroRevive:
            RefreshAnimState();
            break;

        case NotificationName.MSG_HUMAN_ENTITY_ON_ADDED:
        {
            MsgEntityInfo entityInfo = (MsgEntityInfo)notification.Body;
            if (entityInfo.IsMain)
            {
                RefreshAnimState();
            }
        }
        break;
        }
    }
    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;
        }
    }