Ejemplo n.º 1
0
    void Update()
    {
        if (IsLoadingScreenUp || Hotfix_LT.UI.LTCombatEventReceiver.Instance != null && Hotfix_LT.UI.LTCombatEventReceiver.Instance.spawnCameraing)
        {
            return;
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            // Escape to None for android back button, keep touch scheme on android device
            if (UICamera.mainCamera != null)
            {
                UICamera mainUICamera = UICamera.mainCamera.GetComponent <UICamera>();
                if (mainUICamera.useTouch)
                {
                    UICamera.currentKey    = KeyCode.None;
                    UICamera.currentScheme = UICamera.ControlScheme.Touch;
                }
            }
#endif
            if (GameFlowControlManager.IsInView())
            {
                GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "OnCancelButtonClick");
            }
            else if (!_exitConfirm)
            {
                _exitConfirm = true;
                OnExiting(ExitingResult);
            }
        }
    }
Ejemplo n.º 2
0
 private void DownloadComplete(string path, GameObject go)
 {
     if (go != null)
     {
         if (Mgr.State == eGameState.LoadGame)
         {
             if (m_FlowControlObject != null)
             {
                 EB.Debug.LogError("[GameStateLoadGame] m_FlowControlObject != null!");
                 GameObject.Destroy(m_FlowControlObject);
                 m_FlowControlObject  = null;
                 m_FlowControlManager = null;
             }
             m_FlowControlObject = go;
             m_FlowControlObject.transform.SetParent(GameStateManager.Instance.transform);
             m_FlowControlManager = m_FlowControlObject.GetComponent <GameFlowControlManager>();
         }
         else
         {
             GameObject.Destroy(go);
             EB.Assets.UnloadAssetByName("GameFlowControl", true);
         }
     }
     else
     {
         EB.Debug.LogError("[GameStateLoadGame]DownloadComplete: Failed to download {0}.", path);
     }
 }
Ejemplo n.º 3
0
        private void DestroyFlowControlObject()
        {
            if (m_FlowControlObject != null)
            {
                GameObject.Destroy(m_FlowControlObject);
                m_FlowControlObject  = null;
                m_FlowControlManager = null;

                EB.Assets.UnloadAssetByName("GameFlowControl", true);
            }
        }
Ejemplo n.º 4
0
 public void OnDestroy()
 {
     instance = null;
 }
Ejemplo n.º 5
0
 public void Awake()
 {
     instance = this;
 }
