| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231 | using System;using System.Collections.Generic;using Core.Language;using Excel2Json;using Fort23.Core;using Fort23.Mono.Phases;using Fort23.UTool;using GameLogic.Bag;using UnityEngine;using UnityEngine.Events;using UnityEngine.UI;using Utility;using Utility.CTween;namespace Fort23.Mono{    public class PlayerGuideManager : Singleton<PlayerGuideManager>    {        public bool isSkip = false;        public bool isUnLockAll = false;        /// <summary>        /// 调试模式.        /// </summary>        public bool isDebugging;        public List<int> debugPhase = new List<int>();        public UnityAction overCallBack;        /// <summary>        /// 是否完成强制引导        /// </summary>        public bool isForceDone = true;        /// <summary>        /// 是否完成非强制引导        /// </summary>        public bool isTriggerDone = true;        /// <summary>        /// 手指        /// </summary>        public Transform finger;        /// <summary>        /// 黑底Obj        /// </summary>        public GameObject blackBaseObj;        /// <summary>        /// 新手引导表        /// </summary>        public PlayerGuideConfig guideConfig;        /// <summary>        /// 光圈(方)        /// </summary>        public Transform fxTrans01;        /// <summary>        /// 光圈(圆)        /// </summary>        public Transform fxTrans02;        /// <summary>        /// 高亮区域        /// </summary>        // public GameObject fxHighLightObj;        public Image highLightSpr;        /// <summary>        /// 保存 被改变父级的引用        /// </summary>        private Transform myMother;        /// <summary>        /// 被改变的目标        /// </summary>        private GameObject target;        /// <summary>        /// 引导目标上一次的坐标        /// </summary>        private Vector3 lastPos;        /// <summary>        /// 当前引导id         /// </summary>        public int curPhase = -1;        /// <summary>        /// 当前步骤        /// </summary>        public int curStep;        // private bool mIsNew = false;        //        // public bool IsNewUser        // {        //     get { return mIsNew; }        //     set { mIsNew = value; }        // }        public DialogBox dialogBox = new DialogBox();        public IGuideLogic guideLogic;        /// <summary>        /// 简化配置用.        /// </summary>        public bool isReadFingerPos;        public bool isInitGuide = false;        public GameRuntimeConfig GameRuntimeConfig;        public Map<int, int> ALLGuideStepData = new Map<int, int>();        public PlayerGuideManager()        {            InitGuide();        }        /// <summary>        /// 引导重置        /// </summary>        /// <param name="id"></param>        public void GuideReset(int id)        {            if (AccountFileInfo.Instance.playerData.phaseKey.Contains(id))            {                int maxCount = 0;                if (ALLGuideStepData.ContainsKey(id))                {                    maxCount = ALLGuideStepData[id];                }                var idx = AccountFileInfo.Instance.playerData.phaseKey.IndexOf(id);                if (AccountFileInfo.Instance.playerData.phaseValue[idx] < maxCount)                {                    AccountFileInfo.Instance.playerData.phaseValue[idx] = -1;                }            }        }        /// <summary>        /// 新手引导是否能做 步数从0开始 需要看对应逻辑所在的索引        /// </summary>        /// <param name="groupID"></param>        /// <returns></returns>        public bool GuideIsCanDo(int groupID, int curstep = 0)        {            // if (!(groupID == 9 || groupID == 910 || groupID == 320))            // {            //     return false;            // }            // if (groupID != 330)            // {            //     return false;            // }            // if (GuideIsCanDo(5))            // {            //     return false;            // }            if (curstep > 1 && guideLogic == null)            {                return false;            }            if (AccountFileInfo.Instance.playerData == null) //todo 容错测试场景没有玩家数据            {                LogTool.Log("AccountFileInfo.Instance.playerSetting = " + AccountFileInfo.Instance.playerData);                return false;            }            if (isSkip)            {                return false;            }            if (isDebugging)            {                if (!debugPhase.Contains(groupID) !)                {                    return false;                }            }            if (guideLogic != null)            {                if (guideLogic.guideID != groupID)                {                    return false;                }            }            //            // if (!isDebugging) //如果不是指定调试就要判断是否能触发            // {            //     if (groupID >= 0)             //     {            //         int configId = (groupID + 1) * 100 + 1;            //         PlayerGuideConfig playerGuideConfig = ConfigComponent.Instance.Get<PlayerGuideConfig>(configId);            //            //         if (playerGuideConfig.NeedLevel > PlayerManager.Instance.Level)            //         {            //             return false;            //         }            //     }            // }            int maxCount = 0;            if (ALLGuideStepData.ContainsKey(groupID))            {                maxCount = ALLGuideStepData[groupID];            }            int step = GetPhaseStep(groupID);            if (curstep != -1) //判断这个新手引导这一步能否做            {                if (curstep <= step)                {                    return false;                }                if (curstep - step > 1) //只能比当前步数多1才可以执行                {                    return false;                }            }            if (step >= maxCount)            {                return false;            }            return true;        }        public TimerEntity _timerEntity;        public void ChangeBtnSkip()        {            GuidePanel guidePanel = UIManager.Instance.GetComponent<GuidePanel>();            if (guidePanel != null)                guidePanel.Btn_Skip.gameObject.SetActive(false);            _timerEntity?.Dispose();            _timerEntity = null;            _timerEntity = TimerComponent.Instance.AddTimer(10000, () =>            {                if (UIManager.Instance.GetComponent<GuidePanel>() != null)                    UIManager.Instance.GetComponent<GuidePanel>().Btn_Skip.gameObject.SetActive(true);            });        }        /// <summary>        /// 引导初始化        /// </summary>        public void InitGuide()        {            foreach (var playerGuideConfig in ConfigComponent.Instance.GetAll<PlayerGuideConfig>())            {                if (!ALLGuideStepData.ContainsKey(playerGuideConfig.groupID))                {                    ALLGuideStepData.Add(playerGuideConfig.groupID, 1);                }                else                {                    ALLGuideStepData[playerGuideConfig.groupID] += 1;                }            }            //            // EventManager.Instance.AddEventListener(CustomEventType.NextGuide, RunNextGuide);            GameRuntimeConfig = Resources.Load<GameRuntimeConfig>("GameRuntimeConfig");            LogTool.Log("InitGuide************************");            if (isInitGuide)            {                LogTool.Log("已初始化");                return;            }            isSkip = GameRuntimeConfig.isSkip;            isDebugging = GameRuntimeConfig.isDebug;            isUnLockAll = GameRuntimeConfig.isUnlockAll;#if UNITY_IPHONE || UNITY_ANDROID&&!UNITY_EDITOR            IsUseServerData = true;#endif            //#if !UNITY_EDITOR            isSkip = false;            isDebugging = false;            isUnLockAll = false;            IsUseServerData = true;#endif            List<int> ids = new List<int>();            if (GameRuntimeConfig.debugPhase.x != 0)            {                ids.Add((int)GameRuntimeConfig.debugPhase.x);            }            if (GameRuntimeConfig.debugPhase.y != 0)            {                ids.Add((int)GameRuntimeConfig.debugPhase.y);            }            if (GameRuntimeConfig.debugPhase.z != 0)            {                ids.Add((int)GameRuntimeConfig.debugPhase.z);            }            if (GameRuntimeConfig.debugPhase.w != 0)            {                ids.Add((int)GameRuntimeConfig.debugPhase.w);            }            debugPhase = ids;            if (isDebugging)            {                for (var i = 0; i < debugPhase.Count; i++)                {                    if (AccountFileInfo.Instance.playerData.phaseKey.Contains((int)debugPhase[i]))                    {                        var idx = AccountFileInfo.Instance.playerData.phaseKey.IndexOf(debugPhase[i]);                        AccountFileInfo.Instance.playerData.phaseValue[idx] = -1;                    }                }            }            if (isSkip || isDebugging)            {                isInitGuide = true;                isForceDone = true;                return;            }            isForceDone = AccountFileInfo.Instance.playerData.isForceDone;            // curPhase = AccountFileInfo.Instance.playerData.curPhase;            // curStep = AccountFileInfo.Instance.playerData.curStep;            //完成强制引导            if (isForceDone)            {                isInitGuide = true;                return;            }            //新用户,从未做过新手引导            if (PlayerManager.Instance.curGuideGroupId == 0 && curPhase <= 0)            {                curPhase = 0;            }            // //没有引导记录,但有游戏记录(不是第一次玩)            // else if (PlayerManager.Instance.currStageId > 1 && curPhase <= 0)            // {            //     LogTool.Warning("玩家更换了设备,或者本地引导记录被删除,跳过所有强制引导:" + PlayerManager.Instance.PlayerId);            //     isForceDone = true;            //     isInitGuide = true;            //     AccountFileInfo.Instance.playerSetting.isForceDone = true;            //     AccountFileInfo.Instance.Save();            //     return;            // }            // else if (PlayerManager.Instance.currStageId > 10)            // {            //     LogTool.Warning("超过10关了,强制引导已经完成:" + PlayerManager.Instance.PlayerId);            //     isForceDone = true;            //     isInitGuide = true;            //     AccountFileInfo.Instance.playerSetting.isForceDone = true;            //     AccountFileInfo.Instance.Save();            //     return;            // }            // else            // {            //                // }            isInitGuide = true;        }        private int GetPhaseStep(int key)        {            if (AccountFileInfo.Instance.playerData.phaseKey.Contains(key))            {                int idx = AccountFileInfo.Instance.playerData.phaseKey.IndexOf(key);                return AccountFileInfo.Instance.playerData.phaseValue[idx];            }            else            {                return -1;            }        }        /// <summary>        /// 将目标加到新手引导的Panel里面.        /// </summary>        /// <param name="target"></param>        public void JoinMe(GameObject target)        {            finger.gameObject.SetActive(false);            if (target == null)            {                LogTool.Log("______" + "找不到目标");                return;            }            Transform transform = UIManager.Instance.GetComponent<GuidePanel>().transform;            if (target.transform.parent.Equals(transform))            {                LogTool.Log("______" + "重复改变目标的父节点,自动忽略,可能是断网重连造成的,请检查");                return;            }            this.lastPos = target.transform.localPosition;            myMother = target.transform.parent;            this.target = target;            target.transform.parent = transform;            target.transform.localScale = Vector3.one;            fxTrans01.gameObject.SetActive(true);            fxTrans01.position = target.transform.position;        }        /// <summary>        /// 还原对象        /// </summary>        public void ReductionTargetObject()        {            target.transform.parent = myMother;            target.transform.localPosition = lastPos;        }        public void JoinMe(GameObject target, Vector3 vector3)        {            if (target == null)            {                LogTool.Log("______" + "找不到目标");                return;            }            Transform transform = UIManager.Instance.GetComponent<GuidePanel>().transform;            if (target.transform.parent.Equals(transform))            {                LogTool.Log("______" + "重复改变目标的父节点,自动忽略,可能是断网重连造成的,请检查");                return;            }            this.lastPos = target.transform.localPosition;            myMother = target.transform.parent;            this.target = target;            target.transform.parent = transform;            target.transform.localScale = Vector3.one;            fxTrans01.gameObject.SetActive(true);            fxTrans01.parent = target.transform;            fxTrans01.localPosition = vector3;            fxTrans01.parent = transform;            finger.gameObject.SetActive(false);        }        public void RestGuide()        {            curPhase = 0;            curStep = 0;        }        /// <summary>        /// 设置新手引导        /// </summary>        /// <param name="phase"></param>        public async CTask SetGuid(int phase)        {            if (isDebugging)            {                if (!debugPhase.Contains(phase))                {                    return;                }            }            if (isSkip)            {                return;            }            if (guideLogic != null)            {                return;            }            UIManager.Instance.SetEventSystemEnable(false);            curPhase = phase;            guideLogic = null;            guideLogic = GetIGuideLogic(curPhase);            GuidePanel guildPanel =                await UIManager.Instance.LoadAndOpenPanel<GuidePanel>(null, UILayer.Top, isFocus: false);            dialogBox.Init();            UIManager.Instance.SetEventSystemEnable(true);            finger = guildPanel.GuideHand;            fxTrans01 = guildPanel.FocusFrame01;            fxTrans02 = guildPanel.FocusFrame02;            blackBaseObj = guildPanel.Btn_Bg.gameObject;            guideLogic.SavePhase(curPhase);            guideLogic.ClearList();            guideLogic.Active();            guideLogic.Begin();            NextGuideEx();        }        public IGuideLogic GetIGuideLogic(int groupId)        {            string typeName = " Fort23.Mono.Phases.Phase" + groupId;            IGuideLogic guideLogic = null;            System.Type type = System.Type.GetType(typeName);            if (type == null)            {                LogTool.Error("没有找到Phase" + groupId + "脚本");                return null;            }            object[] constructorArgs = new object[] { this };            guideLogic = (IGuideLogic)Activator.CreateInstance(type, constructorArgs);            // switch (groupId)            // {            //     case 1:            //         guideLogic = new Phase1(this);            //         break;            //     case 2:            //         guideLogic = new Phase2(this);            //         break;            //     case 3:            //         guideLogic = new Phase3(this);            //         break;            // }            return guideLogic;        }        /// <summary>        /// 关闭引导,重置到初始状态.        /// </summary>        public void ResetPlayerGuide()        {            Transform transform = UIManager.Instance.GetComponent<GuidePanel>().transform;            finger.transform.parent = transform;            finger.transform.localScale = new Vector3(1, 1, 1);            SetFingerVisiable(false);        }        public void SetFingerVisiable(bool b, string playName = "Loop")        {            finger.gameObject.SetActive(b);            GuidePanel guidePanel = UIManager.Instance.GetComponent<GuidePanel>();            switch (guideConfig.FingerType)            {                case 1:                    guidePanel.GuideHandState.ChangeState(0);                    break;                case 2:                    guidePanel.GuideHandState.ChangeState(1);                    break;                case 3:                    guidePanel.GuideHandState.ChangeState(2);                    break;                case 4:                    playName = "changan";                    guidePanel.GuideHandState.ChangeState(1);                    break;                case -1:                    finger.gameObject.SetActive(false);                    break;            }            SetFingerAnimation(playName);        }        public void SetFingerSize(Vector3 size)        {            finger.localScale = size;        }        public void SetfxTransVisiable(bool b, int type = 0)        {            switch (type)            {                case 0:                    fxTrans01.gameObject.SetActive(b);                    break;                case 1:                    fxTrans02.gameObject.SetActive(b);                    break;            }        }        public void SetfxTransImageVisiable(bool b, int type = 0)        {            switch (type)            {                case 0:                    fxTrans01.gameObject.GetComponent<MyImage>().enabled = b;                    break;                case 1:                    fxTrans02.gameObject.GetComponent<MyImage>().enabled = b;                    break;            }        }        public void SetBlackBaseVisiable(bool b)        {            blackBaseObj.gameObject.SetActive(b);        }        public void SetBlackA(byte b)        {            Color c = new Color32(0, 0, 0, b);            blackBaseObj.gameObject.GetComponent<Image>().color = c;        }        public void FinishATriggerGuide()        {            SetBlackBaseVisiable(false);            if (guideLogic != null)            {                guideLogic = null;            }        }        public bool IsStepSkip = false;        public async CTask ConfigLogic(int configID, System.Action action, int diTyp = 1, string str = null)        {            IsStepSkip = false;            guideConfig = ConfigComponent.Instance.Get<PlayerGuideConfig>(configID);            if (guideConfig.AwardItem != null)            {                for (var i = 0; i < guideConfig.AwardItem.Length; i++)                {                    PlayerManager.Instance.BagController.AddItem(new ItemInfo(guideConfig.AwardItem[i],                        guideConfig.AwardItemNum[i]));                }            }            if (guideConfig.desc == -1)            {                HideDialogBox();            }            else            {                HideDialogBox(false);            }            if (guideConfig.IsSkip == 1)            {                IsStepSkip = true;                NextGuide();                return;            }            if (guideConfig.Highlighting == 0)            {                SetfxTransImageVisiable(false);            }            else            {                SetfxTransImageVisiable(true);            }            int[] fPos = guideConfig.fingerPos;            int[] dPos = guideConfig.dialogPos;            isReadFingerPos = true;            SetFingerVisiable(false);            SetFingerPos(fPos);            SetDialogPos(dPos);            SetBlackBaseVisiable(true);            SetBlackAlpha(guideConfig.blackAlpha);            ShowDialogBox(action, str);            await dialogBox.SetDiTex(guideConfig, guideConfig.SpeakerImage);            UIManager.Instance.SetEventSystemEnable(true);        }        /// <summary>        /// 下一步引导        /// </summary>        public async void NextGuide()        {            if (BreakGuide(guideLogic))            {                return;            }            try            {                //容错:                await guideLogic.Guide();            }            catch (System.Exception e)            {                LogTool.Error("打印异常信息:" + e);                ResetPlayerGuide();                CloseForceGuide();                LogTool.Error("引导出错,出错步骤,Phase=" + curPhase + "-" + curStep);            }            EventManager.Instance.Dispatch(CustomEventType.NextGuide, null);        }        public CTask CanDoNextCTask;        public async void RunNextGuide(IEventData eventData)        {            if (CanDoNextCTask != null)            {                await CanDoNextCTask;                NextGuideEx();            }            else            {                NextGuideEx();            }            CanDoNextCTask = null;        }        public void NextGuideEx()        {            if (BreakGuide(guideLogic))            {                return;            }            try            {                //容错:                guideLogic.Guide();            }            catch (System.Exception e)            {                LogTool.Error("打印异常信息:" + e);                ResetPlayerGuide();                CloseForceGuide();                LogTool.Error("引导出错,出错步骤,Phase=" + curPhase + "-" + curStep);            }            ChangeBtnSkip();        }        private bool BreakGuide(IGuideLogic guideLogic)        {            //#if UNITY_EDITOR            if (isSkip)            {                this.guideLogic = null;                return true;            }            //#endif            if (guideLogic == null)            {                return true;            }            if (guideLogic.isSkipGuide)            {                LogTool.Log("引导开启条件不符合,不再执行");                this.guideLogic = null;                return true;            }            //强制和非强制引导都完成            if (isForceDone && isTriggerDone)            {                LogTool.Log("引导完成");                this.guideLogic = null;                return true;            }            return false;        }        public void SkipGuide()        {        }        /// <summary>        /// 关闭强制引导        /// </summary>        public void CloseForceGuide()        {            HideDialogBox();            isForceDone = true;            SetBlackBaseVisiable(false);            if (guideLogic != null)            {                guideLogic = null;            }            overCallBack?.Invoke();            overCallBack = null;            UIManager.Instance.HideUIUIPanel<GuidePanel>(UIDestroyType.ImmediatelyDestroy);        }        public void SetBlackAlpha(float f)        {            if (f == 0)            {                f = 0.05f;            }            Color color = blackBaseObj.GetComponent<Image>().color;            color.a = f;            blackBaseObj.GetComponent<Image>().color = color;        }        public BetterList<string> dialogList = new BetterList<string>();        public void HideDialogBox(bool isHide = true)        {            GuidePanel guidePanel = UIManager.Instance.GetComponent<GuidePanel>();            if (guidePanel != null)            {                guidePanel.DialogBoxState.gameObject.SetActive(!isHide);                // if (isHide)                // {                //     guidePanel.DialogBoxState.gameObject.SetActive(false);                // }            }        }        /// <summary>        /// 显示对话框        /// </summary>        public void ShowDialogBox(System.Action action = null, string key = null)        {            if (guideConfig.desc == -1)            {                action?.Invoke();                action = null;                return;            }            GuidePanel guidePanel = UIManager.Instance.GetComponent<GuidePanel>();            switch (guideConfig.SpeakerStyle)            {                case 1:                    guidePanel.DialogBoxState.ChangeState(0);                    break;                case 2:                    guidePanel.DialogBoxState.ChangeState(1);                    break;                case 3:                    guidePanel.DialogBoxState.ChangeState(2);                    break;                case 4:                    guidePanel.DialogBoxState.ChangeState(3);                    break;            }            dialogBox.ChangeState(guideConfig.SpeakerStyle);            if (guideConfig.SpeakerStyle != 3)            {                SetDialogPos(guideConfig.dialogPos);            }            string str = null;            if (key == null)            {                str = LanguageManager.Instance.Text(guideConfig.desc);            }            else            {                str = string.Format(LanguageManager.Instance.Text(guideConfig.desc), key);            }            string[] textArr = str.Split(';');            dialogList.Clear();            foreach (string tex in textArr)            {                dialogList.Add(tex);            }            dialogBox.Open(dialogList, action);        }        private void SetDialogPos(int[] dPos)        {            if (dPos != null)            {                Vector3 pos = new Vector3(dPos[0], dPos[1], 0);                float ratio = Screen.width / 750f;                pos.x *= ratio;                dialogBox.MessageBG.localPosition = pos;            }            else            {                dialogBox.MessageBG.localPosition = new Vector3(-125, -100, 0);            }        }        private void SetNpcPos(int[] nPos)        {            if (nPos != null)            {                Vector3 pos = new Vector3(nPos[0], nPos[1], 0);                // dialogBox.UISpiritLoader.transform.localPosition = pos;            }            else            {                // dialogBox.UISpiritLoader.transform.localPosition = new Vector3(422, -100, 0);            }        }        public void SetFingerPos(Vector3 pos, GameObject gameObject = null)        {            if (gameObject != null)            {                finger.GetComponent<RectTransform>().pivot = gameObject.GetComponent<RectTransform>().pivot;            }            else            {                finger.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);            }            finger.transform.localPosition = pos;        }        private CustomVectorTween _customVectorTween;        public void SetFingerTweenMove(Vector3 starPos, Vector3 endPos, float time)        {            // SetFingerAnimation("Loop");            _customVectorTween?.Kill();            _customVectorTween = null;            _customVectorTween = CustomTweenManager                .To(() => starPos, x => SetFingerPos(x), endPos, time, finger.gameObject)                .SetEase(CustomTweenEX.CustomAnimationCurve.Line).SetLoop(true);        }        public void SetFingerAnimation(string playerName)        {            // SetFingerAnimation("Loop");            finger.GetComponent<Animator>().Play(playerName);        }        private void SetFingerPos(int[] fPos)        {            SetFingerPos(new Vector3(9999, 9999, 0));            if (fPos != null && fPos.Length >= 2)            {                Vector3 pos = new Vector3(fPos[0], fPos[1], 0);                SetFingerPos(pos);            }            else            {                isReadFingerPos = false;            }            // if (guideConfig.reversalFinger == 1)            // {            //     finger.transform.localScale = new Vector3(1, 1, 1);            // }            // else if (guideConfig.reversalFinger == 2)            // {            //     finger.transform.localScale = new Vector3(-1, 1, 1);            // }        }        public Vector2 GetProperPos(Vector3 pos, Vector2 size, GameObject gameObject = null)        {            if (gameObject != null)            {                Vector2 pivot = gameObject.GetComponent<RectTransform>().pivot;                Vector2 pivot1 = pivot - Vector2.one * 0.5f;                float x = pos.x - size.x * pivot1.x;                float y = pos.y - size.y * pivot1.y;                return new Vector2(x, y);            }            else            {                return pos;            }        }        /// <summary>        /// 设置展示框的大小和位置 如果有锚点同步传入对应gameobject        /// </summary>        /// <param name="pos"></param>        /// <param name="size"></param>        /// <param name="type">0是矩阵 1是圆形</param>        /// <param name="gameObject"></param>        public void SetShowFramePosAndSize(Vector3 pos, Vector2 size, int type = 0, GameObject gameObject = null)        {            switch (type)            {                case 0:                    if (gameObject != null)                    {                        RectTransform rectTransform = gameObject.GetComponent<RectTransform>();                        Vector2 pivot = rectTransform.pivot;                        Vector2 pivot1 = pivot - Vector2.one * 0.5f;                        float x = pos.x - size.x * pivot1.x;                        float y = pos.y - size.y * pivot1.y;                        fxTrans01.transform.localPosition = new Vector3(x, y, 0);                        //fxTrans01.GetComponent<RectTransform>().pivot = gameObject.GetComponent<RectTransform>().pivot;                    }                    else                    {                        fxTrans01.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);                        fxTrans01.transform.localPosition = pos;                    }                    fxTrans01.GetComponent<RectTransform>().sizeDelta = size * 2f;                    CustomTweenManager.To(() => fxTrans01.GetComponent<RectTransform>().sizeDelta,                            x => fxTrans01.GetComponent<RectTransform>().sizeDelta = x,                            size, 0.3f, fxTrans01.gameObject).OnComplete(                            () => { fxTrans01.GetComponent<RectTransform>().sizeDelta = size; })                        .SetEase(CustomTweenEX.CustomAnimationCurve.InExpo);                    //fxTrans01.GetComponent<RectTransform>().sizeDelta = size;                    break;                case 1:                    if (gameObject != null)                    {                        fxTrans02.GetComponent<RectTransform>().pivot = gameObject.GetComponent<RectTransform>().pivot;                    }                    else                    {                        fxTrans02.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);                    }                    fxTrans02.transform.localPosition = pos;                    fxTrans02.GetComponent<RectTransform>().sizeDelta = size;                    break;            }        }        public Vector3 Setpos(Vector3 pos, Vector2 size, GameObject gameObject)        {            RectTransform rectTransform = gameObject.GetComponent<RectTransform>();            Vector2 pivot = rectTransform.pivot;            Vector2 pivot1 = pivot - Vector2.one * 0.5f;            float x = pos.x - size.x * pivot1.x;            float y = pos.y - size.y * pivot1.y;            return new Vector3(x, y, 0);        }        /// <summary>        /// 设置文本大小        /// </summary>        /// <param name="size"></param>        public void SetDilogBGSize(Vector2 size)        {            dialogBox.MessageBG.GetComponent<RectTransform>().sizeDelta = size;        }        /// <summary>        /// 设置mpc大小        /// </summary>        /// <param name="scale"></param>        public void SetNpcSize(int[] scale)        {            dialogBox.UISpiritLoader.GetComponent<RectTransform>().sizeDelta = new Vector2(scale[0], scale[1]);            dialogBox.UISpiritLoader.SetLoaderSpirit();        }        public Vector3 WorldPosToLocalPos(Vector3 pos)        {            Vector3 localPos = UIManager.Instance.GetComponent<GuidePanel>().transform.InverseTransformPoint(pos);            return localPos;        }        public void SetMaskTarget(GameObject gameObject)        {            // if (guideConfig.ForceOnclick == 0)            // {            //     return;            // }            UIManager.Instance.GetComponent<GuidePanel>().SetTarget(gameObject);        }        public void SetOnClickMask(bool value)        {            SetOnClickMaskSize(Vector2.zero);            UIManager.Instance.GetComponent<GuidePanel>().OnClickMask.onClick.RemoveAllListeners();            UIManager.Instance.GetComponent<GuidePanel>().SetOnClickMask(value);        }        public void SetOnClickMaskSize(Vector2 size)        {            UIManager.Instance.GetComponent<GuidePanel>().SetOnClickMaskSize(size);        }        public void SetOnClickMaskOnClickAction(UnityAction unityAction)        {            UIManager.Instance.GetComponent<GuidePanel>().SetOnClickMaskOnClickAction(unityAction);        }        /// <summary>        /// 阶段初始化        /// </summary>        public void StepInit()        {            UIManager.Instance.SetEventSystemEnable(false);            _customVectorTween?.Kill();            _customVectorTween = null;            UIManager.Instance.GetComponent<GuidePanel>().transform.SetAsLastSibling();            HideDialogBox();            SetfxTransVisiable(false);            SetMaskTarget(null);            SetFingerVisiable(false);            SetBlackBaseVisiable(false);        }        public void TweenAlpha()        {        }    }}
 |