备份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,395 @@
using asap.core;
using cfg;
using GameCore;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public partial class FishingRodPanel : BasePanel
{
private readonly List<Perk> _levelPerkList = new List<Perk>();
List<Button> level_peark_btns = new List<Button>();
Image title_image;
TMP_Text text_name;
StarItemRoot starItemRoot;
Button btn_review;
Button btn_appearance;
Button btn_change_right;
Button btn_change_left;
GameObject btn_equip_go;
GameObject equipped;
GameObject btn_levelup_gray;
GameObject btn_levelup;
GameObject btn_promote_go;
GameObject btn_waytoget_go;
GameObject btn_combine_go;
[Header("升级")]
public RodLevelAttributeRoot rodLevelAttributeRoot;
public GameObject fx_rodpanel_upgrade_change;
Button btn_upgrade;
TMP_Text text_bar;
Button btn_upgrade_gray;
TMP_Text text_bar_gray;
Button btn_equip;
Button btn_promote;
Button btn_waytoget;
Button btn_combine;
TMP_Text icon_cost_num_combine;
Image icon_ticket_combine;
Button btn_ascend;
GameObject btn_ascend_locked;
GameObject btn_ascend_redpoint;
GameObject btn_honorlevel;
TMP_Text text_honorlevel;
GameObject btn_honorlevel_locked;
TMP_Text text_level;
TMP_Text text_tips;
int requireNum;
string toastPanelString;
void InitLevelUpPanel()
{
text_level = LevelRoot.Find("level_info/perks/level/text_num").GetComponent<TMP_Text>();
btn_upgrade = LevelRoot.Find("btn_all/btn_levelup/btn_green").GetComponent<Button>();
text_bar = LevelRoot.Find("btn_all/btn_levelup/icon_cost/text_num").GetComponent<TMP_Text>();
btn_upgrade_gray = LevelRoot.Find("btn_all/btn_levelup_gray/btn_green").GetComponent<Button>();
text_bar_gray = LevelRoot.Find("btn_all/btn_levelup_gray/icon_cost/text_num").GetComponent<TMP_Text>();
text_tips = LevelRoot.Find("btn_all/btn_levelup_gray/text_tips").GetComponent<TMP_Text>();
btn_promote = LevelRoot.Find("btn_all/btn_promote/btn_green").GetComponent<Button>();
btn_equip = LevelRoot.Find("btn_all/btn_equip/btn_green").GetComponent<Button>();
btn_waytoget = LevelRoot.Find("btn_all/btn_waytoget/btn_green").GetComponent<Button>();
btn_combine = LevelRoot.Find("btn_all/btn_combine/btn_green").GetComponent<Button>();
btn_combine.onClick.AddListener(Combine);
btn_upgrade.onClick.AddListener(OnClickLevelUp);
btn_upgrade_gray.onClick.AddListener(OnClickUpgradeGray);
btn_equip.onClick.AddListener(OnClickEquip);
//btn_upgrade_info.onClick.AddListener(OnClickUpgrade);
btn_ascend = LevelRoot.Find("level_info/perks/btn_ascend").GetComponent<Button>();
btn_ascend_locked = LevelRoot.Find("level_info/perks/btn_ascend/locked").gameObject;
btn_ascend_redpoint = LevelRoot.Find("level_info/perks/btn_ascend/redpoint").gameObject;
btn_ascend.onClick.AddListener(OnClickAscend);
btn_honorlevel = LevelRoot.Find("level_info/perks/btn_honorlevel").gameObject;
text_honorlevel = btn_honorlevel.transform.Find("text_level").GetComponent<TMP_Text>();
btn_honorlevel_locked = btn_honorlevel.transform.Find("locked").gameObject;
var rodBasicStats = _tables.TbRodBasicStats.DataList;
for (int i = 0; i < 3; i++)
{
rodLevelAttributeRoot.rodAttributes[i].icon.sprite = uIService.GetSprite(rodBasicStats[i].Icon);
int index = i;
Button btn = rodLevelAttributeRoot.rodAttributes[i].button;
btn.onClick.AddListener(() =>
{
ShowAttributes(index, btn.transform);
});
}
title_image = LevelRoot.Find("star/bg").GetComponent<Image>();
text_name = LevelRoot.Find("star/text_name").GetComponent<TMP_Text>();
starItemRoot = LevelRoot.Find("star").GetComponent<StarItemRoot>();
btn_review = LevelRoot.Find("btn_review").GetComponent<Button>();
btn_appearance = LevelRoot.Find("btn_appearance").GetComponent<Button>();
btn_change_right = LevelRoot.Find("btn_change_right").GetComponent<Button>();
btn_change_left = LevelRoot.Find("btn_change_left").GetComponent<Button>();
btn_equip_go = LevelRoot.Find("btn_all/btn_equip").gameObject;
equipped = LevelRoot.Find("btn_all/btn_equipped").gameObject;
btn_levelup = LevelRoot.Find("btn_all/btn_levelup").gameObject;
btn_levelup_gray = LevelRoot.Find("btn_all/btn_levelup_gray").gameObject;
btn_promote_go = LevelRoot.Find("btn_all/btn_promote").gameObject;
btn_waytoget_go = LevelRoot.Find("btn_all/btn_waytoget").gameObject;
btn_combine_go = LevelRoot.Find("btn_all/btn_combine").gameObject;
icon_cost_num_combine = LevelRoot.Find("btn_all/btn_combine/cost/icon_cost_1/text_num").GetComponent<TMP_Text>();
icon_ticket_combine = LevelRoot.Find("btn_all/btn_combine/cost/icon_cost_1/icon_ticket").GetComponent<Image>();
Transform perks = LevelRoot.Find("level_info/perks");
for (int i = 1; i < 5; i++)
{
_levelPerkList.Add(perks.Find($"perk{i}").GetComponent<Perk>());
level_peark_btns.Add(perks.Find($"perk{i}/bg").GetComponent<Button>());
}
for (int i = 0; i < level_peark_btns.Count; i++)
{
int index = i;
level_peark_btns[i].onClick.AddListener(() =>
{
ShowPerk(index, _levelPerkList[index].transform);
});
}
btn_change_left.onClick.AddListener(OnClickLeft);
btn_change_right.onClick.AddListener(OnClickRight);
btn_review.onClick.AddListener(ShowFishingRodInfoPanel);
btn_appearance.onClick.AddListener(ShowAppearance);
btn_promote.onClick.AddListener(ShowHonorlevel);
btn_waytoget.onClick.AddListener(ShowWaytoget);
}
public void Combine()
{
OnClickUpgrade();
//重新生成鱼竿
GameObject rodGo = rodAvatar[skin.Fbx];
if (rodGo != null)
{
Destroy(rodGo);
}
rodAvatar.Remove(skin.Fbx);
LoadRodAsync(skin.Fbx);
}
void ShowWaytoget()
{
if (GContext.container.Resolve<PlayerShopData>().IsShopOpen)
{
UIManager.Instance.ShowUI(new UIType("FishingRodWaytogetPopupPanel"));
}
else
{
var t = _tables.TbFishingEvent.GetOrDefault(GContext.container.Resolve<PlayerShopData>().shopTipforUnlocked);
var param = t.ConditionList[0].Param[0];
ToastPanel.Show(LocalizationMgr.GetFormatTextValue("UI_FishingRodPanel_Advanced_45", param));
}
}
async void ShowHonorlevel()
{
await UIManager.Instance.ShowUI(new UIType("FishingRodHonorlevelPanel"));
UIManager.Instance.DestroyUI(gameObject.name);
}
void SetLevelStar()
{
RodData _rodData = data.config;
int star = GContext.container.Resolve<PlayerFishData>().GetRodPiece(_rodData.ID);
starItemRoot.SetStar(star, curRodAscend.MaxAscent);
}
void OnClickLeft()
{
int index = data.sort;
index--;
if (index < 0)
{
index = rodItemDatas.Count - 1;
}
Debug.Log("OnClickLeft" + index);
PlayAni(index);
}
void OnClickRight()
{
int index = data.sort;
index++;
if (index >= rodItemDatas.Count)
{
index = 0;
}
Debug.Log("OnClickRight" + index);
PlayAni(index);
}
void PlayAni(int index)
{
OnClickItem(rodItemDatas[index]);
ani.Play("FishingRodPanel_switch");
AnimationState animationState = ani["FishingRodPanel_switch"];
// 将动画时间设置为 0即从头开始
animationState.time = 0f;
starItemRoot.ShowStar(data.star, curRodAscend.MaxAscent);
}
void OnClickAscend()
{
if (data.isLock)
{
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_111"));
return;
}
ShowAscendRoot(true);
OpenAscendRoot();
effect_yugan_shengji.SetActive(false);
fx_rodpanel_upgrade_change.SetActive(false);
}
void OnClickEquip()
{
if (data.config.ID == GContext.container.Resolve<PlayerData>().equipRodID || data.isLock)
{
return;
}
if (loading.activeSelf)
{
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_26"));
return;
}
GContext.container.Resolve<PlayerData>().SetEquipRodID(data.config.ID);
btn_equip_go.gameObject.SetActive(false);
equipped.SetActive(true);
ToastPanel.Show(LocalizationMgr.GetText("UI_ToastPanel_11"));
GContext.Publish(new VibrationData(HapticTypes.Success));
}
void OnClickUpgradeGray()
{
GContext.Publish(new VibrationData(HapticTypes.Failure));
ToastPanel.Show(toastPanelString);
}
void OnClickLevelUp()
{
effect_yugan_shengji.SetActive(false);
fx_rodpanel_upgrade_change.SetActive(false);
effect_yugan_shengji.SetActive(true);
fx_rodpanel_upgrade_change.SetActive(true);
data.level++;
GContext.container.Resolve<PlayerFishData>().RodLevelUp(data.config.ID, requireNum);
SetPanelData();
}
void SetLevel()
{
RodData rodData = data.config;
RodLevelup rodLevelup = _tables.TbRodLevelup.GetOrDefault(rodData.LevelupID);
bool isMax = rodLevelup.MaxLevel <= data.level;
btn_levelup.SetActive(!isMax && !data.isLock);
btn_levelup_gray.SetActive(false);
btn_promote_go.SetActive(isMax);
btn_ascend.gameObject.SetActive(!data.isMax);
btn_ascend_redpoint.SetActive(!data.isMax && playerFishData.CheckUpgrade(rodData));
btn_honorlevel.SetActive(data.isMax);
btn_ascend_locked.gameObject.SetActive(data.isLock);
btn_honorlevel_locked.gameObject.SetActive(!isMax);
text_level.text = data.level.ToString();
if (!isMax)
{
var fragment = GContext.container.Resolve<PlayerData>().pearl;
requireNum = rodLevelup.LevelupConsume[data.level];
string progressText = $"<color=green>{fragment}</color>/{requireNum}";
text_bar.text = progressText;
var values = playerFishData.GetRodAttribute(rodData.ID);
int curValue;
for (int i = 0; i < values.Count; i++)
{
curValue = values[i];
rodLevelAttributeRoot.rodAttributes[i].value.text = curValue.ToString();
}
int star = playerFishData.GetRodPiece(rodData.ID);
List<int> Millestones = rodLevelup.Millestones;
int maxLevel = data.level + 1;
for (int i = 0; i < Millestones.Count; i++)
{
if (i == star)
{
maxLevel = Millestones[i];
}
}
if (maxLevel <= data.level)
{
btn_levelup.SetActive(false);
btn_levelup_gray.SetActive(!data.isLock);
text_bar_gray.transform.parent.gameObject.SetActive(false);
text_tips.gameObject.SetActive(true);
if (star == 0)
{
toastPanelString = LocalizationMgr.GetFormatTextValue("UI_ToastPanel_109", star + 1);
}
else
{
toastPanelString = LocalizationMgr.GetFormatTextValue("UI_ToastPanel_110", star + 1);
}
text_tips.text = LocalizationMgr.GetFormatTextValue("UI_FishingRodPanel_Advanced_28", star + 1); ;
return;
}
if (fragment < requireNum)
{
btn_levelup.SetActive(false);
btn_levelup_gray.SetActive(!data.isLock);
text_bar_gray.transform.parent.gameObject.SetActive(true);
text_tips.gameObject.SetActive(false);
progressText = $"<color=red>{fragment}</color>/{requireNum}";
text_bar_gray.text = progressText;
toastPanelString = LocalizationMgr.GetText("UI_ToastPanel_12");
}
}
else
{
var values = playerFishData.GetRodAttribute(rodData.ID);
for (int i = 0; i < values.Count; i++)
{
var curValue = values[i];
rodLevelAttributeRoot.rodAttributes[i].value.text = curValue.ToString();
}
}
SetHonorlevel();
}
void InitPearksData()
{
if (data == null)
{
return;
}
RodData rodData = data.config;
int perkIDListCount = curRodAscend.PerkIDList.Count;
int star = playerFishData.GetRodPiece(rodData.ID);
var perkUnlockOrder = curRodAscend.PerkUnlockOrder;
int[] lv = playerFishData.GetPerkLevel(perkIDListCount, star, curRodAscend.DefaultPerk, perkUnlockOrder);
for (int i = 0; i < _levelPerkList.Count; i++)
{
if (i < perkIDListCount)
{
_levelPerkList[i].gameObject.SetActive(true);
_levelPerkList[i].SetData(curRodAscend.PerkIDList[i], lv[i], config.Quality);
}
else
{
_levelPerkList[i].gameObject.SetActive(false);
}
}
}
/*
* var values = playerFishData.GetHonorLevelAttribute(rodData.Quality);
int count = infoRodAttribute.rodAttributes.Count;
for (int i = 0; i < count; i++)
{
if (i < values.Count && values[i] > 0)
{
infoRodAttribute.rodAttributes[i].text_hornor_add.text = $"/+{values[i]}";
}
else
{
infoRodAttribute.rodAttributes[i].text_hornor_add.text = "";
}
}
* */
void SetHonorlevel()
{
text_honorlevel.text = playerFishData.GetHonorLevel(data.config.Quality).ToString();
}
}