public void Activate(List <FieldModel.SlotInfo> slot_infos) { Deactivate(); SetSlotInfos(slot_infos); Coop_Model_RegisterACK registerAck = MonoBehaviourSingleton <CoopNetworkManager> .I.registerAck; if (registerAck != null) { InitStage(registerAck.ids, registerAck.stgids, registerAck.stgidxs, registerAck.stghosts); InitClients(registerAck.ids, registerAck.stgids, registerAck.stgidxs, registerAck.stghosts); SetOwnerFirstClear(registerAck.of); } SetStatus(ROOM_STATUS.STAGE); MonoBehaviourSingleton <CoopManager> .I.coopMyClient.StageStart(); if (isOwnerFirstClear) { CoopClient coopClient = clients.FindPartyOwner(); if (coopClient == null) { Logd("Activate... party owner not found."); MonoBehaviourSingleton <CoopNetworkManager> .I.Close(1000, "Bye!", null); } } }
public void SendSyncPlayerStatus(Self self, int toClientId = -1) { CoopClient coopClient = coopRoom.clients.Find((CoopClient x) => x.stageId != MonoBehaviourSingleton <CoopManager> .I.coopMyClient.stageId); if (!(coopClient == null)) { Coop_Model_RoomSyncPlayerStatus coop_Model_RoomSyncPlayerStatus = new Coop_Model_RoomSyncPlayerStatus(); coop_Model_RoomSyncPlayerStatus.id = 1001; coop_Model_RoomSyncPlayerStatus.hp = self.hp; coop_Model_RoomSyncPlayerStatus.buff = self.buffParam.CreateSyncParamIfNeeded(); coop_Model_RoomSyncPlayerStatus.wid = self.weaponData.eId; if (QuestManager.IsValidInGameExplore()) { ExplorePlayerStatus myExplorePlayerStatus = MonoBehaviourSingleton <QuestManager> .I.GetMyExplorePlayerStatus(); if (myExplorePlayerStatus != null) { coop_Model_RoomSyncPlayerStatus.SetExtraStatus(self, myExplorePlayerStatus.extraStatus); } else { coop_Model_RoomSyncPlayerStatus.SetExtraStatus(self, null); } } if (toClientId > 0) { MonoBehaviourSingleton <CoopNetworkManager> .I.SendTo(toClientId, coop_Model_RoomSyncPlayerStatus, false, null, null); } else { MonoBehaviourSingleton <CoopNetworkManager> .I.SendBroadcast(coop_Model_RoomSyncPlayerStatus, false, null, null); } } }
public PlayerRecord GetPlayer(int id, int?user_id = default(int?)) { int num = -1; if (user_id.HasValue) { num = user_id.Value; } PlayerRecord playerRecord = null; if (num > 0) { playerRecord = GetPlayerByUserId(num); } if (playerRecord != null) { CoopClient coopClient = MonoBehaviourSingleton <CoopManager> .I.coopRoom.clients.FindByUserId(num); if (coopClient != null) { playerRecord.id = coopClient.playerId; } } else { playerRecord = players.Find((PlayerRecord o) => o.id == id); if (playerRecord == null) { playerRecord = new PlayerRecord(); playerRecord.id = id; players.Add(playerRecord); } } return(playerRecord); }
public virtual bool isProgressStop() { if (!MonoBehaviourSingleton <InGameProgress> .IsValid()) { return(false); } bool result = false; if (MonoBehaviourSingleton <InGameProgress> .I.isGameProgressStop) { result = true; } else if (IsCoopNone() || IsOriginal()) { if (!MonoBehaviourSingleton <InGameProgress> .I.isBattleStart) { result = true; } } else if (MonoBehaviourSingleton <CoopManager> .IsValid()) { CoopClient coopClient = MonoBehaviourSingleton <CoopManager> .I.coopRoom.clients.FindByClientId(coopClientId); if (coopClient != null && !coopClient.IsBattleStart()) { result = true; } } return(result); }
public void OnRecvChatStamp(int fromClientId, Coop_Model_RoomChatStamp model) { CoopClient coopClient = clients.FindByClientId(fromClientId); if (!(coopClient == null)) { Player player = coopClient.GetPlayer(); if (Object.op_Implicit(player)) { player.ChatSayStamp(model.stampId); } else if (QuestManager.IsValidInGameExplore()) { ExplorePlayerStatus explorePlayerStatus = MonoBehaviourSingleton <QuestManager> .I.GetExplorePlayerStatus(model.userId); if (MonoBehaviourSingleton <UIInGameMessageBar> .IsValid() && MonoBehaviourSingleton <UIInGameMessageBar> .I.get_isActiveAndEnabled() && explorePlayerStatus != null) { MonoBehaviourSingleton <UIInGameMessageBar> .I.Announce(explorePlayerStatus.userName, model.stampId); } } if (chatConnection != null) { if (Object.op_Implicit(player)) { chatConnection.OnReceiveStamp(coopClient.userId, player.charaName, model.stampId); } else if (coopClient != null) { chatConnection.OnReceiveStamp(coopClient.userId, coopClient.GetPlayerName(), model.stampId); } } } }
public void OnRecvNotifyTraceBoss(int fromClientId, Coop_Model_RoomNotifyTraceBoss model) { if (MonoBehaviourSingleton <QuestManager> .IsValid()) { ExploreStatus.TraceInfo[] bossTraceHistory = MonoBehaviourSingleton <QuestManager> .I.GetBossTraceHistory(); if (bossTraceHistory == null || bossTraceHistory.Length <= 0 || bossTraceHistory[bossTraceHistory.Length - 1].mapId != model.mid) { bool reserve = false; CoopClient coopClient = clients.FindByClientId(fromClientId); string playerName = coopClient.GetPlayerName(); if (MonoBehaviourSingleton <InGameProgress> .IsValid() && MonoBehaviourSingleton <InGameProgress> .I.progressEndType == InGameProgress.PROGRESS_END_TYPE.NONE) { int num = 0; num = ((model.lc != 0) ? 8004 : 8003); string text = StringTable.Format(STRING_CATEGORY.IN_GAME, (uint)num, playerName); UIInGamePopupDialog.PushOpen(text, false, 1.22f); } else if (QuestManager.IsValidExplore()) { reserve = true; } if (QuestManager.IsValidExplore()) { MonoBehaviourSingleton <QuestManager> .I.UpdateBossTraceHistory(model.mid, model.lc, playerName, reserve); } } } }
private ExplorePlayerStatus GetPlayerStatus(CoopClient coopClient) { if (Object.op_Implicit(coopClient)) { return(GetPlayerStatus(coopClient.userId)); } return(null); }
public void OnRecvExploreBossDamage(int fromClientId, Coop_Model_RoomExploreBossDamage model) { CoopClient coopClient = clients.FindByClientId(fromClientId); if (coopClient != null) { MonoBehaviourSingleton <QuestManager> .I.UpdateExploreTotalDamageToBoss(coopClient, model.dmg); } }
public void UpdatePlayerStatus(CoopClient coopClient) { ExplorePlayerStatus playerStatus = GetPlayerStatus(coopClient); Player player = coopClient.GetPlayer(); if (playerStatus != null && Object.op_Implicit(player)) { playerStatus.SyncFromPlayer(player); } }
public bool OnRecvRoomLeaved(Coop_Model_RoomLeaved model) { CoopClient coopClient = clients.FindByClientId(model.cid); if (coopClient == null || coopClient.userToken != model.token) { Logd("OnRecvRoomLeaved: client not found. clientId={0}, client={1}", model.cid, coopClient); return(true); } OnLeaveClient(coopClient, model.stgid, model.stghostid); return(true); }
public void ForEach(Action <CoopClient> action) { int i = 0; for (int num = clientList.Length; i < num; i++) { CoopClient coopClient = clientList[i]; if (!(coopClient == null)) { action(coopClient); } } }
public CoopClient Find(Predicate <CoopClient> predicate) { int i = 0; for (int num = clientList.Length; i < num; i++) { CoopClient coopClient = clientList[i]; if (!(coopClient == null) && predicate(coopClient)) { return(coopClient); } } return(null); }
public int IndexOf(CoopClient client) { int i = 0; for (int num = clientList.Length; i < num; i++) { CoopClient coopClient = clientList[i]; if (coopClient.userId == client.userId) { return(i); } } return(-1); }
public CoopClient FindByClientId(int client_id) { for (int i = 0; i < clientList.Length; i++) { if (!(clientList[i] == null)) { CoopClient coopClient = clientList[i]; if (coopClient.clientId == client_id) { return(coopClient); } } } return(null); }
private void InitClients(List <int> ids, List <int> stgids, List <int> stgidxs, List <bool> stghosts) { DestroyAllClient(); int num = 0; int i = 0; for (int count = ids.Count; i < count; i++) { CoopClient coopClient = OnJoinClient(ids[i], stgids[i], stgidxs[i], stghosts[i], num); if (!coopClient.IsActivate()) { num++; } } }
public void SetSlotInfos(List <FieldModel.SlotInfo> slot_infos) { slotInfos = slot_infos; if (slotInfos != null) { int i = 0; for (int count = slotInfos.Count; i < count; i++) { FieldModel.SlotInfo slotInfo = slotInfos[i]; CoopClient coopClient = clients.FindByClientId(slotInfo.userId); if (coopClient != null) { coopClient.Activate(slotInfo.userId, slotInfo.token, slotInfo.userInfo, i); } } } }
public void OnRecvSyncPlayerStatus(int fromClientId, Coop_Model_RoomSyncPlayerStatus model) { if (QuestManager.IsValidExplore()) { CoopClient coopClient = clients.FindByClientId(fromClientId); if (model.hp <= 0 && Object.op_Implicit(coopClient)) { ExplorePlayerStatus explorePlayerStatus = MonoBehaviourSingleton <QuestManager> .I.GetExplorePlayerStatus(coopClient.userId); if (explorePlayerStatus != null && explorePlayerStatus.hp > 0 && MonoBehaviourSingleton <UIDeadAnnounce> .IsValid()) { MonoBehaviourSingleton <UIDeadAnnounce> .I.Announce(UIDeadAnnounce.ANNOUNCE_TYPE.DEAD, coopClient.GetPlayerName()); } } MonoBehaviourSingleton <QuestManager> .I.UpdateExplorePlayerStatus(coopClient, model); } }
public Player FindPlayer(Predicate <Player> predicate) { int i = 0; for (int num = clientList.Length; i < num; i++) { CoopClient coopClient = clientList[i]; if (!(coopClient == null)) { Player player = coopClient.GetPlayer(); if (player != null && predicate(player)) { return(player); } } } return(null); }
public void Remove(CoopClient client) { int num = 0; int num2 = clientList.Length; while (true) { if (num >= num2) { return; } if (clientList[num] == client) { break; } num++; } clientList[num] = null; }
public bool OnRecvRoomStageChanged(Coop_Model_RoomStageChanged model) { if (!IsActivate()) { return(true); } CoopClient coopClient = clients.FindByClientId(model.cid); if (coopClient == null) { Logd("OnRecvRoomStageChanged: client not found. clientId={0}", model.cid); return(true); } Logd("OnRecvRoomStageChanged: sid={0}, client={1}", model.sid, coopClient); coopClient.SetStage(model.stgid, model.stgidx, coopClient.clientId == model.stghostid); if (coopClient is CoopMyClient) { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnInitStage(model.stgid, model.stgidx, model.stghostid); MonoBehaviourSingleton <CoopNetworkManager> .I.SetRegisterSID(model.sid); } else if (model.pstgid == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId) { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnLeaveClient(coopClient, model.pstghostid); } else if (model.stgid == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId) { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnJoinClient(coopClient); } clients.ForEach(delegate(CoopClient c) { if (c.stageId == model.pstgid) { c.SetStageHost(c.clientId == model.pstghostid); } if (c.stageId == model.stgid) { c.SetStageHost(c.clientId == model.stghostid); } }); return(true); }
public void DestroyClient(CoopClient client) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!(client == null)) { Logd("destory client:{0}", client.clientId); if (CoopWebSocketSingleton <KtbWebSocket> .IsValidConnected()) { MonoBehaviourSingleton <KtbWebSocket> .I.RemoveResendPackets(client.clientId); } clients.Remove(client); client.Clear(); if (!(client is CoopMyClient)) { Logd("object destory client"); Object.Destroy(client.get_gameObject()); client = null; } } }
public void ActivatePlayerStatus(CoopClient coopClient) { ExplorePlayerStatus explorePlayerStatus = GetPlayerStatus(coopClient); if (explorePlayerStatus == null) { bool flag = coopClient is CoopMyClient; explorePlayerStatus = new ExplorePlayerStatus(coopClient.userInfo, flag); playerStatuses[coopClient.slotIndex] = explorePlayerStatus; if (flag) { selfPlayerStatus = explorePlayerStatus; } } explorePlayerStatus.Activate(coopClient); if (this.onChangeExploreMemberList != null) { this.onChangeExploreMemberList(); } }
private void OnLeaveClient(CoopClient client, int stgid, int stghostid) { Logd("OnLeaveClient: leave client. status={0} clientId={1} userid={2} token={3}", client.status, client.clientId, client.userId, client.userToken); if (!client.isLeave) { if (MonoBehaviourSingleton <CoopManager> .I.coopMyClient.IsBattleEnd()) { CoopClient.CLIENT_STATUS status = MonoBehaviourSingleton <CoopManager> .I.coopMyClient.status; Logd("OnLeaveClient: already my client is clear or leave({0}).", status); } else { client.OnRoomLeaved(); roomLeaveCnt++; if (isOwnerFirstClear && client.isPartyOwner) { SwitchOfflinePlay(); } else if (NeedsForceLeave()) { SwitchOfflinePlay(); } else { if (stgid == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId) { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnLeaveClient(client, stghostid); } if (client is CoopMyClient) { SwitchOfflinePlay(); } else { DestroyClient(client); } } } } }
public void RemovePlayerStatus(CoopClient coopClient) { int num = 0; while (true) { if (num >= 8) { return; } ExplorePlayerStatus explorePlayerStatus = playerStatuses[num]; if (explorePlayerStatus != null && explorePlayerStatus.userId == coopClient.userId) { break; } num++; } playerStatuses[num] = null; if (this.onChangeExploreMemberList != null) { this.onChangeExploreMemberList(); } }
public bool OnRecvRoomStageRequested(Coop_Model_RoomStageRequested model) { CoopClient coopClient = clients.FindByClientId(model.cid); if (coopClient == null) { return(true); } if (coopClient is CoopMyClient) { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnRequested(); } else { MonoBehaviourSingleton <CoopManager> .I.coopMyClient.WelcomeClient(model.cid); if (coopClient.stageId == MonoBehaviourSingleton <CoopManager> .I.coopStage.stageId) { MonoBehaviourSingleton <CoopManager> .I.coopStage.OnRequestedClient(coopClient); } } return(true); }
public PacketReceiver GetPacketReceiver(CoopPacket packet) { if (packet.destObjectId == 1000) { return(MonoBehaviourSingleton <CoopNetworkManager> .I.packetReceiver); } if (packet.destObjectId == 1001) { return(coopRoom.packetReceiver); } if (packet.destObjectId == 1002) { return(coopStage.packetReceiver); } if (packet.destObjectId == 1003) { CoopClient coopClient = coopRoom.clients.FindByClientId(packet.fromClientId); if (coopClient != null) { return(coopClient.packetReceiver); } } if (MonoBehaviourSingleton <StageObjectManager> .IsValid()) { StageObject stageObject = MonoBehaviourSingleton <StageObjectManager> .I.FindObject(packet.destObjectId); if (stageObject == null) { stageObject = MonoBehaviourSingleton <StageObjectManager> .I.FindCache(packet.destObjectId); } if (stageObject != null) { return(stageObject.packetReceiver); } } return(null); }
public void OnRecvNotifyEncounterBoss(int fromClientId, Coop_Model_RoomNotifyEncounterBoss model) { if (!QuestManager.IsValidInGameExplore() || !MonoBehaviourSingleton <QuestManager> .I.IsExploreBossMap()) { if (!MonoBehaviourSingleton <QuestManager> .I.IsEncountered() && MonoBehaviourSingleton <InGameProgress> .IsValid() && MonoBehaviourSingleton <InGameProgress> .I.progressEndType == InGameProgress.PROGRESS_END_TYPE.NONE) { CoopClient coopClient = clients.FindByClientId(fromClientId); MonoBehaviourSingleton <QuestManager> .I.SetMemberEncounteredMap(model.mid); uint currentQuestID = MonoBehaviourSingleton <QuestManager> .I.currentQuestID; QuestTable.QuestTableData questData = Singleton <QuestTable> .I.GetQuestData(currentQuestID); int mainEnemyID = questData.GetMainEnemyID(); string enemyName = Singleton <EnemyTable> .I.GetEnemyName((uint)mainEnemyID); string text = StringTable.Format(STRING_CATEGORY.IN_GAME, 8000u, coopClient.GetPlayerName(), enemyName); UIInGamePopupDialog.PushOpen(text, false, 1.22f); } if (QuestManager.IsValidExplore()) { MonoBehaviourSingleton <QuestManager> .I.UpdatePortalUsedFlag(model.pid); } } }
public int GetPlayerID(CoopClient client) { return(100000 + client.slotIndex); }
protected virtual void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) coopClient = this.get_gameObject().GetComponent <CoopClient>(); }
public void Init(InGameManager.IntervalTransferInfo transfer_info = null) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) Self self = null; if (transfer_info != null) { int i = 0; for (int count = transfer_info.playerInfoList.Count; i < count; i++) { InGameManager.IntervalTransferInfo.PlayerInfo playerInfo = transfer_info.playerInfoList[i]; Player player = null; CoopClient coopClient = null; if (MonoBehaviourSingleton <CoopManager> .IsValid() && !playerInfo.isSelf && playerInfo.coopClientId != 0) { coopClient = MonoBehaviourSingleton <CoopManager> .I.coopRoom.clients.FindByClientId(playerInfo.coopClientId); } if (playerInfo.isSelf) { player = CreatePlayer(0, playerInfo.createInfo, true, Vector3.get_zero(), 0f, playerInfo.transferInfo, null); if (player == null) { continue; } self = (player as Self); self.taskChecker = playerInfo.taskChecker; } else { bool flag = false; if (MonoBehaviourSingleton <CoopManager> .IsValid()) { if (MonoBehaviourSingleton <CoopManager> .I.coopRoom.isOfflinePlay) { flag = true; } else if (coopClient != null && coopClient.isLeave && MonoBehaviourSingleton <CoopManager> .I.isStageHost) { flag = true; } } if (flag || playerInfo.coopMode == StageObject.COOP_MODE_TYPE.NONE || playerInfo.coopMode == StageObject.COOP_MODE_TYPE.ORIGINAL) { player = CreatePlayer(playerInfo.id, playerInfo.createInfo, false, Vector3.get_zero(), 0f, playerInfo.transferInfo, null); if (player == null) { continue; } player.SetAppearPosGuest(Vector3.get_zero()); if (coopClient != null && playerInfo.isCoopPlayer) { coopClient.SetPlayerID(player.id); } } else { PlayerLoader.OnCompleteLoad callback = delegate(object o) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Player player2 = o as Player; player2.get_gameObject().SetActive(false); MonoBehaviourSingleton <StageObjectManager> .I.AddCacheObject(player2); }; player = CreatePlayer(playerInfo.id, playerInfo.createInfo, false, Vector3.get_zero(), 0f, playerInfo.transferInfo, callback); if (player == null) { continue; } if (coopClient != null) { coopClient.SetCachePlayer(player.id, playerInfo.isCoopPlayer); } } if (flag || playerInfo.isNpcController) { if (!(player.controller is NpcController)) { player.AddController <NpcController>(); } if (QuestManager.IsValidInGameDefenseBattle()) { player.DestroyObject(); } } } if (player.controller != null) { player.controller.SetEnableControll(false, ControllerBase.DISABLE_FLAG.BATTLE_START); } } } if (self == null) { self = CreateSelf(0, Vector3.get_zero(), 0f); if (self != null && self.controller != null) { self.controller.SetEnableControll(false, ControllerBase.DISABLE_FLAG.BATTLE_START); } } if (!(self == null)) { if (QuestManager.IsValidInGame() && !MonoBehaviourSingleton <InGameManager> .I.IsNeedInitBoss()) { self.SetAppearPosGuest(Vector3.get_zero()); } if (FieldManager.IsValidInGameNoQuest() || MonoBehaviourSingleton <QuestManager> .I.IsExplore() || MonoBehaviourSingleton <QuestManager> .I.IsWaveMatch()) { self.SetAppearPosField(); } } }