private void Start() { AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>(); if (baseComponent == null) { Log.Fatal("Base component is invalid."); return; } m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>(); if (m_EventComponent == null) { Log.Fatal("Event component is invalid."); return; } //if (baseComponent.EditorResourceMode) //{ // m_EntityManager.SetResourceManager(baseComponent.EditorResourceHelper); //} //else { m_EntityManager.SetResourceManager(AshEntry.GetModule <IResourceManager>()); } m_EntityManager.SetObjectPoolManager(AshEntry.GetModule <IObjectPoolManager>()); EntityHelperBase entityHelper = Helper.CreateHelper(m_EntityHelperTypeName, m_CustomEntityHelper); if (entityHelper == null) { Log.Error("Can not create entity helper."); return; } entityHelper.name = string.Format("Entity Helper"); Transform transform = entityHelper.transform; transform.SetParent(this.transform); transform.localScale = Vector3.one; m_EntityManager.SetEntityHelper(entityHelper); if (m_InstanceRoot == null) { m_InstanceRoot = (new GameObject("Entity Instances")).transform; m_InstanceRoot.SetParent(gameObject.transform); m_InstanceRoot.localScale = Vector3.one; } for (int i = 0; i < m_EntityGroups.Length; i++) { if (!AddEntityGroup(m_EntityGroups[i].Name, m_EntityGroups[i].InstanceAutoReleaseInterval, m_EntityGroups[i].InstanceCapacity, m_EntityGroups[i].InstanceExpireTime, m_EntityGroups[i].InstancePriority)) { Log.Warning("Add entity group '{0}' failure.", m_EntityGroups[i].Name); continue; } } }
private void Start() { AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>(); if (baseComponent == null) { Log.Fatal("Base component is invalid."); return; } m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>(); if (m_EventComponent == null) { Log.Fatal("Event component is invalid."); return; } //if (baseComponent.EditorResourceMode) //{ // m_SceneManager.SetResourceManager(baseComponent.EditorResourceHelper); //} //else { m_SceneManager.SetResourceManager(AshEntry.GetModule <IResourceManager>()); } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_SceneManager = AshEntry.GetModule <ISceneManager>(); if (m_SceneManager == null) { Log.Fatal("Scene manager is invalid."); return; } m_SceneManager.LoadSceneSuccess += OnLoadSceneSuccess; m_SceneManager.LoadSceneFailure += OnLoadSceneFailure; m_SceneManager.LoadSceneUpdate += OnLoadSceneUpdate; m_SceneManager.LoadSceneDependencyAsset += OnLoadSceneDependencyAsset; m_SceneManager.UnloadSceneSuccess += OnUnloadSceneSuccess; m_SceneManager.UnloadSceneFailure += OnUnloadSceneFailure; m_GameFrameworkScene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(0); if (!m_GameFrameworkScene.IsValid()) { Log.Fatal("Game Framework scene is invalid."); return; } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_SoundManager = AshEntry.GetModule <ISoundManager>(); if (m_SoundManager == null) { Log.Fatal("Sound manager is invalid."); return; } m_SoundManager.PlaySoundSuccess += OnPlaySoundSuccess; m_SoundManager.PlaySoundFailure += OnPlaySoundFailure; m_SoundManager.PlaySoundUpdate += OnPlaySoundUpdate; m_SoundManager.PlaySoundDependencyAsset += OnPlaySoundDependencyAsset; m_AudioListener = gameObject.GetOrAddComponent <AudioListener>(); #if UNITY_5_4_OR_NEWER SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; #else ISceneManager sceneManager = AshEntry.GetModule <ISceneManager>(); if (sceneManager == null) { Log.Fatal("Scene manager is invalid."); return; } sceneManager.LoadSceneSuccess += OnLoadSceneSuccess; sceneManager.LoadSceneFailure += OnLoadSceneFailure; sceneManager.UnloadSceneSuccess += OnUnloadSceneSuccess; sceneManager.UnloadSceneFailure += OnUnloadSceneFailure; #endif }
private void Start() { AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>(); if (baseComponent == null) { Log.Fatal("Base component is invalid."); return; } m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>(); if (m_EventComponent == null) { Log.Fatal("Event component is invalid."); return; } //if (baseComponent.EditorResourceMode) //{ // m_SoundManager.SetResourceManager(baseComponent.EditorResourceHelper); //} //else { m_SoundManager.SetResourceManager(AshEntry.GetModule <IResourceManager>()); } SoundHelperBase soundHelper = Helper.CreateHelper(m_SoundHelperTypeName, m_CustomSoundHelper); if (soundHelper == null) { Log.Error("Can not create sound helper."); return; } soundHelper.name = string.Format("Sound Helper"); Transform transform = soundHelper.transform; transform.SetParent(this.transform); transform.localScale = Vector3.one; m_SoundManager.SetSoundHelper(soundHelper); if (m_InstanceRoot == null) { m_InstanceRoot = (new GameObject("Sound Instances")).transform; m_InstanceRoot.SetParent(gameObject.transform); m_InstanceRoot.localScale = Vector3.one; } for (int i = 0; i < m_SoundGroups.Length; i++) { if (!AddSoundGroup(m_SoundGroups[i].Name, m_SoundGroups[i].AvoidBeingReplacedBySamePriority, m_SoundGroups[i].Mute, m_SoundGroups[i].Volume, m_SoundGroups[i].AgentHelperCount)) { Log.Warning("Add sound group '{0}' failure.", m_SoundGroups[i].Name); continue; } } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_ProcedureManager = AshEntry.GetModule <IProcedureManager>(); if (m_ProcedureManager == null) { Log.Fatal("Procedure manager is invalid."); return; } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_FsmManager = AshEntry.GetModule <IFsmManager>(); if (m_FsmManager == null) { Log.Fatal("FSM manager is invalid."); return; } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_ObjectPoolManager = AshEntry.GetModule <IObjectPoolManager>(); if (m_ObjectPoolManager == null) { Log.Fatal("Object pool manager is invalid."); return; } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_DataNodeManager = AshEntry.GetModule <IDataNodeManager>(); if (m_DataNodeManager == null) { Log.Fatal("Data node manager is invalid."); return; } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_DataTableManager = AshEntry.GetModule <IDataTableManager>(); if (m_DataTableManager == null) { Log.Fatal("Data table manager is invalid."); return; } m_DataTableManager.LoadDataTableSuccess += OnLoadDataTableSuccess; m_DataTableManager.LoadDataTableFailure += OnLoadDataTableFailure; m_DataTableManager.LoadDataTableUpdate += OnLoadDataTableUpdate; m_DataTableManager.LoadDataTableDependencyAsset += OnLoadDataTableDependencyAsset; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_LocalizationManager = AshEntry.GetModule <ILocalizationManager>(); if (m_LocalizationManager == null) { Log.Fatal("Localization manager is invalid."); return; } m_LocalizationManager.LoadDictionarySuccess += OnLoadDictionarySuccess; m_LocalizationManager.LoadDictionaryFailure += OnLoadDictionaryFailure; m_LocalizationManager.LoadDictionaryUpdate += OnLoadDictionaryUpdate; m_LocalizationManager.LoadDictionaryDependencyAsset += OnLoadDictionaryDependencyAsset; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_WebRequestManager = AshEntry.GetModule <IWebRequestManager>(); if (m_WebRequestManager == null) { Log.Fatal("Web request manager is invalid."); return; } m_WebRequestManager.Timeout = m_Timeout; m_WebRequestManager.WebRequestStart += OnWebRequestStart; m_WebRequestManager.WebRequestSuccess += OnWebRequestSuccess; m_WebRequestManager.WebRequestFailure += OnWebRequestFailure; }
private void Start() { m_ResourceComponent = AshUnityEntry.Instance.GetComponent <ResourceComponent>(); if (m_ResourceComponent == null) { Log.Fatal("Resource component is invalid."); return; } m_LocalizationManager = AshEntry.GetModule <ILocalizationManager>(); if (m_LocalizationManager == null) { Log.Fatal("Localization manager is invalid."); return; } }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_EntityManager = AshEntry.GetModule <IEntityManager>(); if (m_EntityManager == null) { Log.Fatal("Entity manager is invalid."); return; } m_EntityManager.ShowEntitySuccess += OnShowEntitySuccess; m_EntityManager.ShowEntityFailure += OnShowEntityFailure; m_EntityManager.ShowEntityUpdate += OnShowEntityUpdate; m_EntityManager.ShowEntityDependencyAsset += OnShowEntityDependencyAsset; m_EntityManager.HideEntityComplete += OnHideEntityComplete; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_UIManager = AshEntry.GetModule <IUIManager>(); if (m_UIManager == null) { Log.Fatal("UI manager is invalid."); return; } m_UIManager.OpenUIFormSuccess += OnOpenUIFormSuccess; m_UIManager.OpenUIFormFailure += OnOpenUIFormFailure; m_UIManager.OpenUIFormUpdate += OnOpenUIFormUpdate; m_UIManager.OpenUIFormDependencyAsset += OnOpenUIFormDependencyAsset; m_UIManager.CloseUIFormComplete += OnCloseUIFormComplete; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_NetworkManager = AshEntry.GetModule <INetworkManager>(); if (m_NetworkManager == null) { Log.Fatal("Network manager is invalid."); return; } m_NetworkManager.NetworkConnected += OnNetworkConnected; m_NetworkManager.NetworkClosed += OnNetworkClosed; m_NetworkManager.NetworkSendPacket += OnNetworkSendPacket; m_NetworkManager.NetworkMissHeartBeat += OnNetworkMissHeartBeat; m_NetworkManager.NetworkError += OnNetworkError; m_NetworkManager.NetworkCustomError += OnNetworkCustomError; }
/// <summary> /// 游戏框架组件初始化。 /// </summary> protected override void Awake() { base.Awake(); m_DownloadManager = AshEntry.GetModule <IDownloadManager>(); if (m_DownloadManager == null) { Log.Fatal("Download manager is invalid."); return; } m_DownloadManager.DownloadStart += OnDownloadStart; m_DownloadManager.DownloadUpdate += OnDownloadUpdate; m_DownloadManager.DownloadSuccess += OnDownloadSuccess; m_DownloadManager.DownloadFailure += OnDownloadFailure; m_DownloadManager.FlushSize = m_FlushSize; m_DownloadManager.Timeout = m_Timeout; }
private void Start() { AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>(); if (baseComponent == null) { Log.Fatal("Base component is invalid."); return; } m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>(); if (m_EventComponent == null) { Log.Fatal("Event component is invalid."); return; } //if (baseComponent.EditorResourceMode) //{ // m_LocalizationManager.SetResourceManager(baseComponent.EditorResourceHelper); //} //else { m_LocalizationManager.SetResourceManager(AshEntry.GetModule <IResourceManager>()); } LocalizationHelperBase localizationHelper = Helper.CreateHelper(m_LocalizationHelperTypeName, m_CustomLocalizationHelper); if (localizationHelper == null) { Log.Error("Can not create localization helper."); return; } localizationHelper.name = string.Format("Localization Helper"); Transform transform = localizationHelper.transform; transform.SetParent(this.transform); transform.localScale = Vector3.one; m_LocalizationManager.SetLocalizationHelper(localizationHelper); m_LocalizationManager.Language = baseComponent.EditorLanguage; }
private IEnumerator Start() { ProcedureBase[] procedures = new ProcedureBase[m_AvailableProcedureTypeNames.Length]; for (int i = 0; i < m_AvailableProcedureTypeNames.Length; i++) { Type procedureType = Utility.Assembly.GetType(m_AvailableProcedureTypeNames[i]); if (procedureType == null) { Log.Error("Can not find procedure type '{0}'.", m_AvailableProcedureTypeNames[i]); yield break; } procedures[i] = (ProcedureBase)Activator.CreateInstance(procedureType); if (procedures[i] == null) { Log.Error("Can not create procedure instance '{0}'.", m_AvailableProcedureTypeNames[i]); yield break; } if (m_EntranceProcedureTypeName == m_AvailableProcedureTypeNames[i]) { m_EntranceProcedure = procedures[i]; } } if (m_EntranceProcedure == null) { Log.Error("Entrance procedure is invalid."); yield break; } m_ProcedureManager.Initialize(AshEntry.GetModule <IFsmManager>(), procedures); yield return(new WaitForEndOfFrame()); m_ProcedureManager.StartProcedure(m_EntranceProcedure.GetType()); }
public IEnumerator FsmTestWithEnumeratorPasses() { // Use the Assert class to test conditions. // yield to skip a frame AshUnityEntry.New(); IFsmManager fsmManager = AshEntry.GetModule <IFsmManager>(); FsmOwer fsmOwer = new FsmOwer(); Status1 status1 = new Status1(); Status2 status2 = new Status2(); //fsmManager.CreateFsm<FsmOwer>( fsmOwer, status1, status2); fsmManager.CreateFsm <FsmOwer>("Test", fsmOwer, status1, status2); Log.Debug("有限状态机的数量时{0}", fsmManager.Count); IFsm <FsmOwer> fsm = fsmManager.GetFsm <FsmOwer> ("Test"); Assert.IsNotNull(fsm); VarString v = new VarString(); v.SetValue("Variable data"); // v.Value = "Variable data"; fsm.SetData("data", v); fsm.Start <Status1> (); Assert.AreEqual(fsm.CurrentState, status1); yield return(new WaitForSeconds(1)); fsm.FireEvent(this, 1, "userData"); // Assert.AreEqual (fsm.CurrentState, status2); yield return(null); }
private void Start() { AshUnityEntry baseComponent = AshUnityEntry.Instance.GetComponent <AshUnityEntry>(); if (baseComponent == null) { Log.Fatal("Base component is invalid."); return; } m_EventComponent = AshUnityEntry.Instance.GetComponent <EventComponent>(); if (m_EventComponent == null) { Log.Fatal("Event component is invalid."); return; } m_EditorResourceMode = false; m_ResourceManager = AshEntry.GetModule <IResourceManager>(); if (m_ResourceManager == null) { Log.Fatal("Resource manager is invalid."); return; } m_ResourceManager.ResourceInitComplete += OnResourceInitComplete; m_ResourceManager.VersionListUpdateSuccess += OnVersionListUpdateSuccess; m_ResourceManager.VersionListUpdateFailure += OnVersionListUpdateFailure; m_ResourceManager.ResourceCheckComplete += OnResourceCheckComplete; m_ResourceManager.ResourceUpdateStart += OnResourceUpdateStart; m_ResourceManager.ResourceUpdateChanged += OnResourceUpdateChanged; m_ResourceManager.ResourceUpdateSuccess += OnResourceUpdateSuccess; m_ResourceManager.ResourceUpdateFailure += OnResourceUpdateFailure; m_ResourceManager.ResourceUpdateAllComplete += OnResourceUpdateAllComplete; m_ResourceManager.SetReadOnlyPath(Application.streamingAssetsPath); if (m_ReadWritePathType == ReadWritePathType.TemporaryCache) { m_ResourceManager.SetReadWritePath(Application.temporaryCachePath); } else { if (m_ReadWritePathType == ReadWritePathType.Unspecified) { m_ReadWritePathType = ReadWritePathType.PersistentData; } m_ResourceManager.SetReadWritePath(Application.persistentDataPath); } if (m_EditorResourceMode) { return; } SetResourceMode(m_ResourceMode); m_ResourceManager.SetDownloadManager(AshEntry.GetModule <IDownloadManager>()); m_ResourceManager.SetObjectPoolManager(AshEntry.GetModule <IObjectPoolManager>()); m_ResourceManager.AssetAutoReleaseInterval = m_AssetAutoReleaseInterval; m_ResourceManager.AssetCapacity = m_AssetCapacity; m_ResourceManager.AssetExpireTime = m_AssetExpireTime; m_ResourceManager.AssetPriority = m_AssetPriority; m_ResourceManager.ResourceAutoReleaseInterval = m_ResourceAutoReleaseInterval; m_ResourceManager.ResourceCapacity = m_ResourceCapacity; m_ResourceManager.ResourceExpireTime = m_ResourceExpireTime; m_ResourceManager.ResourcePriority = m_ResourcePriority; if (m_ResourceMode == ResourceMode.Updatable) { m_ResourceManager.UpdatePrefixUri = m_UpdatePrefixUri; m_ResourceManager.UpdateRetryCount = m_UpdateRetryCount; } m_ResourceHelper = Helper.CreateHelper(m_ResourceHelperTypeName, m_CustomResourceHelper); if (m_ResourceHelper == null) { Log.Error("Can not create resource helper."); return; } m_ResourceHelper.name = string.Format("Resource Helper"); Transform transform = m_ResourceHelper.transform; transform.SetParent(this.transform); transform.localScale = Vector3.one; m_ResourceManager.SetResourceHelper(m_ResourceHelper); if (m_InstanceRoot == null) { m_InstanceRoot = (new GameObject("Load Resource Agent Instances")).transform; m_InstanceRoot.SetParent(gameObject.transform); m_InstanceRoot.localScale = Vector3.one; } for (int i = 0; i < m_LoadResourceAgentHelperCount; i++) { AddLoadResourceAgentHelper(i); } }