少年修仙传客户端代码仓库
hch
4 小时以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
using System.Collections.Generic;
using UnityEngine;
 
public class JiaPlayerManager
{
    public static bool Start = false;
 
    public static FuncConfigConfig gemTypeConfig = FuncConfigConfig.Get("FakePlayer");
    // 等级限制
    private static int m_LevelLimit = int.Parse(gemTypeConfig.Numerical1);
    // 创建间隔
    private static float m_CraeteInterval = 2f;
    // 计算创建间隔
    private static float m_CraeteCalcTime = 0;
    // 最大的玩家数量
    private static int m_MaxPlayerCount = int.Parse(gemTypeConfig.Numerical3);
    // 每个的持续时间
    public static float EachPlayerLastTime = 20f;
    // 开服天内
    public static int ServerDayLimit = int.Parse(gemTypeConfig.Numerical2);
 
    // 装备配置
    // 境界 | 职业 | [衣服,武器,副手]
    private static List<Dictionary<int, List<int>>> m_Equip = new List<Dictionary<int, List<int>>>()
    {
        new Dictionary<int, List<int>>()
        {
            { 1,new List<int>(){1011040,1011010, 1011020} },
            { 2,new List<int>(){2011040,2011010, 2011020} }
        }
    };
 
    private static List<JiaPlayerController> m_ControllerList = new List<JiaPlayerController>();
 
    public static void Update()
    {
        if (!Start)
        {
            return;
        }
 
        if (AdventureStage.Instance.IsInAdventureStage)
        {
            return;
        }
 
        for (int i = m_ControllerList.Count - 1; i >= 0; --i)
        {
            if (m_ControllerList[i] == null)
            {
                continue;
            }
            m_ControllerList[i].Update();
            if (m_ControllerList[i].IsDone)
            {
                m_ControllerList[i].UnInit();
                m_ControllerList.RemoveAt(i);
            }
        }
 
        if (TimeUtility.OpenDay > ServerDayLimit) return;
 
        if (PlayerDatas.Instance.baseData.LV > m_LevelLimit)
        {
            return;
        }
 
        if (Time.time - m_CraeteCalcTime < m_CraeteInterval)
        {
            return;
        }
 
        m_CraeteCalcTime = Time.time;
 
        int _curPlayerCount = 0;
 
        var _playerList = GAMgr.Instance.GetTypeList(E_ActorClassType.Player);
        if (_playerList != null)
        {
            _curPlayerCount = _playerList.Count;
        }
 
        _playerList = GAMgr.Instance.GetTypeList(E_ActorClassType.JiaPlayer);
        if (_playerList != null)
        {
            _curPlayerCount += _playerList.Count;
        }
 
        if (_curPlayerCount >= m_MaxPlayerCount)
        {
            return;
        }
 
        int _ranJob = Random.Range(1, 3);
        // 随机类型
        int _ran = Random.Range(0, (int)(JiaPlayerController.E_BehaviourType.MaxType));
 
        var _controller = new JiaPlayerController();
        _controller.Init(new JiaPlayerController.JiaPlayerData()
        {
            job = _ranJob,
            name = StringUtility.Contact(RandomNameConfig.GetFirstName(_ranJob), RandomNameConfig.GetSecondName(_ranJob)),
            clothes = m_Equip[PlayerDatas.Instance.baseData.realmLevel][_ranJob][0],
            weapon = m_Equip[PlayerDatas.Instance.baseData.realmLevel][_ranJob][1],
            sedcondary = m_Equip[PlayerDatas.Instance.baseData.realmLevel][_ranJob][2],
            behaviourType = (JiaPlayerController.E_BehaviourType)_ran
        });
 
        m_ControllerList.Add(_controller);
    }
 
    public static void UnInit()
    {
        for (int i = m_ControllerList.Count - 1; i >= 0; --i)
        {
            if (m_ControllerList[i] == null)
            {
                continue;
            }
            m_ControllerList[i].UnInit();
        }
        m_ControllerList.Clear();
    }
}