提交项目
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45a53fe4413ebe44dbf670faf8651e3b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,114 @@
|
||||
namespace ZooMatch
|
||||
{
|
||||
public abstract class BaseCtrl
|
||||
{
|
||||
public string ctrlName;
|
||||
public bool isEnable = true;
|
||||
public bool IsNew { get; private set; }
|
||||
|
||||
protected ModuleManager moduleManager;
|
||||
|
||||
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 virtual void GameStart()
|
||||
{
|
||||
if (!isEnable) return;
|
||||
|
||||
OnGameStart();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if (!isEnable) return;
|
||||
|
||||
RemoveListener();
|
||||
RemoveServerListener();
|
||||
OnDispose();
|
||||
UnAssignment();
|
||||
IsNew = false;
|
||||
}
|
||||
|
||||
protected virtual void Assignment()
|
||||
{
|
||||
moduleManager = ModuleManager.Instance;
|
||||
|
||||
modelDispatcher = ModelDispatcher.Instance;
|
||||
ctrlDispatcher = CtrlDispatcher.Instance;
|
||||
uiCtrlDispatcher = UICtrlDispatcher.Instance;
|
||||
dataDispatcher = DataDispatcher.Instance;
|
||||
gameDispatcher = GameDispatcher.Instance;
|
||||
}
|
||||
|
||||
protected virtual void UnAssignment()
|
||||
{
|
||||
moduleManager = 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 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,33 @@
|
||||
namespace ZooMatch
|
||||
{
|
||||
public abstract class BaseUICtrl : BaseCtrl
|
||||
{
|
||||
public virtual uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eeb97e2ef9396894d8e09b5ac644433e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,107 @@
|
||||
namespace ZooMatch
|
||||
{
|
||||
public abstract class BaseModel
|
||||
{
|
||||
public string modelName;
|
||||
private string localStorageKey;
|
||||
|
||||
protected ModuleManager mOduleManager;
|
||||
|
||||
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 GameStart()
|
||||
{
|
||||
OnGameStart();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Dispose();
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
RemoveListener();
|
||||
RemoveServerListener();
|
||||
OnDispose();
|
||||
UnAssignment();
|
||||
}
|
||||
|
||||
protected virtual void Assignment()
|
||||
{
|
||||
mOduleManager = ModuleManager.Instance;
|
||||
|
||||
modelDispatcher = ModelDispatcher.Instance;
|
||||
ctrlDispatcher = CtrlDispatcher.Instance;
|
||||
uiCtrlDispatcher = UICtrlDispatcher.Instance;
|
||||
dataDispatcher = DataDispatcher.Instance;
|
||||
gameDispatcher = GameDispatcher.Instance;
|
||||
}
|
||||
|
||||
protected virtual void UnAssignment()
|
||||
{
|
||||
mOduleManager = 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 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: 2ab9296c1feb18b42a12bbc53cdfc39b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e875f86aa27a545449f052c022fcd58c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 350d8669cca7ae24282a784c6a857707
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,338 @@
|
||||
using FairyGUI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZooMatch
|
||||
{
|
||||
public abstract class BaseUI
|
||||
{
|
||||
protected UIManager mUIManager;
|
||||
protected ModuleManager moduleManager;
|
||||
|
||||
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;
|
||||
|
||||
public BaseUI(BaseUICtrl baseUICtrl)
|
||||
{
|
||||
New(baseUICtrl);
|
||||
}
|
||||
|
||||
public void New(BaseUICtrl baseUICtrl)
|
||||
{
|
||||
this.baseUICtrl = baseUICtrl;
|
||||
|
||||
Assignment();
|
||||
OnNew();
|
||||
Process_Init();
|
||||
}
|
||||
|
||||
protected virtual void Assignment()
|
||||
{
|
||||
mUIManager = UIManager.Instance;
|
||||
moduleManager = ModuleManager.Instance;
|
||||
|
||||
modelDispatcher = ModelDispatcher.Instance;
|
||||
ctrlDispatcher = CtrlDispatcher.Instance;
|
||||
uiCtrlDispatcher = UICtrlDispatcher.Instance;
|
||||
dataDispatcher = DataDispatcher.Instance;
|
||||
gameDispatcher = GameDispatcher.Instance;
|
||||
}
|
||||
|
||||
protected virtual void UnAssignment()
|
||||
{
|
||||
mUIManager = null;
|
||||
moduleManager = null;
|
||||
|
||||
modelDispatcher = null;
|
||||
ctrlDispatcher = null;
|
||||
uiCtrlDispatcher = null;
|
||||
dataDispatcher = null;
|
||||
gameDispatcher = null;
|
||||
}
|
||||
|
||||
|
||||
public void Open(object args = null)
|
||||
{
|
||||
uiArgs = args;
|
||||
mUIManager.Internal_OpenUI(this, args);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (isClose) return;
|
||||
mUIManager.Internal_CloseUI(this);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
mUIManager.Internal_HideUI(this);
|
||||
}
|
||||
|
||||
public void Display(object args = null)
|
||||
{
|
||||
uiArgs = args;
|
||||
mUIManager.Internal_DisplayUI(this, args);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public void CtrlCloseUI()
|
||||
{
|
||||
if (baseUICtrl == null) return;
|
||||
|
||||
baseUICtrl.DispatchCloseUI(uiName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2304886815d7ebc45aff43b801f57c13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using FairyGUI;
|
||||
|
||||
namespace ZooMatch
|
||||
{
|
||||
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:
|
||||
@@ -0,0 +1,51 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace ZooMatch
|
||||
{
|
||||
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 uint closeUIMsgId = 0;
|
||||
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
|
||||
{
|
||||
Background = 0,
|
||||
Bottom = 1,
|
||||
|
||||
Normal = 2,
|
||||
Top = 3,
|
||||
|
||||
FullScreen = 4,
|
||||
Popup = 5,
|
||||
|
||||
Highest = 6,
|
||||
Animation = 7,
|
||||
Tips = 8,
|
||||
|
||||
Loading = 9,
|
||||
System = 10,
|
||||
}
|
||||
|
||||
public enum UIGComType : int
|
||||
{
|
||||
GComponent = 0,
|
||||
Window = 1,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaef7fcebcd15164bb758addcacaef25
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user