This commit is contained in:
2026-07-15 16:19:07 +08:00
parent 64bad7c077
commit 544f4b2d01
7963 changed files with 447731 additions and 972637 deletions
@@ -0,0 +1,193 @@
namespace ScrewsMaster
{
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_login,
fx_signin,//2024年9月12日添加
fx_title,
fx_title_light,
fx_prize_wheel,
fx_rabbit,
fx_savepot_icon,
fx_broad,
fx_tips,
fx_savepot,
fx_hand_pre,
fx_main_ad,
fx_disaappear_1,
fx_disaappear_2,
fx_first_reward,
fx_lose,
fx_win,
fx_win_light,
fx_three_gift,
fx_title_effect,
fx_free_idle = 104,
fx_ui_jinbi_click = 107,
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9cde96b619c044d99e1f59d178df68cd
timeCreated: 1681806251
@@ -0,0 +1,228 @@
namespace ScrewsMaster
{
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
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;
public QuestionBank selectedQuestionbankVo;
public event Action UpdateEvent;
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();
}
private void OnGameStart(object obj)
{
var lang = PlayerPrefsKit.ReadString("LangIdKey");
if (lang.IsNullOrWhiteSpace())
{
lang = "en";
}
PurchasingManager.Instance.InitProduct();
AudioManager.Instance.PlayBGM("game_bgm");
UIManager.Instance.SetSwitchLanguage(lang);
EnterHall();
isGameStart = true;
}
private void EnterHall(object obj = null)
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardAniUI_Close);
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SheepPlayUI_Open);
// Debug.Log("dakaiyouxijiemian");
// AudioManager.Instance.PlayBGM(AudioConst.MainBg);
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Open);
if (GameHelper.IsGiftSwitch()) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BroadcastUI_Open);
GameHelper.PlayGameTimeEvent(3);
}
void BackToGame(object obj = null)
{
Debug.Log("BackToGame----");
if (MaxPayManager.isPay)
{
MaxPayManager.isPay = false;
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
MaxPayManager.Instance.PaySuccess();
}
// DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
// newDate = newDate.AddSeconds(GameHelper.GetNowTime());
// var newDays = newDate.Day;
// var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
// if (last_time != newDays)
// {
// var config = ConfigSystem.GetConfig<CommonModel>();
// if (config == null)
// {
// return;
// }
// SaveData.GetSaveobject().onlineRewardsTimes = 0;
// }
}
private void EnterGame(object obj)
{
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close);
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
var questionDatas = obj as List<GameQuestionData>;
}
#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;
UpdateSecondEvent?.Invoke();
}
if (_secondTime1 >= 5)
{
_secondTime1 = 0;
UpdateFiveSecondEvent?.Invoke();
}
}
public List<GameQuestionData> RandomSelectQuestions(QuestionBank vo, bool isGuide = false)
{
var questionDatas = new List<GameQuestionData>();
int needGenerate = CommonHelper.RandomRange(ConfigSystem.GetConfig<CommonModel>().quiznum);
int temp = needGenerate;
while (temp > 0)
{
var questionModel = QuestionBankKit.GetQuestionTable(vo, isGuide);
bool isAdd = true;
foreach (var gameQuestionData in questionDatas)
{
if (gameQuestionData.questionType.Equals(questionModel.questionType)
&& gameQuestionData.questionTableID.Equals(questionModel.questionTableID))
{
isAdd = false;
}
}
if (isAdd)
{
temp--;
questionDatas.Add(questionModel);
}
}
foreach (var questionData in questionDatas)
{
GetGalleryNet(questionData.logoId);
}
return questionDatas;
}
public void GetQuestionData(List<GameQuestionData> questionDatas, Action<int> totalDownloadAction,
Action preAction = null,
Action<bool> action = null)
{
StartCoroutine(GetQuestionData1(questionDatas, totalDownloadAction, preAction, action));
}
private IEnumerator GetQuestionData1(List<GameQuestionData> questionDatas, Action<int> totalDownloadAction,
Action preAction = null,
Action<bool> action = null)
{
int logoCount = 0;
int completedIndex = 0;
int cacheCompletedIndex = 0;
foreach (var questionData in questionDatas)
{
if (questionData.logoId != 0)
{
logoCount++;
}
}
totalDownloadAction?.Invoke(logoCount);
for (var i = 0; i < questionDatas.Count; i++)
{
var questionData = questionDatas[i];
GetGalleryNet(questionData.logoId, (bool isSuccess) =>
{
completedIndex++;
if (isSuccess)
{
cacheCompletedIndex++;
}
preAction?.Invoke();
if (completedIndex == questionDatas.Count)
{
CommonHelper.RandomSortList(questionDatas);
action?.Invoke(cacheCompletedIndex == questionDatas.Count);
}
});
}
yield return null;
}
public void AddChangeGiftSwitch(Action action)
{
}
public void RemoveChangeGiftSwitch(Action action)
{
}
void OnApplicationQuit()
{
PreferencesMgr.Instance.ImmediateSendSave();
}
private bool isInH5;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b0f6f2d2a8a4351902376d77d27b4e8
timeCreated: 1681804729
@@ -0,0 +1,37 @@
namespace ScrewsMaster
{
public class NetworkManager : BaseUnityManager<NetworkManager>
{
public const string DomainDebugUrl = @"https://api.jsoncompare.online/";
public static string DomainRelease = "zoomatchsolo.top";
// 改为只读属性,实时获取(等调用时 DomainRelease 早就初始化好了)
public static string DomainReleaseUrl => $"https://{DomainRelease}/api/";
// 改为只读属性,实时获取
#if JarvisRelease
public static string CrazyUrl => DomainReleaseUrl;
#else
public static string CrazyUrl => DomainDebugUrl;
#endif
public static bool haveSimCard = false;
private LoginSystem loginSystem;
private ConfigSystem configSystem;
private PlayDataSystem playDataSystem;
// public const string packName = "com.stronggame.nutboltparty";
public const string packName = "com.zoo.ZooMatchSolo";
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
@@ -0,0 +1,246 @@
using System;
using System.IO;
using UnityEngine;
using System.Collections.Generic;
namespace ScrewsMaster
{
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(10, 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: