少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
using UnityEngine;
 
using vnxbqy.UI;
using System.Collections.Generic;
using System.Collections;
 
public class GA_NpcFunc : GActorNpcNoFight
{
    protected HeadUpName m_HeadUpName;
    // 用于触发点击的组件
    protected NPCInteractProcessor m_NPCInteractProcessor;
    protected H0406_tagNPCAppear m_H0406;
    private HeadUpQuestSign m_MissionSign;
 
    private int m_WeaponID;
    private int m_SecondaryID;
    private int m_WingID;
    private int m_HorseID;
 
    private GameObject m_WeaponModel;
    private GameObject m_SecondaryModel;
    private GameObject m_WingModel;
    private GameObject m_HorseModel;
 
    protected override void OnInit(GameNetPackBasic package)
    {
        base.OnInit(package);
 
        m_H0406 = package as H0406_tagNPCAppear;
 
        if (m_H0406 == null)
        {
            Debug.LogErrorFormat("Npc 执行初始化时, 传入的包错误...{0}", package.GetType());
        }
 
        // 初始化坐标
        AdjustPos(m_H0406.PosX, m_H0406.PosY);
 
        ActorInfo.serverBornPos = new Vector2(m_H0406.PosX, m_H0406.PosY);
        ActorInfo.PlayerName = NpcConfig.charName;
 
        // 功能NPC需要读取配置朝向
        GAStaticDefine.NPCLocation _npcLocation;
        if (GAStaticDefine.TryGetMapNPCLocation(NpcConfig.NPCID, out _npcLocation))
        {
            Rotation = MathUtility.GetClientRotationFromAngle(_npcLocation.face);
        }
        else
        {
            Rotation = Quaternion.Euler(0, UnityEngine.Random.Range(0, 360), 0);
        }
 
        if (CanBeSelected())
        {
            m_NPCInteractProcessor = Root.AddMissingComponent<NPCInteractProcessor>();
            m_NPCInteractProcessor.npcIntergactEvent += OnClick;
        }
 
        GAStaticDefine.NpcID2ServerInstID[NpcConfig.NPCID] = ServerInstID;
 
        var _npcID = NpcConfig.NPCID;
        TaskModel.Event_TaskResponse += OnTaskRefresh;
        bool _needHide = (NpcConfig.Show == 0);
 
        TaskModel _model = ModelCenter.Instance.GetModel<TaskModel>();
 
        if (_npcID == 10404101)
        {
            _npcID = 10404100;
        }
 
        if (_model.NPCShowDic.ContainsKey(_npcID))
        {
            if (_model.NPCShowDic[_npcID] == 1)
            {
                _needHide = false;
#if UNITY_EDITOR
                string _content = string.Format("{0} / {1} => 因为任务决定的, 不需要隐藏", ServerInstID, _npcID);
                RuntimeLogUtility.AddLog(_content, ServerInstID, true);
#endif
            }
            else if (_model.NPCShowDic[_npcID] == 0)
            {
                _needHide = true;
#if UNITY_EDITOR
                string _content = string.Format("{0} / {1} => 因为任务决定的, 需要隐藏", ServerInstID, _npcID);
                RuntimeLogUtility.AddLog(_content, ServerInstID, true);
#endif
            }
        }
 
        // 这里针对指定的NPC特殊矫正位置
        if (GeneralDefine.NpcPosOffset.ContainsKey(NpcConfig.NPCID))
        {
            Pos = GeneralDefine.NpcPosOffset[NpcConfig.NPCID];
            //Debug.Log("矫正位置: " + Pos);
        }
 
        if (_needHide)
        {
#if UNITY_EDITOR
            string _content = string.Format("{0} / {1} => 需要隐藏", ServerInstID, _npcID);
            RuntimeLogUtility.AddLog(_content, ServerInstID, true);
#endif
            Pos = Constants.Special_Hide_Position;
        }
        else
        {
#if UNITY_EDITOR
            string _content = string.Format("{0} / {1} => 不需要隐藏", ServerInstID, _npcID);
            RuntimeLogUtility.AddLog(_content, ServerInstID, true);
#endif
        }
    }
 
