少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-08 b42b7e1d1651f5ab4a8c7f3679129628ba84ddb6
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Snxxz.UI
{
    [XLua.LuaCallCSharp]
    [XLua.Hotfix]
    public class RidingPetBossModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    {
        public int[] BossIDArray;
        public int[] Boss1RewardIDArray;
        public int[] Boss2RewardIDArray;
        public bool isActivityOver { get; private set; }
        public const int RIDINGPETBOSS_MAP = 31200;
        Dictionary<int, RidingPetBossLine> RidingPetBossLineDict = new Dictionary<int, RidingPetBossLine>();
        private string m_MountsBossID;
        private string m_Boss1RewardID;
        private string m_Boss2RewardID;
        public event Action GetRidingPetBossLineDictAction;
 
        public string MountsBossID
        {
            get
            {
                if (m_MountsBossID == null)
                {
                    m_MountsBossID = FuncConfigConfig.Get("QCBOSSID").Numerical1;
                    
                }
                return m_MountsBossID;
            }
        }
 
        public string Boss1RewardID
        {
            get
            {
                if (m_Boss1RewardID == null)
                {
                    m_Boss1RewardID = FuncConfigConfig.Get("QCBOSSID").Numerical2;
 
                }
                return m_Boss1RewardID;
            }
        }
 
        public string Boss2RewardID
        {
            get
            {
                if (m_Boss2RewardID == null)
                {
                    m_Boss2RewardID = FuncConfigConfig.Get("QCBOSSID").Numerical3;
 
                }
                return m_Boss2RewardID;
            }
        }
 
        public override void Init()
        {
            BossIDArray = ConfigParse.GetMultipleStr<int>(MountsBossID);
            Boss1RewardIDArray = ConfigParse.GetMultipleStr<int>(Boss1RewardID);
            Boss2RewardIDArray = ConfigParse.GetMultipleStr<int>(Boss2RewardID);
        }
 
        public void OnBeforePlayerDataInitialize()
        {
        }
 
        public void OnPlayerLoginOk()
        {
            
        }
 
        public override void UnInit()
        {
            
        }
 
        public void ReceivePackage(HAC07_tagGCHorsePetBossInfo package)
        {
            if (package.IsEnd == 1)
            {
                isActivityOver = true;
            }
        }
 
        public void ReceivePackage(HA007_tagGCFBLinePlayerCnt package)
        {
            if (package.MapID != RIDINGPETBOSS_MAP)
            {
                return;
            }
 
            RidingPetBossLineDict.Clear();
 
            for (int i = 0; i < package.Count; i++)
            {
                var mapState = package.FBLineInfoList[i];
                RidingPetBossLineDict[mapState.FBLineID] = new RidingPetBossLine()
                {
                    playerCnt = mapState.PlayerCnt,
                    remainedHP = int.Parse(mapState.ExtraStr)
                };
            }
            if (GetRidingPetBossLineDictAction != null)
            {
                GetRidingPetBossLineDictAction();
            }
        }
 
        public string GetBossName(int index)
        {
            return NPCConfig.Get(BossIDArray[index]).charName;
        }
 
        public int GetBossRemianedHP(int index)
        {
            if (RidingPetBossLineDict.Count == 0 || !RidingPetBossLineDict.ContainsKey(index))
            {
                return 100;
            }
            else
            {
                return RidingPetBossLineDict[index].remainedHP;
            }
        }
    }
 
    public struct RidingPetBossLine
    {
        public int playerCnt;
        public int remainedHP;
    }
 
}