Ejemplo n.º 6
0
        public ParticleSystem PlayParticle(ParticleEventProperties properties, float time = 0, bool forcePlay = false, bool target = false, Vector3 tarPos = new Vector3(), Animator tarAimator = null, Vector3 tarOrgPos = new Vector3(), Vector3 tarHitPos = new Vector3())
        {
            if (!m_CanPlayParticle)
            {
                return(null);
            }

            //判断是否被禁止播放特效
            if (DisableFX)
            {
                return(null);
            }

            if (properties._applyOnTargetList)
            {
                ParticleEventProperties clone = ParticleEventProperties.Deserialize(properties.Serialize());
                PlayParticleOnTargetList(clone);
                return(null);
            }
            //ToDo:改调热更
            //if (LTInstanceMapModel.Instance.IsInsatnceViewAction() && properties._flippedParticleReference.Name.Contains("paobu"))
            if (GameFlowControlManager.IsInView("InstanceView") && properties._flippedParticleReference.Name.Contains("paobu"))
            {
                return(null);
            }

            //如果是世界boss的封印特效,则必须要在主场景才会出现
            //ToDo:改调热更
            //if (properties._flippedParticleReference.Name.Contains("fx_f_M00") && (!_animator.name.Contains("-Variant-Normal-M") || LTWorldBossDataManager.Instance.IsOpenWorldBoss()))
            if (properties._flippedParticleReference.Name.Contains("fx_f_M00") && (!_animator.name.Contains("-Variant-Normal-M") || (bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.LTWorldBossDataManager", "IsOpenWorldBossFromILR")))
            {
                return(null);
            }

            //世界boss某个出场特效播放之后需要特殊处理场景状态
            if (properties._flippedParticleReference.Name.Equals("fx_m_m001_specialappear03") || properties._flippedParticleReference.Name.Equals("fx_m_m002_specialappear03") || properties._flippedParticleReference.Name.Equals("fx_m_m003_specialappear03"))
            {
                if (WorldBossCombatScene.Instance != null)
                {
                    WorldBossCombatScene.Instance.SetSceneStatus(2);//世界boss播放出场镜头的时候需要特殊设置场景状态
                }
            }

            if (!string.IsNullOrEmpty(properties._partition))
            {
                //AvatarComponent avatar = _player != null ? _player.GetComponent<AvatarComponent>() : GetComponent<AvatarComponent>();
                AvatarComponent avatar = GetComponent <AvatarComponent>();
                if (avatar == null)
                {
                    return(null);
                }

                if (!avatar.Partitions.ContainsKey(properties._partition))
                {
                    return(null);
                }

                /*string fxName = avatar.Partitions[properties._partition].AssetName;
                 * if (properties._particleReference.Valiad && !properties._particleReference.Name.EndsWith(fxName))
                 * {
                 *      return null;
                 * }
                 * if (properties._flippedParticleReference.Valiad && !properties._flippedParticleReference.Name.EndsWith(fxName))
                 * {
                 *      return null;
                 * }
                 * if (!string.IsNullOrEmpty(properties.ParticleName) && !properties.ParticleName.EndsWith(fxName))
                 * {
                 *      return null;
                 * }
                 * if (!string.IsNullOrEmpty(properties.FlippedParticleName) && !properties.FlippedParticleName.EndsWith(fxName))
                 * {
                 *      return null;
                 * }*/
            }

            bool canPlay = true;

            // TJ: Test conditions that would prevent the particle from playing
            if (!forcePlay)
            {
                // check if there are any particles playing using this event name
                if (properties._eventName.Length > 0 && _activeParticles.Count(pi => pi._name == properties._eventName) > 0)
                {
                    ParticleInfo info = _activeParticles.Find(pi => pi._name == properties._eventName);
                    if (!info._stopOnOverride)
                    {
                        canPlay = false;
                    }
                }
                // check if we need to wait for attacks to be resolved
                else if (properties._killIfBlocked || properties._cancelIfMissed || properties._cancelIfHit)
                {
                    _cachedConditionalParticles.Add(properties);
                    canPlay = false;
                }
            }

            if (!canPlay)
            {
                return(null);
            }

            ParticleInfo last = null;

            if (properties._eventName.Length > 0 && _activeParticles.Count(pi => pi._name == properties._eventName) > 0)
            {
                foreach (ParticleInfo info in _activeParticles.FindAll(pi => pi._name == properties._eventName))
                {
                    if (info._stopOnOverride)
                    {
                        if (!info._particleSystem.loop || last != null)
                        {
                            StopParticle(info._name);
                        }
                        else
                        {
                            last = info;
                        }
                    }
                }
            }

            //EB.Debug.Log("PlayParticle: play {0} _activeParticles = {1}", properties._eventName, _activeParticles.Count);

            ParticleInfo   new_pi = last;
            ParticleSystem ps     = last != null ? last._particleSystem : null;

            if (new_pi == null)
            {
                ps = InstantiateParticle(properties, _flipped, target, tarPos, tarAimator, tarOrgPos, tarHitPos);
                if (ps == null)
                {
                    //如果是开场动画,如果还没播放开场动画,还需要隔一段时间播放
                    //if (CombatUtil.IsHeroStartEffect(MoveUtils.GetParticleName(properties, true)))
                    if (IsHeroStartEffect(MoveUtils.GetParticleName(properties, true)))
                    {
                        mCurrentReplayTime++;
                        if (mCurrentReplayTime >= mReplayTime)
                        {
                            TimerManager.instance.RemoveTimer(mTimer);
                            mCurrentReplayTime = 0;
                            return(null);
                        }
                        mTimer = TimerManager.instance.AddTimer(100, 1, delegate(int seq)
                        {
                            TimerManager.instance.RemoveTimer(mTimer);
                            PlayParticle(properties, time, forcePlay);
                        });
                    }
                    return(null);
                }

                new_pi = RegisterParticle(ps, properties._eventName, properties._interruptable, properties._stopOnExit, properties._stopOnDuration, properties._duration);
            }

            new_pi._stopOnOverride = properties._stopOnOverride;
            new_pi._stopOnEndTurn  = properties._stopOnEndTurn;
            new_pi._stopAfterTurns = properties._stopAfterTurns;
            new_pi._turns          = properties._turns;
            new_pi.properties      = properties;
            new_pi._activeTurn     = Mathf.Max(1, GetCurrentTurn());

            if (last == null)
            {
                ps.EnableEmission(true);

                if (time < 0.01f)
                {
                    ps.Simulate(0.0001f, true, true);
                }
                else
                {
                    ps.Simulate(time, true, true);
                }
                ps.gameObject.layer = gameObject.layer;
                ps.transform.SetChildLayer(gameObject.layer);

                ps.Play(true);
            }
            //EB.Debug.LogPSPoolAsset(string.Format(">>播放指定的特效:<color=#00ff00>{0}</color>", ps.name));
            if (PlayParticleAction != null)
            {
                PlayParticleAction(ps);
            }

            return(ps);
        }