private void InitDispatchTeamCreature() { for (int i = 0; i < m_DispatchTeamSlotList.Count; ++i) { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } if (slot.CreatureIcon != null) { DestroyImmediate(slot.CreatureIcon.gameObject); } UIEventListener.Get(slot.CloseButton).onClick -= OnDispatchTeamSlotClose; UIEventListener.Get(slot.SlotObj).onClick -= OnDispatchSlotClick; UIEventListener.Get(slot.CloseButton).onClick = OnDispatchTeamSlotClose; UIEventListener.Get(slot.SlotObj).onClick = OnDispatchSlotClick; // 첫번째 슬롯 if (slot.iNum == 1) { slot.SetActiveSelect(true); } else { slot.SetActiveSelect(false); } } }
private void OnClickFriendItem(GameObject go) { if (go != null) { SoundManager.Instance.PlayFX(enSoundFXUI.BUTTON_MEDIUM); } for (int i = 0; i < _FriendList.Count; ++i) { DispatchTeamItemFriend friendItem = _FriendList[i]; if (friendItem == null) { continue; } friendItem.SetActiveSelect(false); if (friendItem.gameObject == go) { if (friendItem.bDispatching == true) { // 6747 친구 지원 // 6748 친구의 크리처는 1일 1회만 사용할 수 있습니다. SystemPopupWindow.Instance.SetSystemPopup(enSystemPopupType.Ok, StringTableManager.GetData(6747), StringTableManager.GetData(6748)); if (m_SelectFriend != null) { m_SelectFriend.SetActiveSelect(true); } break; } else { friendItem.SetActiveSelect(true); m_SelectFriend = friendItem; DispatchTeamSlot slot = m_DispatchTeamSlotList[m_DispatchTeamSlotList.Count - 1]; // 친구슬롯. if (slot != null) { if (slot.CreatureIcon != null) { DestroyDispatchTeamCreature(slot); } SetTeamCount(1); CreatureIcon creatureIcon = UIResourceMgr.CreatePrefab <CreatureIcon>(BUNDLELIST.PREFABS_UI_COMMON, slot.SlotObj.transform, "CreatureIcon"); creatureIcon.SetIcon(friendItem.FriendInfo.kCreatureID, enCreatureIcon_Type.DispatchDisplayFriend); creatureIcon.CreatureKey = friendItem.FriendInfo.kFriendCharNo; creatureIcon.AddPanel(m_iPanelDepth); creatureIcon.RemoveBoxCollider(); slot.CreatureIcon = creatureIcon; slot.SetActiveSelect(false); } } } } }
private void DispatchMissionStart(enSystemMessageFlag state) { if (state != enSystemMessageFlag.YES) { return; } bool bUseCreature = false; _stDispatchStartReq stDispatchStartReq = new _stDispatchStartReq(); stDispatchStartReq.kTeamIndex = m_DispatchRecvData.kTeamIndex; stDispatchStartReq.kMissionCategory = m_DispatchTableData.DispatchCategory; stDispatchStartReq.kDispatchSubID = m_DispatchTableData.DispatchEnum; stDispatchStartReq.vUseCreatureKey = new _vCreatureKey(); for (int i = 0; i < m_DispatchTeamSlotList.Count - 1; ++i) { DispatchTeamSlot TeamSlot = m_DispatchTeamSlotList[i]; if (TeamSlot == null) { continue; } ulong kCreatureKey = 0; if (TeamSlot.CreatureIcon != null) { kCreatureKey = TeamSlot.CreatureIcon.CreatureKey; bUseCreature = true; } stDispatchStartReq.vUseCreatureKey.Add(kCreatureKey); } if (bUseCreature == false) // 보낼 크리쳐가 없을때. { StartCoroutine(DispatchMissionStartFail()); //SystemPopupWindow.Instance.SetSystemPopup(enSystemPopupType.Ok, StringTableManager.GetData(4300), "크리쳐를 선택해주세요."); return; } DispatchTeamSlot slot = m_DispatchTeamSlotList[m_DispatchTeamSlotList.Count - 1]; // 친구슬롯. if (slot.CreatureIcon != null) { stDispatchStartReq.kUseFriendCharKey = slot.CreatureIcon.CreatureKey; } else { stDispatchStartReq.kUseFriendCharKey = 0; } CNetManager.Instance.SendPacket(CNetManager.Instance.DispatchProxy.DispatchStart, stDispatchStartReq, typeof(_stDispatchStartAck)); }
/// <summary> /// 왼쪽 편성에 속해있는 크리쳐 1개를 삭제. /// </summary> private void DestroyDispatchTeamCreature(DispatchTeamSlot slot) { if (slot.CreatureIcon == null) { return; } SetTeamCount(-1); _DispatchInfiniteScrollView.SetDispatchSelect(slot.CreatureIcon); DestroyImmediate(slot.CreatureIcon.gameObject); }
//=================================================================================== // // Event // //=================================================================================== private void OnDispatchTeamSlotClose(GameObject go) { if (go != null) { SoundManager.Instance.PlayFX(enSoundFXUI.BUTTON_MEDIUM); } int iDispatchTeamSlotCount = m_DispatchTeamSlotList.Count; for (int i = 0; i < iDispatchTeamSlotCount; ++i) { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } if (slot.CloseButton == go) { DestroyDispatchTeamCreature(slot); slot.SetActiveSelect(true); if (i < iDispatchTeamSlotCount - 1) { SetSlotType(enDispatchTeamSlotType.Creature); } else { SetSlotType(enDispatchTeamSlotType.Friend); for (int k = 0; k < _FriendList.Count; ++k) // 친구슬롯이면 선택된것들 다 해제. { DispatchTeamItemFriend friendItem = _FriendList[k]; if (friendItem == null) { continue; } friendItem.SetActiveSelect(false); } } } else { slot.SetActiveSelect(false); } } }
private void OnDispatchFriendListClose(GameObject go) { if (go != null) { SoundManager.Instance.PlayFX(enSoundFXUI.BUTTON_MEDIUM); } SetSlotType(enDispatchTeamSlotType.Creature); int iDispatchTeamSlotCount = m_DispatchTeamSlotList.Count; for (int i = 0; i < iDispatchTeamSlotCount; ++i) { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } slot.SetActiveSelect(false); } for (int i = 0; i < iDispatchTeamSlotCount; ++i) // 다음 선택될 칸을 지정한다. { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } if (slot.CreatureIcon == null) { slot.SetActiveSelect(true); break; } } }
private void OnDispatchSlotClick(GameObject go) { if (go != null) { SoundManager.Instance.PlayFX(enSoundFXUI.BUTTON_MEDIUM); } int iDispatchTeamSlotCount = m_DispatchTeamSlotList.Count; for (int i = 0; i < iDispatchTeamSlotCount; ++i) { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } if (slot.SlotObj == go) { if (i < iDispatchTeamSlotCount - 1) { SetSlotType(enDispatchTeamSlotType.Creature); } else { SetSlotType(enDispatchTeamSlotType.Friend); } slot.SetActiveSelect(true); } else { slot.SetActiveSelect(false); } } }
private void SetDispatchCreature(CreatureIcon CreatureListIcon) { int iDispatchTeamSlotCount = m_DispatchTeamSlotList.Count - 1; if (CreatureListIcon.IsDispatchSelect == false) // 크리쳐를 추가할때 { bool bAddCreature = false; for (int i = 0; i < iDispatchTeamSlotCount; ++i) { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } if (slot.bSelect == true) { if (slot.CreatureIcon != null) { DestroyDispatchTeamCreature(slot); } SetTeamCount(1); CreatureIcon creatureIcon = UIResourceMgr.CreatePrefab <CreatureIcon>(BUNDLELIST.PREFABS_UI_COMMON, slot.SlotObj.transform, "CreatureIcon"); creatureIcon.SetIcon(CreatureListIcon.CreatureKey, enCreatureIcon_Type.DispatchDisplay); creatureIcon.AddPanel(m_iPanelDepth); creatureIcon.RemoveBoxCollider(); slot.CreatureIcon = creatureIcon; slot.SetActiveSelect(false); CreatureListIcon.SetDispatchSelectNumberLabel(slot.iNum.ToString()); CreatureListIcon.SetActiveDispatchSelect(true); bAddCreature = true; break; } } if (bAddCreature == true) { for (int i = 0; i < iDispatchTeamSlotCount; ++i) // 다음 선택될 칸을 지정한다. { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } if (slot.CreatureIcon == null) { slot.SetActiveSelect(true); break; } } } } else if (CreatureListIcon.IsDispatchSelect == true) // 추가된 크리쳐를 뺄때 { for (int i = 0; i < iDispatchTeamSlotCount; ++i) { DispatchTeamSlot slot = m_DispatchTeamSlotList[i]; if (slot == null) { continue; } slot.SetActiveSelect(false); if (slot.CreatureIcon != null) { if (slot.CreatureIcon.CreatureKey == CreatureListIcon.CreatureKey) { CreatureListIcon.SetActiveDispatchSelect(false); DestroyDispatchTeamCreature(slot); slot.SetActiveSelect(true); } } } } }