fix:1、添加项目

This commit is contained in:
2026-04-22 09:52:55 +08:00
commit 173cfb2dc9
5871 changed files with 600870 additions and 0 deletions
@@ -0,0 +1,243 @@
namespace FlowerPower
{
using System;
using System.Collections.Generic;
using FairyGUI;
using FGUI.P20_MainTab;
using Newtonsoft.Json;
using Spine.Unity;
using UnityEngine;
public class MainTabUI : BaseUI
{
private MainTabUICtrl ctrl;
private MainTabModel model;
private FGUI.P20_MainTab.com_main_tab ui;
private Action closeCallBack;
private static int mTabIndex = 1;
public static int mLastIndex = 1;
private bool exitH5Task;
private Action closeCallback;
public MainTabUI(MainTabUICtrl ctrl) : base(ctrl)
{
uiName = UIConst.MainTabUI;
this.ctrl = ctrl;
}
protected override void SetUIInfo(UIInfo uiInfo)
{
uiInfo.packageName = "P20_MainTab";
uiInfo.assetName = "com_main_tab";
uiInfo.layerType = UILayerType.Top;
uiInfo.isNeedOpenAnim = false;
uiInfo.isNeedCloseAnim = false;
uiInfo.isNeedUIMask = false;
}
#region
protected override void OnInit()
{
}
protected override void OnClose()
{
CommonHelper.FadeOut(ui);
mLastIndex = 1;
mTabIndex = 1;
CloseAllTabView();
}
protected override void OnBind()
{
ui = baseUI as FGUI.P20_MainTab.com_main_tab;
}
protected override void OnOpenBefore(object args)
{
if (args != null)
{
mTabIndex = (int)args;
}
CheckH5Task();
InitView();
}
private void CloseAllTabView()
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.TujianUI_Close);
uiCtrlDispatcher.Dispatch(UICtrlMsg.MainUI_Close);
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Close);
}
protected override void OnOpen(object args)
{
CommonHelper.FadeIn(ui);
}
#endregion
#region
protected override void AddListener()
{
GameDispatcher.Instance.AddListener(GameMsg.MainTab, OnGameTab);
}
protected override void RemoveListener()
{
GameDispatcher.Instance.RemoveListener(GameMsg.MainTab, OnGameTab);
}
#endregion
private void CheckH5Task(object obj = null)
{
exitH5Task = false;
}
private void InitView()
{
ui.com_tab.btn_shop.SetClickDownEffect(0.8f, 1);
ui.com_tab.btn_main.SetClickDownEffect(0.8f, 1);
ui.com_tab.btn_pintu.SetClickDownEffect(0.8f, 1);
ui.com_tab.btn_main.SetClick(OnClickMainTab);
ui.com_tab.btn_shop.SetClick(OnClickShopTab);
ui.com_tab.btn_pintu.SetClick(OnClickPintuTab);
OnGameTab(mTabIndex);
}
private void OnClickShopTab()
{
OnGameTab(1);
}
private void OnClickMainTab()
{
OnGameTab(2);
}
private void OnClickPintuTab()
{
OnGameTab(3);
}
private void OnGameTab(object obj = null)
{
if (obj != null)
{
mTabIndex = (int)obj;
}
OnChangeTab(mTabIndex);
OnClickTab(mTabIndex);
}
private void OnChangeTab(int tabIndex)
{
ui.com_tab.btn_shop.cont_tab.selectedIndex = tabIndex == 1 ? 1 : 0;
ui.com_tab.btn_main.cont_tab.selectedIndex = tabIndex == 2 ? 1 : 0;
ui.com_tab.btn_pintu.cont_tab.selectedIndex = tabIndex == 3 ? 1 : 0;
}
public static void SwapElements<T>(List<T> list, int index1, int index2)
{
if (index1 >= 0 && index1 < list.Count && index2 >= 0 && index2 < list.Count)
{
(list[index2], list[index1]) = (list[index1], list[index2]);
}
else
{
throw new ArgumentOutOfRangeException("One or both of the provided indices are out of range.");
}
}
private void OnClickTab(int tabIndex)
{
GGraph node = null;
if (tabIndex == 1) {
node = ui.com_tab.btn_shop.ani_click;
} else if (tabIndex == 2) {
node = ui.com_tab.btn_main.ani_click;
} else {
node = ui.com_tab.btn_pintu.ani_click;
}
var fx_logo = FXManager.Instance.SetFx<SkeletonAnimation>(node, Fx_Type.fx_click, ref closeCallback);
fx_logo.state.SetAnimation(0, "animation", false);
if (mLastIndex == tabIndex)
{
return;
}
var isH5Tab = tabIndex == 5;
if (mLastIndex == 1)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.BuygoldUI_Close, false);
uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex == 2 ? true : false);
uiCtrlDispatcher.Dispatch(tabIndex == 3 ? UICtrlMsg.TujianUI_Open : UICtrlMsg.TujianUI_Close, tabIndex == 3 ? true : false);
}
else if (mLastIndex == 2)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.MainUI_Close, tabIndex < 2 ? true : false);
buygoldParam param = new buygoldParam() {
isShow1 = false,
is_in_game = false
};
uiCtrlDispatcher.Dispatch(tabIndex == 1 ? UICtrlMsg.BuygoldUI_Open : UICtrlMsg.BuygoldUI_Close, param);
uiCtrlDispatcher.Dispatch(tabIndex == 3 ? UICtrlMsg.TujianUI_Open : UICtrlMsg.TujianUI_Close, tabIndex == 3 ? true : false);
}
else if (mLastIndex == 3)
{
uiCtrlDispatcher.Dispatch(UICtrlMsg.TujianUI_Close, true);
buygoldParam param = new buygoldParam() {
isShow1 = false,
is_in_game = false
};
uiCtrlDispatcher.Dispatch(tabIndex == 1 ? UICtrlMsg.BuygoldUI_Open : UICtrlMsg.BuygoldUI_Close, param);
uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex == 2 ? false : true);
}
// uiCtrlDispatcher.Dispatch(tabIndex == 2 ? UICtrlMsg.MainUI_Open : UICtrlMsg.MainUI_Close, tabIndex < 2 ? true : false);
// uiCtrlDispatcher.Dispatch(isH5Tab ? UICtrlMsg.BackgroundUI_Close : UICtrlMsg.BackgroundUI_Open);
mLastIndex = tabIndex;
if (isH5Tab)
{
// AudioManager.Instance.StopBGM();
}
else
{
//背景音乐
AudioManager.Instance.PlayBGM(AudioConst.hallbgm);
}
if (PreferencesMgr.Instance.IsLastH5Tab != isH5Tab)
{
PreferencesMgr.Instance.IsLastH5Tab = isH5Tab;
}
}
}
}