private void StartUpdateResources(string resourceGroupName) { if (m_UpdateResourceForm == null) { m_UpdateResourceForm = Object.Instantiate(GameEntry.BuiltinData.UpdateResourceFormTemplate); } Log.Info("Start update resources..."); GameEntry.Resource.UpdateResources(resourceGroupName, OnUpdateResourcesComplete); }
protected override void OnLeave(ProcedureOwner procedureOwner, bool isShutdown) { if (m_UpdateResourceForm != null) { Object.Destroy(m_UpdateResourceForm.gameObject); m_UpdateResourceForm = null; } GameEntry.Event.Unsubscribe(ResourceUpdateStartEventArgs.EventId, OnResourceUpdateStart); GameEntry.Event.Unsubscribe(ResourceUpdateChangedEventArgs.EventId, OnResourceUpdateChanged); GameEntry.Event.Unsubscribe(ResourceUpdateSuccessEventArgs.EventId, OnResourceUpdateSuccess); GameEntry.Event.Unsubscribe(ResourceUpdateFailureEventArgs.EventId, OnResourceUpdateFailure); base.OnLeave(procedureOwner, isShutdown); }
protected override void OnEnter(ProcedureOwner procedureOwner) { base.OnEnter(procedureOwner); m_UpdateResourcesComplete = false; m_UpdateCount = procedureOwner.GetData<VarInt>("UpdateResourceCount"); procedureOwner.RemoveData("UpdateResourceCount"); m_UpdateSuccessCount = 0; m_UpdateLengthData.Clear(); m_UpdateResourceForm = null; GameEntry.Event.Subscribe(ResourceUpdateStartEventArgs.EventId, OnResourceUpdateStart); GameEntry.Event.Subscribe(ResourceUpdateChangedEventArgs.EventId, OnResourceUpdateChanged); GameEntry.Event.Subscribe(ResourceUpdateSuccessEventArgs.EventId, OnResourceUpdateSuccess); GameEntry.Event.Subscribe(ResourceUpdateFailureEventArgs.EventId, OnResourceUpdateFailure); StartUpdateResources("0"); }