| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 | 
							- using System;
 
- using System.Linq;
 
- using Core.Language;
 
- using Excel2Json;
 
- using Fort23.UTool;
 
- namespace Fort23.Mono
 
- {
 
-     [UIBinding(prefab = "PlacesInfoWidget")]
 
-     public partial class PlacesInfoWidget : UIComponent
 
-     {
 
-         private AccountFileInfo.SmallPlacesData currentSmallPlacesData;
 
-         private AccountFileInfo.SmallPlacesData lastSmallPlacesData;
 
-         private SmallPlacesConfig smallPlacesConfig;
 
-         private Action<bool> callBack;
 
-         private void Init()
 
-         {
 
-         }
 
-         public override void AddEvent()
 
-         {
 
-         }
 
-         public override void DelEvent()
 
-         {
 
-         }
 
-         public override void AddButtonEvent()
 
-         {
 
-             Btn_Qianwang.onClick.AddListener(async () =>
 
-             {
 
-                 if (smallPlacesConfig.ID == 0)
 
-                     return;
 
-                 SmallPlacesConfig lastSmallPlacesConfig =
 
-                     ConfigComponent.Instance.Get<SmallPlacesConfig>(smallPlacesConfig.ID - 1);
 
-                 if (smallPlacesConfig.ID > 1 && (lastSmallPlacesData == null ||
 
-                                                  lastSmallPlacesData.completionEventCount <
 
-                                                  lastSmallPlacesConfig.CompletionEventCount))
 
-                 {
 
-                     TipMessagePanel.OpenTipMessagePanel(
 
-                         LanguageManager.Instance.Text(10375, lastSmallPlacesConfig.CompletionEventCount));
 
-                     return;
 
-                 }
 
-                 if (lastSmallPlacesConfig.UnlockEnvetid != 0)
 
-                 {
 
-                     AccountFileInfo.EventList eventList =
 
-                         AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>
 
-                             ce.eventID == lastSmallPlacesConfig.UnlockEnvetid);
 
-                     EventConfig eventConfig =
 
-                         ConfigComponent.Instance.Get<EventConfig>(lastSmallPlacesConfig.UnlockEnvetid);
 
-                     if (eventList == null || !eventList.isCompleted)
 
-                     {
 
-                         TipMessagePanel.OpenTipMessagePanel(
 
-                             LanguageManager.Instance.Text(10376, LanguageManager.Instance.Text(eventConfig.EventName)));
 
-                         return;
 
-                     }
 
-                 }
 
-                 if (smallPlacesConfig.ID == PlayerManager.Instance.CurrentsmallPlaces.id)
 
-                 {
 
-                     await UIManager.Instance.HideUIUIPanel<LevelChoosePanel>();
 
-                     await UIManager.Instance.HideUIUIPanel<PlacesInfoPanel>();
 
-                     return;
 
-                 }
 
-                 PlacesInfoPanel placesInfoPanel = UIManager.Instance.GetComponent<PlacesInfoPanel>();
 
-                 if (placesInfoPanel != null && !placesInfoPanel.IsClose)
 
-                 {
 
-                     placesInfoPanel.isChange = true;
 
-                 }
 
-                 SmallPlacesConfig currentSmallPlacesConfig =
 
-                     ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
 
-                 await UIManager.Instance.HideUIUIPanel<LevelChoosePanel>();
 
-                 await UIManager.Instance.HideUIUIPanel<PlacesInfoPanel>();
 
-                 await PlayerManager.Instance.ChangeMap(smallPlacesConfig.ID);
 
-                 if (currentSmallPlacesConfig.PlacesId == smallPlacesConfig.PlacesId)
 
-                 {
 
-                     PlacesChangeInfoPanel placesChangeInfoPanel =
 
-                         await PlacesChangeInfoPanel.OpenPanel(smallPlacesConfig.ID);
 
-                     await placesChangeInfoPanel.UIClosed();
 
-                 }
 
-                 else
 
-                 {
 
-                     BigPlacesChangeInfoPanel bigPlacesChangeInfoPanel =
 
-                         await BigPlacesChangeInfoPanel.OpenPanel(smallPlacesConfig.PlacesId);
 
-                     await bigPlacesChangeInfoPanel.UIClosed();
 
-                 }
 
-                 callBack?.Invoke(true);
 
-                 callBack = null;
 
-             });
 
-             Btn_Jiesuo.onClick.AddListener(async () =>
 
-             {
 
-                 if (smallPlacesConfig.ID == 0)
 
-                     return;
 
-                 //解锁下一个地图
 
-                 if (currentSmallPlacesData == null && IsSmallPlacesDataUlock(smallPlacesConfig.ID))
 
-                 {
 
-                     PlacesInfoPanel placesInfoPanel = UIManager.Instance.GetComponent<PlacesInfoPanel>();
 
-                     if (placesInfoPanel != null && !placesInfoPanel.IsClose)
 
-                     {
 
-                         placesInfoPanel.isChange = true;
 
-                     }
 
-                     await UIManager.Instance.HideUIUIPanel<LevelChoosePanel>();
 
-                     await UIManager.Instance.HideUIUIPanel<PlacesInfoPanel>();
 
-                     SmallPlacesConfig currentSmallPlacesConfig =
 
-                         ConfigComponent.Instance.Get<SmallPlacesConfig>(PlayerManager.Instance.CurrentsmallPlaces.id);
 
-                     //切换下一个地图
 
-                     await PlayerManager.Instance.ChangeMap(smallPlacesConfig.ID);
 
-                     if (currentSmallPlacesConfig.PlacesId == smallPlacesConfig.PlacesId)
 
-                     {
 
-                         PlacesChangeInfoPanel placesChangeInfoPanel =
 
-                             await PlacesChangeInfoPanel.OpenPanel(smallPlacesConfig.ID);
 
-                         await placesChangeInfoPanel.UIClosed();
 
-                     }
 
-                     else
 
-                     {
 
-                         BigPlacesChangeInfoPanel bigPlacesChangeInfoPanel =
 
-                             await BigPlacesChangeInfoPanel.OpenPanel(smallPlacesConfig.PlacesId);
 
-                         await bigPlacesChangeInfoPanel.UIClosed();
 
-                     }
 
-                     callBack?.Invoke(true);
 
-                     callBack = null;
 
-                 }
 
-             });
 
-         }
 
-         public void CustomInit(int smallPlacesId, Action<bool> callBack)
 
-         {
 
-             this.callBack = callBack;
 
-             smallPlacesConfig = ConfigComponent.Instance.Get<SmallPlacesConfig>(smallPlacesId);
 
-             Text_Name.text = LanguageManager.Instance.Text(smallPlacesConfig.placeName);
 
-             Text_Desc.text = LanguageManager.Instance.Text(smallPlacesConfig.placeDesc);
 
-             lastSmallPlacesData = PlayerManager.Instance.GetSmallPlacesData(smallPlacesConfig.ID - 1);
 
-             currentSmallPlacesData = PlayerManager.Instance.GetSmallPlacesData(smallPlacesConfig.ID);
 
-             Btn_Qianwang.gameObject.SetActive(PlayerManager.Instance.CurrentsmallPlaces.id != smallPlacesConfig.ID);
 
-             Icon_DIdian.gameObject.SetActive(PlayerManager.Instance.CurrentsmallPlaces.id != smallPlacesConfig.ID);
 
-             Icon_Places.icon_name = smallPlacesConfig.placeIcon;
 
-             bool isUlock = IsSmallPlacesDataUlock(smallPlacesConfig.ID);
 
-             if (currentSmallPlacesData == null && isUlock)
 
-             {
 
-                 Text_Tips.text = "";
 
-                 Icon_Marsk.gameObject.SetActive(true);
 
-                 Btn_Jiesuo.gameObject.SetActive(true);
 
-             }
 
-             else if (!isUlock)
 
-             {
 
-                 Icon_Marsk.gameObject.SetActive(true);
 
-                 Text_Tips.text = GetSmallPlacesDataTips(smallPlacesConfig.ID);
 
-                 Btn_Jiesuo.gameObject.SetActive(false);
 
-             }
 
-             else
 
-             {
 
-                 Icon_Marsk.gameObject.SetActive(false);
 
-                 Btn_Jiesuo.gameObject.SetActive(false);
 
-             }
 
-         }
 
-         private string GetSmallPlacesDataTips(int id)
 
-         {
 
-             SmallPlacesConfig smallPlacesConfig = ConfigComponent.Instance.Get<SmallPlacesConfig>(id);
 
-             AccountFileInfo.SmallPlacesData lastSmallPlacesData =
 
-                 PlayerManager.Instance.GetSmallPlacesData(smallPlacesConfig.ID - 1);
 
-             SmallPlacesConfig lastSmallPlacesConfig =
 
-                 ConfigComponent.Instance.Get<SmallPlacesConfig>(smallPlacesConfig.ID - 1);
 
-             if (smallPlacesConfig.ID > 1 && (lastSmallPlacesData == null ||
 
-                                              lastSmallPlacesData.completionEventCount <
 
-                                              lastSmallPlacesConfig.CompletionEventCount))
 
-             {
 
-                 return LanguageManager.Instance.Text(10375, lastSmallPlacesConfig.CompletionEventCount);
 
-             }
 
-             if (lastSmallPlacesConfig.UnlockEnvetid != 0)
 
-             {
 
-                 AccountFileInfo.EventList eventList =
 
-                     AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>
 
-                         ce.eventID == lastSmallPlacesConfig.UnlockEnvetid);
 
-                 if (eventList == null || !eventList.isCompleted)
 
-                 {
 
-                     EventConfig eventConfig =
 
-                         ConfigComponent.Instance.Get<EventConfig>(lastSmallPlacesConfig.UnlockEnvetid);
 
-                     return LanguageManager.Instance.Text(10376, LanguageManager.Instance.Text(eventConfig.EventName));
 
-                 }
 
-             }
 
-             AccountFileInfo.SmallPlacesData currentSmallPlacesData =
 
-                 PlayerManager.Instance.GetSmallPlacesData(smallPlacesConfig.ID);
 
-             if (currentSmallPlacesData == null)
 
-             {
 
-                 return LanguageManager.Instance.Text(10377);
 
-             }
 
-             return "";
 
-         }
 
-         private bool IsSmallPlacesDataUlock(int id)
 
-         {
 
-             AccountFileInfo.SmallPlacesData lastSmallPlacesData =
 
-                 PlayerManager.Instance.GetSmallPlacesData(id - 1);
 
-             SmallPlacesConfig lastSmallPlacesConfig =
 
-                 ConfigComponent.Instance.Get<SmallPlacesConfig>(id - 1);
 
-             if (id > 1 && (lastSmallPlacesData == null ||
 
-                            lastSmallPlacesData.completionEventCount <
 
-                            lastSmallPlacesConfig.CompletionEventCount))
 
-             {
 
-                 return false;
 
-             }
 
-             if (lastSmallPlacesConfig.UnlockEnvetid != 0)
 
-             {
 
-                 AccountFileInfo.EventList eventList =
 
-                     AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce =>
 
-                         ce.eventID == lastSmallPlacesConfig.UnlockEnvetid);
 
-                 if (eventList == null || !eventList.isCompleted)
 
-                 {
 
-                     return false;
 
-                 }
 
-             }
 
-             return true;
 
-         }
 
-     }
 
- }
 
 
  |