Ejemplo n.º 1
0
 // ボタンから呼び出される
 public void OnPushVoid()
 {
     if (EventVoid != null)
     {
         EventVoid.Invoke(this, new EventArgs());
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 其它都准备好了,加载AssetBundle
 /// 注意:这个方法只能被 AssetBundleManager 调用
 /// 由 Manager 统一分配加载时机,防止加载过卡
 /// </summary>
 public virtual void LoadBundleAsync(EventVoid callback = null)
 {
     if (State == eLoadState.State_None)
     {
         State = eLoadState.State_Loading;
         //var e1 = this.ILoadDependsAsync();
         ////先加载依赖包
         //while (e1 != null && e1.MoveNext())
         //{
         //    yield return e1.Current;
         //}//目前Loader的依赖加载挪到AbInfo中处理
         //加载自身
         abCreateReq = LoadSelfAsync();
         LoadBundleAsync_CallBack = callback;
         abCreateReq.completed   += LoadBundleAsync_Finish;
     }
     else if (State == eLoadState.State_Error)
     {
         this.Error();
     }
     else if (State == eLoadState.State_Complete)
     {
         this.Complete();
     }
 }
Ejemplo n.º 3
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            if (state == StartState.Editor && isSwitchable)
            {
                Events ["enableIntraCollisions"].active  = !isActiveForAll;
                Events ["disableIntraCollisions"].active = isActiveForAll;
            }
            else
            {
                GameEvents.onVesselCreate.Add(EnqueueVessel);
                GameEvents.onNewVesselCreated.Add(EnqueueVessel);
                GameEvents.onVesselGoOffRails.Add(EnqueueVessel);
                GameEvents.onVesselWasModified.Add(EnqueueVessel);
                GameEvents.OnCollisionIgnoreUpdate.Add(EnqueueVoid);
                GameEvents.OnAnimationGroupStateChanged.Add(EnqueueOnAnimation);

                onWorldStabilizationStartEvent = GameEvents.FindEvent <EventVoid> ("onWorldStabilizationStart");
                if (onWorldStabilizationStartEvent != null)
                {
                    onWorldStabilizationStartEvent.Add(onWorldStabilizationStart);
                }

                onWorldStabilizedEvent = GameEvents.FindEvent <EventVoid> ("onWorldStabilized");
                if (onWorldStabilizedEvent != null)
                {
                    onWorldStabilizedEvent.Add(onWorldStabilized);
                }
            }
        }
Ejemplo n.º 4
0
 public AsbLoaderAsyncResult AddLoaderAsyncTask(EventVoid onfinish = null, params AssetBundleLoader[] ls)
 {
     foreach (var l in ls)
     {
         if (!AsyncLoadersHash.Contains(l))
         {
             AsyncLoadersHash.Add(l);
             AsyncLoaders.AddLast(l);
         }
     }
     return(new AsbLoaderAsyncResult().InitByLoaders(onfinish, ls));
 }
Ejemplo n.º 5
0
 public AsbLoaderAsyncResult InitByLoaders(EventVoid OnFinish = null, params AssetBundleLoader[] ls)
 {
     Loaders = ls;
     for (int i = 0; i < ls.Length; i++)
     {
         var l = Loaders[i];
         l.parent = this;
     }
     OnFinishCallback = OnFinish;
     RefreshIsFinish();
     return(this);
 }
Ejemplo n.º 6
0
        public static void Initialize()
        {
            if (!initialized)
            {
                Logging.DebugLog("Initializing Events.");
                OnSYInventoryChanged         = new EventData <InventoryPart, bool>("OnSYInventoryChanged");
                OnSYInventoryAppliedToVessel = new EventVoid("OnSYInventoryAppliedToVessel");
                OnSYInventoryAppliedToPart   = new EventData <Part>("OnSYInventoryAppliedToPart");
                OnSYTrackerUpdated           = new EventData <IEnumerable <InventoryPart> >("OnSYTrackerUpdated");
                OnSYReady = new EventVoid("OnSYReady");

                initialized = true;
                Logging.DebugLog("Events Initialized.");
            }
        }
Ejemplo n.º 7
0
 public AsbLoaderAsyncResult InitByLoaders(List <AssetBundleLoader> ls, EventVoid OnFinish = null)
 {
     if (ls != null)
     {
         Loaders = new AssetBundleLoader[ls.Count];
         int i = 0;
         foreach (var l in ls)
         {
             Loaders[i] = l;
             i++;
             l.parent = this;
         }
     }
     OnFinishCallback = OnFinish;
     RefreshIsFinish();
     return(this);
 }
Ejemplo n.º 8
0
        private void LoadBundleAsync_Finish(AsyncOperation op)
        {
            if (op is AssetBundleCreateRequest abcr)
            {
                Bundle = abcr.assetBundle;
                if (Bundle != null && State != eLoadState.State_Error)
                {
                    this.Complete();
                }
                else
                {
                    this.Error();
                }

                if (LoadBundleAsync_CallBack != null)
                {
                    LoadBundleAsync_CallBack.Invoke();
                    LoadBundleAsync_CallBack = null;
                }

                abCreateReq = null;
            }
        }
	/// <summary>
	/// Remove a method from the list of methods to be run when the EventVoid is fired.
	/// 
	/// This is generally done in an object's OnDestroy method.
	/// </summary>
	/// <param name="evt">The method you want to remove, should contain no parameters</param>
    public extern void Remove(EventVoid.OnEvent evt);
 public extern static bool AddEventUpwards(Transform transform, string eventName, EventVoid.OnEvent evt, bool addToAll);
 public extern static bool AddEventScene(string eventName, EventVoid.OnEvent evt, bool addToAll);
	/// <summary>
	/// Add a method to be run when the EventVoid is fired.
	/// 
	/// This is generally done in an object's Start or Awake method, or a class' constructor.
	/// 
	/// Can be setup like:
	/// 
	/// GameEvents.someEventVoidEvent.Add(yourMethod);
	/// 
	/// or
	/// 
	/// GameEvents.someEventVoidEvent.Add(new EventVoid.OnEvent(yourMethod));
	/// </summary>
	/// <param name="evt">The method you want to add, should contain no parameters</param>
    public extern void Add(EventVoid.OnEvent evt);
Ejemplo n.º 13
0
 private void Awake()
 {
     DontDestroyOnLoad(this);
     OnBudgetAwarded     = new EventData <double, double>("OnBudgetAwarded");
     OnBudgetAboutToFire = new EventVoid("OnBudgetAboutToFire");
 }
Ejemplo n.º 14
0
 public void SetCallBack(EventVoid callback)
 {
     cb = callback;
 }
Ejemplo n.º 15
0
 public OnceCallBackButton(EventVoid callback)
 {
     SetCallBack(callback);
 }
 public extern static bool RemoveEventScene(string eventName, EventVoid.OnEvent evt, bool removeFromAll);
 public extern static bool RemoveEventUpwards(Transform transform, string eventName, EventVoid.OnEvent evt, bool removeFromAll);
 public WorldStabilizer()
 {
     onWorldStabilizationStartEvent = new EventVoid("onWorldStabilizationStart");
     onWorldStabilizedEvent         = new EventVoid("onWorldStabilized");
 }