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
+203
View File
@@ -0,0 +1,203 @@
namespace FlowerPower
{
using System;
using FairyGUI;
using Spine.Unity;
using UnityEngine;
using System.Collections.Generic;
using Object = UnityEngine.Object;
public class FXManager : BaseUnityManager<FXManager>
{
private string fxPath = "Effect/sys/";
FXPool<Fx_Type> fx_ObjMonoObjPool;
private Transform goWrapperPar;
public override void Init()
{
base.Init();
GameObject obj = new GameObject("FX_Pool");
obj.transform.parent = transform;
obj.transform.localPosition = Vector3.zero;
obj.transform.localEulerAngles = Vector3.zero;
fx_ObjMonoObjPool = new FXPool<Fx_Type>(obj.transform);
fx_ObjMonoObjPool.NewObjFunc = NewObjFunc;
fx_ObjMonoObjPool.GetObjFunc = GetObjFunc;
fx_ObjMonoObjPool.RecObjFunc = RecObjFunc;
}
private void RecObjFunc(Fx_Type arg1, Object arg2)
{
var componet = arg2 as Component;
if (componet)
componet.gameObject.SetActive(false);
else
{
(arg2 as GameObject).SetActive(false);
}
}
private void GetObjFunc(Fx_Type arg1, Object arg2)
{
var componet = arg2 as Component;
if (componet)
componet.gameObject.SetActive(true);
else
{
(arg2 as GameObject).SetActive(true);
}
}
private Object NewObjFunc(Fx_Type arg)
{
if ((int)arg < 100)
{
var go = LoadKit.Instance.LoadGameObjectAndCloneSync("Effect.spine." + arg, arg.ToString());
SkeletonAnimation sk = go.GetComponent<SkeletonAnimation>();
return sk;
}
else
{
fxPath = "Effect.sys." + arg;
var go = LoadKit.Instance.LoadGameObjectAndCloneSync(fxPath, arg.ToString());
ParticleSystem particleSystem = go.GetComponent<ParticleSystem>();
if (particleSystem == null)
{
particleSystem = go.GetComponentInChildren<ParticleSystem>();
}
if (particleSystem != null)
{
foreach (var item in particleSystem.GetComponentsInChildren<ParticleSystem>())
{
var main = item.main;
main.scalingMode = ParticleSystemScalingMode.Hierarchy;
}
particleSystem.transform.localScale = Vector3.one * 100;
return particleSystem;
}
return go;
}
}
public T GetFx<T>(Fx_Type fx_Type) where T : Object
{
T obj = fx_ObjMonoObjPool.GetObject<T>(fx_Type);
SkeletonAnimation ani = obj as SkeletonAnimation;
if (ani != null)
{
ani.gameObject.layer = 0;
ani.ClearState();
ani.transform.localPosition = Vector3.zero;
ani.transform.localEulerAngles = Vector3.zero;
}
return obj;
}
public void RecFx<T>(Fx_Type fx_Type, T obj) where T : Object
{
fx_ObjMonoObjPool.RecObject(fx_Type, obj);
}
public List<GameObject> gameObjects = new List<GameObject>();
public override void Dispose()
{
base.Dispose();
fx_ObjMonoObjPool.Dispose();
}
private Queue<GoWrapper> goWrapperQueue = new Queue<GoWrapper>();
public T SetFx<T>(GGraph gp, Fx_Type fx_Type, ref Action Rec) where T : Component
{
var fx = GetFx<T>(fx_Type);
if (fx != null)
{
var goWrapper = new GoWrapper(fx.gameObject);
gp.SetNativeObject(goWrapper);
fx.transform.localPosition = Vector3.zero;
fx.transform.localScale = Vector3.one * 100;
fx.transform.localEulerAngles = Vector3.zero;
Rec += () =>
{
goWrapper.wrapTarget = null;
gp.SetNativeObject(null);
RecFx(fx_Type, fx);
};
}
return fx;
}
public GameObject SetFx(GGraph gp, Fx_Type fx_Type, ref Action Rec, bool supportStencil = false)
{
GameObject fx = GetFx<GameObject>(fx_Type);
if (fx != null)
{
var goWrapper = new GoWrapper(fx.gameObject);
gp.SetNativeObject(goWrapper);
fx.transform.localPosition = Vector3.zero;
fx.transform.localScale = Vector3.one * 100;
fx.transform.localEulerAngles = Vector3.zero;
Rec += () =>
{
goWrapper.wrapTarget = null;
gp.SetNativeObject(null);
RecFx(fx_Type, fx);
};
}
return fx;
}
}
public enum Fx_Type
{
None = -1,
gamwin,
fx_add,
fx_click,
fx_coin,
fx_hall,
fx_luck_gift,
fx_login,
fx_hand_pre,
fx_open,
fx_pack,
fx_pass,
fx_wheel,
fx_disaappear_01,
fx_disaappear_02,
fx_first_reward,
fx_broad,
fx_shop,
fx_sign,
fx_tips,
fx_three_gift,
fx_tujian,
fx_lock,
fx_lose,
fx_wins,
fx_title_effect,
fx_win,
fx_logo,
fx_ad,
fx_petty_reward,
fx_btn_start,
fx_powerup,
fx_proplight,
fx_free_idle = 104,
fx_ui_jinbi_click = 107,
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9cde96b619c044d99e1f59d178df68cd
timeCreated: 1681806251
+182
View File
@@ -0,0 +1,182 @@
namespace FlowerPower
{
using System;
using UnityEngine;
using System.Collections.Generic;
using Unity.VisualScripting;
using IgnoreOPS;
public class HallManager : BaseUnityManager<HallManager>
{
public event Action UpdateSecondEvent;
public event Action UpdateFiveSecondEvent;
private float _secondTime;
private float _secondTime1;
private LoginModel loginModel;
private bool isGameStart;
private GameDataSystem gameDataSys;
private WindowSystem windowSys;
private RewardSystem rewardSys;
private ConsumeSystem consumeSys;
private bool isFirstEnter = true;
public int enterHallTimes = 0;
public bool isShowRankView = false;
public event Action UpdateEvent;
public int countTimes = 0;
public int activeTime = 0;
public override void Init()
{
CtrlDispatcher.Instance.AddListener(CtrlMsg.Game_Start, OnGameStart);
GameDispatcher.Instance.AddListener(GameMsg.OpenGame, EnterGame);
GameDispatcher.Instance.AddListener(GameMsg.BackMainScene, EnterHall);
AppDispatcher.Instance.AddListener(MainThreadMsg.App_Focus_True, BackToGame);
InitSystem();
}
private void InitSystem()
{
gameDataSys = new GameDataSystem();
windowSys = new WindowSystem();
rewardSys = new RewardSystem();
consumeSys = new ConsumeSystem();
}
void BackToGame(object obj = null)
{
if (MaxPayManager.isPay)
{
MaxPayManager.isPay = false;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
MaxPayManager.Instance.PaySuccess();
}
var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
newDate = newDate.AddSeconds(GameHelper.GetNowTime(true));
// Debug.Log($"barry newdate==== {newDate}");
var newDays = newDate.Day;
}
private void OnGameStart(object obj)
{
var lang = PlayerPrefsKit.ReadString("LangIdKey");
if (lang.IsNullOrWhiteSpace())
{
lang = "en";
}
if (GameHelper.GetLoginModel().new_player)
{
SaveData.GetSaveobject().ExchangeModeToggle = ConfigSystem.GetConfig<CommonModel>().ExchangeModeToggle;
SaveData.GetSaveobject().ExchangeProcessMode = ConfigSystem.GetConfig<CommonModel>().ExchangeProcessMode;
SaveData.GetSaveobject().CHProcessMode = ConfigSystem.GetConfig<CommonModel>().CHProcessMode;
}
PurchasingManager.Instance.InitProduct();
UIManager.Instance.SetSwitchLanguage(lang);
EnterHall();
UnityManager.Instance.initACTData();
isGameStart = true;
bool enterGame = CommonHelper.GetBoolByChance(ConfigSystem.GetConfig<CommonModel>().roomrate / 100f);
// if (GameHelper.IsGiftSwitch() && enterGame)
// {
// if (!SaveData.GetSaveobject().have_slot && UnityEngine.Random.Range(0, 100) < ConfigSystem.GetConfig<CommonModel>().BonusInside)
// {
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AddviewnewUI_Open);
// }
// else
// {
EnterGame(enterGame);
// }
// }
}
private void EnterHall(object obj = null)
{
int index = obj != null ? (int)obj : 2;
enterHallTimes++;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PlayUI_Close);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardAniUI_Close);
AudioManager.Instance.StopBGM();
AudioManager.Instance.PlayBGM(AudioConst.hallbgm);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Open, index);
if (GameHelper.IsGiftSwitch()) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BroadcastUI_Open);
GameHelper.PlayGameTimeEvent(1);
}
private void EnterGame(object obj)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open);
AudioManager.Instance.StopBGM();
AudioManager.Instance.PlayBGM(AudioConst.gamebgm);
}
#region
public void GetGalleryNet(int imageID, Action<bool> action = null)
{
StartCoroutine(TextureHelper.GetGalleryFromNet(imageID, action));
}
#endregion
public void Update()
{
if (!isGameStart) return;
UpdateEvent?.Invoke();
_secondTime += Time.deltaTime;
_secondTime1 += Time.deltaTime;
if (_secondTime >= 1)
{
_secondTime = 0;
activeTime++;
if (UpdateSecondEvent == null)
{
Debug.Log("xxxxxxx");
}
UpdateSecondEvent?.Invoke();
}
if (_secondTime1 >= 5)
{
_secondTime1 = 0;
UpdateFiveSecondEvent?.Invoke();
}
}
public void AddChangeGiftSwitch(Action action)
{
}
public void RemoveChangeGiftSwitch(Action action)
{
}
void OnApplicationQuit()
{
PreferencesMgr.Instance.ImmediateSendSave();
}
private bool isInH5;
public void SetInH5(bool isInH5)
{
this.isInH5 = isInH5;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b0f6f2d2a8a4351902376d77d27b4e8
timeCreated: 1681804729
+38
View File
@@ -0,0 +1,38 @@
using UnityEngine;
namespace FlowerPower
{
public class NetworkManager : BaseUnityManager<NetworkManager>
{
#if FlowerPowerRelease
public static string crazyUrl => true ? DomainReleaseUrl : DomainDebugUrl;
#else
public static string crazyUrl => false ? DomainReleaseUrl : DomainDebugUrl;
#endif
public const string DomainRelease = "flowerlazypower.fun";
//is debug test--------
public const string DomainDebugUrl = @"https://sandbox-api.swhitegames.tech/api/";
public static readonly string DomainReleaseUrl = $"https://{DomainRelease}/api/";
public const string identifier = "com.lazydoggygame.flowerpower";
private LoginSystem loginSystem;
private ConfigSystem configSystem;
private PlayDataSystem playDataSystem;
public static bool haveSimCard = false;
public override void Init()
{
InitSystem();
}
private void InitSystem()
{
loginSystem = new LoginSystem();
configSystem = new ConfigSystem();
playDataSystem = new PlayDataSystem();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 54f9fcd655e04ba99afa430eec09c068
timeCreated: 1681976638
+246
View File
@@ -0,0 +1,246 @@
using System;
using System.IO;
using UnityEngine;
using System.Collections.Generic;
namespace FlowerPower
{
public sealed partial class PreferencesMgr : BaseInterfaceManager<PreferencesMgr>
{
private Preferences preferences;
private DataDispatcher dataDispatcher;
private PlayData c2s_preferencesMsg;
private ObjectPool<KeyValue> keyValuePool;
private List<KeyValue> autoSaveList;
public override void Init()
{
base.Init();
AddListener();
c2s_preferencesMsg = new PlayData
{
data = new Dictionary<string, object>()
};
keyValuePool = new ObjectPool<KeyValue>();
autoSaveList = new List<KeyValue>();
}
public override void StartUp()
{
base.StartUp();
dataDispatcher = DataDispatcher.Instance;
//HACK preferences服务器数据实时存储
TimerHelper.UnscaleGeneral.AddLoopTimer(60, OnAutoDelaySave);
}
public override void DisposeBefore()
{
base.DisposeBefore();
ImmediateSendSave();
}
public override void Dispose()
{
base.Dispose();
RemoveListener();
//autoSaveTimer.Dispose();
keyValuePool.Dispose();
}
private void AddListener()
{
AppDispatcher.Instance.AddListener(AppMsg.App_Pause_True, ImmediateSendSave);
}
private void RemoveListener()
{
AppDispatcher.Instance.RemoveListener(AppMsg.App_Pause_True, ImmediateSendSave);
}
public void InitPreferences()
{
LoginModel loginModel = ModuleManager.Instance.GetModel(ModelConst.LoginModel) as LoginModel;
preferences = new Preferences();
if (!loginModel.new_player)
{
preferences = ReadServerPreferencesCache();
var ser_dataVer = loginModel.play_data_ver;
if (preferences == null || ser_dataVer > preferences.data_ver)
{
preferences = loginModel.preferences;
}
if (preferences == null)
{
preferences = new Preferences();
}
}
else
{
PlayerPrefs.DeleteAll();
NetworkKit.SetCacheToken(loginModel.token);
PlayerPrefs.Save();
}
SaveServerPreferencesCache(preferences);
OnInitPreferences();
}
private void AutoSaveList(List<KeyValue> autolist)
{
if (autolist == null || autolist.Count == 0) return;
foreach (KeyValue item in autolist)
{
Save(item.key, item.value);
keyValuePool.Release(item);
}
autolist.Clear();
}
private void AddDataVer()
{
++Data_ver;
}
/// <summary>
/// 立即发送保存
/// </summary>
public void ImmediateSendSave(object arg = null)
{
AutoSaveList(autoSaveList);
PreferencesSendSave();
}
private void OnAutoDelaySave(TimerTask timerInfo)
{
AutoSaveList(autoSaveList);
PreferencesSendSave();
}
#region
#region
private void AddToAutoDelaySaveList(string key, object value)
{
KeyValue item = keyValuePool.Get();
item.key = key;
item.value = value;
autoSaveList.Add(item);
// ImmediateSendSave();
}
private void Save<T>(string key, T data)
{
c2s_preferencesMsg.data[key] = data;
}
#endregion
private void ClearPreferencesDic()
{
// c2s_preferencesMsg.data.Clear();
}
private long timeSave = 0;
private long unsaveCount = 0;
private void PreferencesSendSave()
{
if (c2s_preferencesMsg == null || c2s_preferencesMsg.data.Count == 0) return;
AddDataVer();
SaveServerPreferencesCache(preferences);
try
{
if (unsaveCount < 3)
{
if (timeSave > 0 && GameHelper.GetNowTime() - timeSave < 3)
{
unsaveCount++;
return;
}
}
unsaveCount = 0;
timeSave = GameHelper.GetNowTime();
var data = SerializeUtil.ToObject<Dictionary<string, object>>(SerializeUtil.ToJson(preferences));
NetworkDispatcher.Instance.Dispatch(NetworkMsg.SavePlayData, data);
}
catch (Exception e)
{
Debug.LogError(e);
throw;
}
ClearPreferencesDic();
}
#endregion
#region
public Preferences GetPreferences()
{
return preferences;
}
/// <summary>
/// 保存Preferences缓存服务器数据
/// </summary>
public static void SaveServerPreferencesCache(Preferences preferences)
{
var text = SerializeUtil.ToJson(preferences);
if (!Directory.Exists(PlayerPrefsConst.CachePath + "/.."))
{
Directory.CreateDirectory(PlayerPrefsConst.CachePath + "/..");
}
File.WriteAllText(PlayerPrefsConst.CachePath, text);
}
/// <summary>
/// 读取Preferences缓存服务器数据
/// </summary>
public static Preferences ReadServerPreferencesCache()
{
Preferences preferences = null;
var path = PlayerPrefsConst.CachePath;
if (File.Exists(path))
{
try
{
string text = File.ReadAllText(path);
if (string.IsNullOrEmpty(text))
{
// Debug.LogError("[JsonEncryptUtil]ReadFormLocalFile decryptedString Fail: " + path);
preferences = null;
}
preferences = SerializeUtil.ToObject<Preferences>(text);
}
catch (Exception)
{
// Debug.LogError("[LoginLocalCache]ReadServerPreferencesCache Fail!");
}
}
return preferences;
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a99b010c051c8764b8de691284c7310c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: