| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A0 04 查询副本功能线路人数 #tagCGGetFBLinePlayerCnt |
| | | |
| | | public class CA004_tagCGGetFBLinePlayerCnt : GameNetPackBasic |
| | | { |
| | | public uint MapID; |
| | | public byte FBLineID; |
| | | public byte IsAllLine; |
| | | |
| | | public CA004_tagCGGetFBLinePlayerCnt() |
| | | { |
| | | combineCmd = (ushort)0x1801; |
| | | _cmd = (ushort)0xA004; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(MapID, NetDataType.DWORD); |
| | | WriteBytes(FBLineID, NetDataType.BYTE); |
| | | WriteBytes(IsAllLine, NetDataType.BYTE); |
| | | } |
| | | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A0 04 查询副本功能线路人数 #tagCGGetFBLinePlayerCnt
|
| | |
|
| | | public class CA004_tagCGGetFBLinePlayerCnt : GameNetPackBasic
|
| | | {
|
| | |
|
| | | public uint MapID;
|
| | |
|
| | | public byte LineCount;
|
| | |
|
| | | public byte[] LineIDList; //个数为0时代表全部
|
| | |
|
| | |
|
| | |
|
| | | public CA004_tagCGGetFBLinePlayerCnt()
|
| | | {
|
| | |
|
| | | combineCmd = (ushort)0x1801;
|
| | |
|
| | | _cmd = (ushort)0xA004;
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | public override void WriteToBytes()
|
| | | {
|
| | |
|
| | | WriteBytes(MapID, NetDataType.DWORD);
|
| | |
|
| | | WriteBytes(LineCount, NetDataType.BYTE);
|
| | |
|
| | | WriteBytes(LineIDList, NetDataType.BYTE, LineCount);
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | } |
| | |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "OnMapInitOk", _m_OnMapInitOk); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "RequestMapTransport", _m_RequestMapTransport); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "RequestSelectedLine", _m_RequestSelectedLine); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "RequestQueryMapLineState", _m_RequestQueryMapLineState); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetMapLines", _m_GetMapLines); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "UpdateMapLines", _m_UpdateMapLines); |
| | | Utils.RegisterFunc(L, Utils.METHOD_IDX, "UpdateDungeonMapLines", _m_UpdateDungeonMapLines); |
| | |
| | | } catch(System.Exception gen_e) { |
| | | return LuaAPI.luaL_error(L, "c# exception:" + gen_e); |
| | | } |
| | | |
| | | } |
| | | |
| | | [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] |
| | | static int _m_RequestQueryMapLineState(RealStatePtr L) |
| | | { |
| | | try { |
| | | |
| | | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| | | |
| | | |
| | | Snxxz.UI.MapModel gen_to_be_invoked = (Snxxz.UI.MapModel)translator.FastGetCSObj(L, 1); |
| | | |
| | | |
| | | int gen_param_count = LuaAPI.lua_gettop(L); |
| | | |
| | | if(gen_param_count == 4&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 4)) |
| | | { |
| | | int __mapId = LuaAPI.xlua_tointeger(L, 2); |
| | | int __lineId = LuaAPI.xlua_tointeger(L, 3); |
| | | bool __isAllLine = LuaAPI.lua_toboolean(L, 4); |
| | | |
| | | gen_to_be_invoked.RequestQueryMapLineState( __mapId, __lineId, __isAllLine ); |
| | | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | if(gen_param_count == 3&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) |
| | | { |
| | | int __mapId = LuaAPI.xlua_tointeger(L, 2); |
| | | int __lineId = LuaAPI.xlua_tointeger(L, 3); |
| | | |
| | | gen_to_be_invoked.RequestQueryMapLineState( __mapId, __lineId ); |
| | | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | if(gen_param_count == 2&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) |
| | | { |
| | | int __mapId = LuaAPI.xlua_tointeger(L, 2); |
| | | |
| | | gen_to_be_invoked.RequestQueryMapLineState( __mapId ); |
| | | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | } catch(System.Exception gen_e) { |
| | | return LuaAPI.luaL_error(L, "c# exception:" + gen_e); |
| | | } |
| | | |
| | | return LuaAPI.luaL_error(L, "invalid arguments to Snxxz.UI.MapModel.RequestQueryMapLineState!"); |
| | | |
| | | } |
| | | |
| | |
| | | {
|
| | | m_BossAlive = value;
|
| | | DisplayBossState();
|
| | |
|
| | | if (m_BossAlive)
|
| | | {
|
| | | model.incidentDirty = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | float timer = 0f;
|
| | |
|
| | | DateTime requestPlayerCountTime = DateTime.Now;
|
| | |
|
| | | HazyRegionIncidentType incidentType = HazyRegionIncidentType.Adventure;
|
| | |
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | SendRequestPlayerCount();
|
| | | DisplayPlayerCount();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | bossAlive = findPreciousModel.IsBossAlive(config.npcId);
|
| | |
|
| | | if (bossAlive)
|
| | | {
|
| | | if ((DateTime.Now - requestPlayerCountTime).TotalSeconds > 5)
|
| | | {
|
| | | SendRequestPlayerCount();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | m_ContainerCompleted.gameObject.SetActive(incident.state == HazyRegionModel.IncidentState.Complete);
|
| | | m_ContainerProcessing.gameObject.SetActive(incident.state == HazyRegionModel.IncidentState.Processing);
|
| | | }
|
| | | }
|
| | |
|
| | | void SendRequestPlayerCount()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null && config.incidentType == (int)HazyRegionIncidentType.DemonKing
|
| | | && !model.InFakeHazyRegion)
|
| | | {
|
| | | var pak = new CA004_tagCGGetFBLinePlayerCnt();
|
| | | pak.MapID = (uint)config.dungeonId;
|
| | | pak.FBLineID = (byte)config.lineId;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | |
|
| | | requestPlayerCountTime = DateTime.Now;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | HazyRegionModel model { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | | DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
|
| | | PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
| | | FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
|
| | |
|
| | | DateTime requestTime = DateTime.Now;
|
| | | int requestCount = 0;
|
| | | float timer = 0f;
|
| | | Dictionary<int, List<byte>> requestLines = new Dictionary<int, List<byte>>();
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | |
| | | DisplayPoint();
|
| | | DisplayIncidents();
|
| | | DisplayBackButton();
|
| | |
|
| | | requestCount = 0;
|
| | | model.incidentDirty = false;
|
| | | SendRequestPlayerCount();
|
| | | }
|
| | |
|
| | | void DisplayIncidents()
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void LateUpdate()
|
| | | {
|
| | | timer += Time.deltaTime;
|
| | | if (timer >= 0.5f && !model.InFakeHazyRegion)
|
| | | {
|
| | | if (model.incidentDirty)
|
| | | {
|
| | | model.incidentDirty = false;
|
| | | requestCount = 0;
|
| | | requestTime = DateTime.Now;
|
| | | SendRequestPlayerCount();
|
| | | return;
|
| | | }
|
| | | timer = 0f;
|
| | | if ((DateTime.Now - requestTime).TotalSeconds > 5
|
| | | && requestCount < 10)
|
| | | {
|
| | | SendRequestPlayerCount();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void SendRequestPlayerCount()
|
| | | {
|
| | | requestLines.Clear();
|
| | | if (model.InFakeHazyRegion)
|
| | | {
|
| | | return;
|
| | | }
|
| | | for (int i = 0; i < incidents.Count; i++)
|
| | | {
|
| | | var config = HazyRegionConfig.Get(incidents[i]);
|
| | | if (config.incidentType != (int)HazyRegionIncidentType.DemonKing)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | if (findPreciousModel.IsBossAlive(config.npcId))
|
| | | {
|
| | | if (!requestLines.ContainsKey(config.dungeonId))
|
| | | {
|
| | | requestLines.Add(config.dungeonId, new List<byte>());
|
| | | }
|
| | | if (!requestLines[config.dungeonId].Contains((byte)config.lineId))
|
| | | {
|
| | | requestLines[config.dungeonId].Add((byte)config.lineId);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (requestLines.Count > 0)
|
| | | {
|
| | | foreach (var mapId in requestLines.Keys)
|
| | | {
|
| | | var pak = new CA004_tagCGGetFBLinePlayerCnt();
|
| | | pak.MapID = (uint)mapId;
|
| | | pak.LineCount = (byte)requestLines[mapId].Count;
|
| | | pak.LineIDList = requestLines[mapId].ToArray();
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | | }
|
| | | requestCount++;
|
| | | requestTime = DateTime.Now;
|
| | | }
|
| | | }
|
| | |
|
| | | public void Dispose()
|
| | | {
|
| | | m_CyclicScroll.Dispose();
|
| | |
| | | public int fakeOpenTimes { get; private set; }
|
| | | public bool isServerPrepare { get; private set; }
|
| | | public bool requireIncidentAnimation { get; set; }
|
| | | public bool incidentDirty { get; set; }
|
| | |
|
| | | int m_SelectIncident;
|
| | | public int selectIncident
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void RequestQueryMapLineState(int _mapId, int _lineId = 0, bool _isAllLine = true)
|
| | | public void RequestQueryMapLineState(int _mapId, byte[] _lineIds = null, bool _isAllLine = true)
|
| | | {
|
| | | var config = MapConfig.Get(_mapId);
|
| | | if (config.MapFBType == (int)MapType.OpenCountry)
|
| | |
| | | {
|
| | | var lineState = new CA004_tagCGGetFBLinePlayerCnt();
|
| | | lineState.MapID = (uint)_mapId;
|
| | | lineState.IsAllLine = (byte)(_isAllLine ? 1 : 0);
|
| | | lineState.LineCount = (byte)(_isAllLine ? 0 : _lineIds.Length);
|
| | | if (_isAllLine)
|
| | | {
|
| | | lineState.FBLineID = (byte)_lineId;
|
| | | lineState.LineIDList = new byte[0];
|
| | | }
|
| | | GameNetSystem.Instance.SendInfo(lineState);
|
| | | }
|