This commit is contained in:
2026-05-15 16:15:09 +08:00
commit dd3b97bb48
4515 changed files with 1165044 additions and 0 deletions
+123
View File
@@ -0,0 +1,123 @@
namespace BingoBrain.Core
{
public abstract class BaseCtrl
{
public string ctrlName;
public bool isEnable = true;
public bool IsNew { get; private set; }
protected ModuleBoardk ModuleBoardk;
protected ModelDispatcher modelDispatcher;
protected CtrlDispatcher ctrlDispatcher;
protected UICtrlDispatcher uiCtrlDispatcher;
protected DataDispatcher dataDispatcher;
protected GameDispatcher gameDispatcher;
public void New()
{
if (!isEnable) return;
OnNew();
IsNew = true;
}
public virtual void Init()
{
if (!isEnable) return;
Assignment();
AddListener();
AddServerListener();
OnInit();
}
public virtual void StartUp()
{
if (!isEnable) return;
OnStartUp();
}
public void ReadData()
{
OnReadData();
}
public virtual void GameStart()
{
if (!isEnable) return;
OnGameStart();
}
public virtual void Dispose()
{
if (!isEnable) return;
RemoveListener();
RemoveServerListener();
OnDispose();
UnAssignment();
IsNew = false;
}
protected virtual void Assignment()
{
ModuleBoardk = ModuleBoardk.Instance;
modelDispatcher = ModelDispatcher.Instance;
ctrlDispatcher = CtrlDispatcher.Instance;
uiCtrlDispatcher = UICtrlDispatcher.Instance;
dataDispatcher = DataDispatcher.Instance;
gameDispatcher = GameDispatcher.Instance;
}
protected virtual void UnAssignment()
{
ModuleBoardk = null;
modelDispatcher = null;
ctrlDispatcher = null;
uiCtrlDispatcher = null;
dataDispatcher = null;
gameDispatcher = null;
}
protected virtual void OnNew()
{
}
protected abstract void OnInit();
protected virtual void OnStartUp()
{
}
protected virtual void OnReadData()
{
}
protected virtual void OnGameStart()
{
}
protected abstract void OnDispose();
protected virtual void AddListener()
{
}
protected virtual void RemoveListener()
{
}
protected virtual void AddServerListener()
{
}
protected virtual void RemoveServerListener()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b81051b63111ae24091f178cd25ab0a5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,242 @@
using System;
using UnityEngine;
using System.Collections.Generic;
namespace BingoBrain.Core
{
public abstract class BaseDispatcher<T, Msg, Param> : IDisposable where T : class, new() where Param : class
{
private static T m_instance;
public static T Instance
{
get
{
if (m_instance == null)
{
m_instance = new T();
}
return m_instance;
}
}
private Dictionary<Msg, List<Action<Param>>> m_msgPriorityDict = new();
private Dictionary<Msg, List<Action<Param>>> m_msgDict = new();
private Dictionary<Msg, List<Action<Param>>> m_msgFinallyDict = new();
private Dictionary<Msg, List<Action<Param>>> m_msgOnceDict = new();
public void AddPriorityListener(Msg msgId, Action<Param> listener)
{
if (m_msgPriorityDict.TryGetValue(msgId, out var value))
{
value.Add(listener);
}
else
{
var list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgPriorityDict.Add(msgId, list);
}
}
public void AddListener(Msg msgId, Action<Param> listener)
{
if (m_msgDict.TryGetValue(msgId, out var value))
{
value.Add(listener);
}
else
{
var list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgDict.Add(msgId, list);
}
}
public void AddFinallyListener(Msg msgId, Action<Param> listener)
{
if (m_msgFinallyDict.TryGetValue(msgId, out var value))
{
value.Add(listener);
}
else
{
var list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgFinallyDict.Add(msgId, list);
}
}
public void AddOnceListener(Msg msgId, Action<Param> listener)
{
if (m_msgOnceDict.TryGetValue(msgId, out var value))
{
value.Add(listener);
}
else
{
var list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgOnceDict.Add(msgId, list);
}
}
private bool ContainsListener(Msg msgId, Action<Param> listener, Dictionary<Msg, List<Action<Param>>> msgDict)
{
return msgDict.TryGetValue(msgId, out var list) && list.Contains(listener);
}
private bool ContainsPriorityListener(Msg msgId, Action<Param> listener)
{
return ContainsListener(msgId, listener, m_msgPriorityDict);
}
private bool ContainsListener(Msg msgId, Action<Param> listener)
{
return ContainsListener(msgId, listener, m_msgDict);
}
private bool ContainsFinallyListener(Msg msgId, Action<Param> listener)
{
return ContainsListener(msgId, listener, m_msgFinallyDict);
}
private bool ContainsOnceListener(Msg msgId, Action<Param> listener)
{
return ContainsListener(msgId, listener, m_msgOnceDict);
}
public void RemovePriorityListener(Msg msgId, Action<Param> listener)
{
if (m_msgPriorityDict.TryGetValue(msgId, out var list))
{
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgPriorityDict.Remove(msgId);
}
}
}
}
public void RemoveListener(Msg msgId, Action<Param> listener)
{
if (m_msgDict.TryGetValue(msgId, out var list))
{
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgDict.Remove(msgId);
}
}
}
}
public void RemoveFinallyListener(Msg msgId, Action<Param> listener)
{
if (m_msgFinallyDict.TryGetValue(msgId, out var list))
{
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgFinallyDict.Remove(msgId);
}
}
}
}
public void RemoveOnceListener(Msg msgId, Action<Param> listener)
{
if (m_msgOnceDict.ContainsKey(msgId))
{
List<Action<Param>> list = m_msgOnceDict[msgId];
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgOnceDict.Remove(msgId);
}
}
}
}
public void Dispatch(Msg msgId, Param param = null)
{
InvokeMethods(m_msgPriorityDict, msgId, param);
InvokeMethods(m_msgDict, msgId, param);
InvokeMethods(m_msgFinallyDict, msgId, param);
InvokeMethods(m_msgOnceDict, msgId, param);
if (m_msgOnceDict.ContainsKey(msgId))
{
Uncc<Action<Param>>.Release(m_msgOnceDict[msgId]);
m_msgOnceDict.Remove(msgId);
}
}
private void InvokeMethods(Dictionary<Msg, List<Action<Param>>> msgDict, Msg msgId, Param param)
{
if (!msgDict.ContainsKey(msgId)) return;
var rawList = msgDict[msgId];
int funcCount = rawList.Count;
if (funcCount == 1)
{
Action<Param> onEvent = rawList[0];
onEvent(param);
return;
}
var invokeFuncs = Uncc<Action<Param>>.Get();
invokeFuncs.AddRange(rawList);
for (var i = 0; i < funcCount; i++)
{
try
{
var onEvent = invokeFuncs[i];
onEvent(param);
}
catch (Exception e)
{
Debug.LogError(e);
}
}
Uncc<Action<Param>>.Release(invokeFuncs);
}
public void Clear()
{
m_msgPriorityDict.Clear();
m_msgDict.Clear();
m_msgFinallyDict.Clear();
m_msgOnceDict.Clear();
}
public void Dispose()
{
m_instance = null;
m_msgPriorityDict.Clear();
m_msgDict.Clear();
m_msgFinallyDict.Clear();
m_msgOnceDict.Clear();
m_msgPriorityDict = null;
m_msgDict = null;
m_msgFinallyDict = null;
m_msgOnceDict = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c4b55125cefc9754888cccfc76bee4c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
using System;
namespace BingoBrain.Core
{
public abstract class BaseInterfaceManager<T> : IDisposable, InterfaceManager where T : BaseInterfaceManager<T>, new()
{
public bool IsInit { get; private set; }
public bool IsStartUp { get; private set; }
public bool IsDispose { get; private set; }
private static T m_instance;
public static T Instance
{
get
{
if (m_instance == null)
{
m_instance = new T();
m_instance.New();
}
return m_instance;
}
}
public BaseInterfaceManager()
{
}
protected virtual void New()
{
IsDispose = false;
}
public virtual void Init()
{
IsInit = true;
}
public virtual void StartUp()
{
IsStartUp = true;
}
public virtual void DisposeBefore()
{
IsDispose = true;
IsInit = false;
IsStartUp = false;
}
public virtual void Dispose()
{
m_instance = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0395f071bf7ad864083ee86433bcec9b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,224 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace BingoBrain.Core
{
public class BaseMainThreadDispatcher<T, Msg, Param> : SingletonUnity<T>
where T : SingletonUnity<T>
where Param : class
{
private class MainThreadMsgClass
{
public Msg currMsgId;
public Param currParam;
}
private Queue<MainThreadMsgClass> m_msgQueue = new Queue<MainThreadMsgClass>();
private Dictionary<Msg, List<Action<Param>>> m_msgPriorityDict = new Dictionary<Msg, List<Action<Param>>>();
private Dictionary<Msg, List<Action<Param>>> m_msgDict = new Dictionary<Msg, List<Action<Param>>>();
private Dictionary<Msg, List<Action<Param>>> m_msgOnceDict = new Dictionary<Msg, List<Action<Param>>>();
private object m_queueLock = new object();
private void Update()
{
if (m_msgQueue.Count <= 0) return;
while (m_msgQueue.Count > 0)
{
MainThreadMsgClass msg;
lock (m_queueLock)
{
msg = m_msgQueue.Dequeue();
}
AutoDispatch(msg.currMsgId, msg.currParam);
}
}
public void AddPriorityListener(Msg msgId, Action<Param> listener)
{
if (m_msgPriorityDict.ContainsKey(msgId))
{
m_msgPriorityDict[msgId].Add(listener);
}
else
{
List<Action<Param>> list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgPriorityDict.Add(msgId, list);
}
}
public void AddListener(Msg msgId, Action<Param> listener)
{
if (m_msgDict.ContainsKey(msgId))
{
m_msgDict[msgId].Add(listener);
}
else
{
List<Action<Param>> list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgDict.Add(msgId, list);
}
}
public void AddOnceListener(Msg msgId, Action<Param> listener)
{
if (m_msgOnceDict.ContainsKey(msgId))
{
m_msgOnceDict[msgId].Add(listener);
}
else
{
List<Action<Param>> list = Uncc<Action<Param>>.Get();
list.Add(listener);
m_msgOnceDict.Add(msgId, list);
}
}
public void RemovePriorityListener(Msg msgId, Action<Param> listener)
{
if (m_msgPriorityDict.ContainsKey(msgId))
{
List<Action<Param>> list = m_msgPriorityDict[msgId];
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgPriorityDict.Remove(msgId);
}
}
}
}
public void RemoveListener(Msg msgId, Action<Param> listener)
{
if (m_msgDict.ContainsKey(msgId))
{
List<Action<Param>> list = m_msgDict[msgId];
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgDict.Remove(msgId);
}
}
}
}
public void RemoveOnceListener(Msg msgId, Action<Param> listener)
{
if (m_msgOnceDict.ContainsKey(msgId))
{
List<Action<Param>> list = m_msgOnceDict[msgId];
if (list.Contains(listener))
{
list.Remove(listener);
if (list.Count == 0)
{
Uncc<Action<Param>>.Release(list);
m_msgOnceDict.Remove(msgId);
}
}
}
}
public void Dispatch(Msg msgId, Param param = null)
{
if (!m_msgPriorityDict.ContainsKey(msgId)
&& !m_msgDict.ContainsKey(msgId)
&& !m_msgOnceDict.ContainsKey(msgId))
return;
MainThreadMsgClass msg = new MainThreadMsgClass
{
currMsgId = msgId,
currParam = param,
};
lock (m_queueLock)
{
m_msgQueue.Enqueue(msg);
}
}
private void AutoDispatch(Msg msgId, Param param)
{
InvokeMethods(m_msgPriorityDict, msgId, param);
InvokeMethods(m_msgDict, msgId, param);
InvokeMethods(m_msgOnceDict, msgId, param);
if (m_msgOnceDict.ContainsKey(msgId))
{
Uncc<Action<Param>>.Release(m_msgOnceDict[msgId]);
m_msgOnceDict.Remove(msgId);
}
}
private void InvokeMethods(Dictionary<Msg, List<Action<Param>>> msgDict, Msg msgId, Param param)
{
if (!msgDict.ContainsKey(msgId)) return;
List<Action<Param>> rawList = msgDict[msgId];
int funcCount = rawList.Count;
if (funcCount == 1)
{
Action<Param> onEvent = rawList[0];
onEvent(param);
return;
}
List<Action<Param>> invokeFuncs = Uncc<Action<Param>>.Get();
invokeFuncs.AddRange(rawList);
for (int i = 0; i < funcCount; i++)
{
try
{
Action<Param> onEvent = invokeFuncs[i];
onEvent(param);
}
catch (Exception e)
{
Debug.LogError(e);
}
}
Uncc<Action<Param>>.Release(invokeFuncs);
}
public void Clear()
{
lock (m_queueLock)
{
m_msgQueue.Clear();
}
m_msgPriorityDict.Clear();
m_msgDict.Clear();
m_msgOnceDict.Clear();
}
protected override string ParentRootName
{
get { return OCConst.DispatcherGoName; }
}
protected override void OnDestroy()
{
base.OnDestroy();
m_msgPriorityDict.Clear();
m_msgDict.Clear();
m_msgOnceDict.Clear();
m_msgPriorityDict = null;
m_msgDict = null;
m_msgOnceDict = null;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e02321e1c5d556b4484a914fec6eafbd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+173
View File
@@ -0,0 +1,173 @@
namespace BingoBrain.Core
{
public abstract class BaseModel
{
public string modelName;
private string localStorageKey;
protected ModuleBoardk MOduleBoardk;
protected ModelDispatcher modelDispatcher;
protected CtrlDispatcher ctrlDispatcher;
protected UICtrlDispatcher uiCtrlDispatcher;
protected DataDispatcher dataDispatcher;
protected GameDispatcher gameDispatcher;
public void New()
{
OnNew();
}
public void Init()
{
Assignment();
AddListener();
AddServerListener();
OnInit();
}
public void StartUp()
{
OnStartUp();
}
public void ReadData()
{
OnReadData();
}
public void GameStart()
{
OnGameStart();
}
public void Reset()
{
Dispose();
Init();
}
public void Dispose()
{
RemoveListener();
RemoveServerListener();
OnDispose();
UnAssignment();
}
protected virtual void Assignment()
{
MOduleBoardk = ModuleBoardk.Instance;
modelDispatcher = ModelDispatcher.Instance;
ctrlDispatcher = CtrlDispatcher.Instance;
uiCtrlDispatcher = UICtrlDispatcher.Instance;
dataDispatcher = DataDispatcher.Instance;
gameDispatcher = GameDispatcher.Instance;
}
protected virtual void UnAssignment()
{
MOduleBoardk = null;
modelDispatcher = null;
ctrlDispatcher = null;
uiCtrlDispatcher = null;
dataDispatcher = null;
gameDispatcher = null;
}
protected virtual void OnNew()
{
}
protected abstract void OnInit();
protected virtual void OnStartUp()
{
}
protected virtual void OnReadData()
{
}
protected virtual void OnGameStart()
{
}
protected abstract void OnReset();
protected abstract void OnDispose();
protected virtual void AddListener()
{
}
protected virtual void RemoveListener()
{
}
protected virtual void AddServerListener()
{
}
protected virtual void RemoveServerListener()
{
}
#region LocalStorage
protected virtual void WriteLocalStorage()
{
}
private string GetLocalStorageKey()
{
if (string.IsNullOrEmpty(localStorageKey))
{
localStorageKey = string.Concat("M_", modelName, "_", Pva.UserInfo.userId);
}
return localStorageKey;
}
protected void SetCustomLocalStorageKey(string customSuffixKey)
{
localStorageKey = string.Concat(modelName, "_", customSuffixKey);
}
protected void WriteLocalStorage(object storageData)
{
string key = GetLocalStorageKey();
RrysKit.WriteObject(key, storageData);
}
protected object ReadLocalStorage<T>()
{
string key = GetLocalStorageKey();
return RrysKit.ReadObject<T>(key);
}
protected bool HasLocalStorage()
{
string key = GetLocalStorageKey();
return RrysKit.HasKey(key);
}
protected void DeleteLocalStorage()
{
string key = GetLocalStorageKey();
RrysKit.DeleteKey(key);
}
#endregion
#region
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2ab9296c1feb18b42a12bbc53cdfc39b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
namespace BingoBrain.Core
{
public abstract class BaseScene
{
public abstract int SceneIdx { get; }
public void Enter()
{
Pva.Enter();
OnEnter();
}
public void Leave()
{
OnLeave();
}
public void SwchSneCote(object param)
{
OnSwhSceCompl(param);
}
protected abstract void OnEnter();
protected abstract void OnLeave();
protected abstract void OnSwhSceCompl(object param);
public abstract void Dispose();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36208f1ae07fbee498389575991236b5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
namespace BingoBrain.Core
{
/// <summary>
/// 系统
/// 承载逻辑
/// 1EntitySystem
/// 2GameObjectSystem
/// </summary>
public abstract class BaseSystem
{
public BaseSystem()
{
}
public virtual void Init()
{
}
public virtual void InitLate()
{
}
public virtual void Dispose()
{
}
public virtual void Update()
{
}
public virtual void LateUpdate()
{
}
public virtual void FixedUpdate()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: db46851f313c4809855238569ed6cfac
timeCreated: 1692256359
+500
View File
@@ -0,0 +1,500 @@
using FairyGUI;
using System.Collections.Generic;
namespace BingoBrain.Core
{
public abstract class BaseUI
{
#region Field
protected UI MUI;
protected ModuleBoardk ModuleBoardk;
protected ModelDispatcher modelDispatcher;
protected CtrlDispatcher ctrlDispatcher;
protected UICtrlDispatcher uiCtrlDispatcher;
protected DataDispatcher dataDispatcher;
protected GameDispatcher gameDispatcher;
public string uiName;
public string rawGameObjectName;
public string gameObjectName;
public UIInfo uiInfo;
public uint uiOpenCumsumId;
public int currLayer;
public BaseUICtrl baseUICtrl;
public object uiArgs;
public GObject baseGObj;
public GComponent baseUI;
public Window windowUI;
public GGraph uiMask;
public List<SubUI> subUIs;
public bool isOpen;
public bool isVisible;
public bool isClose;
public GTweener openUiGTweener;
public GTweener closeUiGTweener;
#endregion
#region Constructor
public BaseUI()
{
}
public BaseUI(BaseUICtrl baseUICtrl)
{
New(baseUICtrl);
}
public void New(BaseUICtrl baseUICtrl)
{
this.baseUICtrl = baseUICtrl;
Assignment();
OnNew();
Process_Init();
}
protected virtual void Assignment()
{
MUI = UI.Instance;
ModuleBoardk = ModuleBoardk.Instance;
modelDispatcher = ModelDispatcher.Instance;
ctrlDispatcher = CtrlDispatcher.Instance;
uiCtrlDispatcher = UICtrlDispatcher.Instance;
dataDispatcher = DataDispatcher.Instance;
gameDispatcher = GameDispatcher.Instance;
}
protected virtual void UnAssignment()
{
MUI = null;
ModuleBoardk = null;
modelDispatcher = null;
ctrlDispatcher = null;
uiCtrlDispatcher = null;
dataDispatcher = null;
gameDispatcher = null;
}
#endregion
#region Interface: UI
public void Open(object args = null)
{
uiArgs = args;
MUI.Internal_OpenUI(this, args);
}
public void OpenUISequence(object args = null)
{
uiArgs = args;
MUI.Internal_OpenUISequence(this, args);
}
public void Close()
{
if (isClose) return;
MUI.Internal_CloseUI(this);
}
public void Hide()
{
MUI.Internal_HideUI(this);
}
public void Display(object args = null)
{
uiArgs = args;
MUI.Internal_DisplayUI(this, args);
}
#endregion
#region Interface: SubUI
protected SubUI OpenSubUI(string subUiName, string assetName, bool needStandardResolution = false)
{
return OpenSubUI(subUiName, uiInfo.packageName, assetName, needStandardResolution);
}
protected SubUI OpenSubUI(string subUiName, string packageName, string assetName,
bool needStandardResolution = false)
{
return MUI.OpenSubUI(this, subUiName, packageName, assetName, needStandardResolution);
}
protected void CloseSubUI(SubUI subUI)
{
MUI.CloseSubUI(this, subUI);
}
protected void CloseAllSubUI()
{
MUI.CloseAllSubUI(this);
}
#endregion
#region Process
private void Process_Init()
{
isOpen = false;
isVisible = false;
isClose = false;
uiInfo = new UIInfo();
SetUIInfo(uiInfo);
PostProcess_UIInfo();
OnInit();
}
private void PostProcess_UIInfo()
{
}
public void Process_Bind()
{
OnBind();
}
public void Process_OpenBefore(object args)
{
OnOpenBefore(args);
}
public void Process_Open(object args)
{
OnOpen(args);
AddListener();
AddServerListener();
isOpen = true;
}
public void Process_OpenUIAnimEnd()
{
OnOpenUIAnimEnd();
}
public void Process_Close()
{
RemoveListener();
RemoveServerListener();
OnClose();
isClose = true;
}
public void Process_CloseUIAnimEnd()
{
OnCloseUIAnimEnd();
}
public void Process_Destroy()
{
OnDestroy();
UnAssignment();
isOpen = false;
isVisible = false;
isClose = true;
baseGObj = null;
baseUI = null;
windowUI = null;
}
public void Process_Hide()
{
isVisible = false;
baseUI.visible = isVisible;
OnHide();
}
public void Process_Display(object args)
{
isVisible = true;
baseUI.visible = isVisible;
OnDisplay(args);
}
public void ProcessFunc_SwitchLanguage()
{
if (isClose) return;
if (baseUI == null) return;
if (baseUI.isDisposed) return;
InternaProcesslFunc_GComponentSwitchLanguage(baseUI);
OnSwitchLanguage();
}
private void InternaProcesslFunc_GComponentSwitchLanguage(GComponent switchCom)
{
if (switchCom == null) return;
if (switchCom.isDisposed) return;
for (int i = 0; i < switchCom.GetChildrenCount(); i++)
{
GObject gObject = switchCom.GetChildAt(i);
if (gObject == null || gObject.isDisposed) continue;
GComponent childCom = gObject.asCom;
if (childCom != null)
{
InternaProcesslFunc_GComponentSwitchLanguage(childCom);
continue;
}
else
{
if (gObject.packageItem != null) continue;
if (gObject.parent == null) continue;
string text = null;
if (gObject is GTextField)
{
GTextField gTextField = gObject.asTextField;
if (gTextField == null) continue;
if (!gTextField.Ex_IsAutoMultiLang) continue;
text = gObject.Ex_GetMultiLangText();
if (text != null)
{
gTextField.text = text;
continue;
}
}
}
}
}
#endregion
#region Virtual Logic
protected virtual void OnNew()
{
}
protected abstract void SetUIInfo(UIInfo uiInfo);
protected virtual void OnInit()
{
}
protected virtual void OnBind()
{
}
protected virtual void OnOpenBefore(object args)
{
}
protected virtual void OnOpen(object args)
{
}
protected virtual void OnOpenUIAnimEnd()
{
}
protected virtual void OnClose()
{
}
protected virtual void OnCloseUIAnimEnd()
{
}
protected virtual void OnDestroy()
{
}
protected virtual void OnHide()
{
}
protected virtual void OnDisplay(object args)
{
}
public virtual void OnUpdate()
{
}
public virtual void OnSwitchLanguage()
{
}
protected virtual void AddListener()
{
}
protected virtual void RemoveListener()
{
}
protected virtual void AddServerListener()
{
}
protected virtual void RemoveServerListener()
{
}
#endregion
#region Event
protected void AutoBindButtonEvent(EventCallback1 callback)
{
AutoBindButtonEvent(baseUI, callback);
}
protected void AutoBindButtonEvent(GComponent gComponent, EventCallback1 callback)
{
GObject[] gObjects = gComponent.GetChildren();
for (int i = 0; i < gObjects.Length; i++)
{
GObject gObject = gObjects[i];
if (gObject.asButton != null)
{
gObject.onClick.Remove(callback);
gObject.onClick.Add(callback);
continue;
}
GComponent otherGComponent = gObject.asCom;
if (otherGComponent != null)
{
AutoBindButtonEvent(otherGComponent, callback);
continue;
}
}
}
protected void BaseUIClickEvent(GComponent gComponent)
{
}
#endregion
#region Anim
public void KillOpenUIAnim()
{
if (openUiGTweener != null)
{
if (!openUiGTweener.allCompleted)
{
openUiGTweener.Kill(complete: false);
}
openUiGTweener = null;
}
}
public void KillCloseUIAnim()
{
if (closeUiGTweener != null)
{
if (!closeUiGTweener.allCompleted)
{
closeUiGTweener.Kill(complete: false);
}
closeUiGTweener = null;
}
}
#endregion
#region Func
public uint GetOpenUIMsgId()
{
if (uiInfo.openUIMsgId == 0)
{
if (baseUICtrl == null) return 0;
uiInfo.openUIMsgId = baseUICtrl.GetOpenUIMsg(uiName);
}
return uiInfo.openUIMsgId;
}
public uint GetCloseUIMsgId()
{
if (uiInfo.closeUIMsgId == 0)
{
if (baseUICtrl == null) return 0;
uiInfo.closeUIMsgId = baseUICtrl.GetCloseUIMsg(uiName);
}
return uiInfo.closeUIMsgId;
}
public void CtrlCloseUI()
{
if (baseUICtrl == null) return;
baseUICtrl.DispatchCloseUI(uiName);
}
public UILayerType GetCurrRenderLayer()
{
string uiLayer = baseUI.parent.name;
switch (uiLayer)
{
case RyerConst.Background:
return UILayerType.Background;
case RyerConst.Bottom:
return UILayerType.Bottom;
case RyerConst.Normal:
return UILayerType.Normal;
case RyerConst.Top:
return UILayerType.Top;
case RyerConst.FullScreen:
return UILayerType.FullScreen;
case RyerConst.Popup:
return UILayerType.Popup;
case RyerConst.Highest:
return UILayerType.Highest;
case RyerConst.Animation:
return UILayerType.Animation;
case RyerConst.Tips:
return UILayerType.Tips;
case RyerConst.Loading:
return UILayerType.Loading;
case RyerConst.System:
return UILayerType.System;
case RyerConst.NetworkError:
return UILayerType.NetworkError;
default:
return UILayerType.None;
}
}
public int GetCurrRenderQueueIdx()
{
return baseUI.parent.GetChildIndex(baseUI);
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2304886815d7ebc45aff43b801f57c13
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
namespace BingoBrain.Core
{
public abstract class BaseUICtrl : BaseCtrl
{
protected override void Assignment()
{
base.Assignment();
}
protected override void UnAssignment()
{
base.UnAssignment();
}
public virtual uint GetOpenUIMsg(string uiName)
{
return 0;
}
public virtual uint GetCloseUIMsg(string uiName)
{
return 0;
}
public void DispatchOpenUI(string uiName = null, object args = null)
{
uint msgId = GetOpenUIMsg(uiName);
if (msgId == 0)
{
OpenUI(args);
return;
}
if (uiCtrlDispatcher != null)
{
uiCtrlDispatcher.Dispatch(msgId, args);
}
}
public void DispatchCloseUI(string uiName = null, object args = null)
{
uint msgId = GetCloseUIMsg(uiName);
if (msgId == 0)
{
CloseUI(args);
return;
}
if (uiCtrlDispatcher != null)
{
uiCtrlDispatcher.Dispatch(msgId, args);
}
}
public abstract void OpenUI(object args = null);
public abstract void CloseUI(object args = null);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 17086b56b8ce86e44a2a0e0f23b0f5ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,43 @@
namespace BingoBrain.Core
{
public abstract class BaseUnity<T> : SingletonUnity<T>, InterfaceManager
where T : BaseUnity<T>
{
public bool IsInit { get; private set; }
public bool IsStartUp { get; private set; }
public bool IsDispose { get; private set; }
protected override string ParentRootName
{
get { return OCConst.MonoManagerGoName; }
}
protected override void New()
{
base.New();
IsDispose = false;
}
public virtual void Init()
{
IsInit = true;
}
public virtual void StartUp()
{
IsStartUp = true;
}
public virtual void DisposeBefore()
{
IsDispose = true;
IsInit = false;
IsStartUp = false;
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c01f68bc92a2b648a38f328f7e95ce6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+164
View File
@@ -0,0 +1,164 @@
using UnityEngine;
using DG.Tweening;
using System.Collections;
using UnityEngine.Android;
namespace BingoBrain.Core
{
public class Bea : MonoBehaviour
{
public static bool IsAppQuit { get; private set; }
public bool IsRestart { get; private set; }
public int RestartCount { get; private set; }
public bool IsAppFocus { get; private set; }
public bool IsAppPause { get; private set; }
public long LastFocusFlaseTime { get; private set; }
public virtual void Init()
{
IsAppFocus = true;
}
public virtual void Enable()
{
CreateEnvironment();
}
public virtual void Restart()
{
Debug.Log("[Application]Restart");
IsRestart = true;
RestartCount++;
StartCoroutine(OnRestart());
}
public virtual void Quit()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
private void CreateEnvironment()
{
OCConst.ApplicationGo = gameObject;
OCConst.EngineSingletonGo = new GameObject(OCConst.EngineSingletonGoName);
OCConst.EngineSingletonGo.SetParent(OCConst.bfdn);
}
private IEnumerator OnRestart()
{
DOTween.KillAll();
ClearAllObjects();
yield return vbadConst.WaitForEndOfFrame;
CloseApp();
Uvsjk.Destroy(OCConst.EngineSingletonGo);
yield return vbadConst.WaitForEndOfFrame;
Enable();
}
private void CloseApp()
{
if (UI.Instance != null)
{
UI.Instance.DisposeAllUI();
}
ModuleBoardk.Instance.DisposeAllModule();
Ard.Instance.DisposeAllManager();
Ard.Instance.Dispose();
}
private void ClearAllObjects()
{
var otherGos = FindObjectsOfType<GameObject>();
foreach (var otherGo in otherGos)
{
if (IsCanDestroyObj(otherGo))
{
Uvsjk.Destroy(otherGo);
}
}
}
private bool IsCanDestroyObj(GameObject go)
{
if (go.transform.parent == null)
{
if (go.name is OCConst.LauncherGoName or
OCConst.EngineEventSystemGoName or
OCConst.ApplicationGoName or
OCConst.EngineSingletonGoName or
OCConst.DOTweenGoName or
OCConst.SuperInvokeGoName)
{
return false;
}
return true;
}
return IsCanDestroyObj(go.transform.parent.gameObject);
}
private void OnApplicationPause(bool pause)
{
IsAppPause = pause;
Debug.Log("??????????1222222222222");
if (pause)
{
AppDispatcher.Instance.Dispatch(CsjInfoC.App_Pause_True, pause);
}
else
{
MainThreadDispatcher.Instance.Dispatch(GinInfoC.App_Pause_False, pause);
AppDispatcher.Instance.Dispatch(CsjInfoC.App_Focus_False, pause);
}
}
private void OnApplicationQuit()
{
Debug.Log("[ BingoBrain ] [ Application ] OnApplicationQuit");
IsAppQuit = true;
AppDispatcher.Instance.Dispatch(CsjInfoC.App_Focus_False);
CloseApp();
AppDispatcher.Instance.Dispatch(CsjInfoC.App_Quit);
AssetBundle.UnloadAllAssetBundles(true);
}
#if UNITY_ANDROID
private void Update()
{
if (Application.platform == RuntimePlatform.Android && Input.GetKeyDown(KeyCode.Home))
{
OnClickKeyCodeHome();
}
if (Application.platform == RuntimePlatform.Android && Input.GetKeyDown(KeyCode.Escape))
{
OnClickKeyCodeEscape();
}
}
#endif
protected virtual void OnClickKeyCodeHome()
{
AppDispatcher.Instance.Dispatch(CsjInfoC.KeyCode_Home);
Debug.Log("[ BingoBrain ] [ Application ] OnClickAppHome");
}
protected virtual void OnClickKeyCodeEscape()
{
AppDispatcher.Instance.Dispatch(CsjInfoC.KeyCode_Escape);
Debug.Log("[ BingoBrain ] [ Application ] OnClickAppEscape");
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f456d9a76e898ac4db489cb8c7fcb3b9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
using BingoBrain.HotFix;
namespace BingoBrain.Core
{
public class Bingo : SingletonUnity<Bingo>
{
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41b35f98275b2ce40ac58d230dba9d80
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+235
View File
@@ -0,0 +1,235 @@
using UnityEngine;
using BingoBrain.HotFix;
using System.Collections;
using BingoBrain;
namespace BingoBrain.Core
{
public class BingoBea : Bea
{
private static BingoBea m_instance;
public string attribution = "organic";
public static BingoBea Instance
{
get
{
if (m_instance == null)
{
if (IsAppQuit)
{
return null;
}
OCConst.ApplicationGo = new GameObject(OCConst.ApplicationGoName);
OCConst.ApplicationGo.SetParent(OCConst.bfdn);
m_instance = OCConst.ApplicationGo.AddComponent<BingoBea>();
}
return m_instance;
}
}
private void OnApplicationFocus(bool focus)
{
//IsAppFocus = focus;
if (focus)
{
// MainThreadDispatcher.Instance.Dispatch(GinInfoC.App_Focus_True, focus);
AppDispatcher.Instance.Dispatch(GinInfoC.App_Focus_True, focus);
}
else
{
// LastFocusFlaseTime = DateTimeBoardk.Instance.GetServerCurrTimestamp();
AppDispatcher.Instance.Dispatch(CsjInfoC.App_Focus_False, focus);
}
}
public override void Init()
{
base.Init();
if (!RrysKit.HasKey(FsyConst.App_isNewInstall))
{
RrysKit.WriteInt(FsyConst.App_isNewInstall, 1);
}
else
{
}
AppDispatcher.Instance.AddListener(CsjInfoC.AppManagerRegister,
(obj) => { BingoBoard.SetData(); });
}
public override void Enable()
{
base.Enable();
InitPlugin();
InitAppSetting();
ManagerBoard.Register();
BingoBoard.Board();
ManagerBoard.RegisterData();
Ard.Instance.Init();
ModuleBoardk.Instance.StartUpAllModule();
InitSettingMode();
StartUpGameMain();
}
private void OnDestroy()
{
m_instance = null;
}
#region Enable
private void InitPlugin()
{
Bsaddd.Init();
}
private void InitAppSetting()
{
if (!BingoConst.UseInternalSetting) return;
Physics.autoSimulation = true;
Physics.autoSyncTransforms = true;
Physics2D.simulationMode = SimulationMode2D.Script;
Physics2D.autoSyncTransforms = true;
Debug.unityLogger.logEnabled = BingoConst.IsEnabledEngineLog;
Debug.unityLogger.filterLogType = BingoConst.EnabledFilterLogType;
Screen.sleepTimeout = BingoConst.SleepTimeoutMode;
Application.runInBackground = BingoConst.IsRunInBG;
QualitySettings.vSyncCount = 0;
QualitySettings.lodBias = 1;
QualitySettings.antiAliasing = BingoConst.AntiAliasing;
Application.targetFrameRate = BingoConst.LowFrameRate;
}
private void StartUpGameMain()
{
if (!IsRestart)
{
GameBoardk.Instance.InitialMain();
}
else
{
GameBoardk.Instance.EnterMain();
}
}
#endregion Enable
#region SettingMode
private void InitSettingMode()
{
if (!BingoConst.UseInternalSetting) return;
InitResolutionMode();
InitFrameRateMode();
}
private bool isHDMode;
public bool IsHDMode
{
get { return isHDMode; }
set
{
isHDMode = value;
RrysKit.WriteBool(FsyConst.Application_isHDMode, isHDMode);
SetResolutionMode(isHDMode);
}
}
private bool isHFRMode;
public bool IsHFRMode
{
get { return IsHFRMode; }
set
{
isHFRMode = value;
RrysKit.WriteBool(FsyConst.Application_isHFRMode, isHFRMode);
SetFrameRateMode(isHFRMode);
}
}
private void InitResolutionMode()
{
isHDMode = RrysKit.ReadBool(FsyConst.Application_isHDMode, true);
SetResolutionMode(isHDMode);
}
private void InitFrameRateMode()
{
isHFRMode = RrysKit.ReadBool(FsyConst.Application_isHFRMode, true);
SetFrameRateMode(isHFRMode);
}
private void SetResolutionMode(bool isHDMode)
{
if (isHDMode)
{
CenConst.CurrResolution.x = CenConst.RawResolution.x * BingoConst.HDHighViewScale;
CenConst.CurrResolution.y = CenConst.RawResolution.y * BingoConst.HDHighViewScale;
}
else
{
CenConst.CurrResolution.x = CenConst.RawResolution.x * BingoConst.HDLowViewScale;
CenConst.CurrResolution.y = CenConst.RawResolution.y * BingoConst.HDLowViewScale;
}
SetScreenResolution(CenConst.CurrResolution.x, CenConst.CurrResolution.y, true);
}
private void SetFrameRateMode(bool isHFRMode)
{
Application.targetFrameRate = isHFRMode ? BingoConst.HighFrameRate : BingoConst.LowFrameRate;
QualitySettings.vSyncCount = 0;
QualitySettings.lodBias = 1;
}
private void SetScreenResolution(float width, float height, bool isFullScreen)
{
StartCoroutine(OnSetScreenResolution(width, height, isFullScreen));
}
private IEnumerator OnSetScreenResolution(float width, float height, bool isFullScreen)
{
yield return vbadConst.WaitForEndOfFrame;
var allCams = Camera.allCameras;
if (allCams == null)
{
yield break;
}
foreach (var cam in allCams)
{
cam.enabled = false;
}
Screen.SetResolution((int)width, (int)height, isFullScreen);
Screen.fullScreen = true;
yield return vbadConst.WaitForEndOfFrame;
if (allCams == null)
{
yield break;
}
foreach (var cam in allCams)
{
cam.enabled = true;
}
}
#endregion SettingMode
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e34e769b3926fa24eb9398b230d7c31b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+29
View File
@@ -0,0 +1,29 @@
#if UNITY_EDITOR
using UnityEditor;
#endif
using System;
using System.Text;
using BingoBrain;
using UnityEngine;
namespace BingoBrain.Core
{
public class Bingoaav : MonoBehaviour
{
public void Awake()
{
StartBingo();
}
public static void StartBingo()
{
OCConst.bfdn = new GameObject($"{OCConst.vas}");
OCConst.bfdn.AddComponent<Bingo>();
OCConst.WorldSpaceGo = new GameObject(OCConst.bfd);
OCConst.WorldSpaceGo.SetParent(OCConst.bfdn);
DontDestroyOnLoad(OCConst.bfdn);
Pva.Congds(BingoBea.Instance);
GameHelper.PostFunnelLogin("bootstrap");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 958cbcd088fb3bc4c826840c9648b64e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
namespace BingoBrain.Core
{
public interface InterfaceManager
{
void Init();
void StartUp();
void DisposeBefore();
void Dispose();
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e53d06f42f51d84498ab4ffe80556de6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+67
View File
@@ -0,0 +1,67 @@
using BingoBrain.HotFix;
namespace BingoBrain.Core
{
public class UserInfo
{
public string userId;
}
/// <summary>
/// 全局应用
/// 应用层逻辑注入到框架层
/// </summary>
public static class Pva
{
#region User
public static UserInfo UserInfo;
#endregion User
#region Application
private static Bea _sCurrBea = null;
public static void Congds(Bea bea)
{
_sCurrBea = bea;
_sCurrBea.Init();
_sCurrBea.Enable();
}
public static void Restart()
{
_sCurrBea.Restart();
}
public static void Quit()
{
_sCurrBea.Quit();
}
#endregion Application
#region UIMsg
private static float LoadingProgressDelayTime = 0f;
public static void Enter()
{
AppDispatcher.Instance.Dispatch(CsjInfoC.UI_DisplayLoadingUI);
}
public static void HideLoadingUI(bool isDelay = false)
{
if (!isDelay)
{
AppDispatcher.Instance.Dispatch(CsjInfoC.UI_HideLoadingUI);
return;
}
TimerHelper.mEasy.AddTimer(0.5f, () => { AppDispatcher.Instance.Dispatch(CsjInfoC.UI_HideLoadingUI); });
}
#endregion UIMsg
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 58141605cb271ab488578de8509d91e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+24
View File
@@ -0,0 +1,24 @@
using FairyGUI;
namespace BingoBrain.Core
{
public class SubUI
{
public string uiName;
public string packageName;
public string assetName;
public string rawGameObjectName;
public string gameObjectName;
public GObject baseGObj;
public GComponent baseUI;
public SubUI(string uiName, string packageName, string assetName)
{
this.uiName = uiName;
this.packageName = packageName;
this.assetName = assetName;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bffd78e7d21b93a42a38ac88f77d3432
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+101
View File
@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections.Generic;
namespace BingoBrain.Core
{
public static class UIInfoConst
{
public static Color DefaultUIMaskColor = new Color(0, 0, 0, 0.8f);
}
public class UIInfo
{
public string packageName = null;
public string assetName = null;
public UILayerType layerType = UILayerType.Normal;
public UIGComType gComType = UIGComType.GComponent;
public UIType uiType = UIType.NormalUI;
public uint openUIMsgId = 0;
public uint closeUIMsgId = 0;
public bool isCache = false;
public bool isSwitchSceneCloseUI = false;
public bool isTickUpdate = false;
public bool isClosetWorldRaycast = false;
public bool isNeedOpenAnim = false;
public bool isNeedCloseAnim = false;
public bool isNeedUIMask = false;
public bool isNeedUIMaskCloseEvent = false;
public Color uiMaskCustomColor = UIInfoConst.DefaultUIMaskColor;
}
public enum UILayerType : int
{
None = -1,
Background = 0,
Bottom = 1,
Normal = 2,
Top = 3,
FullScreen = 4,
Popup = 5,
Highest = 6,
Animation = 7,
Tips = 8,
Loading = 9,
System = 10,
NetworkError = 11,
}
public enum UIGComType : int
{
GComponent = 0,
Window = 1,
}
public enum UIType : int
{
NormalUI = 0,
FullScreenUI = 1,
ConfirmationUI = 2,
}
public class EnumComparer_UILayerType : IEqualityComparer<UILayerType>
{
public static EnumComparer_UILayerType Instance = new EnumComparer_UILayerType();
public bool Equals(UILayerType x, UILayerType y)
{
return (int)x == (int)y;
}
public int GetHashCode(UILayerType obj)
{
return (int)obj;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aaef7fcebcd15164bb758addcacaef25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: