示例#1
0
    /// <summary>
    /// 某个界面管理器是否被删除了
    /// </summary>
    /// <param name="ui"></param>
    /// <returns></returns>
    public static bool IsDestroyed(UIController ui)
    {
        if (ui == null)
        {
            return(true);
        }

        bool isDestroyed = false;


        UIPanel panel = ui.GetComponent <UIPanel>();

        if (panel == null)
        {
            isDestroyed = ui.gameObject.activeSelf;
        }
        else
        {
            //isDestroyed = !panel.enabled;
            isDestroyed = false;
        }

        if (isDestroyed)
        {
            //ToDo:暂时屏蔽
            //if (GlobalMenuManager.Instance != null)
            //{
            //    GlobalMenuManager.Instance.RemoveOpenController(ui);
            //}
            GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "RemoveOpenControllerFromILR", ui);
        }

        return(isDestroyed);
    }
示例#2
0
    /// <summary>
    /// 销毁ui,需主动调用,一般在OnRemoveFromStack中调用
    /// </summary>
    /// <param name="isGc"></param>
    public void DestroySelf(bool isGc = false)
    {
        //先这样写,以后会往下走。
        //DestroyController();
        //return;
        if (this == null || gameObject == null)
        {
            return;
        }

        EB.Debug.LogUI("-----------执行【<color=#00ff00>{0}</color>】预设<color=#ff0000>清除UI</color>界面对象, 是否全屏 = {1}", MCurrentViewName, IsFullscreen());

        Show(false);
        //ToDo:暂时屏蔽
        //if (GlobalMenuManager.Instance != null)
        //{
        //    GlobalMenuManager.Instance.RemoveOpenController(this);
        //}
        GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "RemoveOpenControllerFromILR", this);

        if (IsFullscreen())
        {
            transform.localPosition = mHideUIPos;
            if (GetComponent <BoxCollider>() != null)
            {
                GetComponent <BoxCollider>().enabled = false;
            }
            //ToDo:暂时屏蔽
            //GlobalMenuManager.Instance.AddUIController(this);
            GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "AddUIControllerFromILR", this);
        }
    }
示例#3
0
    /// <summary>
    /// 销毁Controller
    /// </summary>
    private void DestroyController()
    {
        if (IsDestroyed(this))
        {
            return;
        }

        if (gameObject != null)
        {
            EB.Debug.LogUI("执行【<color=#00ff00>{0}</color>】预设<color=#ff0000>清除UI</color>界面对象", gameObject.name);
        }

        StopAllCoroutines();
        if (ShowUIBlocker)
        {
            mTrigger  = null;
            mCollider = null;
            mBlocker  = null;
        }
        mParam = null;

        Show(false);
        DestroyObject();
        //ToDo:暂时屏蔽
        //if (GlobalMenuManager.Instance != null)
        //{
        //    GlobalMenuManager.Instance.RemoveOpenController(this);
        //}
        GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "RemoveOpenControllerFromILR", this);
    }
示例#4
0
 public void Start()
 {
     //ToDo:暂时屏蔽,方便解耦
     //LTMainMenuHudController.Instance.gameObject.SetActive(false);
     GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.LTMainMenuHudController", "SetActiveFromILR", false);
     Stop();
 }
示例#5
0
 private void OnAssetReady(string assetname, GameObject obj, bool isSuccessed)
 {
     if (!isSuccessed)
     {
         EB.Debug.LogError(string.Format("Asset {0} dont find", assetname));
     }
     else
     {
         if (this == null)
         {
             EB.Debug.LogError("<color=#ff0000>加载的资源完成的~发现寄主对象已经不存在了,就直接清除掉刚才加载的对象:</color>" + assetname);
             Destroy(obj);
         }
         else
         {
             if (IsHeroStartEffect(obj.name))
             {
                 GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "BossParticleInSceneComplete");
             }
             if (!_fxParticleList.Contains(obj))
             {
                 _fxParticleList.Add(obj);
             }
         }
     }
     TimerManager.instance.AddFramer(0, 1, RegisterFxParticles, obj);
     loadingAssetCount--;
 }
示例#6
0
 public void SetMovementTargetQueue(EB.Collections.Queue <Vector3> movePosQue, System.Action onEndCallback)
 {
     _movePosQue           = movePosQue;
     _onMoveEndActionByQue = onEndCallback;
     GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.AlliancesManager", "RecordTransferPointFromILRWithCallback", _movePosQue.Count - 1);
     SetMovementTarget(_movePosQue.Dequeue(), false, true, false, true);
 }
示例#7
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);
            }
        }
    }
示例#8
0
 void OnLogOff(string error)
 {
     GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.FusionTelemetry", "PostLogout");
     if (GameStateManager.Instance.State >= eGameState.Login)
     {
         Relogin(error);
     }
 }
示例#9
0
 public virtual void Interact(GameObject player)
 {
     GlobalUtils.CallStaticHotfixEx("Hotfix_LT.UI.WorldMapPathManager", "Instance", "StopPath");       //这个还需要存在,不然寻路到NPC处寻路数据未清理
     if (!UIStack.Instance.IsUIBlockingScreen)
     {
         GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "OnInteractEvent", player, gameObject);
         onInteract(player);
     }
 }
示例#10
0
    /// <summary>
    /// 更新缓存数据
    /// </summary>
    /// <param name="dataID">数据的唯一id</param>
    /// <param name="incomingValue">刷新的数据对象</param>
    private void UpdateLookups(string dataID, object incomingValue)
    {
        //刷新的缓存数据一定要先存在
        if (dataID != null && lookups.ContainsKey(dataID))
        {
            //获取所有在激活状态及允许更新的缓存对象
            IEnumerable <DataLookup> lookupsToUpdate = lookups[dataID].Where(arg => arg != null && arg.gameObject.activeInHierarchy && arg.AllowLookupUpdate);

            //foreach(DataLookup lookup in lookupsToUpdate)
            for (int i = 0; i < lookupsToUpdate.Count(); i++)
            {
                DataLookup lookup = lookupsToUpdate.ElementAt(i);

                if (lookup != null)
                {
                    lookup.OnLookupUpdate(dataID, incomingValue);
                }
            }
        }

        if (dataID != null && inlineLookups.ContainsKey(dataID))
        {
            string finalDataID;
            bool   inlineFound = SearchDataByID <string>(dataID, out finalDataID);
            if (!inlineFound)
            {
                // todo
            }

            InlineLookupEntry inlineEntry = inlineLookups[dataID];

            string previousCachedInlineValue = inlineEntry.CachedValue;

            if (!AreDataIDEqual(previousCachedInlineValue, finalDataID))
            {
                inlineEntry.CachedValue = finalDataID;
                inlineLookups[dataID]   = inlineEntry;

                foreach (DataLookup lookup in inlineEntry.Lookups.Where(arg => arg != null))
                {
                    if (lookup != null)
                    {
                        RemoveLookup(previousCachedInlineValue, lookup);
                        AddLookup(finalDataID, lookup);
                    }
                }
            }
        }

        //背包数据变更通知
        if (dataID == "inventory")
        {
            GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "Data_InventoryChanged", incomingValue);
        }
    }
示例#11
0
    /// <summary>
    /// 退出战斗
    /// </summary>
    public void ExitCombat()
    {
        if (CombatId < 0)
        {
            return;
        }

        GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "ExitCombat");
        CombatId             = -1;
        LocalPlayerTeamIndex = -1;
        Sides          = null;
        DefaultHudMode = eCombatHudMode.Normal;
    }
示例#12
0
    private void UpdateFPS()
    {
        _timeleft -= Time.deltaTime;
        _accum    += Time.timeScale / Time.deltaTime;
        ++_frames;
        if (_timeleft <= 0.0)
        {
            _fps      = _accum / _frames;
            _timeleft = UpdateInterval;
            _accum    = 0.0F;
            _frames   = 0;
        }

        if (!_lockThreshold)
        {
            if (_fps < fps_threshold)
            {
                _thresholdTime += Time.deltaTime;
                if (_thresholdTime > 5)
                {
                    _thresholdTime = 0;
                    _lockThreshold = true;//要弹出窗口调画质拉
                    if (QualitySettings.GetQualityLevel() != 2)
                    {
                        //ToDo:
                        //MessageTemplateManager.ShowMessage(eMessageUIType.MessageDialogue_2, EB.Localizer.GetString("ID_codefont_in_GameEngine_12427"), delegate (int r)
                        //{
                        //    if (r == 0)
                        //    {
                        //        GlobalUtils.SetGameQualityLevel(QualitySettings.GetQualityLevel() + 1);
                        //    }
                        //});
                        GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.MessageTemplateManager", "ShowMessageFromILR", "MessageDialogue_2", EB.Localizer.GetString("ID_codefont_in_GameEngine_12427"), true);
                    }
                }
            }
            else
            {
                _thresholdTime = 0;
            }
        }
        else
        {
            _thresholdTime += Time.deltaTime;
            if (_thresholdTime > 300)
            {
                _lockThreshold = false;
                _thresholdTime = 0;
            }
        }
    }
示例#13
0
 public void ShowTipCall(string tip)
 {
     EB.Debug.LogError("OnLoginTip: login tip = {0}", tip);
     if (tip.Equals("ID_SPARX_LOGIN_FAIL_MORE"))
     {
         ShowLoginFailDialog();
     }
     else
     {
         //ToDo:调热更
         //MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString(tip));
         GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.MessageTemplateManager", "ShowMessageFromILR", "FloatingText", EB.Localizer.GetString(tip), false);
     }
 }
示例#14
0
    void Update()
    {
        if (_showSplash)
        {
            SetLoadingText(_uiLabel);
        }

        if (waitforOther)
        {
            _outTimer -= Time.deltaTime;
            if (_outTimer >= 0)
            {
                GlobalUtils.SetText(UIBarLabel, string.Format(EB.Localizer.GetString("ID_COMBAT_WAITFOROTHER"), (int)_outTimer));
            }
            else
            {
                GlobalUtils.SetText(UIBarLabel, EB.Localizer.GetString("ID_LOADING"));
                if (CombatLogic.Instance.LocalPlayerIsObserver)
                {
                    GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "ExitWatchAsk");
                }
            }
            if (_outTimer <= -_waitOutTimer)
            {
                _outTimer = 0;
                EB.Debug.LogError("LoadingLogic.Update: loading timedout");
                SparxHub.Instance.Disconnect(true);
            }
        }
        else
        {
            if (!_showSplash && _outTimer > 0)
            {
                _outTimer -= Time.deltaTime;
                if (_outTimer <= 0)
                {
                    _outTimer = 0;
                    EB.Debug.LogError("LoadingLogic.Update: loading timedout");
                    SparxHub.Instance.Disconnect(true);
                    return;
                }
            }

            if (UseCustomProgress)
            {
                UpdateCustomProgress();
            }
        }
    }
示例#15
0
    //未读消息回调
    public void OnAIHelpMessageArrived(string str)
    {
        GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.LTGameSettingManager", "RefreshHwCsRedPoint");
        Debug.Log("OnMessageArrived is called str:" + str);
        var jnode = Johny.JSONNode.Parse(str);

        if (jnode != null && jnode.IsObject)
        {
            var data = jnode["data"]?["cs_message_count"];
            if (data != null && data.IsNumber)
            {
                AIHelp.AIHelpManager.IshaveUnreadMessage = (int)data > 0;
            }
        }
    }
示例#16
0
 public bool MoveToNextPos()
 {
     if (_movePosQue.Count > 0)
     {
         GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.AlliancesManager", "RecordTransferPointFromILRWithCallback", _movePosQue.Count - 1);
         SetMovementTarget(_movePosQue.Dequeue(), false, true, false, true);
         return(true);
     }
     else if (_onMoveEndActionByQue != null)
     {
         _onMoveEndActionByQue();
         _onMoveEndActionByQue = null;
     }
     return(false);
 }
示例#17
0
        private void BattleReady(string str)
        {
            string rstr = NodeMessageManager.Fail;

            // bool isReady = Hotfix_LT.Messenger.RaiseEx<bool>(Hotfix_LT.EventName.IsReady);
            bool isReady = (bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "IsReady");

            if (LTCombatEventReceiver.Instance != null)
            {
                if (LTCombatEventReceiver.Instance.Ready)
                {
                    rstr = NodeMessageManager.Sucess;
                }
            }
            if (isReady)
            {
                rstr = NodeMessageManager.Sucess;
            }
            DispatchConditionReceipt(NodeMessageManager.BattleReady, rstr);
        }
示例#18
0
    /// <summary>
    /// shortcut for UIStack.Open
    /// </summary>
    public void Open()
    {
        if (this.gameObject != null)
        {
            EB.Debug.LogUI("执行【<color=#00ff00>{0}</color>】预设UIController中<color=#42fe79>Open</color>方法", this.gameObject.name);
        }

        if (UIStack.Instance != null && UIStack.Instance.gameObject.activeSelf)
        {
            UIStack.Open(this);
            //ToDo:暂时屏蔽
            //if (GlobalMenuManager.Instance != null && gameObject != null)
            //{
            //    GlobalMenuManager.Instance.SetUIEnabled(MCurrentViewName, true);
            //}
            if (gameObject != null)
            {
                GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "SetUIEnabledFromILR", MCurrentViewName, true);
            }
        }
    }
示例#19
0
    public IEnumerator BaseOnAddToStack()
    {
        if ((IsHudUI || IsFullscreen()) && !gameObject.activeSelf)
        {
            gameObject.CustomSetActive(true);
        }
        Show(true);

        if (GetComponent <BoxCollider>() != null && !GetComponent <BoxCollider>().enabled)
        {
            GetComponent <BoxCollider>().enabled = true;
        }

        if (ShowUIBlocker)
        {
            mBlocker  = UIStack.Instance.GetPanelBlocker(this);
            mCollider = mBlocker.GetComponentInChildren <BoxCollider>();
            mTrigger  = mCollider.GetComponent <ConsecutiveClickCoolTrigger>();
            if (mTrigger == null)
            {
                mTrigger = mCollider.gameObject.AddComponent <ConsecutiveClickCoolTrigger>();
            }
            mTrigger.clickEvent.Clear();
            mTrigger.clickEvent.Add(new EventDelegate(OnCancelButtonClick));

            Transform bg       = mBlocker.transform.Find("Background");
            UISprite  bgSprite = bg.GetComponent <UISprite>();
            bgSprite.enabled = true;
        }
        //ToDo:暂时屏蔽
        //if (GlobalMenuManager.Instance != null)
        //{
        //    GlobalMenuManager.Instance.AddOpenController(this);
        //}
        GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "AddOpenControllerFromILR", this);

        yield break;
    }
示例#20
0
    /// <summary>
    /// shortcut for UIStack.Close
    /// </summary>
    public void Close()
    {
        if (this.gameObject != null)
        {
            EB.Debug.LogUI("执行【<color=#00ff00>{0}</color>】预设UIController中<color=#ff0000>Close</color>方法", this.gameObject.name);
        }

        if (UIStack.Instance != null && UIStack.Instance.gameObject.activeSelf)
        {
            UIStack.Close(this);
            //ToDo:暂时屏蔽
            //if (GlobalMenuManager.Instance != null && gameObject != null)
            //{
            //    GlobalMenuManager.Instance.SetUIEnabled(MCurrentViewName, false);
            //}
            if (gameObject != null)
            {
                GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "SetUIEnabledFromILR", MCurrentViewName, false);
            }
        }
        IsFirstLoad    = false;
        HasPlayedTween = false;
    }
示例#21
0
    public void Update()
    {
        if (Application.isPlaying)
        {
            if (GameEngine.Instance && !GameEngine.Instance.IsTimeToRootScene)
            {
                return;
            }

            //如果是副本中则不能进入rvo
            //ToDo:暂时屏蔽,方便解耦
            //if (GameEngine.Instance && LTInstanceMapModel.Instance != null && LTInstanceMapModel.Instance.IsInstanceMap())
            //{
            //    return;
            //}
            if (GameEngine.Instance && (bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.LTInstanceMapModel", "IsInstanceMapFromILR"))
            {
                return;
            }

            InternalUpdate(Time.deltaTime);
        }
    }
示例#22
0
    /// <summary>
    /// 加载好场景资源配置信息
    /// </summary>
    /// <param name="level_name">场景名称</param>
    /// <param name="level_description">场景资源描述json</param>
    void LoadedSceneDescription(string level_name, string level_description)
    {
        if (EB.Util.IsJson(level_description))
        {
            m_LevelAssets = GM.JSON.ToObject <PlacedAsset[]>(level_description);

            if (m_LevelAssets != null && m_LevelAssets.Length > 0)
            {
                //实体化场景对象
                m_SceneRoot = new GameObject(level_name);
                // parallel load
                for (int i = 0; i < m_LevelAssets.Length; ++i)
                {
                    EB.Debug.LogLoadLevel("<color=#000000>开始</color>逐个_加载场景需要的指定资源StartLoad:{0} ,realtimeSinceStartup={1}, time = {2},Length={3},index={4}", m_LevelAssets[i].name, Time.realtimeSinceStartup, Time.time, m_LevelAssets.Length, i);
                    EB.Assets.LoadAsyncAndInit <GameObject>(m_LevelAssets[i].name, ParallelDownloadResult, GameEngine.Instance.gameObject);
                }

                if (level_name != "MainLandView" && level_name != "CombatView")
                {
                    GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.SceneLogic", "PreLoadMainHero");
                }
            }
            else
            {
                EB.Debug.Log(level_description);
                EB.Debug.LogError("加载场景发生错误_Level {0} has no data definition in its Json file!", level_name);
                HandleFaild();
            }
        }
        else
        {
            EB.Debug.Log(level_description);
            EB.Debug.LogError("加载场景发生错误_Level {0}'s Json file is invalid!", level_name);

            HandleFaild();
        }
    }
示例#23
0
    /// <summary>
    /// Start后执行的协程,用于播放Tween动画
    /// </summary>
    /// <returns></returns>
    public void PlayTween()
    {
        if (IsFullscreen())
        {
            transform.localPosition = mInitUIPos;

            //打开界面时重新刷新锚点
            //ToDo:暂时屏蔽
            //bool isContain = (GlobalMenuManager.Instance != null && GlobalMenuManager.Instance.IsCouldFindController(this));
            bool isContain = (bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.GlobalMenuManager", "IsCouldFindControllerFromILR", this);

            if (isContain)
            {
                var uIWidgets = transform.GetComponentsInChildren <UIWidget>();
                for (int i = 0; i < uIWidgets.Length; i++)
                {
                    uIWidgets[i].UpdateAnchors();
                }
            }
        }
        //EB.Debug.LogUI("执行【<color=#00ff00>{0}</color>】预设UIController中<color=#42fe79>StartAfterCoroutine</color>协程", this.gameObject.name);
        HasPlayedTween = true;
        //设为true是为了解决反复点击同一触发区出现的界面不弹出问题
        gameObject.SetActive(true);
        // 点级特效要关闭
        ClickFxPoolManager.Instance.StopAll();

        int waitFrame = IsFirstLoad ? WaitFrameForBoot.x : WaitFrameForBoot.y;

        if (IsFirstLoad)
        {
            PauseBootFlash();
        }
        TimerManager.instance.AddFramer(waitFrame, 1, delegate { StartBootFlash(); });
        LTTools.SwitchToPlayerCamera(IsFullscreen());
    }
示例#24
0
        /** Update the simulation */
        void Update()
        {
            if (!GameEngine.Instance.IsTimeToRootScene)
            {
                return;
            }
            //����Ǹ��������ܽ���rvo
            //ToDo:��ʱ���Σ��������
            //if (LTInstanceMapModel.Instance.IsInstanceMap())
            //{
            //    return;
            //}
            if ((bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.LTInstanceMapModel", "IsInstanceMapFromILR"))
            {
                return;
            }

            if (desiredSimulationFPS < 1)
            {
                desiredSimulationFPS = 1;
            }

            Pathfinding.RVO.Sampled.Agent.DesiredVelocityWeight   = desiredVelocityWeight;
            Pathfinding.RVO.Sampled.Agent.GlobalIncompressibility = incompressibility;

            var sim = GetSimulator();

            sim.DesiredDeltaTime = 1.0f / desiredSimulationFPS;
            sim.Interpolation    = interpolation;
            sim.stepScale        = stepScale;
            sim.qualityCutoff    = qualityCutoff;
            sim.algorithm        = algorithm;
            sim.Oversampling     = oversampling;
            sim.WallThickness    = wallThickness;
            sim.Update();
        }
示例#25
0
    void OnApplicationFocus(bool focusStatus)
    {
        // first called after Awake
        //EB.Debug.Log("GameEngine.OnApplicationFocus: status = {0}", focusStatus);

        GameStateManager.Instance.OnFocus(focusStatus);
        if (GameStateManager.Instance.State >= eGameState.Login)
        {
            SparxHub.Instance.OnFocus(focusStatus);
        }
        bool isSceneLoop = false;

        if (HotfixILRManager.GetInstance().IsInit)
        {
            isSceneLoop = (bool)GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.SceneLogic", "isSceneLoop");
        }
        if (isSceneLoop /*isSceneLoop*//*SceneLogic.SceneState == SceneLogic.eSceneState.SceneLoop*/)
        {
            if (PerformanceManager.Instance.CurrentEnvironmentInfo.slowDevice)
            {
                //setDesignContentScale(1334,750);
            }
        }
    }
示例#26
0
    void OnSwipe(Vector2 deltaPos, bool isResetDefault = false)
    {
        _isRotate = true;
        _rotationTarget.Rotate(Vector3.down * -deltaPos.x * CameraRotationalSpeed, Space.World);
        if (IsLimitY)
        {
            float y = _rotationTarget.transform.localEulerAngles.y;
            if (deltaPos.x > 0)//左边
            {
                if (!IsYVaild(y))
                {
                    if (_rotationTarget.transform.localEulerAngles.y > maxY)
                    {
                        _rotationTarget.transform.localEulerAngles = new Vector3(_rotationTarget.transform.localEulerAngles.x, maxY, _rotationTarget.transform.localEulerAngles.z);
                    }
                }
            }
            else if (deltaPos.x < 0)//右边
            {
                if (!IsYVaild(y))
                {
                    if (_rotationTarget.transform.localEulerAngles.y < minY)
                    {
                        _rotationTarget.transform.localEulerAngles = new Vector3(_rotationTarget.transform.localEulerAngles.x, minY, _rotationTarget.transform.localEulerAngles.z);
                    }
                }
            }
        }

        RenderSettings rs = (RenderSettings)RenderSettingsManager.Instance.GetCurrentRenderSettings();

        rs.GlobalLightRotation += Vector3.down * -deltaPos.x;

        float angleX = CheckAngle(_rotationTarget.localEulerAngles.x);

        if ((deltaPos.y < 0 && angleX < maxX) || (deltaPos.y > 0 && angleX > minX))
        {
            float y = deltaPos.y * 0.25f;
            if (deltaPos.y < 0)
            {
                if (angleX - y > maxX)
                {
                    y = angleX - maxX;
                }
            }
            else
            {
                if (angleX - y < minX)
                {
                    y = angleX - minX;
                }
            }

            _rotationTarget.Rotate(Vector3.right * -y, Space.Self);
            rs.GlobalLightRotation += Vector3.right * -y;
        }

        if (deltaPos.x != 0f || deltaPos.y != 0f)
        {
            if (!isResetDefault)
            {
                isLerpDefaultCameraView = false;
                // Hotfix_LT.Messenger.Raise<bool>(Hotfix_LT.EventName.DisplayCameraViewButton, true);
                GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "DisplayCameraViewButton", true);
            }
        }
    }
示例#27
0
    // Update is called once per frame
    void Update()
    {
        if (!initialized || followCamera == null)
        {
            return;
        }

        if (isActive)
        {
            if (_rotationTarget == null)
            {
                _rotationTarget          = new GameObject("RotationTarget").transform;
                _rotationTarget.rotation = transform.rotation;
            }

            if (cc != null && cc.State != CombatCamera.MotionState.Freedom)
            {
                cc.State = CombatCamera.MotionState.Freedom;
            }
            followCamera.transform.LookAt(this.transform);
            if (followCamera.transform.localEulerAngles != Vector3.zero)
            {
                followCamera.transform.SetParent(null);
                Transform buffParent = transform.parent;
                transform.SetParent(followCamera.transform);
                transform.localEulerAngles = Vector3.zero;
                transform.SetParent(buffParent);
                followCamera.transform.SetParent(this.transform);
            }

            if (isLerpDefaultCameraView)
            {
                if (cc != null)
                {
                    //if(preLerpDir == Vector3.zero|| (Vector3.Dot(lerpDir, preLerpDir)) > 0)
                    float distanceWithTarget = Vector3.Magnitude(cc.OriginalPosition - cc.transform.position);
                    if (distanceWithTarget > lerpThisThreshold)
                    {
                        Vector2 lerpDir    = (cc.transform.position - cc.OriginalPosition).normalized;
                        Vector2 deltaValue = lerpDir * lerpDefaultViewSpeed * Time.deltaTime;
                        //if (Vector3.Magnitude(deltaValue) < distanceWithTarget)
                        OnSwipe(deltaValue, true);
                    }
                    else
                    {
                        EB.Debug.Log("lerpDefaultCameraView over");
                        isLerpDefaultCameraView = false;
                        ResetToDefaultView();
                        // Hotfix_LT.Messenger.Raise<bool>(Hotfix_LT.EventName.DisplayCameraViewButton, false);
                        GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "DisplayCameraViewButton", false);
                    }
                }
            }

#if UNITY_EDITOR
            if (Input.GetMouseButtonDown(0))
            {
                _isTouchCharacter = false;
                _isTouchInView    = false;
                touchTime         = Time.unscaledTime;
                _mousePosition    = Input.mousePosition;
                _isTouchDown      = true;
            }
            else if (Input.GetMouseButton(0))
            {
                if (!_isTouchDown) //鼠标移出去的情况
                {
                    _mousePosition = Input.mousePosition;
                    _isTouchDown   = true;
                    touchTime      = Time.unscaledTime;
                }
                else
                {
                    Vector3 delta = Input.mousePosition - _mousePosition;
                    Vector2 v     = new Vector2(delta.x, delta.y);
                    if (!isOpenTouchView || (!_isTouchCharacter && !_isTouchInView)) //不点到角色且不触碰界面才旋转摄像机
                    {
                        OnSwipe(v);
                    }
                }
            }
            else if (Input.GetMouseButtonUp(0))
            {
                _isTouchDown      = false;
                _isTouchCharacter = false;
                _isTouchInView    = false;
                touchTime         = Time.unscaledTime;
            }

            _mousePosition = Input.mousePosition;
#else
            if (Input.touchCount == 1)                                               //单点触碰移动摄像机
            {
                if (Input.touches[0].phase == TouchPhase.Moved)                      //手指在屏幕上移动,移动摄像机
                {
                    if (!isOpenTouchView || (!_isTouchCharacter && !_isTouchInView)) //不点到角色且不触碰界面才旋转摄像机
                    {
                        OnSwipe(Input.touches[0].deltaPosition * 0.5f);              // * 0.5f 减慢触控旋转的灵敏度
                    }
                    //transform.Translate(new Vector3(Input.touches[0].deltaPosition.x * Time.fixedDeltaTime, Input.touches[0].deltaPosition.y * Time.fixedDeltaTime, 0));
                }
                else if (Input.touches[0].phase == TouchPhase.Began)
                {
                    _isTouchCharacter = false;
                    _isTouchInView    = false;
                    touchTime         = Time.unscaledTime;
                }
                else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
                {
                    _isTouchInView    = false;
                    _isTouchCharacter = false;
                    touchTime         = Time.unscaledTime;
                }
            }
#endif
            if (_isRotate)
            {
                if (Quaternion.Angle(transform.rotation, _rotationTarget.rotation) > 0.5f)
                {
                    transform.rotation = Quaternion.Lerp(transform.rotation, _rotationTarget.rotation, 1.0f);
                }
                else
                {
                    _isRotate          = false;
                    transform.rotation = _rotationTarget.rotation;
                }
            }
        }
        else
        {
            isLerpDefaultCameraView = false;
        }
        //transform.position = target.position + followOffset;//Vector3.Lerp(transform.position, target.position + followOffset, 0.05f);
    }
示例#28
0
 public override void OnOfferPurchaseCanceled()
 {
     base.OnOfferPurchaseCanceled();
     // Hotfix_LT.Messenger.Raise(Hotfix_LT.EventName.OnOfferPurchaseCanceled);
     GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "Wallet_OnOfferPurchaseCanceled");
 }
示例#29
0
 public override void OnOfferPurchaseNoResult(System.Action callback)
 {
     base.OnOfferPurchaseNoResult(callback);
     // Hotfix_LT.Messenger.Raise(Hotfix_LT.EventName.OnOfferPurchaseNoResult, callback);
     GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "Wallet_OnOfferPurchaseNoResult", callback);
 }
示例#30
0
 public override void OnOfferPurchaseRedeemer(object result)
 {
     base.OnOfferPurchaseRedeemer(result);
     // Hotfix_LT.Messenger.Raise(Hotfix_LT.EventName.OnOfferPurchaseRedeemer, result);
     GlobalUtils.CallStaticHotfix("Hotfix_LT.MessengerAdapter", "Wallet_OnOfferPurchaseRedeemer", result);
 }