    private SFXController m_ReikiEffect;
 
    protected override void OnMainModelLoaded()
    {
        RequestMissionSign();
 
        if (string.IsNullOrEmpty(NpcConfig.Equips))
        {
            return;
        }
 
        string[] _ids = NpcConfig.Equips.Split('|');
        int _weaponId = int.Parse(_ids[0]);
        int _secondaryId = _ids.Length > 1 ? int.Parse(_ids[1]) : -1;
        int _horseId = _ids.Length > 2 ? int.Parse(_ids[2]) : -1;
        int _wingId = _ids.Length > 3 ? int.Parse(_ids[3]) : -1;
        int _effectId = _ids.Length > 4 ? int.Parse(_ids[4]) : -1;
 
        // Debug.LogFormat("weapon: {0}, secondary: {1}, horse: {2}, wing: {3}", _weaponId, _secondaryId, _horseId, _weaponId);
 
        if (_weaponId > 0)
        {
            SetEquipWeapon(_weaponId);
        }
 
        if (_secondaryId > 0)
        {
            SetEquipSecondary(_secondaryId);
        }
 
        if (_wingId > 0)
        {
            SetEquipWing(_wingId);
        }
 
        if (_horseId > 0)
        {
            SetEquipHorse(_horseId);
        }
 
        if (_effectId != -1)
        {
            if (m_ReikiEffect)
            {
                SFXPlayUtility.Instance.Release(m_ReikiEffect);
                m_ReikiEffect = null;
            }
            m_ReikiEffect = SFXPlayUtility.Instance.PlayBattleEffect(_effectId, Root, 1);
        }
 
    }
 
    private void SetEquipHorse(int horseID)
    {
        if (horseID > 0)
        {
            m_HorseID = horseID;
            var _horseConfig = HorseConfig.Get(horseID);
            InstanceResourcesLoader.AsyncLoadModelRes(_horseConfig.Model, OnHorseLoaded);
        }
    }
 
    private void SetEquipSecondary(int resID)
    {
        if (resID > 0)
        {
            m_SecondaryID = resID;
            InstanceResourcesLoader.AsyncLoadModelRes(resID, OnSecondaryLoaded);
        }
    }
 
    private void SetEquipWeapon(int resID)
    {
        if (resID > 0)
        {
            m_WeaponID = resID;
            InstanceResourcesLoader.AsyncLoadModelRes(resID, OnWeaponLoaded);
        }
    }
 
    private void SetEquipWing(int resID)
    {
        if (resID > 0)
        {
            m_WingID = resID;
            InstanceResourcesLoader.AsyncLoadModelRes(resID, OnWingLoaded);
        }
    }
 
    private void OnHorseLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
        }
 
        var _horseConfig = HorseConfig.Get(m_HorseID);
        var _modelResConfig = ModelResConfig.Get(_horseConfig.Model);
 
        m_HorseModel = GameObjectPoolManager.Instance.RequestGameObject(prefab as GameObject);
        if (!m_HorseModel)
        {
            return;
        }
 
        var _animator = m_HorseModel.GetComponent<Animator>();
        if (_animator)
        {
            _animator.runtimeAnimatorController = AnimatorControllerLoader.LoadMobController(AnimatorControllerLoader.controllerSuffix,
                                                                                             _modelResConfig.ResourcesName);
            _animator.enabled = true;
        }
 
        if (m_HorseModel)
        {
            m_HorseModel.transform.SetParent(m_Root);
            m_HorseModel.transform.localPosition = Vector3.zero;
            m_HorseModel.transform.localRotation = Quaternion.identity;
 
            var _horseBindNode = m_HorseModel.transform.GetChildTransformDeeply(_modelResConfig.BindPoint);
 
            if (_horseBindNode)
            {
                m_Model.transform.SetParent(_horseBindNode);
                m_Model.transform.localPosition = Vector3.zero;
                m_Model.transform.localEulerAngles = new Vector3(90, 0, 0);
                _animator = m_Model.GetComponent<Animator>();
                if (_animator)
                {
                    _animator.SetInteger(GAStaticDefine.Param_Action, GAStaticDefine.Act_HorseIdle);
                    switch (_horseConfig.ActionType)
                    {
                        case 0:
                            _animator.Play(GAStaticDefine.State_HorseIdleHash);
                            break;
                        case 1:
                            _animator.Play(GAStaticDefine.State_HorseIdle1Hash);
                            break;
                        case 2:
                            _animator.Play(GAStaticDefine.State_HorseIdle2Hash);
                            break;
                        case 3:
                            _animator.Play(GAStaticDefine.State_HorseIdle3Hash);
                            break;
                        case 4:
                            _animator.Play(GAStaticDefine.State_HorseIdle4Hash);
                            break;
                    }
                }
            }
        }
    }
 
    private void OnWingLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
        }
 
        m_WingModel = GameObjectPoolManager.Instance.RequestGameObject(prefab as GameObject);
        if (!m_WingModel)
        {
            return;
        }
        var _animator = m_WingModel.GetComponent<Animator>();
        if (_animator)
        {
            _animator.enabled = true;
        }
        Transform _bindNode = m_Model.transform.GetChildTransformDeeply(GAStaticDefine.WingBindBoneName);
        if (_bindNode)
        {
            m_WingModel.transform.SetParent(_bindNode);
            m_WingModel.transform.localPosition = Vector3.zero;
            m_WingModel.transform.localRotation = Quaternion.identity;
        }
 
        ModelResConfig _resConfig = ModelResConfig.Get(m_WingID);
        m_WingModel.transform.localScale = _resConfig.Scale;
    }
 
    private void OnSecondaryLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
        }
 
        m_SecondaryModel = GameObjectPoolManager.Instance.RequestGameObject(prefab as GameObject);
        if (!m_SecondaryModel)
        {
            return;
        }
        var _animator = m_SecondaryModel.GetComponent<Animator>();
        if (_animator)
        {
            _animator.enabled = true;
        }
        int _job = NpcConfig.MODE.Contains("A_Zs") ? 1 : 2;
        Transform _bindNode = m_Model.transform.GetChildTransformDeeply(GAStaticDefine.SecondaryBindBoneName[_job - 1]);
        if (_bindNode)
        {
            m_SecondaryModel.transform.SetParent(_bindNode);
            m_SecondaryModel.transform.localPosition = Vector3.zero;
            m_SecondaryModel.transform.localRotation = Quaternion.identity;
        }
    }
 
    private void OnWeaponLoaded(bool result, UnityEngine.Object prefab)
    {
        if (IsUnInit)
        {
            return;
        }
        if (!result || !prefab)
        {
            return;
        }
        m_WeaponModel = GameObjectPoolManager.Instance.RequestGameObject(prefab as GameObject);
        if (!m_WeaponModel)
        {
            return;
        }
        var _animator = m_WeaponModel.GetComponent<Animator>();
        if (_animator)
        {
            _animator.enabled = true;
        }
        Transform _bindNode = m_Model.transform.GetChildTransformDeeply(GAStaticDefine.WeaponBindBoneName);
        if (_bindNode)
        {
            m_WeaponModel.transform.SetParent(_bindNode);
            m_WeaponModel.transform.localPosition = Vector3.zero;
            m_WeaponModel.transform.localRotation = Quaternion.identity;
        }
    }
 
    protected override void OnUnit()
    {
        if (m_ReikiEffect)
        {
            SFXPlayUtility.Instance.Release(m_ReikiEffect);
            m_ReikiEffect = null;
        }
 
        if (m_WeaponModel)
        {
            var _prefab = InstanceResourcesLoader.LoadModelRes(m_WeaponID);
            if (_prefab)
            {
                GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_WeaponModel);
                m_WeaponModel = null;
                m_WeaponID = 0;
            }
        }
 
        if (m_SecondaryModel)
        {
            var _prefab = InstanceResourcesLoader.LoadModelRes(m_SecondaryID);
            if (_prefab)
            {
                GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_SecondaryModel);
                m_SecondaryModel = null;
                m_SecondaryID = 0;
            }
        }
 
        if (m_WingModel)
        {
            var _animator = m_WingModel.GetComponent<Animator>();
            if (_animator)
            {
                _animator.enabled = false;
            }
            var _prefab = InstanceResourcesLoader.LoadModelRes(m_WingID);
            if (_prefab)
            {
                GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_WingModel);
                m_WingModel = null;
                m_WingID = 0;
            }
        }
 
        if (m_HorseModel)
        {
            var _animator = m_HorseModel.GetComponent<Animator>();
            if (_animator)
            {
                _animator.enabled = false;
            }
            var _horseConfig = HorseConfig.Get(m_HorseID);
            var _modelResConfig = ModelResConfig.Get(_horseConfig.Model);
            var _prefab = InstanceResourcesLoader.LoadModelRes(_modelResConfig.ID);
            if (_prefab)
            {
                GameObjectPoolManager.Instance.ReleaseGameObject(_prefab, m_HorseModel);
                m_HorseModel = null;
                m_HorseID = 0;
            }
        }
 
        if (m_NPCInteractProcessor)
        {
            m_NPCInteractProcessor.npcIntergactEvent -= OnClick;
            Object.Destroy(m_NPCInteractProcessor);
            m_NPCInteractProcessor = null;
        }
        TaskModel.Event_TaskResponse -= OnTaskRefresh;
        m_H0406 = null;
 
        ReleaseMissionSign();
 
        base.OnUnit();
 
        IsUnInit = true;
    }
 
    protected virtual void OnTaskRefresh(int _nowNPCid, int _nPCLamp, Dictionary<int, int> _dic)
    {
        if (_nowNPCid == NpcConfig.NPCID)
        {
            RequestMissionSign();
        }
    }
 
    public override void OnClick()
    {
        GA_Hero _hero = PlayerDatas.Instance.hero;
 
        // 这里判断是否要走向此对象
        float _distSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, Pos);
 
        if (PlayerDatas.Instance.baseData.MapID != 31340)
        {
            _hero.LockTarget = this;
            _hero.SelectTarget = this;
        }
        else
        {
            if (_distSqrt < Mathf.Pow(GeneralDefine.CloseNpcDist + NpcConfig.ModelRadius + 0.4f, 2))
            {
                _hero.LockTarget = this;
                _hero.SelectTarget = this;
            }
        }
 
        if (_distSqrt > Mathf.Pow(GeneralDefine.CloseNpcDist + NpcConfig.ModelRadius + 0.4f, 2))
        {
            // MapTransferUtility.Instance.MoveToNPC(NpcConfig.NPCID, (int)ServerInstID);
            _hero.MoveToPosition(Pos, 1);
        }
        else
        {
            if (NpcConfig.AutomaticFace == 1)
            {
                Vector3 _forward = MathUtility.ForwardXZ(_hero.Pos, Pos);
                Forward = _forward;
            }
 
            HandleOnClick();
        }
    }
 
    protected virtual void HandleOnClick()
    {
        NPCInteractProcessor.InvokeEvent(E_NpcType.Func, NpcConfig.NPCID, ServerInstID);
    }
 
    protected override void OnLateUpdate() { }
 
    private float m_PlayDanceTime;
 
    protected override void OnFixedUpdate()
    {
        if (m_HorseModel)
        {
            if (Time.realtimeSinceStartup - m_PlayDanceTime > 10)
            {
                m_PlayDanceTime = Time.realtimeSinceStartup;
                NextAction = GAStaticDefine.Act_HorseIdleTransfer;
            }
        }
    }
    protected override void OnUpdate() { }
 
    public sealed override void Die() { }
    public sealed override void Hurt() { }
    public sealed override void HurtDown() { }
 
    public sealed override void RequestLifeBar() { }
    public sealed override void ReleaseLifeBar() { }
 
    public override void RequestName()
    {
        ReleaseName();
 
        if (!MP_Name)
        {
            return;
        }
 
        HeadUpName.Pattern _pattern = HeadUpName.Pattern.FunctionNPC;
 
        var _bossInfoConfig = BossInfoConfig.GetBossInfoByStoneId(NpcConfig.NPCID);
        if (_bossInfoConfig != null)
        {
            _pattern = HeadUpName.Pattern.NpcReborn;
        }
 
        m_HeadUpName = HeadUpName.RequireHeadUpName(_pattern, MP_Name, 0, CameraController.Instance.CameraObject);
 
        if (_bossInfoConfig != null)
        {
            m_HeadUpName.SetNpcReborn(_bossInfoConfig.NPCID);
        }
        else
        {
            m_HeadUpName.SetNPCName(NpcConfig.NPCID);
        }
    }
 
    public sealed override void ReleaseName()
    {
        if (m_HeadUpName)
        {
            m_HeadUpName.target = null;
            HeadUpName.Recycle(m_HeadUpName);
            m_HeadUpName = null;
        }
    }
 
    TaskModel m_TaskModel;
    TaskModel taskmodel
    {
        get
        {
            return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>());
        }
    }
 
    public void RequestMissionSign()
    {
        ReleaseMissionSign();
        int _status = taskmodel.StatusLightQuery(NpcConfig.NPCID);
        if (_status >= 0)
        {
            HeadUpQuestSign.Pattern _pattern = (HeadUpQuestSign.Pattern)_status;
            m_MissionSign = HeadUpQuestSign.RequireHeadUpQuestSign(_pattern, MP_Name, 0, CameraController.Instance.CameraObject);
        }
    }
 
    public void ReleaseMissionSign()
    {
        if (m_MissionSign)
        {
            HeadUpQuestSign.Recycle(m_MissionSign);
            m_MissionSign = null;
        }
    }
 
    public override void OnSelect()
    {
        if (NpcConfig.NPCID != 10204200)
        {
            SelectionManager.Request(SelectionManager.E_Type.Green, this, NpcConfig.ModelRadius * 2);
        }
 
        GA_Hero _hero = PlayerDatas.Instance.hero;
        Vector3 _forward = MathUtility.ForwardXZ(Pos, _hero.Pos);
 
        if (NpcConfig.NPCID != GeneralDefine.GatherSoulDZ)
        {
            _hero.Forward = _forward;
        }
 
        if (NpcConfig.AutomaticFace == 1)
        {
            _forward = MathUtility.ForwardXZ(_hero.Pos, Pos);
            Forward = _forward;
        }
    }
 
    public override void OnUnSelect()
    {
        SelectionManager.Release(SelectionManager.E_Type.Green);
    }
 
    public override bool CanBeSelected()
    {
        return true;
    }
 
    private static Dictionary<int, bool> s_VisibleNpcFunc = new Dictionary<int, bool>();
 
    public static void SetNpcFuncVisible(int npcID, bool visible,
                                         float delayTime = 0,
                                         UnityEngine.Events.UnityAction<Vector3> callback1 = null,
                                         float timeBeforeDisappare = 0)
    {
        if (delayTime == 0)
        {
            SetNpcFuncVisibleFunc(npcID, visible);
        }
        else
        {
            SnxxzGame.Instance.StartCoroutine(DelaySetVisible(npcID, visible, delayTime, timeBeforeDisappare, callback1));
        }
    }
 
    private static IEnumerator DelaySetVisible(int npcID,
                                               bool visible,
                                               float delayTime,
                                               float timeCallback,
                                               UnityEngine.Events.UnityAction<Vector3> callback)
    {
        float _waitTime = delayTime - timeCallback;
 
        yield return new WaitForSeconds(timeCallback);
 
        GActor _disappearTarget = null;
 
        s_VisibleNpcFunc[npcID] = visible;
        List<GActor> _actorList = GAMgr.Instance.GetGroupList(E_ActorGroup.Collect);
        if (_actorList != null)
        {
            GActorNpcNoFight _target = null;
 
            for (int i = 0; i < _actorList.Count; ++i)
            {
                _target = _actorList[i] as GActorNpcNoFight;
 
                if (_target.NpcConfig.NPCID == npcID)
                {
                    if (visible)
                    {
                        _target.AdjustPos((ushort)_target.ActorInfo.serverBornPos.x, (ushort)_target.ActorInfo.serverBornPos.y);
                    }
                    else
                    {
                        if (callback != null)
                        {
                            callback(_target.Pos);
                        }
 
                        _disappearTarget = _target;
                    }
                }
            }
        }
 
        if (_disappearTarget == null)
        {
            _actorList = GAMgr.Instance.GetGroupList(E_ActorGroup.FuncNpc);
 
            if (_actorList != null)
            {
                GActorNpcNoFight _target = null;
 
                for (int i = 0; i < _actorList.Count; ++i)
                {
                    _target = _actorList[i] as GActorNpcNoFight;
 
                    if (_target.NpcConfig.NPCID == npcID)
                    {
                        if (visible)
                        {
                            _target.AdjustPos((ushort)_target.ActorInfo.serverBornPos.x, (ushort)_target.ActorInfo.serverBornPos.y);
                        }
                        else
                        {
                            if (callback != null)
                            {
                                callback(_target.Pos);
                            }
                            _disappearTarget = _target;
                        }
                        break;
                    }
                }
            }
        }
 
        if (_disappearTarget != null)
        {
            yield return new WaitForSeconds(_waitTime);
            _disappearTarget.Pos = Constants.Special_Hide_Position;
        }
 
    }
 
    private static void SetNpcFuncVisibleFunc(int npcID, bool visible)
    {
        s_VisibleNpcFunc[npcID] = visible;
        List<GActor> _actorList = GAMgr.Instance.GetGroupList(E_ActorGroup.Collect);
        if (_actorList != null)
        {
            GActorNpcNoFight _target = null;
 
            for (int i = 0; i < _actorList.Count; ++i)
            {
                _target = _actorList[i] as GActorNpcNoFight;
 
                if (_target.NpcConfig.NPCID == npcID)
                {
                    if (visible)
                    {
                        _target.AdjustPos((ushort)_target.ActorInfo.serverBornPos.x, (ushort)_target.ActorInfo.serverBornPos.y);
                    }
                    else
                    {
                        _target.Pos = Constants.Special_Hide_Position;
                    }
                    return;
                }
            }
        }
 
        _actorList = GAMgr.Instance.GetGroupList(E_ActorGroup.FuncNpc);
 
        if (_actorList != null)
        {
            GActorNpcNoFight _target = null;
 
            for (int i = 0; i < _actorList.Count; ++i)
            {
                _target = _actorList[i] as GActorNpcNoFight;
 
                if (_target.NpcConfig.NPCID == npcID)
                {
                    if (visible)
                    {
                        _target.AdjustPos((ushort)_target.ActorInfo.serverBornPos.x, (ushort)_target.ActorInfo.serverBornPos.y);
                    }
                    else
                    {
                        _target.Pos = Constants.Special_Hide_Position;
                    }
                    break;
                }
            }
        }
    }
}