备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using asap.core;
using cfg;
using GameCore;
using TMPro;
public class EventReport : ReportBase
{
TMP_Text text_info;
protected override void Awake()
{
base.Awake();
text_info = transform.Find("info/text_info").GetComponent<TMP_Text>();
}
public void SetData(string playFabId, string content, ReportDataType reportDataType)
{
if (reportDataType == ReportDataType.Bomb)
{
text_info.text = LocalizationMgr.GetText("UI_HomePanel_101010");
}
else if (reportDataType == ReportDataType.Heist)
{
text_info.text = LocalizationMgr.GetFormatTextValue("UI_HomePanel_101009", content);
}
else if (reportDataType == ReportDataType.Aquarium)
{
string[] str = content.Split('#');
string aquariumId = "";
if (str.Length > 3 && int.TryParse(str[3], out int itemID))
{
Item fishItem = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(itemID);
if (fishItem != null)
{
int q = fishItem.Quality;
if (q > 6) { q = 6; }
aquariumId = LocalizationMgr.GetText($"UI_FishingMapPanel_10101{q+1}");
}
}
if (str.Length > 4 && bool.TryParse(str[4], out bool result) && result)
{
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventReportPopupPanel_8", aquariumId);
}
else
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventReportPopupPanel_7", aquariumId);
}
Init(playFabId);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80bb253a9a3ffef44b406ecfa102c12b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,89 @@
using asap.core;
using cfg;
using game;
using GameCore;
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class EventReportPopupItem : ReportBase
{
TMP_Text text_info;
GameObject icon_time;
GameObject icon_bomb;
GameObject icon_bankheist;
GameObject icon_lure;
GameObject icon_hunting;
TMP_Text text_time;
override protected void Awake()
{
base.Awake();
text_info = transform.Find("info/text_info").GetComponent<TMP_Text>();
icon_time = transform.Find("icon_time").gameObject;
icon_bomb = transform.Find("icon_bomb").gameObject;
icon_bankheist = transform.Find("icon_bankheist").gameObject;
icon_lure = transform.Find("icon_lure").gameObject;
icon_hunting = transform.Find("icon_hunting").gameObject;
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
}
public void SetData(EventPopupData eventPopupData)
{
icon_lure.SetActive(eventPopupData.type == ReportDataType.Energy);
icon_bomb.SetActive(eventPopupData.type == ReportDataType.Bomb);
icon_bankheist.SetActive(eventPopupData.type == ReportDataType.Heist);
icon_hunting.SetActive(eventPopupData.type == ReportDataType.Aquarium);
switch (eventPopupData.type)
{
case ReportDataType.Bomb:
text_info.text = LocalizationMgr.GetText("UI_HomePanel_101010");
break;
case ReportDataType.Heist:
text_info.text = LocalizationMgr.GetFormatTextValue("UI_HomePanel_101009", eventPopupData.content);
break;
case ReportDataType.Picture:
text_info.text = LocalizationMgr.GetText("UI_HomePanel_101008");
break;
case ReportDataType.Energy:
text_info.text = LocalizationMgr.GetText("UI_EventReportPopupPanel_6");
break;
case ReportDataType.Aquarium:
string[] str = eventPopupData.content.Split('#');
string aquariumId = "";
if (str.Length > 3 && int.TryParse(str[3], out int itemID))
{
Item fishItem = GContext.container.Resolve<Tables>().TbItem.GetOrDefault(itemID);
if (fishItem != null)
{
Image icon_rate = transform.Find("icon_hunting/head/icon_rate").GetComponent<Image>();
Image icon_fish = transform.Find("icon_hunting/head/mask_fish/icon_fish").GetComponent<Image>();
IUIService uIService = GContext.container.Resolve<IUIService>();
uIService.SetImageSprite(icon_rate, "icon_fish_rate_tag_" + fishItem.Quality);
PlayerFishData.SetFishIcon(icon_fish, fishItem);//鱼头像
int q = fishItem.Quality;
if (q > 6) { q = 6; }
aquariumId = LocalizationMgr.GetText($"UI_FishingMapPanel_10101{q + 1}");
}
}
if (str.Length > 4 && bool.TryParse(str[4], out bool result) && result)
{
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventReportPopupPanel_8", aquariumId);
}
else
text_info.text = LocalizationMgr.GetFormatTextValue("UI_EventReportPopupPanel_7", aquariumId);
break;
default:
gameObject.SetActive(false);
break;
}
DateTime dateTime = ZZTimeHelper.UtcNow();
var now = dateTime - eventPopupData.createTime;
text_time.text = LocalizationMgr.GetFormatTextValue("UI_FishingMailPopupPanel_6", ConvertTools.ConvertTime3(now));
Init(eventPopupData.playerID);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7b5bf64a938fb264983720d7acee67f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,52 @@
using asap.core;
using game;
using GameCore;
using UnityEngine;
using UnityEngine.UI;
public class EventReportPopupPanel : ReportPopupPanel
{
Button btn_close;
Button btn_enter;
GameObject reward;
Button btn_green;
int energyAddCount;
private void Awake()
{
clubService = GContext.container.Resolve<ClubService>();
text_empty = transform.Find("root/text_empty").gameObject;
panelScroll = transform.Find("root/ScrollView").gameObject;
eventReportPopupItem = transform.Find("root/ScrollView/Viewport/Content/Item1").gameObject;
eventReportPopupItem.SetActive(false);
Content = transform.Find("root/ScrollView/Viewport/Content");
btn_close = transform.Find("btn_close").GetComponent<Button>();
btn_enter = transform.Find("root/btn_enter/btn_green").GetComponent<Button>();
reward = transform.Find("reward").gameObject;
btn_green = transform.Find("reward/btn_play/btn_green").GetComponent<Button>();
energyAddCount = clubService.GetEnergyAddCount();
reward.SetActive(energyAddCount > 0);
}
protected override void Start()
{
//mask.onClick.AddListener(Close);
btn_close.onClick.AddListener(Close);
btn_enter.onClick.AddListener(Close);
btn_green.onClick.AddListener(Close);
base.Start();
}
void Close()
{
if (energyAddCount > 0)
{
energyAddCount = 0;
ItemData itemData = new ItemData();
itemData.id = 1001;
itemData.count = GContext.container.Resolve<cfg.Tables>().TbGlobalConfig.ClubLureDonateReward;
GContext.Publish(new ShowData(itemData));
GContext.Publish(new ShowData());
}
UIManager.Instance.DestroyUI(UITypes.EventReportPopupPanel);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a06a79d2f2d034e48b3e788bf3edfb79
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using asap.core;
using cfg;
using game;
using System;
using TMPro;
using UniRx;
using UnityEngine;
public class PhotoReport : ReportBase
{
//PictureAttribute pictureAttribute;
protected override void Awake()
{
base.Awake();
//pictureAttribute = transform.Find("album_photo/Item").GetComponent<PictureAttribute>();
}
public void SetData(Picture _data, string playFabId)
{
//pictureAttribute.Init(_data);
Init(playFabId);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28b4110f036f7e444aaccac77acfcf6e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
using asap.core;
using game;
using System;
using TMPro;
using UniRx;
using UnityEngine;
public class ReportBase : MonoBehaviour
{
TMP_Text text_name;
Head head;
IUserService userService;
IDisposable disposable;
string playFabId;
protected virtual void Awake()
{
userService = GContext.container.Resolve<IUserService>();
disposable = GContext.OnEvent<GetClubPlayInfoEvent>().Where(x => x.id == playFabId).Subscribe(SetAvatar);
text_name = transform.Find("info/text_name")?.GetComponent<TMP_Text>();
head = transform.Find("btn_head").GetComponent<Head>();
}
public void Init(string playFabId)
{
this.playFabId = playFabId;
PlayInfo clubPlayInfo = userService.GetPlayInfo(playFabId);
SetAvatar(clubPlayInfo);
}
void SetAvatar(PlayInfo clubPlayInfo)
{
if (clubPlayInfo != null)
{
if (text_name != null)
{
text_name.text = clubPlayInfo.name;
}
head.SetData(clubPlayInfo.avatarUrl);
}
}
void SetAvatar(GetClubPlayInfoEvent getClubPlayInfoEvent)
{
if (getClubPlayInfoEvent.id == playFabId)
{
text_name.text = getClubPlayInfoEvent.name;
head.SetData(getClubPlayInfoEvent.avatarUrl);
}
}
private void OnDestroy()
{
disposable?.Dispose();
disposable = null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d4c838b626d214b44ba53048794782e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
using asap.core;
using cfg;
using System;
using UnityEngine;
using UniRx;
public class ReportPanel : MonoBehaviour
{
PhotoReport photoReport;
EventReport eventReport;
Tables tables;
IReportService reportService;
IDisposable disposable;
bool isEnable = true;
private void Awake()
{
reportService = GContext.container.Resolve<IReportService>();
tables = GContext.container.Resolve<Tables>();
photoReport = transform.Find("photo_report").GetComponent<PhotoReport>();
eventReport = transform.Find("Event_report").GetComponent<EventReport>();
}
private void OnEnable()
{
disposable = GContext.OnEvent<ReportData>().Subscribe(OnReportEvent);
//NextReport();
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
}
void OnReportEvent(ReportData reportEvent)
{
switch (reportEvent.type)
{
case ReportDataType.Picture:
//PlayPhotoReport(reportEvent);
break;
case ReportDataType.Bomb:
case ReportDataType.Heist:
case ReportDataType.Aquarium:
PlayEventReport(reportEvent);
break;
default:
break;
}
}
async void PlayPhotoReport(ReportData reportEvent)
{
Picture _data = tables.TbPicture.GetOrDefault(reportEvent.id);
if (_data != null)
{
photoReport.gameObject.SetActive(true);
photoReport.SetData(_data, reportEvent.playFabId);
await Awaiters.Seconds(4f);
if (!isEnable)
{
return;
}
photoReport.gameObject.SetActive(false);
}
NextReport();
}
async void PlayEventReport(ReportData reportEvent)
{
eventReport.gameObject.SetActive(true);
eventReport.SetData(reportEvent.playFabId, reportEvent.content, reportEvent.type);
await Awaiters.Seconds(4f);
if (!isEnable)
{
return;
}
eventReport.gameObject.SetActive(false);
NextReport();
}
void NextReport()
{
if (this == null || enabled == false)
{
return;
}
var data = reportService.GetReportData();
if (data != null)
{
OnReportEvent(data);
}
}
private void OnDestroy()
{
isEnable = false;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb7f220a3c61d274486a55c0633bde29
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,100 @@
using asap.core;
using game;
using System;
using System.Collections.Generic;
using System.Linq;
using UniRx;
using UnityEngine;
public class ReportPopupPanel : MonoBehaviour
{
protected GameObject eventReportPopupItem;
protected List<EventReportPopupItem> eventReportPopupItems = new List<EventReportPopupItem>();
protected Transform Content;
protected GameObject text_empty;
protected GameObject panelScroll;
protected ClubService clubService;
IDisposable disposable;
protected virtual void Start()
{
disposable = GContext.OnEvent<ReportData>().Subscribe(OnReportEvent);
SetData();
}
public void SetData()
{
List<EventPopupData> eventPopupDatas = clubService.eventPopupDatas.OrderByDescending(c => c.createTime).Take(40).ToList();
bool isEmpty = eventPopupDatas == null || eventPopupDatas.Count == 0;
text_empty.SetActive(isEmpty);
panelScroll.gameObject.SetActive(!isEmpty);
if (isEmpty)
{
return;
}
List<EventPopupData> eventPopupDatasCopy = new List<EventPopupData>();
for (int i = 0; i < eventPopupDatas.Count; i++)
{
if (eventPopupDatas[i].type == ReportDataType.Bomb || eventPopupDatas[i].type == ReportDataType.Heist
|| eventPopupDatas[i].type == ReportDataType.Aquarium)
{
eventPopupDatasCopy.Add(eventPopupDatas[i]);
}
else if (eventPopupDatas[i].type == ReportDataType.Energy && eventPopupDatas[i].content.Contains("%"))
{
string[] content = eventPopupDatas[i].content.Split("#");
for (int j = 0; j < content.Length; j++)
{
string[] contentSplit = content[j].Split("%");
EventPopupData eventPopupData = new EventPopupData();
eventPopupData.type = ReportDataType.Energy;
if (!DateTime.TryParse(contentSplit[0], out DateTime createTime))
{
createTime = ZZTimeHelper.UtcNow().UtcNowOffset();
}
eventPopupData.createTime = createTime;
eventPopupData.playerID = contentSplit[1];
eventPopupDatasCopy.Add(eventPopupData);
}
}
//if (eventPopupDatasCopy.Count >= 40)
//{
// break;
//}
}
isEmpty = eventPopupDatasCopy.Count == 0;
text_empty.SetActive(isEmpty);
panelScroll.gameObject.SetActive(!isEmpty);
if (isEmpty)
{
return;
}
//按时间排序
eventPopupDatasCopy.Sort((a, b) => b.createTime.CompareTo(a.createTime));
for (int i = 0; i < eventPopupDatasCopy.Count; i++)
{
EventReportPopupItem item;
if (eventReportPopupItems.Count > i)
{
item = eventReportPopupItems[i];
}
else
{
GameObject go = Instantiate(eventReportPopupItem, Content);
go.SetActive(true);
item = go.GetComponent<EventReportPopupItem>();
eventReportPopupItems.Add(item);
}
item.SetData(eventPopupDatasCopy[i]);
}
}
public void OnReportEvent(ReportData reportEvent)
{
SetData();
}
private void OnDestroy()
{
disposable?.Dispose();
disposable = null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2e9da1a123408545b9d00c4471b5200
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: