Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | 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);
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | } |
| | |
| | | ModelCenter.Instance.GetModel<JadeDynastyBossModel>().OnReceivePackage(package);
|
| | | ModelCenter.Instance.GetModel<RidingPetBossModel>().ReceivePackage(package);
|
| | | ModelCenter.Instance.GetModel<AllianceBossModel>().ReceivePackage(package);
|
| | | ModelCenter.Instance.GetModel<HazyDemonKingModel>().ReceivePackage(package);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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!"); |
| | | |
| | | } |
| | | |
| | |
| | | public readonly Redpoint redpoint = new Redpoint(MainRedDot.RedPoint_key, 110);
|
| | | public readonly Redpoint alchemyDrugRedpoint1 = new Redpoint(110, 11001);
|
| | | public readonly Redpoint alchemyDrugRedpoint2 = new Redpoint(110, 11002);
|
| | | public readonly Redpoint alchemyDrugREdpoint3 = new Redpoint(110, 11003);
|
| | | Dictionary<int, Dictionary<int, Redpoint>> alchemyQualityRedpoints = new Dictionary<int, Dictionary<int, Redpoint>>();
|
| | | Dictionary<int, AlchemyRedpoint> alchemyRedpoints = new Dictionary<int, AlchemyRedpoint>();
|
| | |
|
| | |
| | | {
|
| | | CheckRedpoint();
|
| | | }
|
| | |
|
| | | if (m_AlchemyDrugs.Contains(itemId))
|
| | | {
|
| | | RefreshUseDrugRedpoint();
|
| | | }
|
| | | }
|
| | |
|
| | | private void PlayerDataRefreshEvent(PlayerDataType dataType)
|
| | |
| | | if (id == (int)FuncOpenEnum.BlastFurnace)
|
| | | {
|
| | | CheckRedpoint();
|
| | | RefreshUseDrugRedpoint();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void RefreshUseDrugRedpoint()
|
| | | {
|
| | | var useable = false;
|
| | | if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BlastFurnace))
|
| | | {
|
| | | foreach (var itemId in m_AlchemyDrugs)
|
| | | {
|
| | | if (GetAlchemyDrugState(itemId) == 0)
|
| | | {
|
| | | useable = true;
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | alchemyDrugREdpoint3.state = useable ? RedPointState.Simple : RedPointState.None;
|
| | | }
|
| | | }
|
| | |
|
| | | public enum AlchemyType
|
| | |
| | | m_ItemCell.Init(cellModel);
|
| | | m_ItemCell.button.SetListener(()=>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(evolve.CostItemID, false, (ulong)1);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | EquipTipUtility.Show(evolve.CostItemID);
|
| | | });
|
| | | string strItemCount = string.Empty;
|
| | | string strEquipLevel = string.Empty;
|
| | |
| | | public class HazyDemonKingModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
|
| | | {
|
| | | Dictionary<uint, HazyDemonKingPlayerInfo> m_PlayerInfos = new Dictionary<uint, HazyDemonKingPlayerInfo>();
|
| | | Dictionary<int, Dictionary<int, int>> m_MapPlayerCounts = new Dictionary<int, Dictionary<int, int>>();
|
| | | List<uint> m_AttackHeroPlayers = new List<uint>();
|
| | |
|
| | | public bool IsInDungeon { get; private set; }
|
| | |
| | | public const int DEMONKINGMAPID2 = 32030;
|
| | |
|
| | | public event Action onPlayerInfoRefresh;
|
| | | public event Action onPlayerCountRefresh;
|
| | |
|
| | | HazyRegionModel hazyRegionModel { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | |
|
| | |
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | m_PlayerInfos.Clear();
|
| | | m_MapPlayerCounts.Clear();
|
| | | }
|
| | |
|
| | | public void OnPlayerLoginOk()
|
| | |
| | | return m_PlayerInfos.Keys;
|
| | | }
|
| | |
|
| | | public int GetDungeonPlayerCount(int mapId, int lineId)
|
| | | {
|
| | | if (m_MapPlayerCounts.ContainsKey(mapId))
|
| | | {
|
| | | return m_MapPlayerCounts[mapId].ContainsKey(lineId) ? m_MapPlayerCounts[mapId][lineId] : 0;
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | public void SendSelectAtkTarget(uint serverInstId)
|
| | | {
|
| | | var actor = GAMgr.Instance.GetBySID(serverInstId);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void ReceivePackage(HA007_tagGCFBLinePlayerCnt package)
|
| | | {
|
| | | var mapId = (int)package.MapID;
|
| | | if (IsInDemonKingDungeon(mapId))
|
| | | {
|
| | | Dictionary<int, int> dict = null;
|
| | | if (!m_MapPlayerCounts.TryGetValue(mapId, out dict))
|
| | | {
|
| | | dict = new Dictionary<int, int>();
|
| | | m_MapPlayerCounts.Add(mapId, dict);
|
| | | }
|
| | | for (int i = 0; i < package.Count; i++)
|
| | | {
|
| | | var data = package.FBLineInfoList[i];
|
| | | dict[data.FBLineID] = data.PlayerCnt;
|
| | | }
|
| | |
|
| | | if (onPlayerCountRefresh != null)
|
| | | {
|
| | | onPlayerCountRefresh();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void RequestEnterClientDungeon()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(hazyRegionModel.processingIncidentId);
|
| | |
| | |
|
| | | HazyRegionModel model { get { return ModelCenter.Instance.GetModel<HazyRegionModel>(); } }
|
| | | FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
|
| | | HazyDemonKingModel hazyDemonKingModel { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
|
| | |
|
| | | int incidentId = 0;
|
| | |
|
| | |
| | | {
|
| | | m_BossAlive = value;
|
| | | DisplayBossState();
|
| | |
|
| | | if (m_BossAlive)
|
| | | {
|
| | | model.incidentDirty = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | incidentType = (HazyRegionIncidentType)config.incidentType;
|
| | |
|
| | | m_BossAlive = false;
|
| | | if (incidentType == HazyRegionIncidentType.DemonKing)
|
| | | {
|
| | | m_BossAlive = findPreciousModel.IsBossAlive(config.npcId);
|
| | |
| | | model.onHazyRegionIncidentRefresh += OnHazyRegionIncidentRefresh;
|
| | | findPreciousModel.bossInfoUpdateEvent -= BossInfoUpdateEvent;
|
| | | findPreciousModel.bossInfoUpdateEvent += BossInfoUpdateEvent;
|
| | | hazyDemonKingModel.onPlayerCountRefresh -= OnPlayerCountRefresh;
|
| | | hazyDemonKingModel.onPlayerCountRefresh += OnPlayerCountRefresh;
|
| | | }
|
| | |
|
| | | void DisplayBase()
|
| | |
| | | {
|
| | | if (model.InFakeHazyRegion)
|
| | | {
|
| | | var fighting = ClientDungeonStageUtility.isClientDungeon;
|
| | | var fighting = ClientDungeonStageUtility.isClientDungeon &&
|
| | | ClientDungeonStageUtility.clientMapId == HazyDemonKingModel.Client_MapID;
|
| | | m_PlayerCount.gameObject.SetActive(true);
|
| | | m_RebornTime.gameObject.SetActive(false);
|
| | | m_PlayerCount.text = Language.Get("HazyDemonKingPlayerCount", fighting ? 1 : 0);
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | m_PlayerCount.text = Language.Get("HazyDemonKingPlayerCount", 0);
|
| | | DisplayPlayerCount();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | {
|
| | | m_RebornTime.text = Language.Get("BossReborn_RefreshTime1");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void DisplayPlayerCount()
|
| | | {
|
| | | var config = HazyRegionConfig.Get(incidentId);
|
| | | if (config != null)
|
| | | {
|
| | | m_PlayerCount.text = Language.Get("HazyDemonKingPlayerCount",
|
| | | hazyDemonKingModel.GetDungeonPlayerCount(config.dungeonId, config.lineId));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void OnPlayerCountRefresh()
|
| | | {
|
| | | if (incidentType == HazyRegionIncidentType.DemonKing
|
| | | && !model.InFakeHazyRegion && bossAlive)
|
| | | {
|
| | | DisplayPlayerCount();
|
| | | }
|
| | | }
|
| | |
|
| | | public override void Dispose()
|
| | | {
|
| | | base.Dispose();
|
| | | hazyDemonKingModel.onPlayerCountRefresh -= OnPlayerCountRefresh;
|
| | | findPreciousModel.bossInfoUpdateEvent -= BossInfoUpdateEvent;
|
| | | model.selectIncidentRefresh -= SelectIncidentRefresh;
|
| | | model.onHazyRegionIncidentRefresh -= OnHazyRegionIncidentRefresh;
|
| | |
| | | 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
|
| | |
| | |
|
| | | private void RedpointValueChangeEvent(int _id)
|
| | | {
|
| | | if (_id ==999999 /*strengthengmodel.StrengthRedpoint.id*/ ||
|
| | | if (_id == 999999 /*strengthengmodel.StrengthRedpoint.id*/ ||
|
| | | _id == MainRedDot.RedPoint_MountPackKey ||
|
| | | _id == MainRedDot.Instance.redPonintPetFunc2.id ||
|
| | | _id == MainRedDot.Instance.redPointWashFunc.id ||
|
| | |
| | | _id == methodData.fairyHeartRedpoint.id ||
|
| | | _id == realmModel.levelUpRedpoint.id ||
|
| | | _id == equipGemModel.redpoint.id ||
|
| | | _id == reikiRootModel.redpoint.id)
|
| | | _id == reikiRootModel.redpoint.id ||
|
| | | _id == alchemyModel.alchemyDrugREdpoint3.id)
|
| | | {
|
| | | CheckPromoteDetailEffect();
|
| | | }
|
| | |
| | | case PromoteDetailType.FairyHeart:
|
| | | return ModelCenter.Instance.GetModel<PlayerMethodData>().fairyHeartRedpoint.state == RedPointState.Simple;
|
| | | case PromoteDetailType.BlastFurnace:
|
| | | return false;
|
| | | //return alchemyModel.CheckUseDrugLimit();
|
| | | return alchemyModel.alchemyDrugREdpoint3.state == RedPointState.Simple;
|
| | | case PromoteDetailType.max:
|
| | | break;
|
| | | }
|
| | |
| | | //WindowCenter.Instance.Open<EquipReinforceWin>(false, 1);
|
| | | break;
|
| | | case RolePromoteModel.PromoteDetailType.BlastFurnace:
|
| | | WindowCenter.Instance.Open<AlchemyBaseWin>(false, 0);
|
| | | WindowCenter.Instance.Open<AlchemyBaseWin>(false, 2);
|
| | | break;
|
| | | }
|
| | | CloseClick();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | 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);
|
| | | }
|