bingo 项目提交

This commit is contained in:
2026-04-20 13:49:36 +08:00
commit ad5920ac6a
5585 changed files with 1216243 additions and 0 deletions
+89
View File
@@ -0,0 +1,89 @@
using BingoBrain.Core;
using UnityEngine;
using BingoBrain.Asset;
using BingoBrain.HotFix;
using UnityEngine.EventSystems;
using System.Collections.Generic;
namespace BingoBrain
{
public class Battle : BaseUnity<Battle>
{
public ShungTik ShungTik = new();
List<BaseSystem> systems = new();
public override void Init()
{
base.Init();
CtrlDispatcher.Instance.AddListener(CtrlMsg.Game_Start, OnGameStart);
GameDispatcher.Instance.AddListener(BingoInfo.AddPause, AddPause);
}
private void AddPause(object obj)
{
BingoCell.PauseSum += (int)obj;
}
private void OnGameStart(object obj)
{
InitRoot();
}
private GameObject bg;
private void InitRoot()
{
BingoCell.root = new GameObject("GameRoot").transform;
BingoCell.root.SetParent(OCConst.WorldSpaceGo.transform, false);
BingoCell.root.localPosition = new Vector3(100, 99.5f);
BetKit.Instance.LoadGameObjectAndClone("Prefab.Game.Card", "playbg", go =>
{
bg = go;
BetKit.Instance.LoadSprite("Atlas.Game", "dt_bg", (spr) =>
{
bg.GetComponent<SpriteRenderer>().sprite = spr;
});
bg.transform.SetParent(BingoCell.root, false);
CameraBoardk.Instance.mainCamera.gameObject.AddComponent<PhysicsRaycaster>();
// Debug.Log("??????????????????????????");
// UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoHallUI_Open);
//UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoHalldUI_Open);
InitSystems();
ShungTik.InitRoot(BingoCell.root);
});
}
public void SetBg(bool isShow)
{
if (bg != null)
{
bg.SetActive(isShow);
}
}
private void InitSystems()
{
AddSystems();
}
private void AddSystems()
{
systems.Add(new BingoSystem());
systems.Add(new CardBoardSystem());
systems.Add(new PropSystem());
systems.Add(new CallSystem());
}
private void Update()
{
if (systems != null)
{
foreach (var sys in systems)
{
sys.Update();
}
}
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8d38b729db4d40bc8cb3eb79ddd2c4f7
timeCreated: 1699946071
+370
View File
@@ -0,0 +1,370 @@
using System;
using BingoBrain.Asset;
using BingoBrain.Core;
using UnityEngine;
using UnityEngine.UI;
namespace BingoBrain
{
public class Cheat : BaseUnity<Cheat>
{
public bool isCheat = true;
private int triggerCount = 5;
private int currentTriggerCount;
private float currentTime;
private int cheatPassword = 31415;
private const string cheatPath = "Prefab/Cheat/CheatCanvas";
private Transform cheatTransform;
private Transform checkPermissionPanel;
private Transform cheatSettingPanel;
private Transform cheatSettingPanelContent;
public float Speed = 1;
public override void Init()
{
base.Init();
cheatPassword = 1314;
AddListener();
}
private void Update()
{
if (currentTriggerCount > 0)
{
if (Time.time - currentTime > 1)
{
currentTriggerCount = 0;
}
}
if (!isCheat)
{
return;
}
#if UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.F12))
{
OpenCheatView();
}
if (Input.GetKeyDown(KeyCode.F5))
{
/*if (UI.Instance.IsExistUI(UIConst.ReconnectUI))
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ReconnectUI_Close);
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ReconnectUI_Open);
}*/
}
if (Input.GetKeyDown(KeyCode.F6))
{
/*GameHelper.GetRewardOnly(new AwardInfo()
{
diamond = 100, money = 100, active = 100
}, RewardOrigin.DailyTask, s =>
{
Debug.Log("eeeeeeeeee");
});*/
}
if (Input.GetKeyDown(KeyCode.F1))
{
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameNotificationUI_Open);
PreferencesMgr.Instance.Currency101 += 50000;
}
if (Input.GetKeyDown(KeyCode.F2))
{
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameNotificationUI_Open);
PreferencesMgr.Instance.Currency102 += 500;
}
if (Input.GetKeyDown(KeyCode.F3))
{
CtrlDispatcher.Instance.Dispatch(CtrlMsg.WatchVideoFinish);
}
#endif
if (Input.touchCount >= 2)
{
if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved)
{
OpenCheatView();
}
}
}
private void AddListener()
{
// CtrlDispatcher.Instance.AddListener(CtrlMsg.Game_Start, OnGameStart);
}
private void OnGameStart(object obj)
{
InitCheat();
}
private void InitCheat()
{
}
public void OnTriggerCheat()
{
/*if (Channel.IsRelease)
{
return;
}*/
// Debug.LogWarning("开始触发GM");
if (!isCheat)
{
return;
}
currentTime = Time.time;
currentTriggerCount++;
// Debug.LogWarning("点击GM标题");
if (currentTriggerCount >= triggerCount)
{
OpenCheatView();
}
}
private bool m_Alpha = false;
private void OpenCheatView()
{
#if BingoBrainDebug || UNITY_EDITOR
if (cheatTransform != null && cheatTransform.gameObject.activeSelf)
{
cheatTransform.gameObject.SetActive(false);
return;
}
// Debug.LogWarning("触发GM界面");
if (cheatTransform == null)
{
// Debug.LogWarning("触发GM界面1");
var cheatTransform1 = BetKit.Instance.LoadGameObject("Prefab.Cheat", "CheatCanvas").transform;
cheatTransform = Instantiate(cheatTransform1);
checkPermissionPanel = cheatTransform.Find("CheatPanel/CheckPermissionPanel");
cheatSettingPanel = cheatTransform.Find("CheatPanel/CheatSettingPanel");
cheatSettingPanelContent = cheatSettingPanel.Find("Viewport/Content");
var buttonSettingClose = cheatTransform.Find("CheatPanel/CheatSettingPanel/ButtonSettingClose")
.GetComponent<Button>();
buttonSettingClose.onClick.AddListener(() => { cheatTransform.Active(false); });
buttonSettingClose.gameObject.SetActive(false);
var passwordInput = checkPermissionPanel.Find("InputField").GetComponent<InputField>();
// passwordInput.text = "";
var buttonClose = checkPermissionPanel.Find("ButtonClose").GetComponent<Button>();
var buttonSure = checkPermissionPanel.Find("ButtonSure").GetComponent<Button>();
buttonSure.onClick.AddListener(() =>
{
if (passwordInput.text.Equals(cheatPassword.ToString()))
{
cheatSettingPanel.Active(true);
checkPermissionPanel.Active(false);
buttonSettingClose.Active(true);
}
});
buttonClose.onClick.AddListener(() => { cheatTransform.Active(false); });
var InputFieldAddMoney = cheatSettingPanelContent
.Find("ImageGeneral/InputFieldAddMoney")
.GetComponent<InputField>();
InitButton("ImageGeneral/InputFieldAddMoney/ButtonAddMoney", cheatSettingPanelContent,
() =>
{
var inputValue = InputFieldAddMoney.text;
var intPut = inputValue.ToInt();
// if (intPut > 0)
// {
PreferencesMgr.Instance.Currency102 += intPut;
// }
});
var InputFieldAddCoin = cheatSettingPanelContent
.Find("ImageGeneral/InputFieldAddCoin")
.GetComponent<InputField>();
InitButton("ImageGeneral/InputFieldAddCoin/ButtonAddCoin", cheatSettingPanelContent,
() =>
{
var inputValue = InputFieldAddCoin.text;
var intPut = inputValue.ToInt();
// if (intPut > 0)
// {
PreferencesMgr.Instance.Currency101 += intPut;
// }
});
/*
InitButton("ImageGeneral/ButtonNewDay", cheatSettingPanelContent,
() => { CtrlDispatcher.Instance.Dispatch(CtrlMsg.GameNewDays); });
*/
/*InitButton("ImageGeneral/ButtonWebView", cheatSettingPanelContent, () =>
{
m_Alpha = !m_Alpha;
cheatSettingPanelContent.Find("ImageGeneral/ButtonWebView/Text").GetComponent<Text>().text =
m_Alpha ? "WebView透视 [已开启]" : "WebView透视 [已关闭]";
SetAlpha(m_Alpha ? 0.1f : 1);
});*/
/*
InitButton("ImageSign/ButtonResetToday", cheatSettingPanelContent, () =>
{
if (GameHelper.TodaySigned())
{
PreferencesMgr.Instance.SignState.RemoveAt(PreferencesMgr.Instance.SignState.Count - 1);
PreferencesMgr.Instance.SaveSignState();
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SignInUI_Close);
}
});
InitButton("ImageSign/ButtonResetAllSign", cheatSettingPanelContent, () =>
{
PreferencesMgr.Instance.SignState.Clear();
PreferencesMgr.Instance.SaveSignState();
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SignInUI_Close);
});
*/
/*
InitButton("ImageSign/ButtonAddSign", cheatSettingPanelContent, () =>
{
GameHelper.AddSign();
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SignInUI_Close);
});
InitButton("ImageSign/ButtonShowSign", cheatSettingPanelContent,
() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SignInUI_Open); });*/
/*var TextButtonAD = cheatSettingPanelContent.Find("ImageAD/ButtonSkipAD/Text").GetComponent<Text>();
var TextAD = cheatSettingPanelContent.Find("ImageAD/TextAD").GetComponent<Text>();
if (ChannelMgr.Instance.IsGMPassAds)
{
TextAD.text = "广告:已跳过";
TextButtonAD.text = "观看广告";
}
else
{
TextAD.text = "广告:未跳过";
TextButtonAD.text = "跳过广告";
}*/
/*InitButton("ImageAD/ButtonSkipAD", cheatSettingPanelContent, () =>
{
ChannelMgr.Instance.IsGMPassAds = !ChannelMgr.Instance.IsGMPassAds;
if (ChannelMgr.Instance.IsGMPassAds)
{
TextAD.text = "广告:已跳过";
TextButtonAD.text = "观看广告";
}
else
{
TextAD.text = "广告:未跳过";
TextButtonAD.text = "跳过广告";
}
});
InitButton("ImageAD/ButtonAddADCount", cheatSettingPanelContent,
() => { CtrlDispatcher.Instance.Dispatch(CtrlMsg.WatchVideoFinish); });
var ButtonGiftSwitch =
cheatSettingPanelContent.Find("ImageGiftSwitch/ButtonGiftSwitch").GetComponent<Button>();
var textGift = ButtonGiftSwitch.transform.Find("Text").GetComponent<Text>();
textGift.text = GameHelper.IsGiftSwitch() ? "转变为白包" : "转变为黑包";
InitButton("ImageGiftSwitch/ButtonGiftSwitch", cheatSettingPanelContent, () =>
{
GameHelper.SetGiftSwitch(!GameHelper.IsGiftSwitch());
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Module_GiftSwitchChange);
textGift.text = GameHelper.IsGiftSwitch() ? "转变为白包" : "转变为黑包";
});*/
/*InitButton("ImageGuide/ButtonResetGuide", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.IsResetGuide = true; })*/;
/*InitButton("ImageDaily/ButtonResetDaily", cheatSettingPanelContent,
() => { CtrlDispatcher.Instance.Dispatch(CtrlMsg.ResetDailyTask); });
InitButton("ImageWheel/ButtonRestCD", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.NextOpenWheelStampTime = 0; });
InitButton("ImageInvite/Button7Login", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.LoginDay += 7; });
InitButton("ImageDailyTask/ButtonAddVideo", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.DailyTaskAdCount += 2; });
InitButton("ImageDailyTask/ButtonAddProp", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.DailyTaskPropCount += 2; });
InitButton("ImageDailyTask/ButtonAddCard", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.DailyTaskEliminateCount += 2; });
InitButton("ImageDailyTask/ButtonAddWin", cheatSettingPanelContent,
() => { PreferencesMgr.Instance.DailyTaskWinCount += 2; });*/
/*var InputFieldSetLevel = cheatSettingPanelContent.Find("ImageGod/InputFieldSetLevel")
.GetComponent<InputField>();
InputFieldSetLevel.text = PreferencesMgr.Instance.GameLevel.ToString();
InitButton("ImageGod/InputFieldSetLevel/ButtonSetLevel", cheatSettingPanelContent, () =>
{
var inputValue = InputFieldSetLevel.text;
var intPut = inputValue.ToInt();
if (intPut > 0)
{
PreferencesMgr.Instance.GameLevel = intPut;
}
});*/
/*InitButton("ImageGod/ButtonWin", cheatSettingPanelContent,
() => { GameDispatcher.Instance.Dispatch(GameMsg.GameCheatWin); });*/
// Debug.LogWarning("触发GM界面2");
}
cheatTransform.Active(true);
checkPermissionPanel.Active(true);
cheatSettingPanel.Active(false);
#endif
}
private void InitButton(string buttonName, Transform parent, Action action)
{
var button = parent.Find(buttonName).GetComponent<Button>();
button.onClick.AddListener(() => { action?.Invoke(); });
}
private void SetAlpha(float alpha)
{
/*var allUI = UIMgr.Instance.GetExistDynamicUIs();
if (allUI == null) return;
for (int i = 0; i < allUI.Count; i++)
{
var ui = allUI[i];
if (null != (ui.baseUI as com_maindi))
{
}
else
{
var welfareUI = ui.baseUI;
welfareUI.alpha = alpha;
}
}*/
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 88a03dcdde0a4662922a641d93fbd02d
timeCreated: 1682049154
+238
View File
@@ -0,0 +1,238 @@
using System;
using FairyGUI;
using Spine.Unity;
using UnityEngine;
using BingoBrain.Core;
using BingoBrain.Asset;
using UnityEngine.Events;
using System.Collections.Generic;
using Object = UnityEngine.Object;
namespace BingoBrain
{
public class FX : BaseUnity<FX>
{
private string fxPath = "Effect/sys/";
EffectPool<Fx_Type> _effectObjMonoObjPool;
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;
_effectObjMonoObjPool = new EffectPool<Fx_Type>(obj.transform);
_effectObjMonoObjPool.NewObjFunc = NewObjFunc;
_effectObjMonoObjPool.GetObjFunc = GetObjFunc;
_effectObjMonoObjPool.RecObjFunc = RecObjFunc;
}
private void RecObjFunc(Fx_Type arg1, Object arg2)
{
var component = arg2 as Component;
if (component)
{
component.gameObject.SetActive(false);
}
else
{
(arg2 as GameObject)?.SetActive(false);
}
}
private void GetObjFunc(Fx_Type arg1, Object arg2)
{
var component = arg2 as Component;
if (component)
{
component.gameObject.SetActive(true);
}
else
{
(arg2 as GameObject)?.SetActive(true);
}
}
private void NewObjFunc(Fx_Type arg, UnityAction<Object> action)
{
if ((int)arg < 100)
{
BetKit.Instance.LoadGameObjectAndClone($"Effect.spine.{arg}", arg.ToString(), (go) =>
{
var sk = go.GetComponent<SkeletonAnimation>();
if (sk == null)
{
sk = go.GetComponentInChildren<SkeletonAnimation>();
}
action?.Invoke(sk);
});
}
else
{
fxPath = $"Effect.sys.{arg}";
BetKit.Instance.LoadGameObjectAndClone(fxPath, arg.ToString(), (go) =>
{
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;
action?.Invoke(particleSystem);
}
else
{
action?.Invoke(go);
}
});
}
}
public void GetFx<T>(Fx_Type fx_Type, UnityAction<T> action) where T : Object
{
_effectObjMonoObjPool.GetObject<T>(fx_Type, (obj) =>
{
var ani = obj as SkeletonAnimation;
if (ani != null)
{
ani.gameObject.layer = 0;
ani.ClearState();
ani.transform.localPosition = Vector3.zero;
ani.transform.localEulerAngles = Vector3.zero;
}
action?.Invoke(obj);
});
}
public void RecFx<T>(Fx_Type fx_Type, T obj) where T : Object
{
_effectObjMonoObjPool.RecObject(fx_Type, obj);
}
public List<GameObject> gameObjects = new List<GameObject>();
public override void Dispose()
{
base.Dispose();
_effectObjMonoObjPool.Dispose();
}
public void SetFx<T>(GGraph gp, Fx_Type fx_Type, UnityAction<T> action, Action Rec = null) where T : Component
{
GetFx<T>(fx_Type, (fx) =>
{
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;
action?.Invoke(fx);
Rec += () =>
{
goWrapper.wrapTarget = null;
gp.SetNativeObject(null);
RecFx(fx_Type, fx);
};
}
});
}
internal T SetFx<T>(GGraph gp, Fx_Type fx_main_ad, Action closeCallback)
{
throw new NotImplementedException();
}
}
public enum Fx_Type
{
None = -1,
#region
/// <summary>
/// 胜利结算飘带
/// </summary>
spine_reward = 0,
/// <summary>
/// 引导手
/// </summary>
fx_hand_pre,
/// <summary>
/// binggo
/// </summary>
spine_bingo,
/// <summary>
/// 主界面卡板
/// </summary>
spine_choice_card,
spine_choice_card_b,
spine_starreward,
spine_starreward_bg,
fx_first_reward,
fx_main_ad,
fx_broad,
fx_tips,
fx_savepot_icon,
fx_savepot,
fx_three_gift,
fx_title_effect,
#endregion
#region
/// <summary>
/// 货币资源入账
/// </summary>
fx_ui_jinbi_click = 107,
/// <summary>
/// 转盘进入特效
/// </summary>
fx_zhuangpan_enter,
/// <summary>
/// 签到头部背景
/// </summary>
fx_tanchuang_glow,
/// <summary>
/// 签到Icon
/// </summary>
fx_icon_glow,
/// <summary>
/// 叫号出现的特效
/// </summary>
fx_ball_enter,
/// <summary>
/// 选择转盘展示特效
/// </summary>
fx_zhuanpan_Select,
#endregion
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9cde96b619c044d99e1f59d178df68cd
timeCreated: 1681806251
+178
View File
@@ -0,0 +1,178 @@
using System;
using BingoBrain.Core;
using UnityEngine;
using BingoBrain.HotFix;
using DG.Tweening;
using DontConfuse;
namespace BingoBrain
{
public class Hall : BaseUnity<Hall>
{
public event Action UpdateSecondEvent;
public event Action UpdateEvent;
private float _secondTime;
// private LoginModel loginModel;
private bool isGameStart;
private bool isInH5;
private bool isGaming = false;
private BingoDataSystem _bingoDataSys;
private TomorrowSystem _tomorrowSys;
private UsaSystem _usaSys;
private TuSystem _tuSys;
private DialogSystem _dialogSys;
private BingoSystem bingoSystem;
public override void Init()
{
InitSystem();
AddListener();
}
private void AddListener()
{
CtrlDispatcher.Instance.AddPriorityListener(CtrlMsg.Game_Start, OnGameStart);
GameDispatcher.Instance.AddListener(BingoInfo.OpenGame, EnterGame);
GameDispatcher.Instance.AddListener(BingoInfo.EnterMain, EnterHall);
AppDispatcher.Instance.AddListener(GinInfoC.App_Focus_True, FocusToGame);
}
public void AddChangeGiftSwitch(Action action)
{
_bingoDataSys?.AddChangeGiftSwitch(action);
}
public void RemoveChangeGiftSwitch(Action action)
{
_bingoDataSys?.RemoveChangeGiftSwitch(action);
}
void FocusToGame (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;
if (last_time != newDays)
{
var configs = GameHelper.GetCommonModel();
// Debug.Log($"barry hall-----{configs != null}");
if (configs != null) {
WebviewManager.Instance.RefreshUrl();
}
}
}
private void InitSystem()
{
//添加游戏数据系统模块
_bingoDataSys = new BingoDataSystem();
// 添加新的一天模块
_tomorrowSys = new TomorrowSystem();
// 添加奖励系统模块
_usaSys = new UsaSystem();
// 添加消费系统模块
_tuSys = new TuSystem();
// 添加弹窗系统模块
_dialogSys = new DialogSystem();
}
/// <summary>
/// 游戏开始
/// </summary>
/// <param name="obj"></param>
private void OnGameStart(object obj)
{
GameDispatcher.Instance.Dispatch(BingoInfo.EnterMain);
isGameStart = true;
GameHelper.PlayGameTimeEvent(1);
}
private void EnterHall(object obj = null)
{
if (!GameHelper.IsGiftSwitch())
{
UICtrlDispatcher.Instance.Dispatch(SkinInfo.PlayBgUI_Close);
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoStartUI_Close);
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BottomUI_Open);
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoHallUI_Open);
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoHalldUI_Open);
}
else
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SheepPlayUI_Open);
}
GameHelper.PostFunnelLogin("enterHall");
Audio.Instance.StopBGM();
Audio.Instance.PlayBGM(DoConst.BGMMainScene);
if (GameHelper.IsGiftSwitch())
{
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BroadcastUI_Open);
if (PlayerPrefs.GetInt("first_", 0) != 1)
{
UICtrlDispatcher.Instance.Dispatch(SkinInfo.FirstRewardUI_Open);
}
}
}
/// <summary>
/// 进入玩法,隐藏主界面
/// </summary>
/// <param name="obj"></param>
private void EnterGame(object obj)
{
UICtrlDispatcher.Instance.Dispatch(SkinInfo.PlayBgUI_Open);
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoHallUI_Close);
UICtrlDispatcher.Instance.Dispatch(SkinInfo.BingoHalldUI_Close);
Audio.Instance.StopBGM();
}
public void Update()
{
//if (!isGameStart) return;
UpdateEvent?.Invoke();
_secondTime += Time.deltaTime;
if (_secondTime >= 1)
{
_secondTime = 0;
UpdateSecondEvent?.Invoke();
}
}
void OnApplicationQuit()
{
PreferencesMgr.Instance.ImmediateSendSave();
}
public void SetGaming(bool isGaming)
{
this.isGaming = isGaming;
if (!isGaming)
{
Audio.Instance.PlayBGM(DoConst.BGMMainScene);
}
}
public bool IsGaming()
{
return isGaming;
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b0f6f2d2a8a4351902376d77d27b4e8
timeCreated: 1681804729
+48
View File
@@ -0,0 +1,48 @@
using BingoBrain.Core;
using DontConfuse;
using UnityEngine;
namespace BingoBrain
{
public class Network : BaseUnity<Network>
{
public static bool IsReleaseMode
{
get
{
#if BingoBrainRelease
return true;
#else
return false;
#endif
}
}
public static string domainUrl => IsReleaseMode ? DomainReleaseUrl : DomainDebugUrl;
public const string DomainDebugUrl = @"http://swhitegames.top/api/";
public static readonly string DomainReleaseUrl = $"https://{DomainRelease}/api/";
public const string DomainRelease = "bingoglassland.top";
private ConfigSystem _ConfigSystem;
private LoginSystem loginSystem;
private PlayDataSystem playDataSystem;
public override void Init()
{
InitSystem();
}
private void InitSystem()
{
new LoginModel();
playDataSystem = new PlayDataSystem();
loginSystem = new LoginSystem();
_ConfigSystem = new ConfigSystem();
new WebviewManager();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 54f9fcd655e04ba99afa430eec09c068
timeCreated: 1681976638
+230
View File
@@ -0,0 +1,230 @@
using System;
using System.IO;
using UnityEngine;
using BingoBrain.Core;
using System.Collections.Generic;
using BingoBrain;
namespace BingoBrain
{
public sealed partial class PreferencesMgr : BaseInterfaceManager<PreferencesMgr>
{
private Preferences preferences;
private DataDispatcher dataDispatcher;
private PlayData c2s_preferencesMsg;
private Jcna<KeyValue> keyValuePool;
private List<KeyValue> autoSaveList;
private static string CachePath = Application.persistentDataPath + "/Cache/CacheLocalPreferences.txt";
public override void Init()
{
base.Init();
AddListener();
c2s_preferencesMsg = new PlayData
{
data = new Dictionary<string, object>()
};
keyValuePool = new Jcna<KeyValue>();
autoSaveList = new List<KeyValue>();
}
public override void StartUp()
{
base.StartUp();
dataDispatcher = DataDispatcher.Instance;
TimerHelper.UnscaleGeneral.AddLoopTimer(10, OnAutoDelaySave);
}
public override void DisposeBefore()
{
base.DisposeBefore();
ImmediateSendSave();
}
public override void Dispose()
{
base.Dispose();
RemoveListener();
keyValuePool.Dispose();
}
private void AddListener()
{
AppDispatcher.Instance.AddListener(CsjInfoC.App_Pause_True, ImmediateSendSave);
}
private void RemoveListener()
{
AppDispatcher.Instance.RemoveListener(CsjInfoC.App_Pause_True, ImmediateSendSave);
}
public void InitPreferences()
{
/*if (ModuleManager.Instance.GetModel(ModelConst.LoginModel) is LoginModel loginModel)
{
preferences = loginModel.preferences ?? ReadServerPreferencesCache();
}*/
preferences = ReadServerPreferencesCache();
if (preferences == null)
{
preferences = new Preferences();
}
else
{
SaveServerPreferencesCache(preferences);
}
OnInitPreferences();
}
private void AutoSaveList(List<KeyValue> autolist)
{
if (autolist == null || autolist.Count == 0) return;
foreach (var 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(Psvsagh timerInfo)
{
AutoSaveList(autoSaveList);
PreferencesSendSave();
}
#region
#region
private void AddToAutoDelaySaveList(string key, object value)
{
var 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()
{
}
private long timeSave;
private long unsaveCount;
private void PreferencesSendSave()
{
if (c2s_preferencesMsg == null || c2s_preferencesMsg.data.Count == 0) return;
AddDataVer();
SaveServerPreferencesCache(preferences);
try
{
if (timeSave > 0 && GameHelper.GetNowTime() - timeSave < 10 || unsaveCount < 10)
{
unsaveCount++;
return;
}
unsaveCount = 0;
timeSave = GameHelper.GetNowTime();
var data = Havva.ToObject<Dictionary<string, object>>(Havva.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 = Havva.ToJson(preferences);
if (!Directory.Exists(CachePath + "/.."))
{
Directory.CreateDirectory(CachePath + "/..");
}
File.WriteAllText(CachePath, text);
}
/// <summary>
/// 读取Preferences缓存服务器数据
/// </summary>
public static Preferences ReadServerPreferencesCache()
{
Preferences preferences = null;
var path = 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 = Havva.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: